epoc32/include/mw/npapi.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/* ***** BEGIN LICENSE BLOCK *****
williamr@2
     2
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
williamr@2
     3
 *
williamr@2
     4
 * The contents of this file are subject to the Netscape Public License
williamr@2
     5
 * Version 1.1 (the "License"); you may not use this file except in
williamr@2
     6
 * compliance with the License. You may obtain a copy of the License at
williamr@2
     7
 * http://www.mozilla.org/NPL/
williamr@2
     8
 *
williamr@2
     9
 * Software distributed under the License is distributed on an "AS IS" basis,
williamr@2
    10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
williamr@2
    11
 * for the specific language governing rights and limitations under the
williamr@2
    12
 * License.
williamr@2
    13
 *
williamr@2
    14
 * The Original Code is mozilla.org code.
williamr@2
    15
 *
williamr@2
    16
 * The Initial Developer of the Original Code is
williamr@2
    17
 * Netscape Communications Corporation.
williamr@2
    18
 * Portions created by the Initial Developer are Copyright (C) 1998
williamr@2
    19
 * the Initial Developer. All Rights Reserved.
williamr@2
    20
 *
williamr@2
    21
 * Contributor(s):
williamr@2
    22
 *    Portions Copyright (c) 2004-2006, Nokia Corporation
williamr@2
    23
 *
williamr@2
    24
 *
williamr@2
    25
 * Alternatively, the contents of this file may be used under the terms of
williamr@2
    26
 * either the GNU General Public License Version 2 or later (the "GPL"), or
williamr@2
    27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
williamr@2
    28
 * in which case the provisions of the GPL or the LGPL are applicable instead
williamr@2
    29
 * of those above. If you wish to allow use of your version of this file only
williamr@2
    30
 * under the terms of either the GPL or the LGPL, and not to allow others to
williamr@2
    31
 * use your version of this file under the terms of the NPL, indicate your
williamr@2
    32
 * decision by deleting the provisions above and replace them with the notice
williamr@2
    33
 * and other provisions required by the GPL or the LGPL. If you do not delete
williamr@2
    34
 * the provisions above, a recipient may use your version of this file under
williamr@2
    35
 * the terms of any one of the NPL, the GPL or the LGPL.
williamr@2
    36
 *
williamr@2
    37
 * ***** END LICENSE BLOCK ***** */
williamr@2
    38
williamr@2
    39
/* NOTES:
williamr@2
    40
 * Nokia modified this file, by changing certain variables for the purpose of
williamr@2
    41
 * porting the file to the Symbian platform on May 1st, 2004.
williamr@2
    42
 */
williamr@2
    43
williamr@2
    44
 /*
williamr@2
    45
  *  Netscape client plug-in API spec
williamr@2
    46
  */
williamr@2
    47
williamr@2
    48
#ifndef _NPAPI_H_
williamr@2
    49
#define _NPAPI_H_
williamr@2
    50
williamr@2
    51
#ifdef INCLUDE_JAVA
williamr@2
    52
#include "jri.h"                /* Java Runtime Interface */
williamr@2
    53
#else
williamr@2
    54
#ifndef __SYMBIAN32__
williamr@2
    55
#define jref    void *
williamr@2
    56
#define JRIEnv  void
williamr@2
    57
#endif
williamr@2
    58
#endif
williamr@2
    59
williamr@2
    60
#ifdef _WIN32
williamr@2
    61
#    ifndef XP_WIN
williamr@2
    62
#        define XP_WIN 1
williamr@2
    63
#    endif /* XP_WIN */
williamr@2
    64
#endif /* _WIN32 */
williamr@2
    65
williamr@2
    66
#ifdef __MWERKS__
williamr@2
    67
#    define _declspec __declspec
williamr@2
    68
#    ifdef macintosh
williamr@2
    69
#        ifndef XP_MAC
williamr@2
    70
#            define XP_MAC 1
williamr@2
    71
#        endif /* XP_MAC */
williamr@2
    72
#    endif /* macintosh */
williamr@2
    73
#    ifdef __INTEL__
williamr@2
    74
#        undef NULL
williamr@2
    75
#        ifndef XP_WIN
williamr@2
    76
#            define XP_WIN 1
williamr@2
    77
#        endif /* __INTEL__ */
williamr@2
    78
#    endif /* XP_PC */
williamr@2
    79
#endif /* __MWERKS__ */
williamr@2
    80
williamr@2
    81
#ifdef __SYMBIAN32__
williamr@2
    82
#undef XP_WIN
williamr@2
    83
#endif
williamr@2
    84
williamr@2
    85
#if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__)
williamr@2
    86
#   define XP_MACOSX
williamr@2
    87
#endif
williamr@2
    88
williamr@2
    89
#ifdef XP_MAC
williamr@2
    90
    #include <Quickdraw.h>
williamr@2
    91
    #include <Events.h>
williamr@2
    92
#endif
williamr@2
    93
williamr@2
    94
#ifdef XP_MACOSX
williamr@2
    95
    #include <Carbon/Carbon.h>
williamr@2
    96
    #include <ApplicationServices/ApplicationServices.h>
williamr@2
    97
    #include <OpenGL/OpenGL.h>
williamr@2
    98
#endif
williamr@2
    99
williamr@2
   100
#ifdef XP_UNIX
williamr@2
   101
    #include <X11/Xlib.h>
williamr@2
   102
    #include <X11/Xutil.h>
williamr@2
   103
#endif
williamr@2
   104
williamr@2
   105
#ifdef XP_WIN
williamr@2
   106
    #include <windows.h>
williamr@2
   107
#endif
williamr@2
   108
williamr@2
   109
#ifdef __SYMBIAN32__
williamr@2
   110
#include <np_defines.h>
williamr@2
   111
