HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
npapi.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is mozilla.org code.
16  *
17  * The Initial Developer of the Original Code is
18  * Netscape Communications Corporation.
19  * Portions created by the Initial Developer are Copyright (C) 1998
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPL"), or
26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 #ifndef npapi_h_
39 #define npapi_h_
40 
41 #if defined(__OS2__)
42 #pragma pack(1)
43 #endif
44 
45 #include "nptypes.h"
46 
47 #if defined(__OS2__) || defined(OS2)
48 #ifndef XP_OS2
49 #define XP_OS2 1
50 #endif
51 #endif
52 
53 #if defined(_WIN32) && !defined(__SYMBIAN32__)
54 #include <windef.h>
55 #ifndef XP_WIN
56 #define XP_WIN 1
57 #endif
58 #endif
59 
60 #if defined(__SYMBIAN32__)
61 #ifndef XP_SYMBIAN
62 #define XP_SYMBIAN 1
63 #undef XP_WIN
64 #endif
65 #endif
66 
67 #if defined(__APPLE_CC__) && !defined(XP_UNIX)
68 #ifndef XP_MACOSX
69 #define XP_MACOSX 1
70 #endif
71 #endif
72 
73 #if defined(XP_MACOSX)
74 #if !defined(NP_NO_OPENGL)
75 #define NP_NO_OPENGL 1
76 #endif /* !defined(NP_NO_OPENGL) */
77 #if defined(__LP64__)
78 #define NP_NO_QUICKDRAW
79 #define NP_NO_CARBON
80 #endif /* defined(__LP64__) */
81 #endif
82 
83 #if defined(XP_MACOSX)
84 #include <ApplicationServices/ApplicationServices.h>
85 #if !NP_NO_OPENGL
86 #include <OpenGL/OpenGL.h>
87 #endif /* !NP_NO_OPENGL */
88 #ifndef NP_NO_CARBON
89 #include <Carbon/Carbon.h>
90 #endif
91 #endif
92 
93 #if defined(XP_UNIX)
94 #include <stdio.h>
95 #if defined(MOZ_X11)
96 #include <X11/Xlib.h>
97 #include <X11/Xutil.h>
98 #endif
99 #endif
100 
101 #if defined(XP_SYMBIAN)
102 #include <QEvent>
103 #include <QRegion>
104 #endif
105 
106 /*----------------------------------------------------------------------*/
107 /* Plugin Version Constants */
108 /*----------------------------------------------------------------------*/
109 
110 #define NP_VERSION_MAJOR 0
111 #define NP_VERSION_MINOR 27
112 
113 
114 /* The OS/2 version of Netscape uses RC_DATA to define the
115  mime types, file extensions, etc that are required.
116  Use a vertical bar to separate types, end types with \0.
117  FileVersion and ProductVersion are 32bit ints, all other
118  entries are strings that MUST be terminated with a \0.
119 
120 AN EXAMPLE:
121 
122 RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
123 
124 RCDATA NP_INFO_MIMEType { "video/x-video|",
125  "video/x-flick\0" }
126 RCDATA NP_INFO_FileExtents { "avi|",
127  "flc\0" }
128 RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
129  "MMOS2 Flc/Fli player(*.flc)\0" }
130 
131 RCDATA NP_INFO_FileVersion { 1,0,0,1 }
132 RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
133 RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
134 RCDATA NP_INFO_InternalName { "NPAVI32\0" )
135 RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
136 RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
137 RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
138 */
139 /* RC_DATA types for version info - required */
140 #define NP_INFO_ProductVersion 1
141 #define NP_INFO_MIMEType 2
142 #define NP_INFO_FileOpenName 3
143 #define NP_INFO_FileExtents 4
144 /* RC_DATA types for version info - used if found */
145 #define NP_INFO_FileDescription 5
146 #define NP_INFO_ProductName 6
147 /* RC_DATA types for version info - optional */
148 #define NP_INFO_CompanyName 7
149 #define NP_INFO_FileVersion 8
150 #define NP_INFO_InternalName 9
151 #define NP_INFO_LegalCopyright 10
152 #define NP_INFO_OriginalFilename 11
153 
154 #ifndef RC_INVOKED
155 
156 /*----------------------------------------------------------------------*/
157 /* Definition of Basic Types */
158 /*----------------------------------------------------------------------*/
159 
160 typedef unsigned char NPBool;
161 typedef int16_t NPError;
162 typedef int16_t NPReason;
163 typedef char* NPMIMEType;
164 
165 /*----------------------------------------------------------------------*/
166 /* Structures and definitions */
167 /*----------------------------------------------------------------------*/
168 
169 #if !defined(__LP64__)
170 #if defined(XP_MACOSX)
171 #pragma options align=mac68k
172 #endif
173 #endif /* __LP64__ */
174 
175 /*
176  * NPP is a plug-in's opaque instance handle
177  */
178 typedef struct _NPP
179 {
180  void* pdata; /* plug-in private data */
181  void* ndata; /* netscape private data */
182 } NPP_t;
183 
184 typedef NPP_t* NPP;
185 
186 typedef struct _NPStream
187 {
188  void* pdata; /* plug-in private data */
189  void* ndata; /* netscape private data */
190  const char* url;
191  uint32_t end;
192  uint32_t lastmodified;
193  void* notifyData;
194  const char* headers; /* Response headers from host.
195  * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
196  * Used for HTTP only; NULL for non-HTTP.
197  * Available from NPP_NewStream onwards.
198  * Plugin should copy this data before storing it.
199  * Includes HTTP status line and all headers,
200  * preferably verbatim as received from server,
201  * headers formatted as in HTTP ("Header: Value"),
202  * and newlines (\n, NOT \r\n) separating lines.
203  * Terminated by \n\0 (NOT \n\n\0). */
204 } NPStream;
205 
206 typedef struct _NPByteRange
207 {
208  int32_t offset; /* negative offset means from the end */
209  uint32_t length;
210  struct _NPByteRange* next;
211 } NPByteRange;
212 
213 typedef struct _NPSavedData
214 {
215  int32_t len;
216  void* buf;
217 } NPSavedData;
218 
219 typedef struct _NPRect
220 {
221  uint16_t top;
222  uint16_t left;
223  uint16_t bottom;
224  uint16_t right;
225 } NPRect;
226 
227 typedef struct _NPSize
228 {
229  int32_t width;
230  int32_t height;
231 } NPSize;
232 
233 typedef enum {
234  NPFocusNext = 0,
235  NPFocusPrevious = 1
236 } NPFocusDirection;
237 
238 /* These formats describe the format in the memory byte-order. This means if
239  * a 32-bit value of a pixel is viewed on a little-endian system the layout will
240  * be 0xAARRGGBB. The Alpha channel will be stored in the most significant
241  * bits. */
242 typedef enum {
243  /* 32-bit per pixel 8-bit per channel - premultiplied alpha */
244  NPImageFormatBGRA32 = 0x1,
245  /* 32-bit per pixel 8-bit per channel - 1 unused channel */
246  NPImageFormatBGRX32 = 0x2
247 } NPImageFormat;
248 
249 typedef struct _NPAsyncSurface
250 {
251  uint32_t version;
252  NPSize size;
253  NPImageFormat format;
254  union {
255  struct {
256  uint32_t stride;
257  void *data;
258  } bitmap;
259 #if defined(XP_WIN)
260  HANDLE sharedHandle;
261 #endif
262  };
264 
265 /* Return values for NPP_HandleEvent */
266 #define kNPEventNotHandled 0
267 #define kNPEventHandled 1
268 /* Exact meaning must be spec'd in event model. */
269 #define kNPEventStartIME 2
270 
271 #if defined(XP_UNIX)
272 /*
273  * Unix specific structures and definitions
274  */
275 
276 /*
277  * Callback Structures.
278  *
279  * These are used to pass additional platform specific information.
280  */
281 enum {
282  NP_SETWINDOW = 1,
283  NP_PRINT
284 };
285 
286 typedef struct
287 {
288  int32_t type;
289 } NPAnyCallbackStruct;
290 
291 typedef struct
292 {
293  int32_t type;
294 #if defined(MOZ_X11)
295  Display* display;
296  Visual* visual;
297  Colormap colormap;
298  unsigned int depth;
299 #endif
300 } NPSetWindowCallbackStruct;
301 
302 typedef struct
303 {
304  int32_t type;
305  FILE* fp;
306 } NPPrintCallbackStruct;
307 
308 #endif /* XP_UNIX */
309 
310 typedef enum {
311 #if defined(XP_MACOSX)
312 #ifndef NP_NO_QUICKDRAW
313  NPDrawingModelQuickDraw = 0,
314 #endif
315  NPDrawingModelCoreGraphics = 1,
316  NPDrawingModelOpenGL = 2,
317  NPDrawingModelCoreAnimation = 3,
318  NPDrawingModelInvalidatingCoreAnimation = 4,
319 #endif
320 #if defined(XP_WIN)
321  NPDrawingModelSyncWin = 5,
322 #endif
323 #if defined(MOZ_X11)
324  NPDrawingModelSyncX = 6,
325 #endif
326  NPDrawingModelAsyncBitmapSurface = 7
327 #if defined(XP_WIN)
328  , NPDrawingModelAsyncWindowsDXGISurface = 8
329 #endif
330 } NPDrawingModel;
331 
332 #ifdef XP_MACOSX
333 typedef enum {
334 #ifndef NP_NO_CARBON
335  NPEventModelCarbon = 0,
336 #endif
337  NPEventModelCocoa = 1
338 } NPEventModel;
339 #endif
340 
341 /*
342  * The following masks are applied on certain platforms to NPNV and
343  * NPPV selectors that pass around pointers to COM interfaces. Newer
344  * compilers on some platforms may generate vtables that are not
345  * compatible with older compilers. To prevent older plugins from
346  * not understanding a new browser's ABI, these masks change the
347  * values of those selectors on those platforms. To remain backwards
348  * compatible with different versions of the browser, plugins can
349  * use these masks to dynamically determine and use the correct C++
350  * ABI that the browser is expecting. This does not apply to Windows
351  * as Microsoft's COM ABI will likely not change.
352  */
353 
354 #define NP_ABI_GCC3_MASK 0x10000000
355 /*
356  * gcc 3.x generated vtables on UNIX and OSX are incompatible with
357  * previous compilers.
358  */
359 #if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
360 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
361 #else
362 #define _NP_ABI_MIXIN_FOR_GCC3 0
363 #endif
364 
365 #if defined(XP_MACOSX)
366 #define NP_ABI_MACHO_MASK 0x01000000
367 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
368 #else
369 #define _NP_ABI_MIXIN_FOR_MACHO 0
370 #endif
371 
372 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
373 
374 /*
375  * List of variable names for which NPP_GetValue shall be implemented
376  */
377 typedef enum {
378  NPPVpluginNameString = 1,
379  NPPVpluginDescriptionString,
380  NPPVpluginWindowBool,
381  NPPVpluginTransparentBool,
382  NPPVjavaClass,
383  NPPVpluginWindowSize,
384  NPPVpluginTimerInterval,
385  NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
386  NPPVpluginScriptableIID = 11,
387  NPPVjavascriptPushCallerBool = 12,
388  NPPVpluginKeepLibraryInMemory = 13,
389  NPPVpluginNeedsXEmbed = 14,
390 
391  /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14.
392  */
393  NPPVpluginScriptableNPObject = 15,
394 
395  /* Get the plugin value (as \0-terminated UTF-8 string data) for
396  * form submission if the plugin is part of a form. Use
397  * NPN_MemAlloc() to allocate memory for the string data. Introduced
398  * in NPAPI minor version 15.
399  */
400  NPPVformValue = 16,
401 
402  NPPVpluginUrlRequestsDisplayedBool = 17,
403 
404  /* Checks if the plugin is interested in receiving the http body of
405  * all http requests (including failed ones, http status != 200).
406  */
407  NPPVpluginWantsAllNetworkStreams = 18,
408 
409  /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
410  NPPVpluginNativeAccessibleAtkPlugId = 19,
411 
412  /* Checks to see if the plug-in would like the browser to load the "src" attribute. */
413  NPPVpluginCancelSrcStream = 20,
414 
415  NPPVsupportsAdvancedKeyHandling = 21,
416 
417  NPPVpluginUsesDOMForCursorBool = 22,
418 
419  /* Used for negotiating drawing models */
420  NPPVpluginDrawingModel = 1000
421 #if defined(XP_MACOSX)
422  /* Used for negotiating event models */
423  , NPPVpluginEventModel = 1001
424  /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
425  , NPPVpluginCoreAnimationLayer = 1003
426 #endif
427 
428 #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
429  , NPPVpluginWindowlessLocalBool = 2002
430 #endif
431 } NPPVariable;
432 
433 /*
434  * List of variable names for which NPN_GetValue should be implemented.
435  */
436 typedef enum {
437  NPNVxDisplay = 1,
438  NPNVxtAppContext,
439  NPNVnetscapeWindow,
440  NPNVjavascriptEnabledBool,
441  NPNVasdEnabledBool,
442  NPNVisOfflineBool,
443 
444  NPNVserviceManager = (10 | NP_ABI_MASK),
445  NPNVDOMElement = (11 | NP_ABI_MASK),
446  NPNVDOMWindow = (12 | NP_ABI_MASK),
447  NPNVToolkit = (13 | NP_ABI_MASK),
448  NPNVSupportsXEmbedBool = 14,
449 
450  /* Get the NPObject wrapper for the browser window. */
451  NPNVWindowNPObject = 15,
452 
453  /* Get the NPObject wrapper for the plugins DOM element. */
454  NPNVPluginElementNPObject = 16,
455 
456  NPNVSupportsWindowless = 17,
457 
458  NPNVprivateModeBool = 18,
459 
460  NPNVsupportsAdvancedKeyHandling = 21,
461 
462  NPNVdocumentOrigin = 22,
463 
464  NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */
465 #if defined(XP_MACOSX)
466  , NPNVcontentsScaleFactor = 1001
467 #ifndef NP_NO_QUICKDRAW
468  , NPNVsupportsQuickDrawBool = 2000
469 #endif
470  , NPNVsupportsCoreGraphicsBool = 2001
471  , NPNVsupportsOpenGLBool = 2002
472  , NPNVsupportsCoreAnimationBool = 2003
473  , NPNVsupportsInvalidatingCoreAnimationBool = 2004
474 #endif
475  , NPNVsupportsAsyncBitmapSurfaceBool = 2007
476 #if defined(XP_WIN)
477  , NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008
478 #endif
479 #if defined(XP_MACOSX)
480 #ifndef NP_NO_CARBON
481  , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
482 #endif
483  , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
484  , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
485  Cocoa text input specification. */
486  , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
487  CA model compositing */
488 #endif
489 #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
490  , NPNVSupportsWindowlessLocal = 2002
491 #endif
492 } NPNVariable;
493 
494 typedef enum {
495  NPNURLVCookie = 501,
496  NPNURLVProxy
497 } NPNURLVariable;
498 
499 /*
500  * The type of Toolkit the widgets use
501  */
502 typedef enum {
503  NPNVGtk12 = 1,
504  NPNVGtk2
505 } NPNToolkitType;
506 
507 /*
508  * The type of a NPWindow - it specifies the type of the data structure
509  * returned in the window field.
510  */
511 typedef enum {
512  NPWindowTypeWindow = 1,
513  NPWindowTypeDrawable
514 } NPWindowType;
515 
516 typedef struct _NPWindow
517 {
518  void* window; /* Platform specific window handle */
519  /* OS/2: x - Position of bottom left corner */
520  /* OS/2: y - relative to visible netscape window */
521  int32_t x; /* Position of top left corner relative */
522  int32_t y; /* to a netscape page. */
523  uint32_t width; /* Maximum window size */
524  uint32_t height;
525  NPRect clipRect; /* Clipping rectangle in port coordinates */
526 #if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
527  void * ws_info; /* Platform-dependent additional data */
528 #endif /* XP_UNIX */
529  NPWindowType type; /* Is this a window or a drawable? */
530 } NPWindow;
531 
532 typedef struct _NPImageExpose
533 {
534  char* data; /* image pointer */
535  int32_t stride; /* Stride of data image pointer */
536  int32_t depth; /* Depth of image pointer */
537  int32_t x; /* Expose x */
538  int32_t y; /* Expose y */
539  uint32_t width; /* Expose width */
540  uint32_t height; /* Expose height */
541  NPSize dataSize; /* Data buffer size */
542  float translateX; /* translate X matrix value */
543  float translateY; /* translate Y matrix value */
544  float scaleX; /* scale X matrix value */
545  float scaleY; /* scale Y matrix value */
546 } NPImageExpose;
547 
548 typedef struct _NPFullPrint
549 {
550  NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
551  NPBool printOne; /* TRUE if plugin should print one copy to default
552  printer */
553  void* platformPrint; /* Platform-specific printing info */
554 } NPFullPrint;
555 
556 typedef struct _NPEmbedPrint
557 {
558  NPWindow window;
559  void* platformPrint; /* Platform-specific printing info */
560 } NPEmbedPrint;
561 
562 typedef struct _NPPrint
563 {
564  uint16_t mode; /* NP_FULL or NP_EMBED */
565  union
566  {
567  NPFullPrint fullPrint; /* if mode is NP_FULL */
568  NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
569  } print;
570 } NPPrint;
571 
572 #if defined(XP_MACOSX)
573 #ifndef NP_NO_CARBON
574 typedef EventRecord NPEvent;
575 #endif
576 #elif defined(XP_SYMBIAN)
577 typedef QEvent NPEvent;
578 #elif defined(XP_WIN)
579 typedef struct _NPEvent
580 {
581  uint16_t event;
582  uintptr_t wParam;
583  uintptr_t lParam;
584 } NPEvent;
585 #elif defined(XP_OS2)
586 typedef struct _NPEvent
587 {
588  uint32_t event;
589  uint32_t wParam;
590  uint32_t lParam;
591 } NPEvent;
592 #elif defined(XP_UNIX) && defined(MOZ_X11)
593 typedef XEvent NPEvent;
594 #else
595 typedef void* NPEvent;
596 #endif
597 
598 #if defined(XP_MACOSX)
599 typedef void* NPRegion;
600 #ifndef NP_NO_QUICKDRAW
601 typedef RgnHandle NPQDRegion;
602 #endif
603 typedef CGPathRef NPCGRegion;
604 #elif defined(XP_WIN)
605 typedef HRGN NPRegion;
606 #elif defined(XP_UNIX) && defined(MOZ_X11)
607 typedef Region NPRegion;
608 #elif defined(XP_SYMBIAN)
609 typedef QRegion* NPRegion;
610 #else
611 typedef void *NPRegion;
612 #endif
613 
614 typedef struct _NPNSString NPNSString;
615 typedef struct _NPNSWindow NPNSWindow;
616 typedef struct _NPNSMenu NPNSMenu;
617 
618 #if defined(XP_MACOSX)
619 typedef NPNSMenu NPMenu;
620 #else
621 typedef void *NPMenu;
622 #endif
623 
624 typedef enum {
625  NPCoordinateSpacePlugin = 1,
626  NPCoordinateSpaceWindow,
627  NPCoordinateSpaceFlippedWindow,
628  NPCoordinateSpaceScreen,
629  NPCoordinateSpaceFlippedScreen
630 } NPCoordinateSpace;
631 
632 #if defined(XP_MACOSX)
633 
634 #ifndef NP_NO_QUICKDRAW
635 typedef struct NP_Port
636 {
637  CGrafPtr port;
638  int32_t portx; /* position inside the topmost window */
639  int32_t porty;
640 } NP_Port;
641 #endif /* NP_NO_QUICKDRAW */
642 
643 /*
644  * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
645  * as its drawing model.
646  */
647 
648 typedef struct NP_CGContext
649 {
650  CGContextRef context;
651  void *window; /* A WindowRef under the Carbon event model. */
652 } NP_CGContext;
653 
654 /*
655  * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
656  * drawing model.
657  */
658 
659 #if !NP_NO_OPENGL
660 typedef struct NP_GLContext
661 {
662  CGLContextObj context;
663 #ifdef NP_NO_CARBON
664  NPNSWindow *window;
665 #else
666  void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
667 #endif
668 } NP_GLContext;
669 #endif /* !NP_NO_OPENGL */
670 
671 typedef enum {
672  NPCocoaEventDrawRect = 1,
673  NPCocoaEventMouseDown,
674  NPCocoaEventMouseUp,
675  NPCocoaEventMouseMoved,
676  NPCocoaEventMouseEntered,
677  NPCocoaEventMouseExited,
678  NPCocoaEventMouseDragged,
679  NPCocoaEventKeyDown,
680  NPCocoaEventKeyUp,
681  NPCocoaEventFlagsChanged,
682  NPCocoaEventFocusChanged,
683  NPCocoaEventWindowFocusChanged,
684  NPCocoaEventScrollWheel,
685  NPCocoaEventTextInput
686 } NPCocoaEventType;
687 
688 typedef struct _NPCocoaEvent {
689  NPCocoaEventType type;
690  uint32_t version;
691  union {
692  struct {
693  uint32_t modifierFlags;
694  double pluginX;
695  double pluginY;
696  int32_t buttonNumber;
697  int32_t clickCount;
698  double deltaX;
699  double deltaY;
700  double deltaZ;
701  } mouse;
702  struct {
703  uint32_t modifierFlags;
704  NPNSString *characters;
705  NPNSString *charactersIgnoringModifiers;
706  NPBool isARepeat;
707  uint16_t keyCode;
708  } key;
709  struct {
710  CGContextRef context;
711  double x;
712  double y;
713  double width;
714  double height;
715  } draw;
716  struct {
717  NPBool hasFocus;
718  } focus;
719  struct {
720  NPNSString *text;
721  } text;
722  } data;
723 } NPCocoaEvent;
724 
725 #ifndef NP_NO_CARBON
726 /* Non-standard event types that can be passed to HandleEvent */
727 enum NPEventType {
728  NPEventType_GetFocusEvent = (osEvt + 16),
729  NPEventType_LoseFocusEvent,
730  NPEventType_AdjustCursorEvent,
731  NPEventType_MenuCommandEvent,
732  NPEventType_ClippingChangedEvent,
733  NPEventType_ScrollingBeginsEvent = 1000,
734  NPEventType_ScrollingEndsEvent
735 };
736 #endif /* NP_NO_CARBON */
737 
738 #endif /* XP_MACOSX */
739 
740 /*
741  * Values for mode passed to NPP_New:
742  */
743 #define NP_EMBED 1
744 #define NP_FULL 2
745 
746 /*
747  * Values for stream type passed to NPP_NewStream:
748  */
749 #define NP_NORMAL 1
750 #define NP_SEEK 2
751 #define NP_ASFILE 3
752 #define NP_ASFILEONLY 4
753 
754 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
755 
756 /*
757  * Flags for NPP_ClearSiteData.
758  */
759 #define NP_CLEAR_ALL 0
760 #define NP_CLEAR_CACHE (1 << 0)
761 
762 #if !defined(__LP64__)
763 #if defined(XP_MACOSX)
764 #pragma options align=reset
765 #endif
766 #endif /* __LP64__ */
767 
768 /*----------------------------------------------------------------------*/
769 /* Error and Reason Code definitions */
770 /*----------------------------------------------------------------------*/
771 
772 /*
773  * Values of type NPError:
774  */
775 #define NPERR_BASE 0
776 #define NPERR_NO_ERROR (NPERR_BASE + 0)
777 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
778 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
779 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
780 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
781 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
782 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
783 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
784 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
785 #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
786 #define NPERR_INVALID_URL (NPERR_BASE + 10)
787 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
788 #define NPERR_NO_DATA (NPERR_BASE + 12)
789 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
790 #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
791 #define NPERR_MALFORMED_SITE (NPERR_BASE + 15)
792 
793 /*
794  * Values of type NPReason:
795  */
796 #define NPRES_BASE 0
797 #define NPRES_DONE (NPRES_BASE + 0)
798 #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
799 #define NPRES_USER_BREAK (NPRES_BASE + 2)
800 
801 /*
802  * Don't use these obsolete error codes any more.
803  */
804 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
805 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
806 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
807 
808 /*
809  * Version feature information
810  */
811 #define NPVERS_HAS_STREAMOUTPUT 8
812 #define NPVERS_HAS_NOTIFICATION 9
813 #define NPVERS_HAS_LIVECONNECT 9
814 #define NPVERS_68K_HAS_LIVECONNECT 11
815 #define NPVERS_HAS_WINDOWLESS 11
816 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
817 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
818 #define NPVERS_HAS_FORM_VALUES 15
819 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16
820 #define NPVERS_HAS_RESPONSE_HEADERS 17
821 #define NPVERS_HAS_NPOBJECT_ENUM 18
822 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
823 #define NPVERS_HAS_ALL_NETWORK_STREAMS 20
824 #define NPVERS_HAS_URL_AND_AUTH_INFO 21
825 #define NPVERS_HAS_PRIVATE_MODE 22
826 #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23
827 #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25
828 #define NPVERS_HAS_URL_REDIRECT_HANDLING 26
829 #define NPVERS_HAS_CLEAR_SITE_DATA 27
830 
831 /*----------------------------------------------------------------------*/
832 /* Function Prototypes */
833 /*----------------------------------------------------------------------*/
834 
835 #if defined(__OS2__)
836 #define NP_LOADDS _System
837 #else
838 #define NP_LOADDS
839 #endif
840 
841 #ifdef __cplusplus
842 extern "C" {
843 #endif
844 
845 /* NPP_* functions are provided by the plugin and called by the navigator. */
846 
847 #if defined(XP_UNIX)
848 const char* NPP_GetMIMEDescription(void);
849 #endif
850 
851 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
852  uint16_t mode, int16_t argc, char* argn[],
853  char* argv[], NPSavedData* saved);
854 NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
855 NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
856 NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
857  NPStream* stream, NPBool seekable,
858  uint16_t* stype);
859 NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
860  NPReason reason);
861 int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
862 int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
863  int32_t len, void* buffer);
864 void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
865  const char* fname);
866 void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
867 int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
868 void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
869  NPReason reason, void* notifyData);
870 NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
871 NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
872 NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
873 void NP_LOADDS NPP_LostFocus(NPP instance);
874 void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
875 NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
876 char** NP_LOADDS NPP_GetSitesWithData(void);
877 void NP_LOADDS NPP_DidComposite(NPP instance);
878 
879 /* NPN_* functions are provided by the navigator and called by the plugin. */
880 void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
881  int* netscape_major, int* netscape_minor);
882 NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
883  const char* target, void* notifyData);
884 NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
885  const char* target);
886 NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
887  const char* target, uint32_t len,
888  const char* buf, NPBool file,
889  void* notifyData);
890 NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
891  const char* target, uint32_t len,
892  const char* buf, NPBool file);
893 NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
894 NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
895  const char* target, NPStream** stream);
896 int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
897  void* buffer);
898 NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
899  NPReason reason);
900 void NP_LOADDS NPN_Status(NPP instance, const char* message);
901 const char* NP_LOADDS NPN_UserAgent(NPP instance);
902 void* NP_LOADDS NPN_MemAlloc(uint32_t size);
903 void NP_LOADDS NPN_MemFree(void* ptr);
904 uint32_t NP_LOADDS NPN_MemFlush(uint32_t size);
905 void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
906 NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
907  void *value);
908 NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
909  void *value);
910 void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
911 void NP_LOADDS NPN_InvalidateRegion(NPP instance,
912  NPRegion invalidRegion);
913 void NP_LOADDS NPN_ForceRedraw(NPP instance);
914 void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
915 void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
916 void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
917  void (*func) (void *),
918  void *userData);
919 NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
920  const char *url, char **value,
921  uint32_t *len);
922 NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
923  const char *url, const char *value,
924  uint32_t len);
925 NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
926  const char *protocol,
927  const char *host, int32_t port,
928  const char *scheme,
929  const char *realm,
930  char **username, uint32_t *ulen,
931  char **password,
932  uint32_t *plen);
933 uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
934 void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
935 NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
936 NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
937 NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
938 NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
939 void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
940 NPError NP_LOADDS NPN_InitAsyncSurface(NPP instance, NPSize *size,
941  NPImageFormat format, void *initData,
942  NPAsyncSurface *surface);
943 NPError NP_LOADDS NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
944 void NP_LOADDS NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
945 
946 #ifdef __cplusplus
947 } /* end extern "C" */
948 #endif
949 
950 #endif /* RC_INVOKED */
951 #if defined(__OS2__)
952 #pragma pack()
953 #endif
954 
955 #endif /* npapi_h_ */
int32_t NPP_WriteReady(NPP instance, NPStream *stream)
URL file data ready.
Definition: plugin.c:609
Definition: npapi.h:178
int16_t NPP_HandleEvent(NPP instance, void *event)
Handle Event.
Definition: plugin.c:717
Definition: npapi.h:516
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
Get Value.
Definition: plugin.c:812
Definition: npapi.h:556
void NPP_Print(NPP instance, NPPrint *platformPrint)
print.
Definition: plugin.c:706
Definition: npapi.h:186
Definition: npapi.h:562
Definition: npapi.h:548
NPError NPP_Destroy(NPP instance, NPSavedData **save)
Destroy plugin.
Definition: plugin.c:430
NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16_t *stype)
new stream.
Definition: plugin.c:540
NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
Destroy Stream.
Definition: plugin.c:581
Definition: npapi.h:227
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved)
Creates a new instance of a plug-in.
Definition: plugin.c:294
Definition: npapi.h:249
NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
Set Value.
Definition: plugin.c:872
Definition: npapi.h:213
Definition: npapi.h:206
int32_t NPP_Write(NPP instance, NPStream *stream, int32_t offset, int32_t len, void *buffer)
URL file data received.
Definition: plugin.c:626
Definition: npapi.h:532
void NPP_URLNotify(NPP instance, const char *URL, NPReason reason, void *notifyData)
URL Notify.
Definition: plugin.c:781
NPError NPP_SetWindow(NPP instance, NPWindow *window)
Set window.
Definition: plugin.c:497
void NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname)
Stream as file.
Definition: plugin.c:672
Definition: npapi.h:219