[Contents] [Previous] [Next] [Index] 

Reference to Functions by Functional Group

This section is a reference to Plug-in API functions organized by the tasks they perform. For a brief summary of functions in each group, see Quick Reference to Functional Groups.

Quick Reference to Functional Groups URL Methods
Initialization and Destruction Methods Memory Methods
Drawing Methods Utility Methods
Stream Methods Methods for Communicating with Java

[Top] [Functions]


Quick Reference to Functional Groups

This section summarizes functions by functional group.

 
Initialization and Destruction: Summary Memory: Summary
Drawing Event Handling: Summary Utility: Summary
Stream: Summary Communicating with Java: Summary
URL: Summary

[Top] [Reference to Functions by Functional Group]


Initialization and Destruction: Summary

Method Name  Description 
NPP_Initialize
Provides global initialization for a plug-in. 
NPP_New
Creates a new instance of a plug-in.
NPP_Destroy
Deletes a specific instance of a plug-in.
NPP_Shutdown
Provides global deinitialization for a plug-in. 

[Top] [Reference to Functions by Functional Group]


Drawing Event Handling: Summary

 
Method Name  Description 
NPP_HandleEvent
Delivers a platform-specific event to the instance.
NPP_SetWindow
Tells the plug-in when a window is created, moved, sized, or destroyed.
NPP_Print
Requests a platform-specific print operation for an embedded or full-screen plug-in.
NPP_GetValue
Allows the Navigator to query the plug-in for information.
NPP_SetValue
Sets information about the plug-in, called by the plug-in.
NPN_ForceRedraw
Forces a paint message for a windowless plug-in.
NPN_InvalidateRect
Invalidates specified drawing area prior to repainting or refreshing a windowless plug-in.
NPN_InvalidateRegion
Invalidates specified drawing region prior to repainting or refreshing a windowless plug-in.
NPN_GetValue
Allows the plug-in to query Communicator for information.
NPP_SetValue
Sets information about the plug-in; called by Communicator.

[Top] [Reference to Functions by Functional Group]


Stream: Summary

 
Method Name  Description 
NPP_NewStream
Notifies a plug-in instance of a new data stream.
NPP_DestroyStream
Tells the plug-in that a stream is about to be closed or destroyed.
NPP_StreamAsFile
Provides a local file name for the data from a stream.
NPP_Write
Delivers data to a plug-in instance.
NPP_WriteReady
Returns the maximum number of bytes that an instance can consume.
NPN_DestroyStream
Closes and deletes a stream.
NPN_NewStream
Requests the creation of a new data stream produced by the plug-in and consumed by Communicator.
NPN_Write
Delivers data to a plug-in instance.
NPN_RequestRead
Requests a range of bytes from a seekable stream.

[Top] [Reference to Functions by Functional Group]


URL: Summary

 
Method Name  Description 
NPP_URLNotify
Notifies the plug-in of the completion of a URL request.
NPN_GetURL
Requests Communicator to create a stream for the specified URL.
NPN_GetURLNotify
Requests creation of a new stream with the contents of the specified URL, and notifies the plug-in of the result.
NPN_PostURL
Posts data from a file or buffer to a URL. 
NPN_PostURLNotify
Posts data from a file or buffer to a URL, and receives notification of the result.

[Top] [Reference to Functions by Functional Group]


Memory: Summary

 
Method Name  Description 
NPN_MemAlloc
Allocates memory from Communicator's memory space.
NPN_MemFlush
Mac OS only. Requests that Communicator free a specified amount of memory.
NPN_MemFree
Deallocates a block of allocated memory.

[Top] [Reference to Functions by Functional Group]


Utility: Summary

 
Method Name  Description 
NPN_ReloadPlugins
Reloads all plug-ins in the Plugins directory.
NPN_Status
Displays a message on the status line of the browser window.
NPN_UserAgent
Returns the Communicator user agent field.
NPN_Version
Returns version information for the Plug-in API.

[Top] [Reference to Functions by Functional Group]


