mozilla

Revision 94214 of NPWindow

  • Revision slug: NPWindow
  • Revision title: NPWindow
  • Revision id: 94214
  • Created:
  • Creator: Josh
  • Is current revision? Yes
  • Comment 4 words added, 4 words removed
Tags: 

Revision Content

{{ Np-plugin-api() }}
{{ languages( { "fr": "fr/NPWindow"} ) }}

Summary

Contains information about the target into which the plug-in instance can draw.

Syntax

typedef struct _NPWindow
{
  void*        window;   /* Platform specific handle */
  uint32_t     x;        /* Coordinates of top left corner */
  uint32_t     y;        /*   relative to a Netscape page */
  uint32_t     width;    /* Maximum window size */
  uint32_t     height;
  NPRect       clipRect; /* Clipping rectangle coordinates */
#ifdef XP_UNIX
  void *       ws_info;  /* Platform-dependent additional data */
#endif /* XP_UNIX */
  NPWindowType type;   /* Window or drawable target */
} NPWindow;

Fields

The data structure has the following fields:

window
Platform-specific handle to a native window element in the Netscape window hierarchy on Windows (HWND) and Unix (X Window ID). Mac OS: window is a pointer to an NP_Port.
x, y
The x and y coordinates for the top left corner of the plug-in relative to the page (and thus relative to the origin of the drawable). Should not be modified by the plug-in.
height, width
The height and width of the plug-in area. Should not be modified by the plug-in.
clipRect
Clipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. Clipping to the clipRect prevents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen. Mac OS: clipRect is the rectangle in port coordinates to which the plug-in should clip its drawing.
ws_info
Unix: Contains information about the plug-in's Unix window environment; points to an NPSetWindowCallbackStruct.
type
NPWindowType value that specifies whether the NPWindow instance represents a window or a drawable. Values:
  • NPWindowTypeWindow: Indicates that the window field holds a platform-specific handle to a window (as in Navigator 2.0 and Navigator 3.0). The plug-in is considered windowed.
  • NPWindowTypeDrawable: Indicates that the plugin is windowless. The window field holds a platform-specific handle to a drawable or an off-screen pixmap, as follows:
    • Windows: HDC
    • Mac OS: pointer to NP_Port structure
    • Unix/X11: not used. (The drawable is provided in a GraphicsExpose event, when the paint is requested.)

Description

The NPWindow structure represents the native window or a drawable, and contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information. The plug-in area is a native window element on Windows and Unix, or a rectangle within a native window on Mac OS. The x, y, height, and width coordinates of NPWindow specify the position and size of this area.

The browser calls NPP_SetValue whenever the drawable changes.

A windowed plug-in is drawn into a native window (or portion of a native window) on a web page. For windowed plug-ins, the browser calls the NPP_SetWindow method with an NPWindow structure that represents a drawable (a pointer to an NPWindow allocated by the browser). This window is valid until NPP_SetWindow is called again with a different window or the instance is destroyed.

A windowless plug-in is drawn into a target called a drawable, which can be defined in several ways depending on the platform. For windowless plug-ins, the browser calls the NPP_SetWindow method with an NPWindow structure that represents a drawable.

The plug-in should not modify the field values in this structure.

See Also

NPP_SetWindow, NP_Port, NPSetWindowCallbackStruct, NPRect

Revision Source

