PageRenderTime 124ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/npapi/npapi.h

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