#endif
williamr@2
   112
#if defined(XP_MACOSX) && defined(__LP64__)
williamr@2
   113
#error 64-bit Netscape plug-ins are not supported on Mac OS X
williamr@2
   114
#endif
williamr@2
   115
williamr@2
   116
/*----------------------------------------------------------------------*/
williamr@2
   117
/*             Plugin Version Constants                                 */
williamr@2
   118
/*----------------------------------------------------------------------*/
williamr@2
   119
williamr@2
   120
#define NP_VERSION_MAJOR 0
williamr@2
   121
#define NP_VERSION_MINOR 18
williamr@2
   122
williamr@2
   123
williamr@2
   124
williamr@2
   125
/*----------------------------------------------------------------------*/
williamr@2
   126
/*             Definition of Basic Types                                */
williamr@2
   127
/*----------------------------------------------------------------------*/
williamr@2
   128
williamr@2
   129
#ifndef _UINT16
williamr@2
   130
#define _UINT16
williamr@2
   131
typedef unsigned short uint16;
williamr@2
   132
#endif
williamr@2
   133
williamr@2
   134
#ifndef _UINT32
williamr@2
   135
#define _UINT32
williamr@2
   136
#ifdef __LP64__
williamr@2
   137
typedef unsigned int uint32;
williamr@2
   138
#else /* __LP64__ */
williamr@2
   139
typedef unsigned long uint32;
williamr@2
   140
#endif /* __LP64__ */
williamr@2
   141
#endif
williamr@2
   142
williamr@2
   143
#ifndef _INT16
williamr@2
   144
#define _INT16
williamr@2
   145
typedef short int16;
williamr@2
   146
#endif
williamr@2
   147
williamr@2
   148
#ifndef _INT32
williamr@2
   149
#define _INT32
williamr@2
   150
#ifdef __LP64__
williamr@2
   151
typedef int int32;
williamr@2
   152
#else /* __LP64__ */
williamr@2
   153
typedef long int32;
williamr@2
   154
#endif /* __LP64__ */
williamr@2
   155
#endif
williamr@2
   156
williamr@2
   157
#ifndef FALSE
williamr@2
   158
#define FALSE (0)
williamr@2
   159
#endif
williamr@2
   160
#ifndef TRUE
williamr@2
   161
#define TRUE (1)
williamr@2
   162
#endif
williamr@2
   163
#ifndef NULL
williamr@2
   164
#define NULL (0L)
williamr@2
   165
#endif
williamr@2
   166
williamr@2
   167
typedef unsigned char    NPBool;
williamr@2
   168
typedef int16            NPError;
williamr@2
   169
typedef int16            NPReason;
williamr@2
   170
#ifndef __SYMBIAN32__
williamr@2
   171
typedef char*     		 NPMIMEType;
williamr@2
   172
#else/* __SYMBIAN32__ */
williamr@2
   173
typedef const TDesC8& 	 NPMIMEType;
williamr@2
   174
#endif
williamr@2
   175
williamr@2
   176
/*----------------------------------------------------------------------*/
williamr@2
   177
/*             Structures and definitions             */
williamr@2
   178
/*----------------------------------------------------------------------*/
williamr@2
   179
williamr@2
   180
#if !defined(__LP64__)
williamr@2
   181
#if defined(XP_MAC) || defined(XP_MACOSX)
williamr@2
   182
#pragma options align=mac68k
williamr@2
   183
#endif
williamr@2
   184
#endif /* __LP64__ */
williamr@2
   185
williamr@2
   186
/*
williamr@2
   187
 *  NPP is a plug-in's opaque instance handle
williamr@2
   188
 */
williamr@2
   189
#ifdef __SYMBIAN32__ 
williamr@2
   190
#ifndef _NP_RUNTIME_H_NPP
williamr@2
   191
#define _NP_RUNTIME_H_NPP
williamr@2
   192
typedef struct _NPP
williamr@2
   193
{
williamr@2
   194
    void*    pdata;            /* plug-in private data */
williamr@2
   195
    void*    ndata;            /* netscape private data */
williamr@2
   196
} NPP_t;
williamr@2
   197
williamr@2
   198
typedef NPP_t*    NPP;
williamr@2
   199
#endif // _NP_RUNTIME_H_NPP
williamr@2
   200
#else
williamr@2
   201
typedef struct _NPP
williamr@2
   202
{
williamr@2
   203
    void*    pdata;            /* plug-in private data */
williamr@2
   204
    void*    ndata;            /* netscape private data */
williamr@2
   205
} NPP_t;
williamr@2
   206
williamr@2
   207
typedef NPP_t*    NPP;
williamr@2
   208
#endif //
williamr@2
   209
williamr@2
   210
typedef struct _NPStream
williamr@2
   211
{
williamr@2
   212
    void*        pdata;        /* plug-in private data */
williamr@2
   213
    void*        ndata;        /* netscape private data */
williamr@2
   214
#ifndef __SYMBIAN32__ 
williamr@2
   215
    const char*  url;
williamr@2
   216
#else /*__SYMBIAN32__*/
williamr@2
   217
    HBufC* url;
williamr@2
   218
#endif
williamr@2
   219
    uint32       end;
williamr@2
   220
    uint32       lastmodified;
williamr@2
   221
    void*        notifyData;
williamr@2
   222
    const char*  headers;      /* Response headers from host.
williamr@2
   223
                                * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
williamr@2
   224
                                * Used for HTTP only; NULL for non-HTTP.
williamr@2
   225
                                * Available from NPP_NewStream onwards.
williamr@2
   226
                                * Plugin should copy this data before storing it.
williamr@2
   227
                                * Includes HTTP status line and all headers,
williamr@2
   228
                                * preferably verbatim as received from server,
williamr@2
   229
                                * headers formatted as in HTTP ("Header: Value"),
williamr@2
   230
                                * and newlines (\n, NOT \r\n) separating lines.
williamr@2
   231
                                * Terminated by \n\0 (NOT \n\n\0). */
williamr@2
   232
} NPStream;
williamr@2
   233
