NPP_SetWindow

  • Revision slug: NPP_SetWindow
  • Revision title: NPP_SetWindow
  • Revision id: 190645
  • Created:
  • Creator: Mgjbot
  • Is current revision? No
  • Comment robot Adding: [[ja:NPP SetWindow]]

Revision Content

{{ Np-plugin-api() }}

Summary

Tells the plug-in when a window is created, moved, sized, or destroyed.

Syntax

#include <npapi.h>
 
NPError NPP_SetWindow(NPP instance, NPWindow *window);

Parameters

The function has the following parameters:

instance
Pointer to the current plug-in instance. Must be embedded or full-screen.
window
Pointer to the window into which the instance draws. The window structure contains a window handle and values for top left corner, width, height, and clipping rectangle (see note on Unix below).

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes.

Description

The browser calls NPP_SetWindow after creating the instance to allow drawing to begin. Subsequent calls to NPP_SetWindow indicate changes in size or position; these calls pass the same NPWindow object each time, but with different values. If the window handle is set to null, the window is destroyed. In this case, the plug-in must not perform any additional graphics operations on the window and should free any associated resources.

The data structure passed in NPP_SetWindow is an NPWindow object, which contains the coordinates of the instance's area and various platform-specific data. This window is valid for the life of the instance, or until NPP_SetWindow is called again with a different value.

For windowed plug-ins on Windows and Unix, the window parameter contains a handle to a subwindow of the browser window hierarchy. On Mac OS, this field points to an NP_Port structure. For windowless plug-ins, it is a platform-specific handle to a drawable.

Before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the previous window (if one existed) to account for any changes.

NOTE: NPP_SetWindow is useful only for embedded (NP_EMBED) or full-screen (NP_FULL) plug-ins, which are drawn into windows. It is irrelevant for hidden plug-ins.

See Also

NPP_HandleEvent, NPWindow, NP_Port

{{ languages( { "ja": "ja/NPP_SetWindow" } ) }}

Revision Source

<p>
</p><p>
{{ Np-plugin-api() }}
</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Tells the plug-in when a window is created, moved, sized, or destroyed.
</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;
 
NPError NPP_SetWindow(NPP instance, NPWindow *window);
</pre> <h3 id="Parameters" name="Parameters">Parameters</h3>
<p>The function has the following parameters:
</p>
<dl><dt>instance
</dt><dd>Pointer to the current plug-in instance. Must be embedded or full-screen.
</dd></dl>
<dl><dt>window
</dt><dd>Pointer to the window into which the instance draws. The window structure contains a window handle and values for top left corner, width, height, and clipping rectangle (see note on Unix below).
</dd></dl>
<h3 id="Returns" name="Returns">Returns</h3>
<ul><li> If successful, the function returns NPERR_NO_ERROR.
</li><li> If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see <a href="en/NPAPI/Constants#Error_Codes">Error Codes</a>.
</li></ul>
<h3 id="Description" name="Description">Description</h3>
<p>The browser calls <code>NPP_SetWindow</code> after creating the instance to allow drawing to begin. Subsequent calls to <code>NPP_SetWindow</code> indicate changes in size or position; these calls pass the same <a href="en/NPWindow">NPWindow</a> object each time, but with different values. If the window handle is set to null, the window is destroyed. In this case, the plug-in must not perform any additional graphics operations on the window and should free any associated resources.
</p><p>The data structure passed in <code>NPP_SetWindow</code> is an <a href="en/NPWindow">NPWindow</a> object, which contains the coordinates of the instance's area and various platform-specific data. This window is valid for the life of the instance, or until <code>NPP_SetWindow</code> is called again with a different value.
</p><p>For windowed plug-ins on Windows and Unix, the window parameter contains a handle to a subwindow of the browser window hierarchy. On Mac OS, this field points to an <a href="en/NP_Port">NP_Port</a> structure. For windowless plug-ins, it is a platform-specific handle to a drawable.
</p><p>Before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the previous window (if one existed) to account for any changes.
</p>
<div class="note">
<p>NOTE: NPP_SetWindow is useful only for embedded (NP_EMBED) or full-screen (NP_FULL) plug-ins, which are drawn into windows. It is irrelevant for hidden plug-ins.
</p>
</div>
<h3 id="See_Also" name="See_Also">See Also</h3>
<p><a href="en/NPP_HandleEvent">NPP_HandleEvent</a>, <a href="en/NPWindow">NPWindow</a>, <a href="en/NP_Port">NP_Port</a>
</p>{{ languages( { "ja": "ja/NPP_SetWindow" } ) }}
Revert to this revision