| 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 |
|
| 39 |
/* npapi.h Revision 3.45 (cvs $Revision$) |
| 40 |
* Netscape client plug-in API spec |
| 41 |
*/ |
| 42 |
|
| 43 |
#ifndef _NPAPI_H_ |
| 44 |
#define _NPAPI_H_ |
| 45 |
|
| 46 |
#ifdef __OS2__ |
| 47 |
#pragma pack(1) |
| 48 |
#endif |
| 49 |
|
| 50 |
#include "prtypes.h" |
| 51 |
/* Copied from xp_core.h */ |
| 52 |
/* removed #ifdef for hpux defined in /usr/include/model.h */ |
| 53 |
#ifndef _INT16 |
| 54 |
#define _INT16 |
| 55 |
#endif |
| 56 |
#ifndef _INT32 |
| 57 |
#define _INT32 |
| 58 |
#endif |
| 59 |
#ifndef _UINT16 |
| 60 |
#define _UINT16 |
| 61 |
#endif |
| 62 |
#ifndef _UINT32 |
| 63 |
#define _UINT32 |
| 64 |
#endif |
| 65 |
|
| 66 |
/* |
| 67 |
* NO_NSPR_10_SUPPORT disables the inclusion |
| 68 |
* of obsolete/protypes.h, whose int16, uint16, |
| 69 |
* int32, and uint32 typedefs conflict with those |
| 70 |
* in this file. |
| 71 |
*/ |
| 72 |
#ifndef NO_NSPR_10_SUPPORT |
| 73 |
#define NO_NSPR_10_SUPPORT |
| 74 |
#endif |
| 75 |
#ifdef OJI |
| 76 |
#include "jri.h" /* Java Runtime Interface */ |
| 77 |
#endif |
| 78 |
|
| 79 |
#if defined (__OS2__ ) || defined (OS2) |
| 80 |
# ifndef XP_OS2 |
| 81 |
# define XP_OS2 1 |
| 82 |
# endif /* XP_OS2 */ |
| 83 |
#endif /* __OS2__ */ |
| 84 |
|
| 85 |
#ifdef _WINDOWS |
| 86 |
# include <windef.h> |
| 87 |
# ifndef XP_WIN |
| 88 |
# define XP_WIN 1 |
| 89 |
# endif /* XP_WIN */ |
| 90 |
#endif /* _WINDOWS */ |
| 91 |
|
| 92 |
#ifdef __MWERKS__ |
| 93 |
# define _declspec __declspec |
| 94 |
# ifdef __INTEL__ |
| 95 |
# undef NULL |
| 96 |
# ifndef XP_WIN |
| 97 |
# define XP_WIN 1 |
| 98 |
# endif /* XP_WIN */ |
| 99 |
# endif /* __INTEL__ */ |
| 100 |
#endif /* __MWERKS__ */ |
| 101 |
|
| 102 |
#ifdef XP_MACOSX |
| 103 |
#include <Carbon/Carbon.h> |
| 104 |
#ifdef __LP64__ |
| 105 |
#define NP_NO_QUICKDRAW |
| 106 |
#endif |
| 107 |
#endif |
| 108 |
|
| 109 |
#if defined(XP_UNIX) |
| 110 |
# include <stdio.h> |
| 111 |
# if defined(MOZ_X11) |
| 112 |
# include <X11/Xlib.h> |
| 113 |
# include <X11/Xutil.h> |
| 114 |
# endif |
| 115 |
#endif |
| 116 |
|
| 117 |
/*----------------------------------------------------------------------*/ |
| 118 |
/* Plugin Version Constants */ |
| 119 |
/*----------------------------------------------------------------------*/ |
| 120 |
|
| 121 |
#define NP_VERSION_MAJOR 0 |
| 122 |
#define NP_VERSION_MINOR 18 |
| 123 |
|
| 124 |
|
| 125 |
/* The OS/2 version of Netscape uses RC_DATA to define the |
| 126 |
mime types, file extensions, etc that are required. |
| 127 |
Use a vertical bar to separate types, end types with \0. |
| 128 |
FileVersion and ProductVersion are 32bit ints, all other |
| 129 |
entries are strings the MUST be terminated wwith a \0. |
| 130 |
|
| 131 |
AN EXAMPLE: |
| 132 |
|
| 133 |
RCDATA NP_INFO_ProductVersion { 1,0,0,1,} |
| 134 |
|
| 135 |
RCDATA NP_INFO_MIMEType { "video/x-video|", |
| 136 |
"video/x-flick\0" } |
| 137 |
RCDATA NP_INFO_FileExtents { "avi|", |
| 138 |
"flc\0" } |
| 139 |
RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", |
| 140 |
"MMOS2 Flc/Fli player(*.flc)\0" } |
| 141 |
|
| 142 |
RCDATA NP_INFO_FileVersion { 1,0,0,1 } |
| 143 |
RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } |
| 144 |
RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" |
| 145 |
RCDATA NP_INFO_InternalName { "NPAVI32\0" ) |
| 146 |
RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" |
| 147 |
RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } |
| 148 |
RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } |
| 149 |
|
| 150 |
*/ |
| 151 |
|
| 152 |
|
| 153 |
/* RC_DATA types for version info - required */ |
| 154 |
#define NP_INFO_ProductVersion 1 |
| 155 |
#define NP_INFO_MIMEType 2 |
| 156 |
#define NP_INFO_FileOpenName 3 |
| 157 |
#define NP_INFO_FileExtents 4 |
| 158 |
|
| 159 |
/* RC_DATA types for version info - used if found */ |
| 160 |
#define NP_INFO_FileDescription 5 |
| 161 |
#define NP_INFO_ProductName 6 |
| 162 |
|
| 163 |
/* RC_DATA types for version info - optional */ |
| 164 |
#define NP_INFO_CompanyName 7 |
| 165 |
#define NP_INFO_FileVersion 8 |
| 166 |
#define NP_INFO_InternalName 9 |
| 167 |
#define NP_INFO_LegalCopyright 10 |
| 168 |
#define NP_INFO_OriginalFilename 11 |
| 169 |
|
| 170 |
#ifndef RC_INVOKED |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
/*----------------------------------------------------------------------*/ |
| 175 |
/* Definition of Basic Types */ |
| 176 |
/*----------------------------------------------------------------------*/ |
| 177 |
|
| 178 |
#ifndef _UINT16 |
| 179 |
typedef unsigned short uint16; |
| 180 |
#endif |
| 181 |
|
| 182 |
#ifndef _UINT32 |
| 183 |
# if defined(__alpha) || defined(__amd64__) || defined(__x86_64__) |
| 184 |
typedef unsigned int uint32; |
| 185 |
# else /* __alpha */ |
| 186 |
typedef unsigned long uint32; |
| 187 |
# endif /* __alpha */ |
| 188 |
#endif |
| 189 |
|
| 190 |
/* |
| 191 |
* AIX defines these in sys/inttypes.h included from sys/types.h |
| 192 |
*/ |
| 193 |
#ifndef AIX |
| 194 |
#ifndef _INT16 |
| 195 |
typedef short int16; |
| 196 |
#endif |
| 197 |
|
| 198 |
#ifndef _INT32 |
| 199 |
# if defined(__alpha) || defined(__amd64__) || defined(__x86_64__) |
| 200 |
typedef int int32; |
| 201 |
# else /* __alpha */ |
| 202 |
typedef long int32; |
| 203 |
# endif /* __alpha */ |
| 204 |
#endif |
| 205 |
#endif |
| 206 |
|
| 207 |
#ifndef FALSE |
| 208 |
#define FALSE (0) |
| 209 |
#endif |
| 210 |
#ifndef TRUE |
| 211 |
#define TRUE (1) |
| 212 |
#endif |
| 213 |
#ifndef NULL |
| 214 |
#define NULL (0L) |
| 215 |
#endif |
| 216 |
|
| 217 |
#ifdef XP_MACOSX |
| 218 |
typedef enum { |
| 219 |
#ifndef NP_NO_QUICKDRAW |
| 220 |
NPDrawingModelQuickDraw = 0, |
| 221 |
#endif |
| 222 |
NPDrawingModelCoreGraphics = 1 |
| 223 |
} NPDrawingModel; |
| 224 |
#endif |
| 225 |
|
| 226 |
typedef unsigned char NPBool; |
| 227 |
typedef int16 NPError; |
| 228 |
typedef int16 NPReason; |
| 229 |
typedef char* NPMIMEType; |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
/*----------------------------------------------------------------------*/ |
| 234 |
/* Structures and definitions */ |
| 235 |
/*----------------------------------------------------------------------*/ |
| 236 |
|
| 237 |
/* |
| 238 |
* NPP is a plug-in's opaque instance handle |
| 239 |
*/ |
| 240 |
typedef struct _NPP |
| 241 |
{ |
| 242 |
void* pdata; /* plug-in private data */ |
| 243 |
void* ndata; /* netscape private data */ |
| 244 |
} NPP_t; |
| 245 |
|
| 246 |
typedef NPP_t* NPP; |
| 247 |
|
| 248 |
|
| 249 |
typedef struct _NPStream |
| 250 |
{ |
| 251 |
void* pdata; /* plug-in private data */ |
| 252 |
void* ndata; /* netscape private data */ |
| 253 |
const char* url; |
| 254 |
uint32 end; |
| 255 |
uint32 lastmodified; |
| 256 |
void* notifyData; |
| 257 |
const char* headers; /* Response headers from host. |
| 258 |
* Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. |
| 259 |
* Used for HTTP only; NULL for non-HTTP. |
| 260 |
* Available from NPP_NewStream onwards. |
| 261 |
* Plugin should copy this data before storing it. |
| 262 |
* Includes HTTP status line and all headers, |
| 263 |
* preferably verbatim as received from server, |
| 264 |
* headers formatted as in HTTP ("Header: Value"), |
| 265 |
* and newlines (\n, NOT \r\n) separating lines. |
| 266 |
* Terminated by \n\0 (NOT \n\n\0). */ |
| 267 |
} NPStream; |
| 268 |
|
| 269 |
|
| 270 |
typedef struct _NPByteRange |
| 271 |
{ |
| 272 |
int32 offset; /* negative offset means from the end */ |
| 273 |
uint32 length; |
| 274 |
struct _NPByteRange* next; |
| 275 |
} NPByteRange; |
| 276 |
|
| 277 |
|
| 278 |
typedef struct _NPSavedData |
| 279 |
{ |
| 280 |
int32 len; |
| 281 |
void* buf; |
| 282 |
} NPSavedData; |
| 283 |
|
| 284 |
|
| 285 |
typedef struct _NPRect |
| 286 |
{ |
| 287 |
uint16 top; |
| 288 |
uint16 left; |
| 289 |
uint16 bottom; |
| 290 |
uint16 right; |
| 291 |
} NPRect; |
| 292 |
|
| 293 |
typedef struct _NPSize |
| 294 |
{ |
| 295 |
int32 width; |
| 296 |
int32 height; |
| 297 |
} NPSize; |
| 298 |
|
| 299 |
#ifdef XP_UNIX |
| 300 |
/* |
| 301 |
* Unix specific structures and definitions |
| 302 |
*/ |
| 303 |
|
| 304 |
/* |
| 305 |
* Callback Structures. |
| 306 |
* |
| 307 |
* These are used to pass additional platform specific information. |
| 308 |
*/ |
| 309 |
enum { |
| 310 |
NP_SETWINDOW = 1, |
| 311 |
NP_PRINT |
| 312 |
}; |
| 313 |
|
| 314 |
typedef struct |
| 315 |
{ |
| 316 |
int32 type; |
| 317 |
} NPAnyCallbackStruct; |
| 318 |
|
| 319 |
typedef struct |
| 320 |
{ |
| 321 |
int32 type; |
| 322 |
#ifdef MOZ_X11 |
| 323 |
Display* display; |
| 324 |
Visual* visual; |
| 325 |
Colormap colormap; |
| 326 |
unsigned int depth; |
| 327 |
#endif |
| 328 |
} NPSetWindowCallbackStruct; |
| 329 |
|
| 330 |
typedef struct |
| 331 |
{ |
| 332 |
int32 type; |
| 333 |
FILE* fp; |
| 334 |
} NPPrintCallbackStruct; |
| 335 |
|
| 336 |
#endif /* XP_UNIX */ |
| 337 |
|
| 338 |
|
| 339 |
/* |
| 340 |
* The following masks are applied on certain platforms to NPNV and |
| 341 |
* NPPV selectors that pass around pointers to COM interfaces. Newer |
| 342 |
* compilers on some platforms may generate vtables that are not |
| 343 |
* compatible with older compilers. To prevent older plugins from |
| 344 |
* not understanding a new browser's ABI, these masks change the |
| 345 |
* values of those selectors on those platforms. To remain backwards |
| 346 |
* compatible with differenet versions of the browser, plugins can |
| 347 |
* use these masks to dynamically determine and use the correct C++ |
| 348 |
* ABI that the browser is expecting. This does not apply to Windows |
| 349 |
* as Microsoft's COM ABI will likely not change. |
| 350 |
*/ |
| 351 |
|
| 352 |
#define NP_ABI_GCC3_MASK 0x10000000 |
| 353 |
/* |
| 354 |
* gcc 3.x generated vtables on UNIX and OSX are incompatible with |
| 355 |
* previous compilers. |
| 356 |
*/ |
| 357 |
#if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) |
| 358 |
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK |
| 359 |
#else |
| 360 |
#define _NP_ABI_MIXIN_FOR_GCC3 0 |
| 361 |
#endif |
| 362 |
|
| 363 |
|
| 364 |
#define NP_ABI_MACHO_MASK 0x01000000 |
| 365 |
/* |
| 366 |
* On OSX, the Mach-O executable format is significantly |
| 367 |
* different than CFM. In addition to having a different |
| 368 |
* C++ ABI, it also has has different C calling convention. |
| 369 |
* You must use glue code when calling between CFM and |
| 370 |
* Mach-O C functions. |
| 371 |
*/ |
| 372 |
#if (defined(TARGET_RT_MAC_MACHO)) |
| 373 |
#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK |
| 374 |
#else |
| 375 |
#define _NP_ABI_MIXIN_FOR_MACHO 0 |
| 376 |
#endif |
| 377 |
|
| 378 |
|
| 379 |
#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) |
| 380 |
|
| 381 |
/* |
| 382 |
* List of variable names for which NPP_GetValue shall be implemented |
| 383 |
*/ |
| 384 |
typedef enum { |
| 385 |
NPPVpluginNameString = 1, |
| 386 |
NPPVpluginDescriptionString, |
| 387 |
NPPVpluginWindowBool, |
| 388 |
NPPVpluginTransparentBool, |
| 389 |
NPPVjavaClass, /* Not implemented in Mozilla 1.0 */ |
| 390 |
NPPVpluginWindowSize, |
| 391 |
NPPVpluginTimerInterval, |
| 392 |
|
| 393 |
NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), |
| 394 |
NPPVpluginScriptableIID = 11, |
| 395 |
|
| 396 |
/* Introduced in Mozilla 0.9.9 */ |
| 397 |
NPPVjavascriptPushCallerBool = 12, |
| 398 |
|
| 399 |
/* Introduced in Mozilla 1.0 */ |
| 400 |
NPPVpluginKeepLibraryInMemory = 13, |
| 401 |
NPPVpluginNeedsXEmbed = 14, |
| 402 |
|
| 403 |
/* Get the NPObject for scripting the plugin. Introduced in Firefox |
| 404 |
* 1.0 (NPAPI minor version 14). |
| 405 |
*/ |
| 406 |
NPPVpluginScriptableNPObject = 15, |
| 407 |
|
| 408 |
/* Get the plugin value (as \0-terminated UTF-8 string data) for |
| 409 |
* form submission if the plugin is part of a form. Use |
| 410 |
* NPN_MemAlloc() to allocate memory for the string data. Introduced |
| 411 |
* in Mozilla 1.8b2 (NPAPI minor version 15). |
| 412 |
*/ |
| 413 |
NPPVformValue = 16 |
| 414 |
} NPPVariable; |
| 415 |
|
| 416 |
/* |
| 417 |
* List of variable names for which NPN_GetValue is implemented by Mozilla |
| 418 |
*/ |
| 419 |
typedef enum { |
| 420 |
NPNVxDisplay = 1, |
| 421 |
NPNVxtAppContext, |
| 422 |
NPNVnetscapeWindow, |
| 423 |
NPNVjavascriptEnabledBool, |
| 424 |
NPNVasdEnabledBool, |
| 425 |
NPNVisOfflineBool, |
| 426 |
|
| 427 |
/* 10 and over are available on Mozilla builds starting with 0.9.4 */ |
| 428 |
NPNVserviceManager = (10 | NP_ABI_MASK), |
| 429 |
NPNVDOMElement = (11 | NP_ABI_MASK), /* available in Mozilla 1.2 */ |
| 430 |
NPNVDOMWindow = (12 | NP_ABI_MASK), |
| 431 |
NPNVToolkit = (13 | NP_ABI_MASK), |
| 432 |
NPNVSupportsXEmbedBool = 14, |
| 433 |
|
| 434 |
/* Get the NPObject wrapper for the browser window. */ |
| 435 |
NPNVWindowNPObject = 15, |
| 436 |
|
| 437 |
/* Get the NPObject wrapper for the plugins DOM element. */ |
| 438 |
NPNVPluginElementNPObject = 16 |
| 439 |
|
| 440 |
#ifdef XP_MACOSX |
| 441 |
/* Used for negotiating drawing models */ |
| 442 |
, NPNVpluginDrawingModel = 1000 |
| 443 |
#ifndef NP_NO_QUICKDRAW |
| 444 |
, NPNVsupportsQuickDrawBool = 2000 |
| 445 |
#endif |
| 446 |
, NPNVsupportsCoreGraphicsBool = 2001 |
| 447 |
#endif |
| 448 |
} NPNVariable; |
| 449 |
|
| 450 |
/* |
| 451 |
* The type of Tookkit the widgets use |
| 452 |
*/ |
| 453 |
typedef enum { |
| 454 |
NPNVGtk12 = 1, |
| 455 |
NPNVGtk2 |
| 456 |
} NPNToolkitType; |
| 457 |
|
| 458 |
/* |
| 459 |
* The type of a NPWindow - it specifies the type of the data structure |
| 460 |
* returned in the window field. |
| 461 |
*/ |
| 462 |
typedef enum { |
| 463 |
NPWindowTypeWindow = 1, |
| 464 |
NPWindowTypeDrawable |
| 465 |
} NPWindowType; |
| 466 |
|
| 467 |
typedef struct _NPWindow |
| 468 |
{ |
| 469 |
void* window; /* Platform specific window handle */ |
| 470 |
/* OS/2: x - Position of bottom left corner */ |
| 471 |
/* OS/2: y - relative to visible netscape window */ |
| 472 |
int32 x; /* Position of top left corner relative */ |
| 473 |
int32 y; /* to a netscape page. */ |
| 474 |
uint32 width; /* Maximum window size */ |
| 475 |
uint32 height; |
| 476 |
NPRect clipRect; /* Clipping rectangle in port coordinates */ |
| 477 |
/* Used by MAC only. */ |
| 478 |
#if defined(XP_UNIX) && !defined(XP_MACOSX) |
| 479 |
void * ws_info; /* Platform-dependent additonal data */ |
| 480 |
#endif /* XP_UNIX */ |
| 481 |
NPWindowType type; /* Is this a window or a drawable? */ |
| 482 |
} NPWindow; |
| 483 |
|
| 484 |
|
| 485 |
typedef struct _NPFullPrint |
| 486 |
{ |
| 487 |
NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ |
| 488 |
NPBool printOne; /* TRUE if plugin should print one copy to default printer */ |
| 489 |
void* platformPrint; /* Platform-specific printing info */ |
| 490 |
} NPFullPrint; |
| 491 |
|
| 492 |
typedef struct _NPEmbedPrint |
| 493 |
{ |
| 494 |
NPWindow window; |
| 495 |
void* platformPrint; /* Platform-specific printing info */ |
| 496 |
} NPEmbedPrint; |
| 497 |
|
| 498 |
typedef struct _NPPrint |
| 499 |
{ |
| 500 |
uint16 mode; /* NP_FULL or NP_EMBED */ |
| 501 |
union |
| 502 |
{ |
| 503 |
NPFullPrint fullPrint; /* if mode is NP_FULL */ |
| 504 |
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ |
| 505 |
} print; |
| 506 |
} NPPrint; |
| 507 |
|
| 508 |
#ifdef XP_MACOSX |
| 509 |
typedef EventRecord NPEvent; |
| 510 |
#elif defined(XP_WIN) |
| 511 |
typedef struct _NPEvent |
| 512 |
{ |
| 513 |
uint16 event; |
| 514 |
uint32 wParam; |
| 515 |
uint32 lParam; |
| 516 |
} NPEvent; |
| 517 |
#elif defined(XP_OS2) |
| 518 |
typedef struct _NPEvent |
| 519 |
{ |
| 520 |
uint32 event; |
| 521 |
uint32 wParam; |
| 522 |
uint32 lParam; |
| 523 |
} NPEvent; |
| 524 |
#elif defined (XP_UNIX) && defined(MOZ_X11) |
| 525 |
typedef XEvent NPEvent; |
| 526 |
#else |
| 527 |
typedef void* NPEvent; |
| 528 |
#endif /* XP_MACOSX */ |
| 529 |
|
| 530 |
#ifdef XP_MACOSX |
| 531 |
typedef void* NPRegion; |
| 532 |
#ifndef NP_NO_QUICKDRAW |
| 533 |
typedef RgnHandle NPQDRegion; |
| 534 |
#endif |
| 535 |
typedef CGPathRef NPCGRegion; |
| 536 |
#elif defined(XP_WIN) |
| 537 |
typedef HRGN NPRegion; |
| 538 |
#elif defined(XP_UNIX) && defined(MOZ_X11) |
| 539 |
typedef Region NPRegion; |
| 540 |
#else |
| 541 |
typedef void *NPRegion; |
| 542 |
#endif /* XP_MACOSX */ |
| 543 |
|
| 544 |
#ifdef XP_MACOSX |
| 545 |
/* |
| 546 |
* Mac-specific structures and definitions. |
| 547 |
*/ |
| 548 |
|
| 549 |
typedef struct NP_Port |
| 550 |
{ |
| 551 |
CGrafPtr port; /* Grafport */ |
| 552 |
int32 portx; /* position inside the topmost window */ |
| 553 |
int32 porty; |
| 554 |
} NP_Port; |
| 555 |
|
| 556 |
typedef struct NP_CGContext |
| 557 |
{ |
| 558 |
CGContextRef context; |
| 559 |
WindowRef window; |
| 560 |
} NP_CGContext; |
| 561 |
|
| 562 |
/* |
| 563 |
* Non-standard event types that can be passed to HandleEvent |
| 564 |
*/ |
| 565 |
|
| 566 |
enum NPEventType { |
| 567 |
NPEventType_GetFocusEvent = (osEvt + 16), |
| 568 |
NPEventType_LoseFocusEvent, |
| 569 |
NPEventType_AdjustCursorEvent, |
| 570 |
NPEventType_MenuCommandEvent, |
| 571 |
NPEventType_ClippingChangedEvent, |
| 572 |
NPEventType_ScrollingBeginsEvent = 1000, |
| 573 |
NPEventType_ScrollingEndsEvent |
| 574 |
}; |
| 575 |
|
| 576 |
#ifdef OBSOLETE |
| 577 |
#define getFocusEvent (osEvt + 16) |
| 578 |
#define loseFocusEvent (osEvt + 17) |
| 579 |
#define adjustCursorEvent (osEvt + 18) |
| 580 |
#endif |
| 581 |
#endif /* XP_MACOSX */ |
| 582 |
|
| 583 |
/* |
| 584 |
* Values for mode passed to NPP_New: |
| 585 |
*/ |
| 586 |
#define NP_EMBED 1 |
| 587 |
#define NP_FULL 2 |
| 588 |
|
| 589 |
/* |
| 590 |
* Values for stream type passed to NPP_NewStream: |
| 591 |
*/ |
| 592 |
#define NP_NORMAL 1 |
| 593 |
#define NP_SEEK 2 |
| 594 |
#define NP_ASFILE 3 |
| 595 |
#define NP_ASFILEONLY 4 |
| 596 |
|
| 597 |
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) |
| 598 |
|
| 599 |
|
| 600 |
/*----------------------------------------------------------------------*/ |
| 601 |
/* Error and Reason Code definitions */ |
| 602 |
/*----------------------------------------------------------------------*/ |
| 603 |
|
| 604 |
/* |
| 605 |
* Values of type NPError: |
| 606 |
*/ |
| 607 |
#define NPERR_BASE 0 |
| 608 |
#define NPERR_NO_ERROR (NPERR_BASE + 0) |
| 609 |
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1) |
| 610 |
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) |
| 611 |
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) |
| 612 |
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) |
| 613 |
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) |
| 614 |
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) |
| 615 |
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) |
| 616 |
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) |
| 617 |
#define NPERR_INVALID_PARAM (NPERR_BASE + 9) |
| 618 |
#define NPERR_INVALID_URL (NPERR_BASE + 10) |
| 619 |
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) |
| 620 |
#define NPERR_NO_DATA (NPERR_BASE + 12) |
| 621 |
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) |
| 622 |
|
| 623 |
/* |
| 624 |
* Values of type NPReason: |
| 625 |
*/ |
| 626 |
#define NPRES_BASE 0 |
| 627 |
#define NPRES_DONE (NPRES_BASE + 0) |
| 628 |
#define NPRES_NETWORK_ERR (NPRES_BASE + 1) |
| 629 |
#define NPRES_USER_BREAK (NPRES_BASE + 2) |
| 630 |
|
| 631 |
/* |
| 632 |
* Don't use these obsolete error codes any more. |
| 633 |
*/ |
| 634 |
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR |
| 635 |
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR |
| 636 |
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK |
| 637 |
|
| 638 |
/* |
| 639 |
* Version feature information |
| 640 |
*/ |
| 641 |
#define NPVERS_HAS_STREAMOUTPUT 8 |
| 642 |
#define NPVERS_HAS_NOTIFICATION 9 |
| 643 |
#define NPVERS_HAS_LIVECONNECT 9 |
| 644 |
#define NPVERS_WIN16_HAS_LIVECONNECT 9 |
| 645 |
#define NPVERS_68K_HAS_LIVECONNECT 11 |
| 646 |
#define NPVERS_HAS_WINDOWLESS 11 |
| 647 |
#define NPVERS_HAS_XPCONNECT_SCRIPTING 13 |
| 648 |
#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 |
| 649 |
#define NPVERS_HAS_FORM_VALUES 15 |
| 650 |
#define NPVERS_HAS_POPUPS_ENABLED_STATE 16 |
| 651 |
#define NPVERS_HAS_RESPONSE_HEADERS 17 |
| 652 |
#define NPVERS_HAS_NPOBJECT_ENUM 18 |
| 653 |
|
| 654 |
/*----------------------------------------------------------------------*/ |
| 655 |
/* Function Prototypes */ |
| 656 |
/*----------------------------------------------------------------------*/ |
| 657 |
|
| 658 |
#if defined(_WINDOWS) && !defined(WIN32) |
| 659 |
#define NP_LOADDS _loadds |
| 660 |
#else |
| 661 |
#if defined(__OS2__) |
| 662 |
#define NP_LOADDS _System |
| 663 |
#else |
| 664 |
#define NP_LOADDS |
| 665 |
#endif |
| 666 |
#endif |
| 667 |
|
| 668 |
#ifdef __cplusplus |
| 669 |
extern "C" { |
| 670 |
#endif |
| 671 |
|
| 672 |
/* |
| 673 |
* NPP_* functions are provided by the plugin and called by the navigator. |
| 674 |
*/ |
| 675 |
|
| 676 |
#ifdef XP_UNIX |
| 677 |
char* NPP_GetMIMEDescription(void); |
| 678 |
#endif /* XP_UNIX */ |
| 679 |
|
| 680 |
NPError NP_LOADDS NPP_Initialize(void); |
| 681 |
void NP_LOADDS NPP_Shutdown(void); |
| 682 |
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, |
| 683 |
uint16 mode, int16 argc, char* argn[], |
| 684 |
char* argv[], NPSavedData* saved); |
| 685 |
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); |
| 686 |
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); |
| 687 |
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, |
| 688 |
NPStream* stream, NPBool seekable, |
| 689 |
uint16* stype); |
| 690 |
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, |
| 691 |
NPReason reason); |
| 692 |
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); |
| 693 |
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, |
| 694 |
int32 len, void* buffer); |
| 695 |
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, |
| 696 |
const char* fname); |
| 697 |
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); |
| 698 |
int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event); |
| 699 |
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, |
| 700 |
NPReason reason, void* notifyData); |
| 701 |
#ifdef OJI |
| 702 |
jref NP_LOADDS NPP_GetJavaClass(void); |
| 703 |
#endif |
| 704 |
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); |
| 705 |
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); |
| 706 |
|
| 707 |
/* |
| 708 |
* NPN_* functions are provided by the navigator and called by the plugin. |
| 709 |
*/ |
| 710 |
void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, |
| 711 |
int* netscape_major, int* netscape_minor); |
| 712 |
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, |
| 713 |
const char* target, void* notifyData); |
| 714 |
NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, |
| 715 |
const char* target); |
| 716 |
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, |
| 717 |
const char* target, uint32 len, |
| 718 |
const char* buf, NPBool file, |
| 719 |
void* notifyData); |
| 720 |
NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, |
| 721 |
const char* target, uint32 len, |
| 722 |
const char* buf, NPBool file); |
| 723 |
NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); |
| 724 |
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, |
| 725 |
const char* target, NPStream** stream); |
| 726 |
int32 NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer); |
| 727 |
NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); |
| 728 |
void NP_LOADDS NPN_Status(NPP instance, const char* message); |
| 729 |
const char* NP_LOADDS NPN_UserAgent(NPP instance); |
| 730 |
void* NP_LOADDS NPN_MemAlloc(uint32 size); |
| 731 |
void NP_LOADDS NPN_MemFree(void* ptr); |
| 732 |
uint32 NP_LOADDS NPN_MemFlush(uint32 size); |
| 733 |
void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); |
| 734 |
#ifdef OJI |
| 735 |
JRIEnv* NP_LOADDS NPN_GetJavaEnv(void); |
| 736 |
jref NP_LOADDS NPN_GetJavaPeer(NPP instance); |
| 737 |
#endif |
| 738 |
NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, void *value); |
| 739 |
NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, void *value); |
| 740 |
void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); |
| 741 |
void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); |
| 742 |
void NP_LOADDS NPN_ForceRedraw(NPP instance); |
| 743 |
void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); |
| 744 |
void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); |
| 745 |
|
| 746 |
#ifdef __cplusplus |
| 747 |
} /* end extern "C" */ |
| 748 |
#endif |
| 749 |
|
| 750 |
#endif /* RC_INVOKED */ |
| 751 |
#ifdef __OS2__ |
| 752 |
#pragma pack() |
| 753 |
#endif |
| 754 |
|
| 755 |
#endif /* _NPAPI_H_ */ |