~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/embedding/browser/activex/src/pluginhostctrl/pluginsdk_include/npapi.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 4; -*- */
 
2
/*
 
3
 *  npapi.h $Revision: 1.2 $
 
4
 *  Netscape client plug-in API spec
 
5
 */
 
6
 
 
7
#ifndef _NPAPI_H_
 
8
#define _NPAPI_H_
 
9
 
 
10
#include "jri.h"                /* Java Runtime Interface */
 
11
 
 
12
#ifdef _WINDOWS
 
13
# ifndef XP_WIN
 
14
#   define XP_WIN 1
 
15
# endif /* XP_WIN */
 
16
#endif /* _WINDOWS */
 
17
 
 
18
#ifdef __MWERKS__
 
19
# define _declspec __declspec
 
20
# ifdef macintosh
 
21
#   ifndef XP_MAC
 
22
#     define XP_MAC 1
 
23
#   endif /* XP_MAC */
 
24
# endif /* macintosh */
 
25
# ifdef __INTEL__
 
26
#   undef NULL
 
27
#   ifndef XP_WIN
 
28
#     define XP_WIN 1
 
29
#   endif /* XP_WIN */
 
30
# endif /* __INTELL__ */
 
31
#endif /* __MWERKS__ */
 
32
 
 
33
#ifdef XP_MAC
 
34
  #include <Quickdraw.h>
 
35
  #include <Events.h>
 
36
#endif
 
37
              
 
38
#ifdef XP_UNIX
 
39
  #include <X11/Xlib.h>
 
40
  #include <X11/Xutil.h>
 
41
#endif          
 
42
 
 
43
 
 
44
/*----------------------------------------------------------------------*/
 
45
/*         Plugin Version Constants       */
 
46
/*----------------------------------------------------------------------*/
 
47
 
 
48
#define NP_VERSION_MAJOR 0
 
49
#define NP_VERSION_MINOR 11
 
50
 
 
51
 
 
52
 
 
53
/*----------------------------------------------------------------------*/
 
54
/*         Definition of Basic Types        */
 
55
/*----------------------------------------------------------------------*/
 
56
 
 
57
#ifndef _UINT16
 
58
typedef unsigned short uint16;
 
59
#endif
 
60
#ifndef _UINT32
 
61
#if defined(__alpha)
 
62
typedef unsigned int uint32;
 
63
#else /* __alpha */
 
64
typedef unsigned long uint32;
 
65
#endif /* __alpha */
 
66
#endif
 
67
#ifndef _INT16
 
68
typedef short int16;
 
69
#endif
 
70
#ifndef _INT32
 
71
#if defined(__alpha)
 
72
typedef int int32;
 
73
#else /* __alpha */
 
74
typedef long int32;
 
75
#endif /* __alpha */
 
76
#endif
 
77
 
 
78
#ifndef FALSE
 
79
#define FALSE (0)
 
80
#endif
 
81
#ifndef TRUE
 
82
#define TRUE (1)
 
83
#endif
 
84
#ifndef NULL
 
85
#define NULL (0L)
 
86
#endif
 
87
 
 
88
typedef unsigned char NPBool;
 
89
typedef int16     NPError;
 
90
typedef int16     NPReason;
 
91
typedef char*     NPMIMEType;
 
92
 
 
93
 
 
94
 
 
95
/*----------------------------------------------------------------------*/
 
96
/*         Structures and definitions       */
 
97
/*----------------------------------------------------------------------*/
 
98
 
 
99
#ifdef XP_MAC
 
100
#pragma options align=mac68k
 
101
#endif
 
102
 
 
103
/*
 
104
 *  NPP is a plug-in's opaque instance handle
 
105
 */
 
106
typedef struct _NPP
 
107
{
 
108
    void* pdata;      /* plug-in private data */
 
109
    void* ndata;      /* netscape private data */
 
110
} NPP_t;
 
111
 
 
112
typedef NPP_t*  NPP;
 
113
 
 
114
 
 
115
typedef struct _NPStream
 
116
{
 
117
    void*   pdata;    /* plug-in private data */
 
118
    void*   ndata;    /* netscape private data */
 
119
    const char*   url;
 
120
    uint32    end;
 
121
    uint32    lastmodified;
 
122
    void*   notifyData;
 
123
} NPStream;
 
124
 
 
125
 
 
126
typedef struct _NPByteRange
 
127
{
 
128
    int32 offset;     /* negative offset means from the end */
 
129
    uint32  length;
 
130
    struct _NPByteRange* next;
 
131
} NPByteRange;
 
132
 
 
133
 
 
134
typedef struct _NPSavedData
 
135
{
 
136
    int32 len;
 
137
    void* buf;
 
138
} NPSavedData;
 
