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