williamr@2
   234
williamr@2
   235
typedef struct _NPByteRange
williamr@2
   236
{
williamr@2
   237
    int32      offset;         /* negative offset means from the end */
williamr@2
   238
    uint32     length;
williamr@2
   239
    struct _NPByteRange* next;
williamr@2
   240
} NPByteRange;
williamr@2
   241
williamr@2
   242
williamr@2
   243
typedef struct _NPSavedData
williamr@2
   244
{
williamr@2
   245
    int32    len;
williamr@2
   246
    void*    buf;
williamr@2
   247
} NPSavedData;
williamr@2
   248
williamr@2
   249
williamr@2
   250
typedef struct _NPRect
williamr@2
   251
{
williamr@2
   252
    uint16    top;
williamr@2
   253
    uint16    left;
williamr@2
   254
    uint16    bottom;
williamr@2
   255
    uint16    right;
williamr@2
   256
} NPRect;
williamr@2
   257
williamr@2
   258
williamr@2
   259
#ifdef XP_UNIX
williamr@2
   260
/*
williamr@2
   261
 * Unix specific structures and definitions
williamr@2
   262
 */
williamr@2
   263
williamr@2
   264
/*
williamr@2
   265
 * Callback Structures.
williamr@2
   266
 *
williamr@2
   267
 * These are used to pass additional platform specific information.
williamr@2
   268
 */
williamr@2
   269
enum {
williamr@2
   270
    NP_SETWINDOW = 1,
williamr@2
   271
    NP_PRINT
williamr@2
   272
};
williamr@2
   273
williamr@2
   274
typedef struct
williamr@2
   275
{
williamr@2
   276
    int32        type;
williamr@2
   277
} NPAnyCallbackStruct;
williamr@2
   278
williamr@2
   279
typedef struct
williamr@2
   280
{
williamr@2
   281
    int32           type;
williamr@2
   282
    Display*        display;
williamr@2
   283
    Visual*         visual;
williamr@2
   284
    Colormap        colormap;
williamr@2
   285
    unsigned int    depth;
williamr@2
   286
} NPSetWindowCallbackStruct;
williamr@2
   287
williamr@2
   288
typedef struct
williamr@2
   289
{
williamr@2
   290
    int32            type;
williamr@2
   291
    FILE*            fp;
williamr@2
   292
} NPPrintCallbackStruct;
williamr@2
   293
williamr@2
   294
#endif /* XP_UNIX */
williamr@2
   295
williamr@2
   296
/*
williamr@2
   297
 *   The following masks are applied on certain platforms to NPNV and 
williamr@2
   298
 *   NPPV selectors that pass around pointers to COM interfaces. Newer 
williamr@2
   299
 *   compilers on some platforms may generate vtables that are not 
williamr@2
   300
 *   compatible with older compilers. To prevent older plugins from 
williamr@2
   301
 *   not understanding a new browser's ABI, these masks change the 
williamr@2
   302
 *   values of those selectors on those platforms. To remain backwards
williamr@2
   303
 *   compatible with differenet versions of the browser, plugins can 
williamr@2
   304
 *   use these masks to dynamically determine and use the correct C++
williamr@2
   305
 *   ABI that the browser is expecting. This does not apply to Windows 
williamr@2
   306
 *   as Microsoft's COM ABI will likely not change.
williamr@2
   307
 */
williamr@2
   308
williamr@2
   309
#define NP_ABI_GCC3_MASK  0x10000000
williamr@2
   310
/*
williamr@2
   311
 *   gcc 3.x generated vtables on UNIX and OSX are incompatible with 
williamr@2
   312
 *   previous compilers.
williamr@2
   313
 */
williamr@2
   314
#if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
williamr@2
   315
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
williamr@2
   316
#else
williamr@2
   317
#define _NP_ABI_MIXIN_FOR_GCC3 0
williamr@2
   318
#endif
williamr@2
   319
williamr@2
   320
#define NP_ABI_MACHO_MASK 0x01000000
williamr@2
   321
/*
williamr@2
   322
 *   On OSX, the Mach-O executable format is significantly
williamr@2
   323
 *   different than CFM. In addition to having a different
williamr@2
   324
 *   C++ ABI, it also has has different C calling convention.
williamr@2
   325
 *   You must use glue code when calling between CFM and
williamr@2
   326
 *   Mach-O C functions. 
williamr@2
   327
 */
williamr@2
   328
#if (defined(TARGET_RT_MAC_MACHO))
williamr@2
   329
#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
williamr@2
   330
#else
williamr@2
   331
#define _NP_ABI_MIXIN_FOR_MACHO 0
williamr@2
   332
#endif
williamr@2
   333
williamr@2
   334
williamr@2
   335
#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
williamr@2
   336
williamr@2
   337
/*
williamr@2
   338
 * List of variable names for which NPP_GetValue shall be implemented
williamr@2
   339
 */
williamr@2
   340
typedef enum {
williamr@2
   341
    NPPVpluginNameString = 1,
williamr@2
   342
    NPPVpluginDescriptionString,
williamr@2
   343
    NPPVpluginWindowBool,
williamr@2
   344
    NPPVpluginTransparentBool,
williamr@2
   345
williamr@2
   346
    NPPVjavaClass,                /* Not implemented in WebKit */
williamr@2
   347
    NPPVpluginWindowSize,         /* Not implemented in WebKit */
williamr@2
   348
    NPPVpluginTimerInterval,      /* Not implemented in WebKit */
williamr@2
   349
williamr@2
   350
    NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), /* Not implemented in WebKit */