<p>{{ Np-plugin-api() }}<br>
{{ languages( { "fr": "fr/NPWindow"} ) }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Contains information about the target into which the plug-in instance can draw.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre>typedef struct _NPWindow
{
  void*        window;   /* Platform specific handle */
  uint32_t     x;        /* Coordinates of top left corner */
  uint32_t     y;        /*   relative to a Netscape page */
  uint32_t     width;    /* Maximum window size */
  uint32_t     height;
  NPRect       clipRect; /* Clipping rectangle coordinates */
#ifdef XP_UNIX
  void *       ws_info;  /* Platform-dependent additional data */
#endif /* XP_UNIX */
  NPWindowType type;   /* Window or drawable target */
} NPWindow;
</pre>
<h3 id="Fields" name="Fields">Fields</h3>
<p>The data structure has the following fields:</p>
<dl> <dt>window</dt> <dd>Platform-specific handle to a native window element in the Netscape window hierarchy on Windows (HWND) and Unix (X Window ID). Mac OS: window is a pointer to an <a href="/en/NP_Port" title="en/NP_Port">NP_Port</a>.</dd>
</dl>
<dl> <dt>x, y</dt> <dd>The x and y coordinates for the top left corner of the plug-in relative to the page (and thus relative to the origin of the drawable). Should not be modified by the plug-in.</dd>
</dl>
<dl> <dt>height, width</dt> <dd>The height and width of the plug-in area. Should not be modified by the plug-in.</dd>
</dl>
<dl> <dt>clipRect</dt> <dd>Clipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. Clipping to the clipRect prevents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen. Mac OS: clipRect is the rectangle in port coordinates to which the plug-in should clip its drawing.</dd>
</dl>
<dl> <dt>ws_info</dt> <dd>Unix: Contains information about the plug-in's Unix window environment; points to an <a href="/en/NPSetWindowCallbackStruct" title="en/NPSetWindowCallbackStruct">NPSetWindowCallbackStruct</a>.</dd>
</dl>
<dl> <dt>type</dt> <dd>NPWindowType value that specifies whether the NPWindow instance represents a window or a drawable. Values: <ul> <li>NPWindowTypeWindow: Indicates that the window field holds a platform-specific handle to a window (as in Navigator 2.0 and Navigator 3.0). The plug-in is considered windowed.</li> <li>NPWindowTypeDrawable: Indicates that the plugin is windowless. The window field holds a platform-specific handle to a drawable or an off-screen pixmap, as follows: <ul> <li>Windows: HDC</li> <li>Mac OS: pointer to <a href="/en/NP_Port" title="en/NP_Port">NP_Port</a> structure</li> <li>Unix/X11: not used. (The drawable is provided in a GraphicsExpose event, when the paint is requested.)</li> </ul> </li> </ul> </dd>
</dl>
<h3 id="Description" name="Description">Description</h3>
<p>The <code>NPWindow</code> structure represents the native window or a drawable, and contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information. The plug-in area is a native window element on Windows and Unix, or a rectangle within a native window on Mac OS. The x, y, height, and width coordinates of <code>NPWindow</code> specify the position and size of this area.</p>
<p>The browser calls <a href="/en/NPP_SetValue" title="en/NPP_SetValue">NPP_SetValue</a> whenever the drawable changes.</p>
<p>A windowed plug-in is drawn into a native window (or portion of a native window) on a web page. For windowed plug-ins, the browser calls the <a href="/en/NPP_SetWindow" title="en/NPP_SetWindow">NPP_SetWindow</a> method with an <a href="/en/NPWindow" title="en/NPWindow">NPWindow</a> structure that represents a drawable (a pointer to an NPWindow allocated by the browser). This window is valid until NPP_SetWindow is called again with a different window or the instance is destroyed.</p>
<p>A windowless plug-in is drawn into a target called a drawable, which can be defined in several ways depending on the platform. For windowless plug-ins, the browser calls the <a href="/en/NPP_SetWindow" title="en/NPP_SetWindow">NPP_SetWindow</a> method with an <code>NPWindow</code> structure that represents a drawable.</p>
<p>The plug-in should not modify the field values in this structure.</p>
<h3 id="See_Also" name="See_Also">See Also</h3>
<p><a href="/en/NPP_SetWindow" title="en/NPP_SetWindow">NPP_SetWindow</a>, <a href="/en/NP_Port" title="en/NP_Port">NP_Port</a>, <a href="/en/NPSetWindowCallbackStruct" title="en/NPSetWindowCallbackStruct">NPSetWindowCallbackStruct</a>, <a href="/en/NPRect" title="en/NPRect">NPRect</a></p>
Revert to this revision