139
 
 
140
 
 
141
typedef struct _NPRect
 
142
{
 
143
    uint16  top;
 
144
    uint16  left;
 
145
    uint16  bottom;
 
146
    uint16  right;
 
147
} NPRect;
 
148
 
 
149
 
 
150
#ifdef XP_UNIX
 
151
/*
 
152
 * Unix specific structures and definitions
 
153
 */
 
154
 
 
155
/*
 
156
 * Callback Structures.
 
157
 *
 
158
 * These are used to pass additional platform specific information.
 
159
 */
 
160
enum {
 
161
  NP_SETWINDOW = 1,
 
162
  NP_PRINT
 
163
};
 
164
 
 
165
typedef struct
 
166
{
 
167
    int32   type;
 
168
} NPAnyCallbackStruct;
 
169
 
 
170
typedef struct
 
171
{
 
172
    int32     type;
 
173
    Display*    display;
 
174
    Visual*     visual;
 
175
    Colormap    colormap;
 
176
    unsigned int  depth;
 
177
} NPSetWindowCallbackStruct;
 
178
 
 
179
typedef struct
 
180
{
 
181
    int32     type;
 
182
    FILE*     fp;
 
183
} NPPrintCallbackStruct;
 
184
 
 
185
#endif /* XP_UNIX */
 
186
 
 
187
/*
 
188
 * List of variable names for which NPP_GetValue shall be implemented
 
189
 */
 
190
typedef enum {
 
191
  NPPVpluginNameString = 1,
 
192
  NPPVpluginDescriptionString,
 
193
  NPPVpluginWindowBool,
 
194
  NPPVpluginTransparentBool
 
195
} NPPVariable;
 
196
 
 
197
/*
 
198
 * List of variable names for which NPN_GetValue is implemented by Mozilla
 
199
 */
 
200
typedef enum {
 
201
  NPNVxDisplay = 1,
 
202
  NPNVxtAppContext,
 
203
    NPNVnetscapeWindow,
 
204
  NPNVjavascriptEnabledBool,
 
205
  NPNVasdEnabledBool,
 
206
  NPNVisOfflineBool
 
207
} NPNVariable;
 
208
 
 
209
/*
 
210
 * The type of a NPWindow - it specifies the type of the data structure
 
211
 * returned in the window field.
 
212
 */
 
213
typedef enum {
 
214
    NPWindowTypeWindow = 1,
 
215
    NPWindowTypeDrawable
 
216
} NPWindowType;
 
217
 
 
218
typedef struct _NPWindow
 
219
{
 
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 */
 
224
    uint32  height;
 
225
    NPRect  clipRect; /* Clipping rectangle in port coordinates */
 
226
            /* Used by MAC only.        */
 
227
#ifdef XP_UNIX
 
228
    void *  ws_info;  /* Platform-dependent additonal data */
 
229
#endif /* XP_UNIX */
 
230
    NPWindowType type;  /* Is this a window or a drawable? */
 
231
} NPWindow;
 
232
 
 
233
 
 
234
typedef struct _NPFullPrint
 
235
{
 
236
    NPBool  pluginPrinted;  /* Set TRUE if plugin handled fullscreen */
 
237
              /*  printing               */
 
238
    NPBool  printOne;   /* TRUE if plugin should print one copy  */
 
239
              /*  to default printer           */
 
240
    void* platformPrint;  /* Platform-specific printing info */
 
241
} NPFullPrint;
 
242
 
 
243
typedef struct _NPEmbedPrint
 
244
{
 
245
    NPWindow  window;
 
246
    void* platformPrint;  /* Platform-specific printing info */
 
247
} NPEmbedPrint;
 
248
 
 
249
typedef struct _NPPrint
 
250
{
 
251
    uint16  mode;           /* NP_FULL or NP_EMBED */
 
252
    union
 
253
    {
 
254
    NPFullPrint   fullPrint;    /* if mode is NP_FULL */
 
255
    NPEmbedPrint  embedPrint;   /* if mode is NP_EMBED */
 
256
    } print;
 
257
} NPPrint;
 
258
 
 
259
#ifdef XP_MAC
 
260
typedef EventRecord NPEvent;
 
261
#elif defined(XP_WIN)
 
262
typedef struct _NPEvent
 
263
{
 
264
    uint16   event;
 
265
    uint32   wParam;
 
266
    uint32   lParam;
 
267
} NPEvent;
 
268
#elif defined (XP_UNIX)
 
269
typedef XEvent NPEvent;
 
270
#else
 
271
typedef void*     NPEvent;
 
272
#endif /* XP_MAC */
 
273
 
 
274
#ifdef XP_MAC
 