williamr@2
   351
    NPPVpluginScriptableIID = 11, /* Not implemented in WebKit */
williamr@2
   352
williamr@2
   353
    /* 12 and over are available on Mozilla builds starting with 0.9.9 */
williamr@2
   354
    NPPVjavascriptPushCallerBool = 12,  /* Not implemented in WebKit */
williamr@2
   355
    NPPVpluginKeepLibraryInMemory = 13, /* Not implemented in WebKit */
williamr@2
   356
    NPPVpluginNeedsXEmbed         = 14, /* Not implemented in WebKit */
williamr@2
   357
williamr@2
   358
    /* Get the NPObject for scripting the plugin. */
williamr@2
   359
    NPPVpluginScriptableNPObject  = 15,
williamr@2
   360
williamr@2
   361
#ifdef __SYMBIAN32__
williamr@2
   362
    // Custom NPP variables, starting from 100 till 1000
williamr@2
   363
    NPPVPluginFocusPosition = 100,    
williamr@2
   364
    NPPVPluginDeactivate = 101,
williamr@2
   365
    NPPVPluginZoom = 102,
williamr@2
   366
    NPPVPluginPointerEvent = 103,
williamr@2
   367
    NPPVpluginInteractiveBool = 1000,
williamr@2
   368
#endif
williamr@2
   369
williamr@2
   370
    /* Get the plugin value (as \0-terminated UTF-8 string data) for
williamr@2
   371
     * form submission if the plugin is part of a form. Use
williamr@2
   372
     * NPN_MemAlloc() to allocate memory for the string data.
williamr@2
   373
     */
williamr@2
   374
    NPPVformValue = 16,    /* Not implemented in WebKit */
williamr@2
   375
    NPPVpluginFullScreenBool = 17 /* Not implemented in WebKit */
williamr@2
   376
} NPPVariable;
williamr@2
   377
williamr@2
   378
/*
williamr@2
   379
 * List of variable names for which NPN_GetValue is implemented by Mozilla
williamr@2
   380
 */
williamr@2
   381
typedef enum {
williamr@2
   382
    NPNVxDisplay = 1,
williamr@2
   383
    NPNVxtAppContext,
williamr@2
   384
    NPNVnetscapeWindow,
williamr@2
   385
    NPNVjavascriptEnabledBool,
williamr@2
   386
    NPNVasdEnabledBool,
williamr@2
   387
    NPNVisOfflineBool,
williamr@2
   388
williamr@2
   389
    /* 10 and over are available on Mozilla builds starting with 0.9.4 */
williamr@2
   390
    NPNVserviceManager = (10 | NP_ABI_MASK),  /* Not implemented in WebKit */
williamr@2
   391
    NPNVDOMElement     = (11 | NP_ABI_MASK),  /* Not implemented in WebKit */
williamr@2
   392
    NPNVDOMWindow      = (12 | NP_ABI_MASK),  /* Not implemented in WebKit */
williamr@2
   393
    NPNVToolkit        = (13 | NP_ABI_MASK),  /* Not implemented in WebKit */
williamr@2
   394
    NPNVSupportsXEmbedBool = 14,              /* Not implemented in WebKit */
williamr@2
   395
williamr@2
   396
    /* Get the NPObject wrapper for the browser window. */
williamr@2
   397
    NPNVWindowNPObject = 15,
williamr@2
   398
williamr@2
   399
    /* Get the NPObject wrapper for the plugins DOM element. */
williamr@2
   400
    NPNVPluginElementNPObject,
williamr@2
   401
williamr@2
   402
#ifdef XP_MACOSX
williamr@2
   403
    , NPNVpluginDrawingModel = 1000 /* The NPDrawingModel specified by the plugin */
williamr@2
   404
williamr@2
   405
#ifndef NP_NO_QUICKDRAW
williamr@2
   406
    , NPNVsupportsQuickDrawBool = 2000 /* TRUE if the browser supports the QuickDraw drawing model */
williamr@2
   407
#endif
williamr@2
   408
    , NPNVsupportsCoreGraphicsBool = 2001 /* TRUE if the browser supports the CoreGraphics drawing model */
williamr@2
   409
    , NPNVsupportsOpenGLBool = 2002 /* TRUE if the browser supports the OpenGL drawing model (CGL on Mac) */
williamr@2
   410
#endif /* XP_MACOSX */
williamr@2
   411
    
williamr@2
   412
    /* Get the id of the currently connected access point */
williamr@2
   413
    NPNNetworkAccess
williamr@2
   414
} NPNVariable;
williamr@2
   415
williamr@2
   416
/*
williamr@2
   417
 * The type of a NPWindow - it specifies the type of the data structure
williamr@2
   418
 * returned in the window field.
williamr@2
   419
 */
williamr@2
   420
typedef enum {
williamr@2
   421
    NPWindowTypeWindow = 1,
williamr@2
   422
    NPWindowTypeDrawable
williamr@2
   423
} NPWindowType;
williamr@2
   424
williamr@2
   425
#ifdef XP_MACOSX
williamr@2
   426
williamr@2
   427
/*
williamr@2
   428
 * The drawing model for a Mac OS X plugin.  These are the possible values for the NPNVpluginDrawingModel variable.
williamr@2
   429
 */
williamr@2
   430
 
williamr@2
   431
typedef enum {
williamr@2
   432
#ifndef NP_NO_QUICKDRAW
williamr@2
   433
    NPDrawingModelQuickDraw = 0,
williamr@2
   434
#endif
williamr@2
   435
    NPDrawingModelCoreGraphics = 1,
williamr@2
   436
    NPDrawingModelOpenGL = 2
williamr@2
   437
} NPDrawingModel;
williamr@2
   438
