1
/* -*- Mode: C; tab-width: 4; -*- */
3
* npapi.h $Revision: 1.2 $
4
* Netscape client plug-in API spec
10
#include "jri.h" /* Java Runtime Interface */
19
# define _declspec __declspec
24
# endif /* macintosh */
30
# endif /* __INTELL__ */
31
#endif /* __MWERKS__ */
34
#include <Quickdraw.h>
40
#include <X11/Xutil.h>
44
/*----------------------------------------------------------------------*/
45
/* Plugin Version Constants */
46
/*----------------------------------------------------------------------*/
48
#define NP_VERSION_MAJOR 0
49
#define NP_VERSION_MINOR 11
53
/*----------------------------------------------------------------------*/
54
/* Definition of Basic Types */
55
/*----------------------------------------------------------------------*/
58
typedef unsigned short uint16;
62
typedef unsigned int uint32;
64
typedef unsigned long uint32;
88
typedef unsigned char NPBool;
89
typedef int16 NPError;
90
typedef int16 NPReason;
91
typedef char* NPMIMEType;
95
/*----------------------------------------------------------------------*/
96
/* Structures and definitions */
97
/*----------------------------------------------------------------------*/
100
#pragma options align=mac68k
104
* NPP is a plug-in's opaque instance handle
108
void* pdata; /* plug-in private data */
109
void* ndata; /* netscape private data */
115
typedef struct _NPStream
117
void* pdata; /* plug-in private data */
118
void* ndata; /* netscape private data */
126
typedef struct _NPByteRange
128
int32 offset; /* negative offset means from the end */
130
struct _NPByteRange* next;
134
typedef struct _NPSavedData
141
typedef struct _NPRect
152
* Unix specific structures and definitions
156
* Callback Structures.
158
* These are used to pass additional platform specific information.
168
} NPAnyCallbackStruct;
177
} NPSetWindowCallbackStruct;
183
} NPPrintCallbackStruct;
188
* List of variable names for which NPP_GetValue shall be implemented
191
NPPVpluginNameString = 1,
192
NPPVpluginDescriptionString,
193
NPPVpluginWindowBool,
194
NPPVpluginTransparentBool
198
* List of variable names for which NPN_GetValue is implemented by Mozilla
204
NPNVjavascriptEnabledBool,
210
* The type of a NPWindow - it specifies the type of the data structure
211
* returned in the window field.
214
NPWindowTypeWindow = 1,
218
typedef struct _NPWindow
220
void* window; /* Platform specific window handle */
221
int32 x; /* Position of top left corner relative */
222
int32 y; /* to a netscape page. */
223
uint32 width; /* Maximum window size */
225
NPRect clipRect; /* Clipping rectangle in port coordinates */
226
/* Used by MAC only. */
228
void * ws_info; /* Platform-dependent additonal data */
230
NPWindowType type; /* Is this a window or a drawable? */
234
typedef struct _NPFullPrint
236
NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */
238
NPBool printOne; /* TRUE if plugin should print one copy */
239
/* to default printer */
240
void* platformPrint; /* Platform-specific printing info */
243
typedef struct _NPEmbedPrint
246
void* platformPrint; /* Platform-specific printing info */
249
typedef struct _NPPrint
251
uint16 mode; /* NP_FULL or NP_EMBED */
254
NPFullPrint fullPrint; /* if mode is NP_FULL */
255
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
260
typedef EventRecord NPEvent;
261
#elif defined(XP_WIN)
262
typedef struct _NPEvent
268
#elif defined (XP_UNIX)
269
typedef XEvent NPEvent;
271
typedef void* NPEvent;
275
typedef RgnHandle NPRegion;
276
#elif defined(XP_WIN)
277
typedef HRGN NPRegion;
278
#elif defined(XP_UNIX)
279
typedef Region NPRegion;
281
typedef void *NPRegion;
286
* Mac-specific structures and definitions.
289
typedef struct NP_Port
291
CGrafPtr port; /* Grafport */
292
int32 portx; /* position inside the topmost window */
297
* Non-standard event types that can be passed to HandleEvent
299
#define getFocusEvent (osEvt + 16)
300
#define loseFocusEvent (osEvt + 17)
301
#define adjustCursorEvent (osEvt + 18)
307
* Values for mode passed to NPP_New:
313
* Values for stream type passed to NPP_NewStream:
318
#define NP_ASFILEONLY 4
320
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
323
#pragma options align=reset
327
/*----------------------------------------------------------------------*/
328
/* Error and Reason Code definitions */
329
/*----------------------------------------------------------------------*/
332
* Values of type NPError:
335
#define NPERR_NO_ERROR (NPERR_BASE + 0)
336
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
337
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
338
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
339
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
340
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
341
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
342
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
343
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
344
#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
345
#define NPERR_INVALID_URL (NPERR_BASE + 10)
346
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
347
#define NPERR_NO_DATA (NPERR_BASE + 12)
348
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
351
* Values of type NPReason:
354
#define NPRES_DONE (NPRES_BASE + 0)
355
#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
356
#define NPRES_USER_BREAK (NPRES_BASE + 2)
359
* Don't use these obsolete error codes any more.
361
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
362
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
363
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
366
* Version feature information
368
#define NPVERS_HAS_STREAMOUTPUT 8
369
#define NPVERS_HAS_NOTIFICATION 9
370
#define NPVERS_HAS_LIVECONNECT 9
371
#define NPVERS_WIN16_HAS_LIVECONNECT 9
372
#define NPVERS_68K_HAS_LIVECONNECT 11
373
#define NPVERS_HAS_WINDOWLESS 11
376
/*----------------------------------------------------------------------*/
377
/* Function Prototypes */
378
/*----------------------------------------------------------------------*/
380
#if defined(_WINDOWS) && !defined(WIN32)
381
#define NP_LOADDS _loadds
391
* NPP_* functions are provided by the plugin and called by the navigator.
395
char* NPP_GetMIMEDescription(void);
398
NPError NPP_Initialize(void);
399
void NPP_Shutdown(void);
400
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
401
uint16 mode, int16 argc, char* argn[],
402
char* argv[], NPSavedData* saved);
403
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
404
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
405
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
406
NPStream* stream, NPBool seekable,
408
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
410
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
411
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
412
int32 len, void* buffer);
413
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
415
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
416
int16 NPP_HandleEvent(NPP instance, void* event);
417
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
418
NPReason reason, void* notifyData);
419
jref NP_LOADDS NPP_GetJavaClass(void);
420
NPError NPP_GetValue(void *instance, NPPVariable variable,
422
NPError NPP_SetValue(void *instance, NPNVariable variable,
426
* NPN_* functions are provided by the navigator and called by the plugin.
429
void NPN_Version(int* plugin_major, int* plugin_minor,
430
int* netscape_major, int* netscape_minor);
431
NPError NPN_GetURLNotify(NPP instance, const char* url,
432
const char* target, void* notifyData);
433
NPError NPN_GetURL(NPP instance, const char* url,
435
NPError NPN_PostURLNotify(NPP instance, const char* url,
436
const char* target, uint32 len,
437
const char* buf, NPBool file,
439
NPError NPN_PostURL(NPP instance, const char* url,
440
const char* target, uint32 len,
441
const char* buf, NPBool file);
442
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
443
NPError NPN_NewStream(NPP instance, NPMIMEType type,
444
const char* target, NPStream** stream);
445
int32 NPN_Write(NPP instance, NPStream* stream, int32 len,
447
NPError NPN_DestroyStream(NPP instance, NPStream* stream,
449
void NPN_Status(NPP instance, const char* message);
450
const char* NPN_UserAgent(NPP instance);
451
void* NPN_MemAlloc(uint32 size);
452
void NPN_MemFree(void* ptr);
453
uint32 NPN_MemFlush(uint32 size);
454
void NPN_ReloadPlugins(NPBool reloadPages);
455
JRIEnv* NPN_GetJavaEnv(void);
456
jref NPN_GetJavaPeer(NPP instance);
457
NPError NPN_GetValue(NPP instance, NPNVariable variable,
459
NPError NPN_SetValue(NPP instance, NPPVariable variable,
461
void NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
462
void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
463
void NPN_ForceRedraw(NPP instance);
466
} /* end extern "C" */
469
#endif /* _NPAPI_H_ */