Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

NPWindow

« Gecko Plugin API Reference « Plug-in Side Plug-in API

Résumé

En cours de traduction.

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

Syntaxe

typedef struct _NPWindow
{
    void*     window;   /* Platform specific handle */
    uint32    x;        /* Coordinates of top left corner */
    uint32    y;        /*   relative to a Netscape page */
    uint32    width;    /* Maximum window size */
    uint32    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;

Champs

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 [en-ja].
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 [ja-en].
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 [en-ja] 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 [ja-en] 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 [en-ja] method with an NPWindow [en-ja] 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 [en-ja] method with an NPWindow structure that represents a drawable.

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

Voir aussi

NPP [en-ja] -> NPP_New [en-ja], NPP_Destroy [en-ja], NPP_HandleEvent [en-ja], NPP_SetWindow [en-ja], NPP_SetValue [ja-en]
NP_Shutdown [en-ja], NP_Initialize [en-ja]
NPWindow [en-ja]
NPSetWindowCallbackStruct [ja-en]
NPSavedData [en-ja]
NP_Port [en-ja]
NPRect [ja-en]
Codes Erreurs [en-ja]

Étiquettes et contributeurs liés au document

 Contributeurs à cette page : Demos
 Dernière mise à jour par : Demos,