williamr@2
   439
#endif
williamr@2
   440
williamr@2
   441
typedef struct _NPWindow
williamr@2
   442
{
williamr@2
   443
    void*    window;     /* Platform specific window handle */
williamr@2
   444
    int32    x;            /* Position of top left corner relative */
williamr@2
   445
    int32    y;            /*    to a netscape page.                    */
williamr@2
   446
    uint32    width;        /* Maximum window size */
williamr@2
   447
    uint32    height;
williamr@2
   448
    NPRect    clipRect;    /* Clipping rectangle in port coordinates */
williamr@2
   449
                        /* Used by MAC only.              */
williamr@2
   450
#ifdef XP_UNIX
williamr@2
   451
    void *    ws_info;    /* Platform-dependent additonal data */
williamr@2
   452
#endif /* XP_UNIX */
williamr@2
   453
    NPWindowType type;    /* Is this a window or a drawable? */
williamr@2
   454
} NPWindow;
williamr@2
   455
williamr@2
   456
williamr@2
   457
typedef struct _NPFullPrint
williamr@2
   458
{
williamr@2
   459
    NPBool    pluginPrinted;    /* Set TRUE if plugin handled fullscreen */
williamr@2
   460
                            /*    printing                             */
williamr@2
   461
    NPBool    printOne;        /* TRUE if plugin should print one copy  */
williamr@2
   462
                            /*    to default printer                     */
williamr@2
   463
    void*    platformPrint;    /* Platform-specific printing info */
williamr@2
   464
} NPFullPrint;
williamr@2
   465
williamr@2
   466
typedef struct _NPEmbedPrint
williamr@2
   467
{
williamr@2
   468
    NPWindow    window;
williamr@2
   469
    void*    platformPrint;    /* Platform-specific printing info */
williamr@2
   470
} NPEmbedPrint;
williamr@2
   471
williamr@2
   472
typedef struct _NPPrint
williamr@2
   473
{
williamr@2
   474
    uint16    mode;                        /* NP_FULL or NP_EMBED */
williamr@2
   475
    union
williamr@2
   476
    {
williamr@2
   477
        NPFullPrint     fullPrint;        /* if mode is NP_FULL */
williamr@2
   478
        NPEmbedPrint    embedPrint;        /* if mode is NP_EMBED */
williamr@2
   479
    } print;
williamr@2
   480
} NPPrint;
williamr@2
   481
williamr@2
   482
#if defined(XP_MAC) || defined(XP_MACOSX)
williamr@2
   483
typedef EventRecord    NPEvent;
williamr@2
   484
#elif defined(XP_WIN)
williamr@2
   485
typedef struct _NPEvent
williamr@2
   486
{
williamr@2
   487
    uint16   event;
williamr@2
   488
    uint32   wParam;
williamr@2
   489
    uint32   lParam;
williamr@2
   490
} NPEvent;
williamr@2
   491
#elif defined (XP_UNIX)
williamr@2
   492
typedef XEvent NPEvent;
williamr@2
   493
#elif defined (__SYMBIAN32__)
williamr@2
   494
typedef struct _NPEvent
williamr@2
   495
{
williamr@2
   496
    uint32   event;
williamr@2
   497
    void*    param;
williamr@2
   498
} NPEvent;
williamr@2
   499
#else
williamr@2
   500
typedef void*            NPEvent;
williamr@2
   501
#endif /* XP_MAC */
williamr@2
   502
williamr@2
   503
#if defined(XP_MAC)
williamr@2
   504
typedef RgnHandle NPRegion;
williamr@2
   505
#elif defined(XP_MACOSX)
williamr@2
   506
/* 
williamr@2
   507
 * NPRegion's type depends on the drawing model specified by the plugin (see NPNVpluginDrawingModel).
williamr@2
   508
 * NPQDRegion represents a QuickDraw RgnHandle and is used with the QuickDraw drawing model.
williamr@2
   509
 * NPCGRegion repesents a graphical region when using any other drawing model.
williamr@2
   510
 */
williamr@2
   511
typedef void *NPRegion;
williamr@2
   512
#ifndef NP_NO_QUICKDRAW
williamr@2
   513
typedef RgnHandle NPQDRegion;
williamr@2
   514
#endif
williamr@2
   515
typedef CGPathRef NPCGRegion;
williamr@2
   516
#elif defined(XP_WIN)
williamr@2
   517
typedef HRGN NPRegion;
williamr@2
   518
#elif defined(XP_UNIX)
williamr@2
   519
typedef Region NPRegion;
williamr@2
   520
#else
williamr@2
   521
typedef void *NPRegion;
williamr@2
   522
#endif /* XP_MAC */
williamr@2
   523
williamr@2
   524
#ifdef XP_MACOSX
williamr@2
   525
williamr@2
   526
/* 
williamr@2
   527
 * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
williamr@2
   528
 * as its drawing model.
williamr@2
   529
 */
williamr@2
   530
williamr@2
   531
typedef struct NP_CGContext
williamr@2
   532
{
williamr@2
   533
    CGContextRef context;
williamr@2
   534
    WindowRef window;
williamr@2
   535
} NP_CGContext;
williamr@2
   536
williamr@2
   537
/* 
williamr@2
   538
 * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
williamr@2
   539
 * drawing model.
williamr@2
   540
 */
williamr@2
   541
williamr@2
   542
typedef struct NP_GLContext
williamr@2
   543
{
williamr@2
   544
    CGLContextObj context;
williamr@2
   545
    WindowRef window;
williamr@2
   546
} NP_GLContext;
williamr@2
   547
williamr@2
   548