Communicating with Java: Summary

 
Method Name  Description 
NPP_GetJavaClass
Returns the Java class associated with the plug-in.
NPN_GetJavaEnv
Returns a pointer to the Java execution environment.
NPN_GetJavaPeer
Returns the Java object associated with the plug-in. 

[Top] [Reference to Functions by Functional Group]


Initialization and Destruction Methods

 
NPP_Initialize
NPP_New
NPP_Destroy
NPP_Shutdown

Four methods from the Plug-in group of Plug-in API methods mark essential stages in the life of a plug-in. They provide services that every plug-in must include: initialization, instance creation and destruction, and shutdown.

See Chapter 3, "Initialization and Destruction," for information about using these methods.

 [Top] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPP_Initialize

Provides global initialization for the plug-in
Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
NPError NPP_Initialize(void)
Returns
Description
Communicator calls this function only once: when a plug-in is loaded, before the first instance is created. This is the first function that Communicator calls. NPP_Initialize tells the plug-in that Communicator has loaded it and provides global initialization. Allocate any memory or resources shared by all instances of your plug-in at this time.

After the last instance of a plug-in has been deleted, Communicator calls NPP_Shutdown, where you can release allocated memory or resources.

MS Windows
This function is called from the DLL entry point NPP_Initialize (found in NPWIN.CPP.) §
See Also
NPP_Shutdown, NPP_New
"Initialization"

 [Top] [Initialization and Destruction Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPP_Destroy

Deletes a specific instance of a plug-in
Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
NPError NPP_Destroy(NPP instance, NPSavedData **save);
Parameters
The function has the following parameters:
instance
Pointer to the plug-in instance to delete.
**save
State or other information to save for reuse by a new instance of this plug-in at the same URL. Passed to NPP_New.
Returns
Description
NPP_Destroy releases the instance data and resources associated with a plug-in. Communicator calls this function when a plug-in instance is deleted, typically because the user has left the page containing the instance, closed the window, or quit the browser. You should delete any private instance-specific information stored in the plug-in's instance->pdata at this time.

If this function is deleting the last instance of a plug-in, NPP_Shutdown is subsequently called. Use NPP_Shutdown to delete any data allocated in NPP_Initialize and intended to be shared by all instances of a plug-in.

Use the optional save parameter if you want to save and reuse some state or other information. Upon the user's return to the page, this information is passed to the new plug-in instance when it is created with NPP_New.

Avoid trying to save critical data with this function. Ownership of the buf field of the NPSavedData structure passes from the plug-in to Communicator when NPP_Destroy returns. The Communicator can and will discard this data based on arbitrary criteria such as its size and the user's page history.

To ensure that Communicator does not crash or leak memory when the saved data is discarded, NPSavedData's buf field should be a flat structure (a simple structure with no allocated substructures) allocated with NPN_MemAlloc.

Mac OS
If you want to restore state information if this plug-in is later recreated, use NP_MemAlloc to create an NPSavedData structure. §
NOTE: You should not perform any graphics operations in NPP_Destroy as the instance's window is no longer guaranteed to be valid. §
See Also
NPP_New, NPP_Shutdown, NPP, NPN_MemAlloc, NPSavedData
"Instance Destruction"

[Top] [Initialization and Destruction Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPP_New

Creates a new instance of a plug-in
Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
NPError NPP_New(NPMIMEType    pluginType,
                NPP instance, uint16 mode,
                int16 argc,   char *argn[],
                char *argv[], NPSavedData *saved);
Parameters
The function has the following parameters:
pluginType
Pointer to the MIME type for new plug-in instance. 
instance
Contains instance-specific private data for the plug-in and Communicator. This data is stored in instance->pdata.
mode
Display mode of plug-in. Values: 
  • NP_EMBED: (1) Instance was created by an EMBED tag and shares Communicator window with other content. 
  • NP_FULL: (2) Instance was created by a separate file and is the primary content in the window. 
argc
Number of HTML arguments in the EMBED tag for an embedded plug-in; determines the number of attributes in the argn and argv arrays.
argn[] 
Array of attribute names passed to the plug-in from the EMBED tag. 
argv[]
Array of attribute values passed to the plug-in from the EMBED tag.
saved
Pointer to data saved by NPP_Destroy for a previous instance of this plug-in at the same URL. If non-null, Communicator passes ownership of the NPSavedData object back to the plug-in. The plug-in is responsible for freeing the memory for the NPSavedData and the buffer it contains.
 
Returns
Description
NPP_New creates a new instance of a plug-in. It is called after NPP_Initialize and provides the MIME type, embedded or full-screen display mode, and, for embedded plug-ins, information about HTML EMBED arguments.

 The plug-in's NPP pointer is valid until the instance is destroyed with NPP_Destroy.

 If instance data was saved from a previous instance of the plug-in by the NPP_Destroy function, it is returned in the saved parameter for the current instance to use.

All attributes in the EMBED tag (standard and private) are passed in NPP_New in the argn and argv arrays. Communicator ignores any non-standard attributes within an EMBED tag. This gives developers a chance to use private attributes to communicate instance-specific options or other information to the plug-in. Place private options at the end of the list of standard attributes in the EMBED Tag.

See Also
NPP_Destroy, NPP_Shutdown, NPP, NPSavedData
"Instance Creation," "EMBED Tag"

 [Top] [Initialization and Destruction Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPP_Shutdown

Provides global deinitialization for a plug-in.
Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
void NPP_Shutdown(void);
Description
Communicator calls this function once after the last instance of your plug-in is destroyed, before unloading the plug-in library itself. Use NPP_Shutdown to delete any data allocated in NPP_Initialize to be shared by all instances of a plug-in.

 If you have defined a Java class for your plug-in, be sure to release it at this time so that Java can unload it and free up memory.

NOTE: If enough memory is available, Communicator can keep the plug-in library loaded if it expects to create more instances in the near future. Communicator calls NPP_Shutdown only when the library is finally unloaded. §
MS Windows
This function is called from the DLL entry point NP_Shutdown (found in NPWIN.CPP). §
WARNING: Library unloading for plug-ins that use LiveConnect: The plug-in library may not be unloaded until Java garbage collection occurs, and when the plug-in's peer class native methods are unloaded. Developers should be aware that this could happen at any time, even long after the NPP_Shutdown call. §
See Also
NPP_Initialize, NPP_Destroy
"Instance Destruction"

 [Top] [Initialization and Destruction Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


Drawing Methods

 
Netscape Methods  Plug-in-Methods  Query/Set Information 
NPN_ForceRedraw
NPP_GetValue
NPN_GetValue
NPN_InvalidateRect
NPP_HandleEvent
NPN_SetValue
NPN_InvalidateRegion
NPP_Print
NPP_SetValue
NPP_SetWindow

In order to draw windowed and windowless plug-ins and handle events, you use a variety of functions from the Netscape and Plug-in groups. This section also contains reference entries for methods that query and set information.

See Chapter 4, "Drawing and Event Handling," for information about using these methods.

Unix
Windowless plug-ins are currently not supported on the X Windows platform. § [Top] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]

NPP_GetValue

New in Netscape Communicator 4.0.

Allows Communicator to query the plug-in for information

Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
NPError NPP_GetValue(void *instance, 
                     NPPVariable variable, 
                     void *value);
Parameters
The function has the following parameters:
instance
Pointer to the current plug-in instance.
variable
Unix only: Plug-in information the call gets. Values: 
  • NPPVpluginNameString: Gets the name of the plug-in 
  • NPPVpluginDescriptionString: Gets the description string of the plug-in 
  • NPPVpluginWindowBool: Tells whether the plug-in is windowless; true=windowless, false=not windowless 
  • NPPVpluginTransparentBool: Tells whether the plug-in is transparent; true=transparent, false=not transparent 
value
Plug-in name, returned by the function.
Returns
Description
NPP_GetValue retrieves plug-in features set with NPP_SetValue, among them whether a plug-in is windowed or windowless and whether JavaScript is enabled.

You can use this method as an optional entry point that Communicator can call to determine the plug-in name and description. It returns the requested values, specified by the variable and value parameters, to the plug-in.

See Also
NPP_SetValue, NPP
"Specifying That a Plug-in Is Windowless"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPP_HandleEvent

For Windowed Plug-ins: Currently used only on Mac OS.
For Windowless Plug-ins: Windows and Mac OS.

 Delivers a platform-specific window event to the instance

Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
int16 NPP_HandleEvent(NPP instance, void* event);
Parameters
The function has the following parameters:
instance
Pointer to the current plug-in instance.
event
Platform-specific value representing the event handled by the function. Values: 
  • MS Windows: Pointer to NPEvent structure 
  • Mac OS: Pointer to a standard Mac OS EventRecord 
For a list of possible events for MS Windows and Mac OS, see NPEvent.
Returns
Description
Communicator calls NPP_HandleEvent to tell the plug-in when events take place in the plug-in's window or drawable area. The plug-in either handles or ignores the event, depending on the value given in the event parameter of this function. For a list of event types the application is responsible for delivering to the plug-in, see the NPEvent structure.

MS Windows
Communicator gives each windowed plug-in its own native window, often a child window of Communicator window, to draw into. The plug-in has complete control over drawing and event handling within that window. §
Mac OS
Communicator does not give a windowed plug-in a native window, because the Mac OS platform does not support child windows. Instead, the windowed plug-in draws into the graphics port associated with the Communicator window, at the offset that Communicator specifies. For this reason, NPP_HandleEvent is only way the plug-in can receive events from its host application on Mac OS. When NPP_HandleEvent is called, the current port is set up so that its origin matches the top-left corner of the plug-in. A plug-in does not need to set up the current port for mouse coordinate translation. §
See Also
NPEvent
"Event Handling for Windowed Plug-ins," "Event Handling for Windowless Plug-ins"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPP_Print

Requests a platform-specific print operation for an embedded or full-screen plug-in
Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
void NPP_Print(NPP instance, NPPrint* PrintInfo);
Parameters
The function has the following parameters:
instance
Pointer to the current plug-in instance. Must be embedded or full-screen.
printInfo
Pointer to NPPrint structure. 
Description
NPP_Print is called when the user requests printing for a web page that contains a visible plug-in (either embedded or full-page). It uses the print mode set in the NPPrint structure in its printInfo parameter to determine whether the plug-in should print as an embedded plug-in or as a full-page plug-in.

 

For information about printing on your platform, see your platform documentation.
MS Windows
On MS Windows, printInfo->print.embedPrint.platformPrint is the device context (DC) handle. Be sure to cast this to type HDC. §
MS Windows
The coordinates for the window rectangle are in TWIPS format. This means that you need to convert the x-y coordinates using the Windows API call DPtoLP when you output text. §
WARNING: To avoid an issue with backward-compatibility that occurred in Communicator 4.0 and was resolved in 4.03, be sure to upgrade to the latest version of the Plug-in API. Make sure that the minor version constant is set to 11. §
See Also
NPPrint, NPFullPrint, NPEmbedPrint
"Drawing Plug-ins"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPP_SetValue

Currently not in use (new in Netscape Communicator 4.0).

Sets information about the plug-in

Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
Syntax
#include <npapi.h>
NPError NPP_SetValue(void *instance,
                     NPPVariable variable,
                     void *value);
Parameters
The function has the following parameters:
instance
Pointer to the current plug-in instance.
variable
The plug-in information the call is setting. For values, see NPP_GetValue.
value
Destination for plug-in information returned by the function.
Returns
Description
NPP_SetValue sets a variety of features for a plug-in, among them whether a plug-in is windowed or windowless and whether JavaScript is enabled. For possible values, see NPP_GetValue. The plug-in makes this call from its NPP_New method.

 For example, to specify that a plug-in is windowless, use NPP_SetValue with NPPVpluginWindowBool as the variable to set and false as the value parameter. If a plug-in does not make this call, it is considered a windowed plug-in.

See Also
NPP_New, NPP_GetValue
[Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]

NPP_SetWindow

Tells the plug-in when a window is created for it to draw into, or when its window is moved, sized, or destroyed
Plug-in API Type
Implemented by plug-in. See Plug-in Method Summary.
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.
Returns
Description
Communicator 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 Netscape 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
"Drawing Plug-ins," "Windowed Plug-ins"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPN_ForceRedraw

New in Netscape Communicator 4.0.

Forces a paint message for a windowless plug-in

Plug-in API Type
Implemented by Navigator. See Netscape Method Summary.
Syntax
#include <npapi.h>
void NPN_ForceRedraw(NPP instance);
Parameters
The function has the following parameters:
instance
Plug-in instance for which the function forces redrawing.
Description
A windowed plug-in determines when it draws, while a windowless plug-in draws only in response to a paint message from Communicator. NPN_ForceRedraw forces a paint message for a windowless plug-in.

Once a value has been invalidated with NPN_InvalidateRect or NPN_InvalidateRegion, a plug-in can call NPN_ForceRedraw to force a paint message. This causes a synchronous update event or paint message for the plug-in.

MS Windows
The plug-in receives a WM_PAINT message. The lParam of the WM_PAINT message holds a pointer to an NPRect that is the bounding box of the update area. Since the plug-in and Communicator share the same HDC, before drawing, the plug-in is responsible for saving the current HDC settings, setting up its own environment, drawing, and restoring the HDC to the previous settings. The HDC settings must be restored whenever control returns back to Communicator, either before returning from NPP_HandleEvent or before calling a drawing-related Netscape method. §
Mac OS
The plug-in receives an updateEvent. The clipRegion of the drawable's CGrafPtr is set to the update region. As is the case for windowed plug-ins on Mac OS, the plug-in must first save the current settings of the port, setting up the drawing environment as appropriate, drawing, and restoring the port to the previous setting. This should happen before the plug-in returns from NP_HandleEvent or before the plug-in calls a drawing-related Navigator method. §
See Also
NPN_InvalidateRect, NPN_InvalidateRegion, NPP
"Forcing a Paint Message"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPN_InvalidateRect

New in Netscape Communicator 4.0.

Invalidates specified drawing area prior to repainting or refreshing a windowless plug-in

Plug-in API Type
Implemented by Navigator. See Netscape Method Summary.
Syntax
#include <npapi.h>
void NPN_InvalidateRect(NPP instance,
                        NP_Rect *invalidRect);
Parameters
The function has the following parameters:
instance
Pointer to the current plug-in instance.
invalidRect
The area to invalidate, specified in a coordinate system that originates at the top left of the plug-in. 
Description
Before a windowless plug-in can repaint or refresh part of its drawing area, the plug-in must first invalidate the area with either NPN_InvalidateRect or NPN_InvalidateRegion.

 NPN_InvalidateRect causes the NPP_HandleEvent method to pass an update event or a paint message to the plug-in. After calling this method, the plug-in receives a paint message asynchronously.

Communicator redraws invalid areas of the document and any windowless plug-ins at regularly timed intervals. To force a paint message, the plug-in can call NPN_ForceRedraw after calling this method.

See Also
NPN_ForceRedraw, NPN_InvalidateRegion, NP_Rect, NPP
"Invalidating the Drawing Area," "Forcing a Paint Message"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPN_InvalidateRegion

New in Netscape Communicator 4.0.

Invalidates specified drawing region prior to repainting or refreshing a windowless plug-in

Plug-in API Type
Implemented by Navigator. See Netscape Method Summary.
Syntax
#include <npapi.h>
void NPN_InvalidateRegion(NPP instance, 
                          NP_Region invalidRegion);
Parameters
The function has the following parameters:
instance
Pointer to the current plug-in instance.
invalidRegion
The area to invalidate, specified in a coordinate system that originates at the top left of the plug-in.
Description
Before a windowless plug-in can repaint or refresh part of its drawing area, the plug-in must first invalidate the area with either NPN_InvalidateRect or NPN_InvalidateRegion.

 NPN_InvalidateRegion causes the NPP_HandleEvent method to pass an update event or a paint message to the plug-in. If a plug-in calls this method, it receives a paint message later. Communicator redraws invalid areas of the document and windowless plug-ins at regularly timed intervals. To force a paint message, the plug-in can call NPN_ForceRedraw after calling this method.

See Also
NPN_ForceRedraw, NPN_InvalidateRect, NP_Region, NPP
"Invalidating the Drawing Area," "Forcing a Paint Message"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPN_GetValue

New in Netscape Communicator 4.0.

Currently used only on Unix and Windows.

Allows the plug-in to query Communicator for information

Plug-in API Type
Implemented by Navigator. See Netscape Method Summary.
Syntax
#include <npapi.h>
NPError NPN_GetValue(NPP         instance,
                     NPNVariable variable,
                     void        *value);
Parameters
This function has the following parameters:
instance
Pointer to the current plug-in instance.
variable
Information the call gets. Values for NPNVariable
  • NPNVxDisplay =1: Unix only: Returns the current Display 
  • NPNVxtAppContext: Unix only: Returns the application's XtAppContext 
  • NPNVnetscapeWindow: MS Windows only: Gets the native window on which plug-in drawing occurs; returns HWND 
  • NPNVjavascriptEnabledBool: Tells whether JavaScript is enabled; true=JavaScript enabled, false=not enabled 
  • NPNVasdEnabledBool: Tells whether SmartUpdate (former name: ASD) is enabled; true=SmartUpdate enabled, false=not enabled 
  • NPNVOfflineBool: Tells whether offline mode is enabled; true=offline mode enabled, false=not enabled
value
Function returns the name of the plug-in in the value parameter.
Returns
Description
NPN_GetValue returns Communicator information set with NPN_SetValue. The queried information is returned in the value parameter.

The method returns a value of type HWND. In many cases, a plug-in may still have to create its own window (a transparent child window of the browser window) to act as the owner window for popup menus and modal dialogs. This transparent child window can have its own WindowProc within which the plug-in can deal with WM_COMMAND messages sent to it a result of tracking the popup menu or modal dialog.

Unix
The values for this parameter are the NPNVxDisplay (the current Display) and the NPNVxtAppContext (the browser's XtAppContext). §

MS Windows
You can use this method to help create a menu or dialog box for a windowless plug-in. In order to bring up popup menus and modal dialogs, a plug-in needs a parent window. A windowless plug-in does not receive its own native window. Instead, it draws directly into the drawable given to it. Use the NPNVnetscapeWindow value to get the native window on which plug-in drawing occurs. §
See Also
NPN_SetValue, NPP_GetValue, NPP_SetValue
"Drawing Plug-ins," "Creating Pop-up Menus and Dialog Boxes"

 [Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


NPN_SetValue

New in Netscape Communicator 4.0.

Sets windowless plug-in as transparent or opaque

Plug-in API Type
Implemented by Navigator. See Netscape Method Summary.
Syntax
#include <npapi.h>
NPError NPN_SetValue(NPP         instance,
                     NPNVariable variable, 
                     void        *value);
Parameters
The function has the following parameters:
instance
Pointer to the current plug-in instance.
variable
Unix only: Information the call is setting. Values: 
  • NPPVpluginWindowBool: Sets windowless mode for display of a plug-in; true=windowless, false=not windowless 
  • NPPVpluginTransparentBool: Sets transparent mode for display of a plug-in; true=transparent, false=opaque 
value
Function returns the name of the plug-in in the value parameter.
Returns
Description
NPN_SetValue specifies that a plug-in is windowless, and either opaque or transparent.

 To specify an opaque windowless plug-in, Communicator calls NPN_SetValue with NPPVpluginWindowBool for its variable parameter and false for its value parameter.

To specify a transparent windowless plug-in, Communicator calls NPN_SetValue with NPPVpluginTransparentBool for its variable parameter and false for its value parameter.

The plug-in makes this call from its NPP_New method. As a default, plug-ins are windowed, so if the NPP_New method does not include this call, the plug-in is considered to be windowed.

See Also
NPP_New, NPN_GetValue, NPP_SetValue
"Specifying That a Plug-in Is Windowless"

[Top] [Drawing Methods] [Reference to Functions by Functional Group] [API Organization: Netscape and Plug-in Methods]


[Contents] [Previous] [Next] [Index]
Last Updated: 01/15/97 16:37:12  
Copyright © 1997 Netscape Communications Corporation