]>
git.saurik.com Git - wxWidgets.git/blob - utils/nplugin/src/npapi.h
3 * Netscape client plug-in API spec
10 /* XXX this needs to get out of here */
11 #if defined(__MWERKS__)
22 #define NP_VERSION_MAJOR 0
23 #define NP_VERSION_MINOR 6
32 typedef unsigned short uint16
;
35 typedef unsigned long uint32
;
54 typedef unsigned char NPBool
;
55 typedef void* NPEvent
;
56 typedef int16 NPError
;
57 typedef char* NPMIMEType
;
61 * NPP is a plug-in's opaque instance handle
65 void* pdata
; /* plug-in private data */
66 void* ndata
; /* netscape private data */
73 typedef struct _NPStream
75 void* pdata
; /* plug-in private data */
76 void* ndata
; /* netscape private data */
82 typedef struct _NPByteRange
84 int32 offset
; /* negative offset means from the end */
86 struct _NPByteRange
* next
;
90 typedef struct _NPSavedData
98 typedef struct _NPRect
106 typedef struct _NPWindow
108 void* window
; /* platform specific window handle */
109 uint32 x
; /* position of top left corner relative to a netscape page */
111 uint32 width
; /* maximum window size */
113 NPRect clipRect
; /* clipping rectangle in port coordinates */
118 typedef struct _NPFullPrint
120 NPBool pluginPrinted
; /* Set TRUE if plugin handled fullscreen printing */
121 NPBool printOne
; /* TRUE if plugin should print one copy to default printer */
122 void* platformPrint
; /* Platform-specific printing info */
125 typedef struct _NPEmbedPrint
128 void* platformPrint
; /* Platform-specific printing info */
131 typedef struct _NPPrint
133 uint16 mode
; /* NP_FULL or NP_EMBED */
136 NPFullPrint fullPrint
; /* if mode is NP_FULL */
137 NPEmbedPrint embedPrint
; /* if mode is NP_EMBED */
147 * Mac-specific structures and definitions.
150 #include <Quickdraw.h>
153 typedef struct NP_Port
155 CGrafPtr port
; /* Grafport */
156 int32 portx
; /* position inside the topmost window */
161 * Non-standard event types that can be passed to HandleEvent
163 #define getFocusEvent (osEvt + 16)
164 #define loseFocusEvent (osEvt + 17)
165 #define adjustCursorEvent (osEvt + 18)
174 #define NP_BACKGROUND 3
180 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
184 * Error and reason code definitions.
192 #define NPERR_NO_ERROR (NPERR_BASE + 0)
193 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
194 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
195 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
196 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
197 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
198 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
199 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
200 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
203 #define NPRES_NETWORK_ERR (NPRES_BASE + 0)
204 #define NPRES_USER_BREAK (NPRES_BASE + 1)
205 #define NPRES_DONE (NPRES_BASE + 3)
210 * Function prototypes.
211 * Functions beginning with 'NPP' are functions provided by the plugin that Netscape will call.
212 * Functions beginning with 'NPN' are functions provided by Netscape that the plugin will call.
215 #if defined(_WINDOWS) && !defined(__WIN32__)
216 #define NP_LOADDS _loadds
225 NPError
NPP_Initialize(void);
226 void NPP_Shutdown(void);
227 NPError NP_LOADDS
NPP_New(NPMIMEType pluginType
, NPP instance
, uint16 mode
, int16 argc
, char* argn
[], char* argv
[], NPSavedData
* saved
);
228 NPError NP_LOADDS
NPP_Destroy(NPP instance
, NPSavedData
** save
);
229 NPError NP_LOADDS
NPP_SetWindow(NPP instance
, NPWindow
* window
);
230 NPError NP_LOADDS
NPP_NewStream(NPP instance
, NPMIMEType type
, NPStream
* stream
, NPBool seekable
, uint16
* stype
);
231 NPError NP_LOADDS
NPP_DestroyStream(NPP instance
, NPStream
* stream
, NPError reason
);
232 int32 NP_LOADDS
NPP_WriteReady(NPP instance
, NPStream
* stream
);
233 int32 NP_LOADDS
NPP_Write(NPP instance
, NPStream
* stream
, int32 offset
, int32 len
, void* buffer
);
234 void NP_LOADDS
NPP_StreamAsFile(NPP instance
, NPStream
* stream
, const char* fname
);
235 void NP_LOADDS
NPP_Print(NPP instance
, NPPrint
* platformPrint
);
236 int16
NPP_HandleEvent(NPP instance
, void* event
);
238 void NPN_Version(int* plugin_major
, int* plugin_minor
, int* netscape_major
, int* netscape_minor
);
239 NPError
NPN_GetURL(NPP instance
, const char* url
, const char* window
);
240 NPError
NPN_PostURL(NPP instance
, const char* url
, const char* window
, uint32 len
, const char* buf
, NPBool file
);
241 NPError
NPN_RequestRead(NPStream
* stream
, NPByteRange
* rangeList
);
242 NPError
NPN_NewStream(NPP instance
, NPMIMEType type
, NPStream
* stream
);
243 int32
NPN_Write(NPP instance
, NPStream
* stream
, int32 len
, void* buffer
);
244 NPError
NPN_DestroyStream(NPP instance
, NPStream
* stream
, NPError reason
);
245 void NPN_Status(NPP instance
, const char* message
);
246 const char* NPN_UserAgent(NPP instance
);
247 void* NPN_MemAlloc(uint32 size
);
248 void NPN_MemFree(void* ptr
);
249 uint32
NPN_MemFlush(uint32 size
);
250 void NPN_ReloadPlugins(NPBool reloadPages
);
253 } /* end extern "C" */
257 #endif /* _NPAPI_H_ */