275
typedef RgnHandle NPRegion;
 
276
#elif defined(XP_WIN)
 
277
typedef HRGN NPRegion;
 
278
#elif defined(XP_UNIX)
 
279
typedef Region NPRegion;
 
280
#else
 
281
typedef void *NPRegion;
 
282
#endif /* XP_MAC */
 
283
 
 
284
#ifdef XP_MAC
 
285
/*
 
286
 *  Mac-specific structures and definitions.
 
287
 */
 
288
 
 
289
typedef struct NP_Port
 
290
{
 
291
    CGrafPtr  port;   /* Grafport */
 
292
    int32   portx;    /* position inside the topmost window */
 
293
    int32   porty;
 
294
} NP_Port;
 
295
 
 
296
/*
 
297
 *  Non-standard event types that can be passed to HandleEvent
 
298
 */
 
299
#define getFocusEvent     (osEvt + 16)
 
300
#define loseFocusEvent      (osEvt + 17)
 
301
#define adjustCursorEvent   (osEvt + 18)
 
302
 
 
303
#endif /* XP_MAC */
 
304
 
 
305
 
 
306
/*
 
307
 * Values for mode passed to NPP_New:
 
308
 */
 
309
#define NP_EMBED    1
 
310
#define NP_FULL     2
 
311
 
 
312
/*
 
313
 * Values for stream type passed to NPP_NewStream:
 
314
 */
 
315
#define NP_NORMAL   1
 
316
#define NP_SEEK     2
 
317
#define NP_ASFILE   3
 
318
#define NP_ASFILEONLY   4
 
319
 
 
320
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
 
321
 
 
322
#ifdef XP_MAC
 
323
#pragma options align=reset
 
324
#endif
 
325
 
 
326
 
 
327
/*----------------------------------------------------------------------*/
 
328
/*         Error and Reason Code definitions      */
 
329
/*----------------------------------------------------------------------*/
 
330
 
 
331
/*
 
332
 *  Values of type NPError:
 
333
 */
 
334
#define NPERR_BASE              0
 
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)
 
349
 
 
350
/*
 
351
 *  Values of type NPReason:
 
352
 */
 
353
#define NPRES_BASE        0
 
354
#define NPRES_DONE          (NPRES_BASE + 0)
 
355
#define NPRES_NETWORK_ERR     (NPRES_BASE + 1)
 
356
#define NPRES_USER_BREAK      (NPRES_BASE + 2)
 
357
 
 
358
/*
 
359
 *      Don't use these obsolete error codes any more.
 
360
 */
 
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
 
364
 
 
365
/*
 
366
 * Version feature information
 
367
 */
 
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
 
374
 
 
375
 
 
376
/*----------------------------------------------------------------------*/
 
377
/*         Function Prototypes        */
 
378
/*----------------------------------------------------------------------*/
 
379
 
 
380
#if defined(_WINDOWS) && !defined(WIN32)
 
381
#define NP_LOADDS  _loadds
 
382
#else
 
383
#define NP_LOADDS
 
384
#endif
 
385
 
 
386
#ifdef __cplusplus
 
387
extern "C" {
 
388
#endif
 
389
 
 
390
/*
 
391
 * NPP_* functions are provided by the plugin and called by the navigator.
 
392
 */
 
393
 
 
394
#ifdef XP_UNIX
 
395
char*         NPP_GetMIMEDescription(void);
 
396
#endif /* XP_UNIX */
 
397
 
 
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,
 
407
                    uint16* stype);
 
408
NPError     NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
 
409
                      NPReason reason);
 
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,
 
414
                     const char* fname);
 
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,
 
421
                   void *value);
 
422
NPError         NPP_SetValue(void *instance, NPNVariable variable,
 
423
                   void *value);
 
424
 
 
425
/*
 
426
 * NPN_* functions are provided by the navigator and called by the plugin.
 
427
 */
 
428
 
 
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,
 
434
               const char* target);
 
435
NPError   NPN_PostURLNotify(NPP instance, const char* url,
 
436
                  const char* target, uint32 len,
 
437
                  const char* buf, NPBool file,
 
438
                  void* notifyData);
 
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,
 
446
              void* buffer);
 
447
NPError     NPN_DestroyStream(NPP instance, NPStream* stream,
 
448
                  NPReason reason);
 
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,
 
458
               void *value);
 
459
NPError     NPN_SetValue(NPP instance, NPPVariable variable,
 
460
               void *value);
 
461
void    NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
 
462
void    NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
 
463
void    NPN_ForceRedraw(NPP instance);
 
464
 
 
465
#ifdef __cplusplus
 
466
}  /* end extern "C" */
 
467
#endif
 
468
 
 
469
#endif /* _NPAPI_H_ */