#endif /* XP_MACOSX */
williamr@2
   549
williamr@2
   550
#if defined(XP_MAC) || defined(XP_MACOSX)
williamr@2
   551
williamr@2
   552
/*
williamr@2
   553
 *  Mac-specific structures and definitions.
williamr@2
   554
 */
williamr@2
   555
williamr@2
   556
#ifndef NP_NO_QUICKDRAW
williamr@2
   557
williamr@2
   558
/* 
williamr@2
   559
 * NP_Port is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelQuickDraw as its
williamr@2
   560
 * drawing model, or the plugin does not specify a drawing model.
williamr@2
   561
 *
williamr@2
   562
 * It is not recommended that new plugins use NPDrawingModelQuickDraw or NP_Port, as QuickDraw has been
williamr@2
   563
 * deprecated in Mac OS X 10.5.  CoreGraphics is the preferred drawing API.
williamr@2
   564
 *
williamr@2
   565
 * NP_Port is not available in 64-bit.
williamr@2
   566
 */
williamr@2
   567
 
williamr@2
   568
typedef struct NP_Port
williamr@2
   569
{
williamr@2
   570
    CGrafPtr     port;        /* Grafport */
williamr@2
   571
    int32        portx;        /* position inside the topmost window */
williamr@2
   572
    int32        porty;
williamr@2
   573
} NP_Port;
williamr@2
   574
williamr@2
   575
#endif /* NP_NO_QUICKDRAW */
williamr@2
   576
williamr@2
   577
/*
williamr@2
   578
 *  Non-standard event types that can be passed to HandleEvent
williamr@2
   579
 */
williamr@2
   580
#define getFocusEvent        (osEvt + 16)
williamr@2
   581
#define loseFocusEvent        (osEvt + 17)
williamr@2
   582
#define adjustCursorEvent   (osEvt + 18)
williamr@2
   583
williamr@2
   584
#endif /* XP_MAC */
williamr@2
   585
williamr@2
   586
williamr@2
   587
/*
williamr@2
   588
 * Values for mode passed to NPP_New:
williamr@2
   589
 */
williamr@2
   590
#define NP_EMBED        1
williamr@2
   591
#define NP_FULL         2
williamr@2
   592
williamr@2
   593
/*
williamr@2
   594
 * Values for stream type passed to NPP_NewStream:
williamr@2
   595
 */
williamr@2
   596
#define NP_NORMAL        1
williamr@2
   597
#define NP_SEEK         2
williamr@2
   598
#define NP_ASFILE        3
williamr@2
   599
#define NP_ASFILEONLY        4
williamr@2
   600
williamr@2
   601
#define NP_MAXREADY    (((unsigned)(~0)<<1)>>1)
williamr@2
   602
williamr@2
   603
#if !defined(__LP64__)
williamr@2
   604
#if defined(XP_MAC) || defined(XP_MACOSX)
williamr@2
   605
#pragma options align=reset
williamr@2
   606
#endif
williamr@2
   607
#endif /* __LP64__ */
williamr@2
   608
williamr@2
   609
williamr@2
   610
/*----------------------------------------------------------------------*/
williamr@2
   611
/*             Error and Reason Code definitions            */
williamr@2
   612
/*----------------------------------------------------------------------*/
williamr@2
   613
williamr@2
   614
/*
williamr@2
   615
 *    Values of type NPError:
williamr@2
   616
 */
williamr@2
   617
#define NPERR_BASE                            0
williamr@2
   618
#define NPERR_NO_ERROR                        (NPERR_BASE + 0)
williamr@2
   619
#define NPERR_GENERIC_ERROR                    (NPERR_BASE + 1)
williamr@2
   620
#define NPERR_INVALID_INSTANCE_ERROR        (NPERR_BASE + 2)
williamr@2
   621
#define NPERR_INVALID_FUNCTABLE_ERROR        (NPERR_BASE + 3)
williamr@2
   622
#define NPERR_MODULE_LOAD_FAILED_ERROR        (NPERR_BASE + 4)
williamr@2
   623
#define NPERR_OUT_OF_MEMORY_ERROR            (NPERR_BASE + 5)
williamr@2
   624
#define NPERR_INVALID_PLUGIN_ERROR            (NPERR_BASE + 6)
williamr@2
   625
#define NPERR_INVALID_PLUGIN_DIR_ERROR        (NPERR_BASE + 7)
williamr@2
   626
#define NPERR_INCOMPATIBLE_VERSION_ERROR    (NPERR_BASE + 8)
williamr@2
   627
#define NPERR_INVALID_PARAM                (NPERR_BASE + 9)
williamr@2
   628
#define NPERR_INVALID_URL                    (NPERR_BASE + 10)
williamr@2
   629
#define NPERR_FILE_NOT_FOUND                (NPERR_BASE + 11)
williamr@2
   630
#define NPERR_NO_DATA                        (NPERR_BASE + 12)
williamr@2
   631
#define NPERR_STREAM_NOT_SEEKABLE            (NPERR_BASE + 13)
williamr@2
   632
williamr@2
   633
/*
williamr@2
   634
 *    Values of type NPReason:
williamr@2
   635
 */
williamr@2
   636
#define NPRES_BASE                0
williamr@2
   637
#define NPRES_DONE                    (NPRES_BASE + 0)
williamr@2
   638
#define NPRES_NETWORK_ERR            (NPRES_BASE + 1)
williamr@2
   639
#define NPRES_USER_BREAK            (NPRES_BASE + 2)
williamr@2
   640
williamr@2
   641
/*
williamr@2
   642
 *      Don't use these obsolete error codes any more.
williamr@2
   643
 */
williamr@2
   644
#define NP_NOERR  NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
williamr@2
   645
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
williamr@2
   646
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
williamr@2
   647
