ffmpeg-6: fix COMPONENT_REVISION
[oi-userland.git] / components / web / icedtea-web / files / npapi.h
blob562a910c79b795082cd4ea35246c2c6e3a15100f
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
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/
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.
15 * The Original Code is mozilla.org code.
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.
22 * Contributor(s):
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.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef npapi_h_
39 #define npapi_h_
41 #if defined(__OS2__)
42 #pragma pack(1)
43 #endif
45 #include "nptypes.h"
47 #if defined(__OS2__) || defined(OS2)
48 #ifndef XP_OS2
49 #define XP_OS2 1
50 #endif
51 #endif
53 #if defined(_WIN32) && !defined(__SYMBIAN32__)
54 #include <windef.h>
55 #ifndef XP_WIN
56 #define XP_WIN 1
57 #endif
58 #endif
60 #if defined(__SYMBIAN32__)
61 #ifndef XP_SYMBIAN
62 #define XP_SYMBIAN 1
63 #undef XP_WIN
64 #endif
65 #endif
67 #if defined(__APPLE_CC__) && !defined(XP_UNIX)
68 #ifndef XP_MACOSX
69 #define XP_MACOSX 1
70 #endif
71 #endif
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
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
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
101 #if defined(XP_SYMBIAN)
102 #include <QEvent>
103 #include <QRegion>
104 #endif
106 /*----------------------------------------------------------------------*/
107 /* Plugin Version Constants */
108 /*----------------------------------------------------------------------*/
110 #define NP_VERSION_MAJOR 0
111 #define NP_VERSION_MINOR 29
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.
120 AN EXAMPLE:
122 RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
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" }
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" }
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
154 #ifndef RC_INVOKED
156 /*----------------------------------------------------------------------*/
157 /* Definition of Basic Types */
158 /*----------------------------------------------------------------------*/
160 typedef unsigned char NPBool;
161 typedef int16_t NPError;
162 typedef int16_t NPReason;
163 typedef char* NPMIMEType;
165 /*----------------------------------------------------------------------*/
166 /* Structures and definitions */
167 /*----------------------------------------------------------------------*/
169 #if !defined(__LP64__)
170 #if defined(XP_MACOSX)
171 #pragma options align=mac68k
172 #endif
173 #endif /* __LP64__ */
176 * NPP is a plug-in's opaque instance handle
178 typedef struct _NPP
180 void* pdata; /* plug-in private data */
181 void* ndata; /* netscape private data */
182 } NPP_t;
184 typedef NPP_t* NPP;
186 typedef struct _NPStream
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;
206 typedef struct _NPByteRange
208 int32_t offset; /* negative offset means from the end */
209 uint32_t length;
210 struct _NPByteRange* next;
211 } NPByteRange;
213 typedef struct _NPSavedData
215 int32_t len;
216 void* buf;
217 } NPSavedData;
219 typedef struct _NPRect
221 uint16_t top;
222 uint16_t left;
223 uint16_t bottom;
224 uint16_t right;
225 } NPRect;
227 typedef struct _NPSize
229 int32_t width;
230 int32_t height;
231 } NPSize;
233 typedef enum {
234 NPFocusNext = 0,
235 NPFocusPrevious = 1
236 } NPFocusDirection;
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;
249 typedef struct _NPAsyncSurface
251 uint32_t version; /* Always 0 */
252 NPSize size; /* Surface size */
253 NPImageFormat format; /* Image format */
254 union {
255 struct {
256 uint32_t stride; /* Image stride */
257 void *data; /* Bitmap buffer, length is stride * size.height bytes */
258 } bitmap;
259 #if defined(XP_WIN)
260 HANDLE sharedHandle; /* DXGI 1.1 resource handle */
261 #endif
263 } NPAsyncSurface;
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
271 #if defined(XP_UNIX)
273 * Unix specific structures and definitions
277 * Callback Structures.
279 * These are used to pass additional platform specific information.
281 enum {
282 NP_SETWINDOW = 1,
283 NP_PRINT
286 typedef struct
288 int32_t type;
289 } NPAnyCallbackStruct;
291 typedef struct
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;
302 typedef struct
304 int32_t type;
305 FILE* fp;
306 } NPPrintCallbackStruct;
308 #endif /* XP_UNIX */
310 typedef enum {
311 NPDrawingModelDUMMY
312 #if defined(XP_MACOSX)
313 #ifndef NP_NO_QUICKDRAW
314 , NPDrawingModelQuickDraw = 0
315 #endif
316 , NPDrawingModelCoreGraphics = 1
317 , NPDrawingModelOpenGL = 2
318 , NPDrawingModelCoreAnimation = 3
319 , NPDrawingModelInvalidatingCoreAnimation = 4
320 #endif
321 #if defined(XP_WIN)
322 , NPDrawingModelSyncWin = 5
323 #endif
324 #if defined(MOZ_X11)
325 , NPDrawingModelSyncX = 6
326 #endif
327 , NPDrawingModelAsyncBitmapSurface = 7
328 #if defined(XP_WIN)
329 , NPDrawingModelAsyncWindowsDXGISurface = 8
330 #endif
331 } NPDrawingModel;
333 #ifdef XP_MACOSX
334 typedef enum {
335 #ifndef NP_NO_CARBON
336 NPEventModelCarbon = 0,
337 #endif
338 NPEventModelCocoa = 1
339 } NPEventModel;
340 #endif
343 * The following masks are applied on certain platforms to NPNV and
344 * NPPV selectors that pass around pointers to COM interfaces. Newer
345 * compilers on some platforms may generate vtables that are not
346 * compatible with older compilers. To prevent older plugins from
347 * not understanding a new browser's ABI, these masks change the
348 * values of those selectors on those platforms. To remain backwards
349 * compatible with different versions of the browser, plugins can
350 * use these masks to dynamically determine and use the correct C++
351 * ABI that the browser is expecting. This does not apply to Windows
352 * as Microsoft's COM ABI will likely not change.
355 #define NP_ABI_GCC3_MASK 0x10000000
357 * gcc 3.x generated vtables on UNIX and OSX are incompatible with
358 * previous compilers.
360 #if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
361 #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
362 #else
363 #define _NP_ABI_MIXIN_FOR_GCC3 0
364 #endif
366 #if defined(XP_MACOSX)
367 #define NP_ABI_MACHO_MASK 0x01000000
368 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
369 #else
370 #define _NP_ABI_MIXIN_FOR_MACHO 0
371 #endif
373 #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
376 * List of variable names for which NPP_GetValue shall be implemented
378 typedef enum {
379 NPPVpluginNameString = 1,
380 NPPVpluginDescriptionString,
381 NPPVpluginWindowBool,
382 NPPVpluginTransparentBool,
383 NPPVjavaClass,
384 NPPVpluginWindowSize,
385 NPPVpluginTimerInterval,
386 NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
387 NPPVpluginScriptableIID = 11,
388 NPPVjavascriptPushCallerBool = 12,
389 NPPVpluginKeepLibraryInMemory = 13,
390 NPPVpluginNeedsXEmbed = 14,
392 /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14.
394 NPPVpluginScriptableNPObject = 15,
396 /* Get the plugin value (as \0-terminated UTF-8 string data) for
397 * form submission if the plugin is part of a form. Use
398 * NPN_MemAlloc() to allocate memory for the string data. Introduced
399 * in NPAPI minor version 15.
401 NPPVformValue = 16,
403 NPPVpluginUrlRequestsDisplayedBool = 17,
405 /* Checks if the plugin is interested in receiving the http body of
406 * all http requests (including failed ones, http status != 200).
408 NPPVpluginWantsAllNetworkStreams = 18,
410 /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
411 NPPVpluginNativeAccessibleAtkPlugId = 19,
413 /* Checks to see if the plug-in would like the browser to load the "src" attribute. */
414 NPPVpluginCancelSrcStream = 20,
416 NPPVsupportsAdvancedKeyHandling = 21,
418 NPPVpluginUsesDOMForCursorBool = 22,
420 /* Used for negotiating drawing models */
421 NPPVpluginDrawingModel = 1000
422 #if defined(XP_MACOSX)
423 /* Used for negotiating event models */
424 , NPPVpluginEventModel = 1001
425 /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
426 , NPPVpluginCoreAnimationLayer = 1003
427 #endif
429 #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
430 , NPPVpluginWindowlessLocalBool = 2002
431 #endif
433 /* Notification that the plugin just started or stopped playing audio */
434 , NPPVpluginIsPlayingAudio = 4000
435 } NPPVariable;
438 * List of variable names for which NPN_GetValue should be implemented.
440 typedef enum {
441 NPNVxDisplay = 1,
442 NPNVxtAppContext,
443 NPNVnetscapeWindow,
444 NPNVjavascriptEnabledBool,
445 NPNVasdEnabledBool,
446 NPNVisOfflineBool,
448 NPNVserviceManager = (10 | NP_ABI_MASK),
449 NPNVDOMElement = (11 | NP_ABI_MASK),
450 NPNVDOMWindow = (12 | NP_ABI_MASK),
451 NPNVToolkit = (13 | NP_ABI_MASK),
452 NPNVSupportsXEmbedBool = 14,
454 /* Get the NPObject wrapper for the browser window. */
455 NPNVWindowNPObject = 15,
457 /* Get the NPObject wrapper for the plugins DOM element. */
458 NPNVPluginElementNPObject = 16,
460 NPNVSupportsWindowless = 17,
462 NPNVprivateModeBool = 18,
464 NPNVsupportsAdvancedKeyHandling = 21,
466 NPNVdocumentOrigin = 22,
468 NPNVCSSZoomFactor = 23,
470 NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */
471 #if defined(XP_MACOSX)
472 , NPNVcontentsScaleFactor = 1001
473 #ifndef NP_NO_QUICKDRAW
474 , NPNVsupportsQuickDrawBool = 2000
475 #endif
476 , NPNVsupportsCoreGraphicsBool = 2001
477 , NPNVsupportsOpenGLBool = 2002
478 , NPNVsupportsCoreAnimationBool = 2003
479 , NPNVsupportsInvalidatingCoreAnimationBool = 2004
480 #endif
481 , NPNVsupportsAsyncBitmapSurfaceBool = 2007
482 #if defined(XP_WIN)
483 , NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008
484 , NPNVpreferredDXGIAdapter = 2009 /* On success, returns a DXGI_ADAPTER_DESC by value. This
485 is the adapter that should be used for creating a device
486 when using an async DXGI surface provided by the browser.
487 Consumers should use this in conjunction with
488 IDXGIFactory1::EnumAdapters1 and match the AdapterLuid
489 portion of the descriptor. */
490 #endif
491 #if defined(XP_MACOSX)
492 #ifndef NP_NO_CARBON
493 , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
494 #endif
495 , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
496 , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
497 Cocoa text input specification. */
498 #endif
499 , NPNVmuteAudioBool = 4000 /* Request that the browser wants to mute or unmute the plugin */
500 #if defined(XP_MACOSX)
501 , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
502 CA model compositing */
503 #endif
504 #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
505 , NPNVSupportsWindowlessLocal = 2002
506 #endif
507 } NPNVariable;
509 typedef enum {
510 NPNURLVCookie = 501,
511 NPNURLVProxy
512 } NPNURLVariable;
515 * The type of Toolkit the widgets use
517 typedef enum {
518 NPNVGtk12 = 1,
519 NPNVGtk2
520 } NPNToolkitType;
523 * The type of a NPWindow - it specifies the type of the data structure
524 * returned in the window field.
526 typedef enum {
527 NPWindowTypeWindow = 1,
528 NPWindowTypeDrawable
529 } NPWindowType;
531 typedef struct _NPWindow
533 void* window; /* Platform specific window handle */
534 /* OS/2: x - Position of bottom left corner */
535 /* OS/2: y - relative to visible netscape window */
536 int32_t x; /* Position of top left corner relative */
537 int32_t y; /* to a netscape page. */
538 uint32_t width; /* Maximum window size */
539 uint32_t height;
540 NPRect clipRect; /* Clipping rectangle in port coordinates */
541 #if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
542 void * ws_info; /* Platform-dependent additional data */
543 #endif /* XP_UNIX */
544 NPWindowType type; /* Is this a window or a drawable? */
545 } NPWindow;
547 typedef struct _NPImageExpose
549 char* data; /* image pointer */
550 int32_t stride; /* Stride of data image pointer */
551 int32_t depth; /* Depth of image pointer */
552 int32_t x; /* Expose x */
553 int32_t y; /* Expose y */
554 uint32_t width; /* Expose width */
555 uint32_t height; /* Expose height */
556 NPSize dataSize; /* Data buffer size */
557 float translateX; /* translate X matrix value */
558 float translateY; /* translate Y matrix value */
559 float scaleX; /* scale X matrix value */
560 float scaleY; /* scale Y matrix value */
561 } NPImageExpose;
563 typedef struct _NPFullPrint
565 NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
566 NPBool printOne; /* TRUE if plugin should print one copy to default
567 printer */
568 void* platformPrint; /* Platform-specific printing info */
569 } NPFullPrint;
571 typedef struct _NPEmbedPrint
573 NPWindow window;
574 void* platformPrint; /* Platform-specific printing info */
575 } NPEmbedPrint;
577 typedef struct _NPPrint
579 uint16_t mode; /* NP_FULL or NP_EMBED */
580 union
582 NPFullPrint fullPrint; /* if mode is NP_FULL */
583 NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
584 } print;
585 } NPPrint;
587 #if defined(XP_MACOSX)
588 #ifndef NP_NO_CARBON
589 typedef EventRecord NPEvent;
590 #endif
591 #elif defined(XP_SYMBIAN)
592 typedef QEvent NPEvent;
593 #elif defined(XP_WIN)
594 typedef struct _NPEvent
596 uint16_t event;
597 uintptr_t wParam;
598 uintptr_t lParam;
599 } NPEvent;
600 #elif defined(XP_OS2)
601 typedef struct _NPEvent
603 uint32_t event;
604 uint32_t wParam;
605 uint32_t lParam;
606 } NPEvent;
607 #elif defined(XP_UNIX) && defined(MOZ_X11)
608 typedef XEvent NPEvent;
609 #else
610 typedef void* NPEvent;
611 #endif
613 #if defined(XP_MACOSX)
614 typedef void* NPRegion;
615 #ifndef NP_NO_QUICKDRAW
616 typedef RgnHandle NPQDRegion;
617 #endif
618 typedef CGPathRef NPCGRegion;
619 #elif defined(XP_WIN)
620 typedef HRGN NPRegion;
621 #elif defined(XP_UNIX) && defined(MOZ_X11)
622 typedef Region NPRegion;
623 #elif defined(XP_SYMBIAN)
624 typedef QRegion* NPRegion;
625 #else
626 typedef void *NPRegion;
627 #endif
629 typedef struct _NPNSString NPNSString;
630 typedef struct _NPNSWindow NPNSWindow;
631 typedef struct _NPNSMenu NPNSMenu;
633 #if defined(XP_MACOSX)
634 typedef NPNSMenu NPMenu;
635 #else
636 typedef void *NPMenu;
637 #endif
639 typedef enum {
640 NPCoordinateSpacePlugin = 1,
641 NPCoordinateSpaceWindow,
642 NPCoordinateSpaceFlippedWindow,
643 NPCoordinateSpaceScreen,
644 NPCoordinateSpaceFlippedScreen
645 } NPCoordinateSpace;
647 #if defined(XP_MACOSX)
649 #ifndef NP_NO_QUICKDRAW
650 typedef struct NP_Port
652 CGrafPtr port;
653 int32_t portx; /* position inside the topmost window */
654 int32_t porty;
655 } NP_Port;
656 #endif /* NP_NO_QUICKDRAW */
659 * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
660 * as its drawing model.
663 typedef struct NP_CGContext
665 CGContextRef context;
666 void *window; /* A WindowRef under the Carbon event model. */
667 } NP_CGContext;
670 * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
671 * drawing model.
674 #if !NP_NO_OPENGL
675 typedef struct NP_GLContext
677 CGLContextObj context;
678 #ifdef NP_NO_CARBON
679 NPNSWindow *window;
680 #else
681 void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
682 #endif
683 } NP_GLContext;
684 #endif /* !NP_NO_OPENGL */
686 typedef enum {
687 NPCocoaEventDrawRect = 1,
688 NPCocoaEventMouseDown,
689 NPCocoaEventMouseUp,
690 NPCocoaEventMouseMoved,
691 NPCocoaEventMouseEntered,
692 NPCocoaEventMouseExited,
693 NPCocoaEventMouseDragged,
694 NPCocoaEventKeyDown,
695 NPCocoaEventKeyUp,
696 NPCocoaEventFlagsChanged,
697 NPCocoaEventFocusChanged,
698 NPCocoaEventWindowFocusChanged,
699 NPCocoaEventScrollWheel,
700 NPCocoaEventTextInput
701 } NPCocoaEventType;
703 typedef struct _NPCocoaEvent {
704 NPCocoaEventType type;
705 uint32_t version;
706 union {
707 struct {
708 uint32_t modifierFlags;
709 double pluginX;
710 double pluginY;
711 int32_t buttonNumber;
712 int32_t clickCount;
713 double deltaX;
714 double deltaY;
715 double deltaZ;
716 } mouse;
717 struct {
718 uint32_t modifierFlags;
719 NPNSString *characters;
720 NPNSString *charactersIgnoringModifiers;
721 NPBool isARepeat;
722 uint16_t keyCode;
723 } key;
724 struct {
725 CGContextRef context;
726 double x;
727 double y;
728 double width;
729 double height;
730 } draw;
731 struct {
732 NPBool hasFocus;
733 } focus;
734 struct {
735 NPNSString *text;
736 } text;
737 } data;
738 } NPCocoaEvent;
740 #ifndef NP_NO_CARBON
741 /* Non-standard event types that can be passed to HandleEvent */
742 enum NPEventType {
743 NPEventType_GetFocusEvent = (osEvt + 16),
744 NPEventType_LoseFocusEvent,
745 NPEventType_AdjustCursorEvent,
746 NPEventType_MenuCommandEvent,
747 NPEventType_ClippingChangedEvent,
748 NPEventType_ScrollingBeginsEvent = 1000,
749 NPEventType_ScrollingEndsEvent
751 #endif /* NP_NO_CARBON */
753 #endif /* XP_MACOSX */
756 * Values for mode passed to NPP_New:
758 #define NP_EMBED 1
759 #define NP_FULL 2
762 * Values for stream type passed to NPP_NewStream:
764 #define NP_NORMAL 1
765 #define NP_SEEK 2
766 #define NP_ASFILE 3
767 #define NP_ASFILEONLY 4
769 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
772 * Flags for NPP_ClearSiteData.
774 #define NP_CLEAR_ALL 0
775 #define NP_CLEAR_CACHE (1 << 0)
777 #if !defined(__LP64__)
778 #if defined(XP_MACOSX)
779 #pragma options align=reset
780 #endif
781 #endif /* __LP64__ */
783 /*----------------------------------------------------------------------*/
784 /* Error and Reason Code definitions */
785 /*----------------------------------------------------------------------*/
788 * Values of type NPError:
790 #define NPERR_BASE 0
791 #define NPERR_NO_ERROR (NPERR_BASE + 0)
792 #define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
793 #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
794 #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
795 #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
796 #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
797 #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
798 #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
799 #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
800 #define NPERR_INVALID_PARAM (NPERR_BASE + 9)
801 #define NPERR_INVALID_URL (NPERR_BASE + 10)
802 #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
803 #define NPERR_NO_DATA (NPERR_BASE + 12)
804 #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
805 #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
806 #define NPERR_MALFORMED_SITE (NPERR_BASE + 15)
809 * Values of type NPReason:
811 #define NPRES_BASE 0
812 #define NPRES_DONE (NPRES_BASE + 0)
813 #define NPRES_NETWORK_ERR (NPRES_BASE + 1)
814 #define NPRES_USER_BREAK (NPRES_BASE + 2)
817 * Don't use these obsolete error codes any more.
819 #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
820 #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
821 #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
824 * Version feature information
826 #define NPVERS_HAS_STREAMOUTPUT 8
827 #define NPVERS_HAS_NOTIFICATION 9
828 #define NPVERS_HAS_LIVECONNECT 9
829 #define NPVERS_68K_HAS_LIVECONNECT 11
830 #define NPVERS_HAS_WINDOWLESS 11
831 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
832 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
833 #define NPVERS_HAS_FORM_VALUES 15
834 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16
835 #define NPVERS_HAS_RESPONSE_HEADERS 17
836 #define NPVERS_HAS_NPOBJECT_ENUM 18
837 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
838 #define NPVERS_HAS_ALL_NETWORK_STREAMS 20
839 #define NPVERS_HAS_URL_AND_AUTH_INFO 21
840 #define NPVERS_HAS_PRIVATE_MODE 22
841 #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23
842 #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25
843 #define NPVERS_HAS_URL_REDIRECT_HANDLING 26
844 #define NPVERS_HAS_CLEAR_SITE_DATA 27
846 /*----------------------------------------------------------------------*/
847 /* Function Prototypes */
848 /*----------------------------------------------------------------------*/
850 #if defined(__OS2__)
851 #define NP_LOADDS _System
852 #else
853 #define NP_LOADDS
854 #endif
856 #ifdef __cplusplus
857 extern "C" {
858 #endif
860 /* NPP_* functions are provided by the plugin and called by the navigator. */
862 #if defined(XP_UNIX)
863 const char* NPP_GetMIMEDescription(void);
864 #endif
866 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
867 uint16_t mode, int16_t argc, char* argn[],
868 char* argv[], NPSavedData* saved);
869 NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
870 NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
871 NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
872 NPStream* stream, NPBool seekable,
873 uint16_t* stype);
874 NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
875 NPReason reason);
876 int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
877 int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
878 int32_t len, void* buffer);
879 void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
880 const char* fname);
881 void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
882 int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
883 void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
884 NPReason reason, void* notifyData);
885 NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
886 NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
887 NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
888 void NP_LOADDS NPP_LostFocus(NPP instance);
889 void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
890 NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
891 char** NP_LOADDS NPP_GetSitesWithData(void);
892 void NP_LOADDS NPP_DidComposite(NPP instance);
894 /* NPN_* functions are provided by the navigator and called by the plugin. */
895 void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
896 int* netscape_major, int* netscape_minor);
897 NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
898 const char* target, void* notifyData);
899 NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
900 const char* target);
901 NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
902 const char* target, uint32_t len,
903 const char* buf, NPBool file,
904 void* notifyData);
905 NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
906 const char* target, uint32_t len,
907 const char* buf, NPBool file);
908 NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
909 NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
910 const char* target, NPStream** stream);
911 int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
912 void* buffer);
913 NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
914 NPReason reason);
915 void NP_LOADDS NPN_Status(NPP instance, const char* message);
916 const char* NP_LOADDS NPN_UserAgent(NPP instance);
917 void* NP_LOADDS NPN_MemAlloc(uint32_t size);
918 void NP_LOADDS NPN_MemFree(void* ptr);
919 uint32_t NP_LOADDS NPN_MemFlush(uint32_t size);
920 void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
921 NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
922 void *value);
923 NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
924 void *value);
925 void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
926 void NP_LOADDS NPN_InvalidateRegion(NPP instance,
927 NPRegion invalidRegion);
928 void NP_LOADDS NPN_ForceRedraw(NPP instance);
929 void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
930 void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
931 void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
932 void (*func) (void *),
933 void *userData);
934 NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
935 const char *url, char **value,
936 uint32_t *len);
937 NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
938 const char *url, const char *value,
939 uint32_t len);
940 NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
941 const char *protocol,
942 const char *host, int32_t port,
943 const char *scheme,
944 const char *realm,
945 char **username, uint32_t *ulen,
946 char **password,
947 uint32_t *plen);
948 uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
949 void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
950 NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
951 NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
952 NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
953 NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
954 void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
955 NPError NP_LOADDS NPN_InitAsyncSurface(NPP instance, NPSize *size,
956 NPImageFormat format, void *initData,
957 NPAsyncSurface *surface);
958 NPError NP_LOADDS NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
959 void NP_LOADDS NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
961 #ifdef __cplusplus
962 } /* end extern "C" */
963 #endif
965 #endif /* RC_INVOKED */
966 #if defined(__OS2__)
967 #pragma pack()
968 #endif
970 #endif /* npapi_h_ */