michael@0: /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef npapi_h_ michael@0: #define npapi_h_ michael@0: michael@0: #include "nptypes.h" michael@0: michael@0: #if defined(_WIN32) && !defined(__SYMBIAN32__) michael@0: #include michael@0: #ifndef XP_WIN michael@0: #define XP_WIN 1 michael@0: #endif michael@0: #endif michael@0: michael@0: #if defined(__SYMBIAN32__) michael@0: #ifndef XP_SYMBIAN michael@0: #define XP_SYMBIAN 1 michael@0: #undef XP_WIN michael@0: #endif michael@0: #endif michael@0: michael@0: #if defined(__APPLE_CC__) && !defined(XP_UNIX) michael@0: #ifndef XP_MACOSX michael@0: #define XP_MACOSX 1 michael@0: #endif michael@0: #endif michael@0: michael@0: #if defined(XP_MACOSX) && defined(__LP64__) michael@0: #define NP_NO_QUICKDRAW michael@0: #define NP_NO_CARBON michael@0: #endif michael@0: michael@0: #if defined(XP_MACOSX) michael@0: #include michael@0: #include michael@0: #ifndef NP_NO_CARBON michael@0: #include michael@0: #endif michael@0: #endif michael@0: michael@0: #if defined(XP_UNIX) michael@0: #include michael@0: #if defined(MOZ_X11) michael@0: #include michael@0: #include michael@0: #endif michael@0: #endif michael@0: michael@0: #if defined(XP_SYMBIAN) michael@0: #include michael@0: #include michael@0: #endif michael@0: michael@0: /*----------------------------------------------------------------------*/ michael@0: /* Plugin Version Constants */ michael@0: /*----------------------------------------------------------------------*/ michael@0: michael@0: #define NP_VERSION_MAJOR 0 michael@0: #define NP_VERSION_MINOR 27 michael@0: michael@0: michael@0: /* The OS/2 version of Netscape uses RC_DATA to define the michael@0: mime types, file extensions, etc that are required. michael@0: Use a vertical bar to separate types, end types with \0. michael@0: FileVersion and ProductVersion are 32bit ints, all other michael@0: entries are strings that MUST be terminated with a \0. michael@0: michael@0: AN EXAMPLE: michael@0: michael@0: RCDATA NP_INFO_ProductVersion { 1,0,0,1,} michael@0: michael@0: RCDATA NP_INFO_MIMEType { "video/x-video|", michael@0: "video/x-flick\0" } michael@0: RCDATA NP_INFO_FileExtents { "avi|", michael@0: "flc\0" } michael@0: RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", michael@0: "MMOS2 Flc/Fli player(*.flc)\0" } michael@0: michael@0: RCDATA NP_INFO_FileVersion { 1,0,0,1 } michael@0: RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } michael@0: RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" michael@0: RCDATA NP_INFO_InternalName { "NPAVI32\0" ) michael@0: RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" michael@0: RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } michael@0: RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } michael@0: */ michael@0: /* RC_DATA types for version info - required */ michael@0: #define NP_INFO_ProductVersion 1 michael@0: #define NP_INFO_MIMEType 2 michael@0: #define NP_INFO_FileOpenName 3 michael@0: #define NP_INFO_FileExtents 4 michael@0: /* RC_DATA types for version info - used if found */ michael@0: #define NP_INFO_FileDescription 5 michael@0: #define NP_INFO_ProductName 6 michael@0: /* RC_DATA types for version info - optional */ michael@0: #define NP_INFO_CompanyName 7 michael@0: #define NP_INFO_FileVersion 8 michael@0: #define NP_INFO_InternalName 9 michael@0: #define NP_INFO_LegalCopyright 10 michael@0: #define NP_INFO_OriginalFilename 11 michael@0: michael@0: #ifndef RC_INVOKED michael@0: michael@0: /*----------------------------------------------------------------------*/ michael@0: /* Definition of Basic Types */ michael@0: /*----------------------------------------------------------------------*/ michael@0: michael@0: typedef unsigned char NPBool; michael@0: typedef int16_t NPError; michael@0: typedef int16_t NPReason; michael@0: typedef char* NPMIMEType; michael@0: michael@0: /*----------------------------------------------------------------------*/ michael@0: /* Structures and definitions */ michael@0: /*----------------------------------------------------------------------*/ michael@0: michael@0: #if !defined(__LP64__) michael@0: #if defined(XP_MACOSX) michael@0: #pragma options align=mac68k michael@0: #endif michael@0: #endif /* __LP64__ */ michael@0: michael@0: /* michael@0: * NPP is a plug-in's opaque instance handle michael@0: */ michael@0: typedef struct _NPP michael@0: { michael@0: void* pdata; /* plug-in private data */ michael@0: void* ndata; /* netscape private data */ michael@0: } NPP_t; michael@0: michael@0: typedef NPP_t* NPP; michael@0: michael@0: typedef struct _NPStream michael@0: { michael@0: void* pdata; /* plug-in private data */ michael@0: void* ndata; /* netscape private data */ michael@0: const char* url; michael@0: uint32_t end; michael@0: uint32_t lastmodified; michael@0: void* notifyData; michael@0: const char* headers; /* Response headers from host. michael@0: * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. michael@0: * Used for HTTP only; nullptr for non-HTTP. michael@0: * Available from NPP_NewStream onwards. michael@0: * Plugin should copy this data before storing it. michael@0: * Includes HTTP status line and all headers, michael@0: * preferably verbatim as received from server, michael@0: * headers formatted as in HTTP ("Header: Value"), michael@0: * and newlines (\n, NOT \r\n) separating lines. michael@0: * Terminated by \n\0 (NOT \n\n\0). */ michael@0: } NPStream; michael@0: michael@0: typedef struct _NPByteRange michael@0: { michael@0: int32_t offset; /* negative offset means from the end */ michael@0: uint32_t length; michael@0: struct _NPByteRange* next; michael@0: } NPByteRange; michael@0: michael@0: typedef struct _NPSavedData michael@0: { michael@0: int32_t len; michael@0: void* buf; michael@0: } NPSavedData; michael@0: michael@0: typedef struct _NPRect michael@0: { michael@0: uint16_t top; michael@0: uint16_t left; michael@0: uint16_t bottom; michael@0: uint16_t right; michael@0: } NPRect; michael@0: michael@0: typedef struct _NPSize michael@0: { michael@0: int32_t width; michael@0: int32_t height; michael@0: } NPSize; michael@0: michael@0: typedef enum { michael@0: NPFocusNext = 0, michael@0: NPFocusPrevious = 1 michael@0: } NPFocusDirection; michael@0: michael@0: /* These formats describe the format in the memory byte-order. This means if michael@0: * a 32-bit value of a pixel is viewed on a little-endian system the layout will michael@0: * be 0xAARRGGBB. The Alpha channel will be stored in the most significant michael@0: * bits. */ michael@0: typedef enum { michael@0: /* 32-bit per pixel 8-bit per channel - premultiplied alpha */ michael@0: NPImageFormatBGRA32 = 0x1, michael@0: /* 32-bit per pixel 8-bit per channel - 1 unused channel */ michael@0: NPImageFormatBGRX32 = 0x2 michael@0: } NPImageFormat; michael@0: michael@0: typedef struct _NPAsyncSurface michael@0: { michael@0: uint32_t version; michael@0: NPSize size; michael@0: NPImageFormat format; michael@0: union { michael@0: struct { michael@0: uint32_t stride; michael@0: void *data; michael@0: } bitmap; michael@0: #if defined(XP_WIN) michael@0: HANDLE sharedHandle; michael@0: #endif michael@0: }; michael@0: } NPAsyncSurface; michael@0: michael@0: /* Return values for NPP_HandleEvent */ michael@0: #define kNPEventNotHandled 0 michael@0: #define kNPEventHandled 1 michael@0: /* Exact meaning must be spec'd in event model. */ michael@0: #define kNPEventStartIME 2 michael@0: michael@0: #if defined(XP_UNIX) michael@0: /* michael@0: * Unix specific structures and definitions michael@0: */ michael@0: michael@0: /* michael@0: * Callback Structures. michael@0: * michael@0: * These are used to pass additional platform specific information. michael@0: */ michael@0: enum { michael@0: NP_SETWINDOW = 1, michael@0: NP_PRINT michael@0: }; michael@0: michael@0: typedef struct michael@0: { michael@0: int32_t type; michael@0: } NPAnyCallbackStruct; michael@0: michael@0: typedef struct michael@0: { michael@0: int32_t type; michael@0: #if defined(MOZ_X11) michael@0: Display* display; michael@0: Visual* visual; michael@0: Colormap colormap; michael@0: unsigned int depth; michael@0: #endif michael@0: } NPSetWindowCallbackStruct; michael@0: michael@0: typedef struct michael@0: { michael@0: int32_t type; michael@0: FILE* fp; michael@0: } NPPrintCallbackStruct; michael@0: michael@0: #endif /* XP_UNIX */ michael@0: michael@0: typedef enum { michael@0: #if defined(XP_MACOSX) michael@0: #ifndef NP_NO_QUICKDRAW michael@0: NPDrawingModelQuickDraw = 0, michael@0: #endif michael@0: NPDrawingModelCoreGraphics = 1, michael@0: NPDrawingModelOpenGL = 2, michael@0: NPDrawingModelCoreAnimation = 3, michael@0: NPDrawingModelInvalidatingCoreAnimation = 4, michael@0: #endif michael@0: #if defined(XP_WIN) michael@0: NPDrawingModelSyncWin = 5, michael@0: #endif michael@0: #if defined(MOZ_X11) michael@0: NPDrawingModelSyncX = 6, michael@0: #endif michael@0: NPDrawingModelAsyncBitmapSurface = 7 michael@0: #if defined(XP_WIN) michael@0: , NPDrawingModelAsyncWindowsDXGISurface = 8 michael@0: #endif michael@0: } NPDrawingModel; michael@0: michael@0: #ifdef XP_MACOSX michael@0: typedef enum { michael@0: #ifndef NP_NO_CARBON michael@0: NPEventModelCarbon = 0, michael@0: #endif michael@0: NPEventModelCocoa = 1 michael@0: } NPEventModel; michael@0: #endif michael@0: michael@0: /* michael@0: * The following masks are applied on certain platforms to NPNV and michael@0: * NPPV selectors that pass around pointers to COM interfaces. Newer michael@0: * compilers on some platforms may generate vtables that are not michael@0: * compatible with older compilers. To prevent older plugins from michael@0: * not understanding a new browser's ABI, these masks change the michael@0: * values of those selectors on those platforms. To remain backwards michael@0: * compatible with different versions of the browser, plugins can michael@0: * use these masks to dynamically determine and use the correct C++ michael@0: * ABI that the browser is expecting. This does not apply to Windows michael@0: * as Microsoft's COM ABI will likely not change. michael@0: */ michael@0: michael@0: #define NP_ABI_GCC3_MASK 0x10000000 michael@0: /* michael@0: * gcc 3.x generated vtables on UNIX and OSX are incompatible with michael@0: * previous compilers. michael@0: */ michael@0: #if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) michael@0: #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK michael@0: #else michael@0: #define _NP_ABI_MIXIN_FOR_GCC3 0 michael@0: #endif michael@0: michael@0: #if defined(XP_MACOSX) michael@0: #define NP_ABI_MACHO_MASK 0x01000000 michael@0: #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK michael@0: #else michael@0: #define _NP_ABI_MIXIN_FOR_MACHO 0 michael@0: #endif michael@0: michael@0: #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) michael@0: michael@0: /* michael@0: * List of variable names for which NPP_GetValue shall be implemented michael@0: */ michael@0: typedef enum { michael@0: NPPVpluginNameString = 1, michael@0: NPPVpluginDescriptionString, michael@0: NPPVpluginWindowBool, michael@0: NPPVpluginTransparentBool, michael@0: NPPVjavaClass, michael@0: NPPVpluginWindowSize, michael@0: NPPVpluginTimerInterval, michael@0: NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), michael@0: NPPVpluginScriptableIID = 11, michael@0: NPPVjavascriptPushCallerBool = 12, michael@0: NPPVpluginKeepLibraryInMemory = 13, michael@0: NPPVpluginNeedsXEmbed = 14, michael@0: michael@0: /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14. michael@0: */ michael@0: NPPVpluginScriptableNPObject = 15, michael@0: michael@0: /* Get the plugin value (as \0-terminated UTF-8 string data) for michael@0: * form submission if the plugin is part of a form. Use michael@0: * NPN_MemAlloc() to allocate memory for the string data. Introduced michael@0: * in NPAPI minor version 15. michael@0: */ michael@0: NPPVformValue = 16, michael@0: michael@0: NPPVpluginUrlRequestsDisplayedBool = 17, michael@0: michael@0: /* Checks if the plugin is interested in receiving the http body of michael@0: * all http requests (including failed ones, http status != 200). michael@0: */ michael@0: NPPVpluginWantsAllNetworkStreams = 18, michael@0: michael@0: /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */ michael@0: NPPVpluginNativeAccessibleAtkPlugId = 19, michael@0: michael@0: /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ michael@0: NPPVpluginCancelSrcStream = 20, michael@0: michael@0: NPPVsupportsAdvancedKeyHandling = 21, michael@0: michael@0: NPPVpluginUsesDOMForCursorBool = 22, michael@0: michael@0: /* Used for negotiating drawing models */ michael@0: NPPVpluginDrawingModel = 1000 michael@0: #if defined(XP_MACOSX) michael@0: /* Used for negotiating event models */ michael@0: , NPPVpluginEventModel = 1001 michael@0: /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ michael@0: , NPPVpluginCoreAnimationLayer = 1003 michael@0: #endif michael@0: michael@0: } NPPVariable; michael@0: michael@0: /* michael@0: * List of variable names for which NPN_GetValue should be implemented. michael@0: */ michael@0: typedef enum { michael@0: NPNVxDisplay = 1, michael@0: NPNVxtAppContext, michael@0: NPNVnetscapeWindow, michael@0: NPNVjavascriptEnabledBool, michael@0: NPNVasdEnabledBool, michael@0: NPNVisOfflineBool, michael@0: michael@0: NPNVserviceManager = (10 | NP_ABI_MASK), michael@0: NPNVDOMElement = (11 | NP_ABI_MASK), michael@0: NPNVDOMWindow = (12 | NP_ABI_MASK), michael@0: NPNVToolkit = (13 | NP_ABI_MASK), michael@0: NPNVSupportsXEmbedBool = 14, michael@0: michael@0: /* Get the NPObject wrapper for the browser window. */ michael@0: NPNVWindowNPObject = 15, michael@0: michael@0: /* Get the NPObject wrapper for the plugins DOM element. */ michael@0: NPNVPluginElementNPObject = 16, michael@0: michael@0: NPNVSupportsWindowless = 17, michael@0: michael@0: NPNVprivateModeBool = 18, michael@0: michael@0: NPNVsupportsAdvancedKeyHandling = 21, michael@0: michael@0: NPNVdocumentOrigin = 22, michael@0: michael@0: NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */ michael@0: #if defined(XP_MACOSX) michael@0: , NPNVcontentsScaleFactor = 1001 michael@0: #ifndef NP_NO_QUICKDRAW michael@0: , NPNVsupportsQuickDrawBool = 2000 michael@0: #endif michael@0: , NPNVsupportsCoreGraphicsBool = 2001 michael@0: , NPNVsupportsOpenGLBool = 2002 michael@0: , NPNVsupportsCoreAnimationBool = 2003 michael@0: , NPNVsupportsInvalidatingCoreAnimationBool = 2004 michael@0: #endif michael@0: , NPNVsupportsAsyncBitmapSurfaceBool = 2007 michael@0: #if defined(XP_WIN) michael@0: , NPNVsupportsAsyncWindowsDXGISurfaceBool = 2008 michael@0: #endif michael@0: #if defined(XP_MACOSX) michael@0: #ifndef NP_NO_CARBON michael@0: , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */ michael@0: #endif michael@0: , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ michael@0: , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated michael@0: Cocoa text input specification. */ michael@0: , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports michael@0: CA model compositing */ michael@0: #endif michael@0: } NPNVariable; michael@0: michael@0: typedef enum { michael@0: NPNURLVCookie = 501, michael@0: NPNURLVProxy michael@0: } NPNURLVariable; michael@0: michael@0: /* michael@0: * The type of Toolkit the widgets use michael@0: */ michael@0: typedef enum { michael@0: NPNVGtk12 = 1, michael@0: NPNVGtk2 michael@0: } NPNToolkitType; michael@0: michael@0: /* michael@0: * The type of a NPWindow - it specifies the type of the data structure michael@0: * returned in the window field. michael@0: */ michael@0: typedef enum { michael@0: NPWindowTypeWindow = 1, michael@0: NPWindowTypeDrawable michael@0: } NPWindowType; michael@0: michael@0: typedef struct _NPWindow michael@0: { michael@0: void* window; /* Platform specific window handle */ michael@0: /* OS/2: x - Position of bottom left corner */ michael@0: /* OS/2: y - relative to visible netscape window */ michael@0: int32_t x; /* Position of top left corner relative */ michael@0: int32_t y; /* to a netscape page. */ michael@0: uint32_t width; /* Maximum window size */ michael@0: uint32_t height; michael@0: NPRect clipRect; /* Clipping rectangle in port coordinates */ michael@0: #if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) michael@0: void * ws_info; /* Platform-dependent additional data */ michael@0: #endif /* XP_UNIX */ michael@0: NPWindowType type; /* Is this a window or a drawable? */ michael@0: } NPWindow; michael@0: michael@0: typedef struct _NPImageExpose michael@0: { michael@0: char* data; /* image pointer */ michael@0: int32_t stride; /* Stride of data image pointer */ michael@0: int32_t depth; /* Depth of image pointer */ michael@0: int32_t x; /* Expose x */ michael@0: int32_t y; /* Expose y */ michael@0: uint32_t width; /* Expose width */ michael@0: uint32_t height; /* Expose height */ michael@0: NPSize dataSize; /* Data buffer size */ michael@0: float translateX; /* translate X matrix value */ michael@0: float translateY; /* translate Y matrix value */ michael@0: float scaleX; /* scale X matrix value */ michael@0: float scaleY; /* scale Y matrix value */ michael@0: } NPImageExpose; michael@0: michael@0: typedef struct _NPFullPrint michael@0: { michael@0: NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ michael@0: NPBool printOne; /* TRUE if plugin should print one copy to default michael@0: printer */ michael@0: void* platformPrint; /* Platform-specific printing info */ michael@0: } NPFullPrint; michael@0: michael@0: typedef struct _NPEmbedPrint michael@0: { michael@0: NPWindow window; michael@0: void* platformPrint; /* Platform-specific printing info */ michael@0: } NPEmbedPrint; michael@0: michael@0: typedef struct _NPPrint michael@0: { michael@0: uint16_t mode; /* NP_FULL or NP_EMBED */ michael@0: union michael@0: { michael@0: NPFullPrint fullPrint; /* if mode is NP_FULL */ michael@0: NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ michael@0: } print; michael@0: } NPPrint; michael@0: michael@0: #if defined(XP_MACOSX) michael@0: #ifndef NP_NO_CARBON michael@0: typedef EventRecord NPEvent; michael@0: #endif michael@0: #elif defined(XP_SYMBIAN) michael@0: typedef QEvent NPEvent; michael@0: #elif defined(XP_WIN) michael@0: typedef struct _NPEvent michael@0: { michael@0: uint16_t event; michael@0: uintptr_t wParam; michael@0: uintptr_t lParam; michael@0: } NPEvent; michael@0: #elif defined(XP_UNIX) && defined(MOZ_X11) michael@0: typedef XEvent NPEvent; michael@0: #else michael@0: typedef void* NPEvent; michael@0: #endif michael@0: michael@0: #if defined(XP_MACOSX) michael@0: typedef void* NPRegion; michael@0: #ifndef NP_NO_QUICKDRAW michael@0: typedef RgnHandle NPQDRegion; michael@0: #endif michael@0: typedef CGPathRef NPCGRegion; michael@0: #elif defined(XP_WIN) michael@0: typedef HRGN NPRegion; michael@0: #elif defined(XP_UNIX) && defined(MOZ_X11) michael@0: typedef Region NPRegion; michael@0: #elif defined(XP_SYMBIAN) michael@0: typedef QRegion* NPRegion; michael@0: #else michael@0: typedef void *NPRegion; michael@0: #endif michael@0: michael@0: typedef struct _NPNSString NPNSString; michael@0: typedef struct _NPNSWindow NPNSWindow; michael@0: typedef struct _NPNSMenu NPNSMenu; michael@0: michael@0: #if defined(XP_MACOSX) michael@0: typedef NPNSMenu NPMenu; michael@0: #else michael@0: typedef void *NPMenu; michael@0: #endif michael@0: michael@0: typedef enum { michael@0: NPCoordinateSpacePlugin = 1, michael@0: NPCoordinateSpaceWindow, michael@0: NPCoordinateSpaceFlippedWindow, michael@0: NPCoordinateSpaceScreen, michael@0: NPCoordinateSpaceFlippedScreen michael@0: } NPCoordinateSpace; michael@0: michael@0: #if defined(XP_MACOSX) michael@0: michael@0: #ifndef NP_NO_QUICKDRAW michael@0: typedef struct NP_Port michael@0: { michael@0: CGrafPtr port; michael@0: int32_t portx; /* position inside the topmost window */ michael@0: int32_t porty; michael@0: } NP_Port; michael@0: #endif /* NP_NO_QUICKDRAW */ michael@0: michael@0: /* michael@0: * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics michael@0: * as its drawing model. michael@0: */ michael@0: michael@0: typedef struct NP_CGContext michael@0: { michael@0: CGContextRef context; michael@0: void *window; /* A WindowRef under the Carbon event model. */ michael@0: } NP_CGContext; michael@0: michael@0: /* michael@0: * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its michael@0: * drawing model. michael@0: */ michael@0: michael@0: typedef struct NP_GLContext michael@0: { michael@0: CGLContextObj context; michael@0: #ifdef NP_NO_CARBON michael@0: NPNSWindow *window; michael@0: #else michael@0: void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */ michael@0: #endif michael@0: } NP_GLContext; michael@0: michael@0: typedef enum { michael@0: NPCocoaEventDrawRect = 1, michael@0: NPCocoaEventMouseDown, michael@0: NPCocoaEventMouseUp, michael@0: NPCocoaEventMouseMoved, michael@0: NPCocoaEventMouseEntered, michael@0: NPCocoaEventMouseExited, michael@0: NPCocoaEventMouseDragged, michael@0: NPCocoaEventKeyDown, michael@0: NPCocoaEventKeyUp, michael@0: NPCocoaEventFlagsChanged, michael@0: NPCocoaEventFocusChanged, michael@0: NPCocoaEventWindowFocusChanged, michael@0: NPCocoaEventScrollWheel, michael@0: NPCocoaEventTextInput michael@0: } NPCocoaEventType; michael@0: michael@0: typedef struct _NPCocoaEvent { michael@0: NPCocoaEventType type; michael@0: uint32_t version; michael@0: union { michael@0: struct { michael@0: uint32_t modifierFlags; michael@0: double pluginX; michael@0: double pluginY; michael@0: int32_t buttonNumber; michael@0: int32_t clickCount; michael@0: double deltaX; michael@0: double deltaY; michael@0: double deltaZ; michael@0: } mouse; michael@0: struct { michael@0: uint32_t modifierFlags; michael@0: NPNSString *characters; michael@0: NPNSString *charactersIgnoringModifiers; michael@0: NPBool isARepeat; michael@0: uint16_t keyCode; michael@0: } key; michael@0: struct { michael@0: CGContextRef context; michael@0: double x; michael@0: double y; michael@0: double width; michael@0: double height; michael@0: } draw; michael@0: struct { michael@0: NPBool hasFocus; michael@0: } focus; michael@0: struct { michael@0: NPNSString *text; michael@0: } text; michael@0: } data; michael@0: } NPCocoaEvent; michael@0: michael@0: #ifndef NP_NO_CARBON michael@0: /* Non-standard event types that can be passed to HandleEvent */ michael@0: enum NPEventType { michael@0: NPEventType_GetFocusEvent = (osEvt + 16), michael@0: NPEventType_LoseFocusEvent, michael@0: NPEventType_AdjustCursorEvent, michael@0: NPEventType_MenuCommandEvent, michael@0: NPEventType_ClippingChangedEvent, michael@0: NPEventType_ScrollingBeginsEvent = 1000, michael@0: NPEventType_ScrollingEndsEvent michael@0: }; michael@0: #endif /* NP_NO_CARBON */ michael@0: michael@0: #endif /* XP_MACOSX */ michael@0: michael@0: /* michael@0: * Values for mode passed to NPP_New: michael@0: */ michael@0: #define NP_EMBED 1 michael@0: #define NP_FULL 2 michael@0: michael@0: /* michael@0: * Values for stream type passed to NPP_NewStream: michael@0: */ michael@0: #define NP_NORMAL 1 michael@0: #define NP_SEEK 2 michael@0: #define NP_ASFILE 3 michael@0: #define NP_ASFILEONLY 4 michael@0: michael@0: #define NP_MAXREADY (((unsigned)(~0)<<1)>>1) michael@0: michael@0: /* michael@0: * Flags for NPP_ClearSiteData. michael@0: */ michael@0: #define NP_CLEAR_ALL 0 michael@0: #define NP_CLEAR_CACHE (1 << 0) michael@0: michael@0: #if !defined(__LP64__) michael@0: #if defined(XP_MACOSX) michael@0: #pragma options align=reset michael@0: #endif michael@0: #endif /* __LP64__ */ michael@0: michael@0: /*----------------------------------------------------------------------*/ michael@0: /* Error and Reason Code definitions */ michael@0: /*----------------------------------------------------------------------*/ michael@0: michael@0: /* michael@0: * Values of type NPError: michael@0: */ michael@0: #define NPERR_BASE 0 michael@0: #define NPERR_NO_ERROR (NPERR_BASE + 0) michael@0: #define NPERR_GENERIC_ERROR (NPERR_BASE + 1) michael@0: #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) michael@0: #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) michael@0: #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) michael@0: #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) michael@0: #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) michael@0: #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) michael@0: #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) michael@0: #define NPERR_INVALID_PARAM (NPERR_BASE + 9) michael@0: #define NPERR_INVALID_URL (NPERR_BASE + 10) michael@0: #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) michael@0: #define NPERR_NO_DATA (NPERR_BASE + 12) michael@0: #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) michael@0: #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) michael@0: #define NPERR_MALFORMED_SITE (NPERR_BASE + 15) michael@0: michael@0: /* michael@0: * Values of type NPReason: michael@0: */ michael@0: #define NPRES_BASE 0 michael@0: #define NPRES_DONE (NPRES_BASE + 0) michael@0: #define NPRES_NETWORK_ERR (NPRES_BASE + 1) michael@0: #define NPRES_USER_BREAK (NPRES_BASE + 2) michael@0: michael@0: /* michael@0: * Don't use these obsolete error codes any more. michael@0: */ michael@0: #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR michael@0: #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR michael@0: #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK michael@0: michael@0: /* michael@0: * Version feature information michael@0: */ michael@0: #define NPVERS_HAS_STREAMOUTPUT 8 michael@0: #define NPVERS_HAS_NOTIFICATION 9 michael@0: #define NPVERS_HAS_LIVECONNECT 9 michael@0: #define NPVERS_68K_HAS_LIVECONNECT 11 michael@0: #define NPVERS_HAS_WINDOWLESS 11 michael@0: #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 michael@0: #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 michael@0: #define NPVERS_HAS_FORM_VALUES 15 michael@0: #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 michael@0: #define NPVERS_HAS_RESPONSE_HEADERS 17 michael@0: #define NPVERS_HAS_NPOBJECT_ENUM 18 michael@0: #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 michael@0: #define NPVERS_HAS_ALL_NETWORK_STREAMS 20 michael@0: #define NPVERS_HAS_URL_AND_AUTH_INFO 21 michael@0: #define NPVERS_HAS_PRIVATE_MODE 22 michael@0: #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 michael@0: #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 michael@0: #define NPVERS_HAS_URL_REDIRECT_HANDLING 26 michael@0: #define NPVERS_HAS_CLEAR_SITE_DATA 27 michael@0: michael@0: /*----------------------------------------------------------------------*/ michael@0: /* Function Prototypes */ michael@0: /*----------------------------------------------------------------------*/ michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif michael@0: michael@0: /* NPP_* functions are provided by the plugin and called by the navigator. */ michael@0: michael@0: #if defined(XP_UNIX) michael@0: const char* NPP_GetMIMEDescription(void); michael@0: #endif michael@0: michael@0: NPError NPP_New(NPMIMEType pluginType, NPP instance, michael@0: uint16_t mode, int16_t argc, char* argn[], michael@0: char* argv[], NPSavedData* saved); michael@0: NPError NPP_Destroy(NPP instance, NPSavedData** save); michael@0: NPError NPP_SetWindow(NPP instance, NPWindow* window); michael@0: NPError NPP_NewStream(NPP instance, NPMIMEType type, michael@0: NPStream* stream, NPBool seekable, michael@0: uint16_t* stype); michael@0: NPError NPP_DestroyStream(NPP instance, NPStream* stream, michael@0: NPReason reason); michael@0: int32_t NPP_WriteReady(NPP instance, NPStream* stream); michael@0: int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, michael@0: int32_t len, void* buffer); michael@0: void NPP_StreamAsFile(NPP instance, NPStream* stream, michael@0: const char* fname); michael@0: void NPP_Print(NPP instance, NPPrint* platformPrint); michael@0: int16_t NPP_HandleEvent(NPP instance, void* event); michael@0: void NPP_URLNotify(NPP instance, const char* url, michael@0: NPReason reason, void* notifyData); michael@0: NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); michael@0: NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value); michael@0: NPBool NPP_GotFocus(NPP instance, NPFocusDirection direction); michael@0: void NPP_LostFocus(NPP instance); michael@0: void NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); michael@0: NPError NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); michael@0: char** NPP_GetSitesWithData(void); michael@0: void NPP_DidComposite(NPP instance); michael@0: michael@0: /* NPN_* functions are provided by the navigator and called by the plugin. */ michael@0: void NPN_Version(int* plugin_major, int* plugin_minor, michael@0: int* netscape_major, int* netscape_minor); michael@0: NPError NPN_GetURLNotify(NPP instance, const char* url, michael@0: const char* target, void* notifyData); michael@0: NPError NPN_GetURL(NPP instance, const char* url, michael@0: const char* target); michael@0: NPError NPN_PostURLNotify(NPP instance, const char* url, michael@0: const char* target, uint32_t len, michael@0: const char* buf, NPBool file, michael@0: void* notifyData); michael@0: NPError NPN_PostURL(NPP instance, const char* url, michael@0: const char* target, uint32_t len, michael@0: const char* buf, NPBool file); michael@0: NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); michael@0: NPError NPN_NewStream(NPP instance, NPMIMEType type, michael@0: const char* target, NPStream** stream); michael@0: int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, michael@0: void* buffer); michael@0: NPError NPN_DestroyStream(NPP instance, NPStream* stream, michael@0: NPReason reason); michael@0: void NPN_Status(NPP instance, const char* message); michael@0: const char* NPN_UserAgent(NPP instance); michael@0: void* NPN_MemAlloc(uint32_t size); michael@0: void NPN_MemFree(void* ptr); michael@0: uint32_t NPN_MemFlush(uint32_t size); michael@0: void NPN_ReloadPlugins(NPBool reloadPages); michael@0: NPError NPN_GetValue(NPP instance, NPNVariable variable, michael@0: void *value); michael@0: NPError NPN_SetValue(NPP instance, NPPVariable variable, michael@0: void *value); michael@0: void NPN_InvalidateRect(NPP instance, NPRect *invalidRect); michael@0: void NPN_InvalidateRegion(NPP instance, michael@0: NPRegion invalidRegion); michael@0: void NPN_ForceRedraw(NPP instance); michael@0: void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); michael@0: void NPN_PopPopupsEnabledState(NPP instance); michael@0: void NPN_PluginThreadAsyncCall(NPP instance, michael@0: void (*func) (void *), michael@0: void *userData); michael@0: NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, michael@0: const char *url, char **value, michael@0: uint32_t *len); michael@0: NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, michael@0: const char *url, const char *value, michael@0: uint32_t len); michael@0: NPError NPN_GetAuthenticationInfo(NPP instance, michael@0: const char *protocol, michael@0: const char *host, int32_t port, michael@0: const char *scheme, michael@0: const char *realm, michael@0: char **username, uint32_t *ulen, michael@0: char **password, michael@0: uint32_t *plen); michael@0: uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); michael@0: void NPN_UnscheduleTimer(NPP instance, uint32_t timerID); michael@0: NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu); michael@0: NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); michael@0: NPBool NPN_HandleEvent(NPP instance, void *event, NPBool handled); michael@0: NPBool NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); michael@0: void NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); michael@0: NPError NPN_InitAsyncSurface(NPP instance, NPSize *size, michael@0: NPImageFormat format, void *initData, michael@0: NPAsyncSurface *surface); michael@0: NPError NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface); michael@0: void NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed); michael@0: michael@0: #ifdef __cplusplus michael@0: } /* end extern "C" */ michael@0: #endif michael@0: michael@0: #endif /* RC_INVOKED */ michael@0: michael@0: #endif /* npapi_h_ */