williamr@2
   648
/*
williamr@2
   649
 * Version feature information
williamr@2
   650
 */
williamr@2
   651
#define NPVERS_HAS_STREAMOUTPUT     8
williamr@2
   652
#define NPVERS_HAS_NOTIFICATION     9
williamr@2
   653
#define NPVERS_HAS_LIVECONNECT        9
williamr@2
   654
#define NPVERS_WIN16_HAS_LIVECONNECT    9
williamr@2
   655
#define NPVERS_68K_HAS_LIVECONNECT    11
williamr@2
   656
#define NPVERS_HAS_WINDOWLESS       11
williamr@2
   657
#define NPVERS_HAS_XPCONNECT_SCRIPTING    13  /* Not implemented in WebKit */
williamr@2
   658
#define NPVERS_HAS_NPRUNTIME_SCRIPTING    14
williamr@2
   659
#define NPVERS_HAS_FORM_VALUES            15  /* Not implemented in WebKit; see bug 13061 */
williamr@2
   660
#define NPVERS_HAS_POPUPS_ENABLED_STATE   16  /* Not implemented in WebKit */
williamr@2
   661
#define NPVERS_HAS_RESPONSE_HEADERS       17
williamr@2
   662
#define NPVERS_HAS_NPOBJECT_ENUM          18
williamr@2
   663
williamr@2
   664
williamr@2
   665
/*----------------------------------------------------------------------*/
williamr@2
   666
/*             Function Prototypes                */
williamr@2
   667
/*----------------------------------------------------------------------*/
williamr@2
   668
williamr@2
   669
#if defined(_WINDOWS) && !defined(WIN32)
williamr@2
   670
#define NP_LOADDS  _loadds
williamr@2
   671
#else
williamr@2
   672
#define NP_LOADDS
williamr@2
   673
#endif
williamr@2
   674
williamr@2
   675
#ifndef __SYMBIAN32__
williamr@2
   676
 #ifdef __cplusplus
williamr@2
   677
 extern "C" {
williamr@2
   678
 #endif
williamr@2
   679
#endif
williamr@2
   680
williamr@2
   681
/*
williamr@2
   682
 * NPP_* functions are provided by the plugin and called by the navigator.
williamr@2
   683
 */
williamr@2
   684
williamr@2
   685
#ifdef XP_UNIX
williamr@2
   686
char*                    NPP_GetMIMEDescription(void);
williamr@2
   687
#endif /* XP_UNIX */
williamr@2
   688
williamr@2
   689
#ifdef __SYMBIAN32__
williamr@2
   690
#include <badesca.h>
williamr@2
   691
IMPORT_C const TDesC* NPP_GetMIMEDescription(void);
williamr@2
   692
#endif /* __SYMBIAN32__ */
williamr@2
   693
williamr@2
   694
NPError     NPP_Initialize(void);
williamr@2
   695
#ifdef __SYMBIAN32__
williamr@2
   696
IMPORT_C
williamr@2
   697
#endif /* __SYMBIAN32__ */
williamr@2
   698
void        NPP_Shutdown(void);
williamr@2
   699
williamr@2
   700
#ifndef __SYMBIAN32__
williamr@2
   701
NPError     NP_LOADDS    NPP_New(NPMIMEType pluginType, NPP instance,
williamr@2
   702
                                uint16 mode, int16 argc, char* argn[],
williamr@2
   703
                                char* argv[], NPSavedData* saved);
williamr@2
   704
#else
williamr@2
   705
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
williamr@2
   706
              uint16 mode, CDesCArray* argn,
williamr@2
   707
              CDesCArray* argv, NPSavedData* saved);
williamr@2
   708
#endif /* __SYMBIAN32__ */
williamr@2
   709
williamr@2
   710
NPError     NP_LOADDS    NPP_Destroy(NPP instance, NPSavedData** save);
williamr@2
   711
NPError     NP_LOADDS    NPP_SetWindow(NPP instance, NPWindow* window);
williamr@2
   712
NPError     NP_LOADDS    NPP_NewStream(NPP instance, NPMIMEType type,
williamr@2
   713
                                      NPStream* stream, NPBool seekable,
williamr@2
   714
                                      uint16* stype);
williamr@2
   715
NPError     NP_LOADDS    NPP_DestroyStream(NPP instance, NPStream* stream,
williamr@2
   716
                                          NPReason reason);
williamr@2
   717
int32        NP_LOADDS    NPP_WriteReady(NPP instance, NPStream* stream);
williamr@2
   718
int32        NP_LOADDS    NPP_Write(NPP instance, NPStream* stream, int32 offset,
williamr@2
   719
                                  int32 len, void* buffer);
williamr@2
   720
williamr@2
   721
#ifndef __SYMBIAN32__
williamr@2
   722
void        NP_LOADDS    NPP_StreamAsFile(NPP instance, NPStream* stream,
williamr@2
   723
                                         const char* fname);
williamr@2
   724
#else/* __SYMBIAN32__ */
williamr@2
   725
void    NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
williamr@2
   726
                                   const TDesC& fname);
williamr@2
   727
#endif /* __SYMBIAN32__ */
williamr@2
   728
williamr@2
   729
void        NP_LOADDS    NPP_Print(NPP instance, NPPrint* platformPrint);
williamr@2
   730
int16            NPP_HandleEvent(NPP instance, void* event);
williamr@2
   731
williamr@2
   732
#ifndef __SYMBIAN32__
williamr@2
   733
void        NP_LOADDS    NPP_URLNotify(NPP instance, const char* url,
williamr@2
   734
                                      NPReason reason, void* notifyData);
williamr@2
   735
jref        NP_LOADDS            NPP_GetJavaClass(void);
williamr@2
   736
