mozilla

Revision 200872 of NP_Port

  • Revision slug: NP_Port
  • Revision title: NP_Port
  • Revision id: 200872
  • Created:
  • Creator: Pmash
  • Is current revision? Yes
  • Comment migration

Revision Content

{{ Np-plugin-api() }}

Summary

Used on Mac OS only

Contains information required by the window field of an NPWindow structure.

Syntax

typedef struct NP_Port
{
    CGrafPtr port;  /* Grafport */
    int32    portx; /* position inside the topmost window */
    int32    porty;
} NP_Port;

Fields

The data structure has the following fields:

port
Standard Mac OS port into which the plug-in should draw.
portx, porty
Top-left corner of the plug-in rectangle in port coordinates (taking the scroll position into account).

Description

On Mac OS, the window field of an NPWindow structure points to an NP_Port object, which is allocated by the browser. The NP_Port is valid for the lifetime of the NPWindow, that is, until NPP_SetWindow is called again with a different value or the instance is destroyed.

Since the port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following:

  • Draw only within the area designated by the NPWindow.
  • Save the current port settings before changing the port for drawing.
  • Set the desired port settings before drawing.
  • Restore the previous port settings after drawing.

See Also

NPP_SetWindow, NPWindow

Revision Source

<p>
</p><p>
{{ Np-plugin-api() }}
</p>
<h3 id="Summary" name="Summary">Summary</h3>
<div class="note">Used on Mac OS only</div>
<p>Contains information required by the window field of an NPWindow structure.
</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre>typedef struct NP_Port
{
    CGrafPtr port;  /* Grafport */
    int32    portx; /* position inside the topmost window */
    int32    porty;
} NP_Port;
</pre> <h3 id="Fields" name="Fields">Fields</h3>
<p>The data structure has the following fields:
</p>
<dl><dt>port
</dt><dd>Standard Mac OS port into which the plug-in should draw.
</dd></dl>
<dl><dt>portx, porty
</dt><dd>Top-left corner of the plug-in rectangle in port coordinates (taking the scroll position into account).
</dd></dl>
<h3 id="Description" name="Description">Description</h3>
<p>On Mac OS, the window field of an <a href="en/NPWindow">NPWindow</a> structure points to an <code>NP_Port</code> object, which is allocated by the browser. The <code>NP_Port</code> is valid for the lifetime of the <a href="en/NPWindow">NPWindow</a>, that is, until <a href="en/NPP_SetWindow">NPP_SetWindow</a> is called again with a different value or the instance is destroyed.
</p><p>Since the port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following:
</p>
<ul><li> Draw only within the area designated by the <a href="en/NPWindow">NPWindow</a>.
</li><li> Save the current port settings before changing the port for drawing.
</li><li> Set the desired port settings before drawing.
</li><li> Restore the previous port settings after drawing. </li></ul>
<h3 id="See_Also" name="See_Also">See Also</h3>
<p><a href="en/NPP_SetWindow">NPP_SetWindow</a>, <a href="en/NPWindow">NPWindow</a>
</p>
Revert to this revision