#else/* __SYMBIAN32__ */
williamr@2
   737
void    NP_LOADDS NPP_URLNotify(NPP instance, const TDesC& url,
williamr@2
   738
                                NPReason reason, void* notifyData);
williamr@2
   739
#endif /* __SYMBIAN32__ */
williamr@2
   740
williamr@2
   741
williamr@2
   742
#ifdef __SYMBIAN32__
williamr@2
   743
IMPORT_C
williamr@2
   744
#endif /* __SYMBIAN32__ */
williamr@2
   745
NPError     NPP_GetValue(NPP instance, NPPVariable variable,
williamr@2
   746
                                     void *value);
williamr@2
   747
NPError     NPP_SetValue(NPP instance, NPNVariable variable,
williamr@2
   748
                                     void *value);
williamr@2
   749
williamr@2
   750
/*
williamr@2
   751
 * NPN_* functions are provided by the navigator and called by the plugin.
williamr@2
   752
 */
williamr@2
   753
williamr@2
   754
void        NPN_Version(int* plugin_major, int* plugin_minor,
williamr@2
   755
                            int* netscape_major, int* netscape_minor);
williamr@2
   756
williamr@2
   757
#ifndef __SYMBIAN32__
williamr@2
   758
NPError     NPN_GetURLNotify(NPP instance, const char* url,
williamr@2
   759
                                 const char* target, void* notifyData);
williamr@2
   760
NPError     NPN_GetURL(NPP instance, const char* url,
williamr@2
   761
                           const char* target);
williamr@2
   762
NPError     NPN_PostURLNotify(NPP instance, const char* url,
williamr@2
   763
                                  const char* target, uint32 len,
williamr@2
   764
                                  const char* buf, NPBool file,
williamr@2
   765
                                  void* notifyData);
williamr@2
   766
NPError     NPN_PostURL(NPP instance, const char* url,
williamr@2
   767
                            const char* target, uint32 len,
williamr@2
   768
                            const char* buf, NPBool file);
williamr@2
   769
#else/* __SYMBIAN32__ */
williamr@2
   770
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const TDesC& url,
williamr@2
   771
                                   const TDesC* target, void* notifyData);
williamr@2
   772
NPError NP_LOADDS NPN_GetURL(NPP instance, const TDesC& url,
williamr@2
   773
                             const TDesC* target);
williamr@2
   774
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const TDesC& url,
williamr@2
   775
                                    const TDesC* target,
williamr@2
   776
                                    const TDesC& buf, NPBool file,
williamr@2
   777
                                    void* notifyData);
williamr@2
   778
NPError NP_LOADDS NPN_PostURL(NPP instance, const TDesC& url,
williamr@2
   779
                              const TDesC* target,
williamr@2
   780
                              const TDesC& buf, NPBool file);
williamr@2
   781
#endif /* __SYMBIAN32__ */
williamr@2
   782
williamr@2
   783
NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
williamr@2
   784
williamr@2
   785
#ifndef __SYMBIAN32__
williamr@2
   786
NPError     NPN_NewStream(NPP instance, NPMIMEType type,
williamr@2
   787
                              const char* target, NPStream** stream);
williamr@2
   788
#else/* __SYMBIAN32__ */
williamr@2
   789
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
williamr@2
   790
                                const TDesC* target, NPStream** stream);
williamr@2
   791
#endif /* __SYMBIAN32__ */
williamr@2
   792
williamr@2
   793
int32   NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
williamr@2
   794
NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
williamr@2
   795
williamr@2
   796
#ifndef __SYMBIAN32__
williamr@2
   797
void        NPN_Status(NPP instance, const char* message);
williamr@2
   798
#else/* __SYMBIAN32__ */
williamr@2
   799
void    NP_LOADDS NPN_Status(NPP instance, const TDesC& message);
williamr@2
   800
#endif /* __SYMBIAN32__ */
williamr@2
   801
williamr@2
   802
#ifndef __SYMBIAN32__
williamr@2
   803
const char*    NPN_UserAgent(NPP instance);
williamr@2
   804
#else/* __SYMBIAN32__ */
williamr@2
   805
const TDesC* NP_LOADDS  NPN_UserAgent(NPP instance);
williamr@2
   806
#endif /* __SYMBIAN32__ */
williamr@2
   807
williamr@2
   808
williamr@2
   809
void*        NPN_MemAlloc(uint32 size);
williamr@2
   810
void        NPN_MemFree(void* ptr);
williamr@2
   811
uint32        NPN_MemFlush(uint32 size);
williamr@2
   812
void        NPN_ReloadPlugins(NPBool reloadPages);
williamr@2
   813
#ifndef __SYMBIAN32__
williamr@2
   814
JRIEnv*     NPN_GetJavaEnv(void);
williamr@2
   815
jref        NPN_GetJavaPeer(NPP instance);
williamr@2
   816
#endif
williamr@2
   817
NPError     NPN_GetValue(NPP instance, NPNVariable variable,
williamr@2
   818
                             void *value);
williamr@2
   819
NPError     NPN_SetValue(NPP instance, NPPVariable variable,
williamr@2
   820
                             void *value);
williamr@2
   821
void        NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
williamr@2
   822
void        NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
williamr@2
   823
void        NPN_ForceRedraw(NPP instance);
williamr@2
   824
void        NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
williamr@2
   825
void        NPN_PopPopupsEnabledState(NPP instance);
williamr@2
   826
williamr@2
   827
#ifndef __SYMBIAN32__
williamr@2
   828
 #ifdef __cplusplus
williamr@2
   829
 }  /* end extern "C" */
williamr@2
   830
 #endif
williamr@2
   831
#endif
williamr@2
   832
williamr@2
   833
#endif /* _NPAPI_H_ */