Back to index

lightning-sunbird  0.9+nobinonly
nsplugindefs.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsplugindefs_h___
00039 #define nsplugindefs_h___
00040 
00041 #if defined(XP_OS2) || defined(__OS2__)
00042 #define INCL_BASE
00043 #define INCL_PM
00044 #include <os2.h>
00045 #pragma pack(1)
00046 #endif
00047 
00048 #ifndef prtypes_h___
00049 #include "prtypes.h"
00050 #endif
00051 
00052 #if defined(XP_MAC) || defined(XP_MACOSX)
00053 #   include <Quickdraw.h>
00054 #   include <Events.h>
00055 #   include <MacWindows.h>
00056 #endif
00057 
00058 #if defined(XP_UNIX) && defined(MOZ_X11)
00059 #   include <X11/Xlib.h>
00060 #   include <X11/Xutil.h>
00061 #endif
00062 
00063 #if defined(XP_WIN)
00064 #   include <windef.h>
00065 #endif
00066 
00068 
00069 /* The OS/2 version of Netscape uses RC_DATA to define the
00070    mime types, file extensions, etc that are required.
00071    Use a vertical bar to separate types, end types with \0.
00072    FileVersion and ProductVersion are 32bit ints, all other
00073    entries are strings the MUST be terminated wwith a \0.
00074 
00075 AN EXAMPLE:
00076 
00077 RCDATA NS_INFO_ProductVersion { 1,0,0,1,}
00078 
00079 RCDATA NS_INFO_MIMEType    { "video/x-video|",
00080                              "video/x-flick\0" }
00081 RCDATA NS_INFO_FileExtents { "avi|",
00082                              "flc\0" }
00083 RCDATA NS_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
00084                              "MMOS2 Flc/Fli player(*.flc)\0" }
00085 
00086 RCDATA NS_INFO_FileVersion       { 1,0,0,1 }
00087 RCDATA NS_INFO_CompanyName       { "Netscape Communications\0" }
00088 RCDATA NS_INFO_FileDescription   { "NPAVI32 Extension DLL\0"
00089 RCDATA NS_INFO_InternalName      { "NPAVI32\0" )
00090 RCDATA NS_INFO_LegalCopyright    { "Copyright Netscape Communications \251 1996\0"
00091 RCDATA NS_INFO_OriginalFilename  { "NVAPI32.DLL" }
00092 RCDATA NS_INFO_ProductName       { "NPAVI32 Dynamic Link Library\0" }
00093 
00094 */
00095 
00096 
00097 /* RC_DATA types for version info - required */
00098 #define NS_INFO_ProductVersion      1
00099 #define NS_INFO_MIMEType            2
00100 #define NS_INFO_FileOpenName        3
00101 #define NS_INFO_FileExtents         4
00102 
00103 /* RC_DATA types for version info - used if found */
00104 #define NS_INFO_FileDescription     5
00105 #define NS_INFO_ProductName         6
00106 
00107 /* RC_DATA types for version info - optional */
00108 #define NS_INFO_CompanyName         7
00109 #define NS_INFO_FileVersion         8
00110 #define NS_INFO_InternalName        9
00111 #define NS_INFO_LegalCopyright      10
00112 #define NS_INFO_OriginalFilename    11
00113 
00114 #ifndef RC_INVOKED
00115 
00117 // Structures and definitions
00118 
00119 #ifdef XP_MAC
00120 #pragma options align=mac68k
00121 #endif
00122 
00123 typedef const char*     nsMIMEType;
00124 
00125 struct nsByteRange {
00126     PRInt32             offset;    /* negative offset means from the end */
00127     PRUint32            length;
00128     struct nsByteRange* next;
00129 };
00130 
00131 struct nsPluginRect {
00132     PRUint16            top;
00133     PRUint16            left;
00134     PRUint16            bottom;
00135     PRUint16            right;
00136 };
00137 
00139 // Unix specific structures and definitions
00140 
00141 #ifdef XP_UNIX
00142 
00143 #include <stdio.h>
00144 
00145 /*
00146  * Callback Structures.
00147  *
00148  * These are used to pass additional platform specific information.
00149  */
00150 enum nsPluginCallbackType {
00151     nsPluginCallbackType_SetWindow = 1,
00152     nsPluginCallbackType_Print
00153 };
00154 
00155 struct nsPluginAnyCallbackStruct {
00156     PRInt32     type;
00157 };
00158 
00159 #ifdef MOZ_X11
00160 struct nsPluginSetWindowCallbackStruct {
00161     PRInt32     type;
00162     Display*    display;
00163     Visual*     visual;
00164     Colormap    colormap;
00165     PRUint32    depth;
00166 };
00167 #else
00168 struct nsPluginSetWindowCallbackStruct {
00169     PRInt32     type;
00170 };
00171 #endif
00172 
00173 
00174 struct nsPluginPrintCallbackStruct {
00175     PRInt32     type;
00176     FILE*       fp;
00177 };
00178 
00179 #endif /* XP_UNIX */
00180 
00182 
00183 // List of variables which should be implmented by the plugin
00184 enum nsPluginVariable {
00185     nsPluginVariable_NameString                      = 1,
00186     nsPluginVariable_DescriptionString               = 2
00187 };
00188 
00189 enum nsPluginManagerVariable {
00190     nsPluginManagerVariable_XDisplay                 = 1,
00191     nsPluginManagerVariable_XtAppContext             = 2,
00192     nsPluginManagerVariable_SupportsXEmbed            = 14
00193 };
00194 
00195 enum nsPluginInstancePeerVariable {
00196     nsPluginInstancePeerVariable_NetscapeWindow      = 3
00197 //    nsPluginInstancePeerVariable_JavaClass              = 5,
00198 //    nsPluginInstancePeerVariable_TimerInterval          = 7
00199 };
00200 
00201 enum nsPluginInstanceVariable {
00202     nsPluginInstanceVariable_WindowlessBool          = 3,
00203     nsPluginInstanceVariable_TransparentBool         = 4,
00204     nsPluginInstanceVariable_DoCacheBool             = 5,
00205     nsPluginInstanceVariable_CallSetWindowAfterDestroyBool = 6,
00206     nsPluginInstanceVariable_ScriptableInstance      = 10,
00207     nsPluginInstanceVariable_ScriptableIID           = 11,
00208     nsPluginInstanceVariable_NeedsXEmbed             = 14
00209 };
00210 
00212 
00213 enum nsPluginMode {
00214     nsPluginMode_Embedded = 1,
00215     nsPluginMode_Full
00216 };
00217 
00218 // XXX this can go away now
00219 enum nsPluginStreamType {
00220     nsPluginStreamType_Normal = 1,
00221     nsPluginStreamType_Seek,
00222     nsPluginStreamType_AsFile,
00223     nsPluginStreamType_AsFileOnly
00224 };
00225 
00226 /*
00227  * The type of a nsPluginWindow - it specifies the type of the data structure
00228  * returned in the window field.
00229  */
00230 enum nsPluginWindowType {
00231     nsPluginWindowType_Window = 1,
00232     nsPluginWindowType_Drawable
00233 };
00234 
00235 #if defined(XP_MAC) || defined(XP_MACOSX)
00236 
00237 struct nsPluginPort {
00238     CGrafPtr     port;   /* Grafport */
00239     PRInt32     portx;  /* position inside the topmost window */
00240     PRInt32     porty;
00241 };
00242 typedef RgnHandle       nsPluginRegion;
00243 typedef WindowRef       nsPluginPlatformWindowRef;
00244 
00245 #elif defined(XP_WIN) || defined(XP_OS2)
00246 
00247 struct nsPluginPort;
00248 typedef HRGN            nsPluginRegion;
00249 typedef HWND            nsPluginPlatformWindowRef;
00250 
00251 #elif defined(XP_UNIX) && defined(MOZ_X11)
00252 
00253 struct nsPluginPort;
00254 typedef Region          nsPluginRegion;
00255 typedef Drawable        nsPluginPlatformWindowRef;
00256 
00257 #else
00258 
00259 struct nsPluginPort;
00260 typedef void*           nsPluginRegion;
00261 typedef void*           nsPluginPlatformWindowRef;
00262 
00263 #endif
00264 
00265 struct nsPluginWindow {
00266     nsPluginPort* window;       /* Platform specific window handle */
00267                                 /* OS/2: x - Position of bottom left corner  */
00268                                 /* OS/2: y - relative to visible netscape window */
00269     PRInt32       x;            /* Position of top left corner relative */
00270     PRInt32       y;            /* to a netscape page.                              */
00271     PRUint32      width;        /* Maximum window size */
00272     PRUint32      height;
00273     nsPluginRect  clipRect;     /* Clipping rectangle in port coordinates */
00274                                 /* Used by MAC only.                    */
00275 #if defined(XP_UNIX) && !defined(XP_MACOSX)
00276     void*         ws_info;      /* Platform-dependent additonal data */
00277 #endif /* XP_UNIX */
00278     nsPluginWindowType type;    /* Is this a window or a drawable? */
00279 };
00280 
00281 struct nsPluginFullPrint {
00282     PRBool      pluginPrinted;     /* Set TRUE if plugin handled fullscreen */
00283                                 /* printing                                                 */
00284     PRBool      printOne;       /* TRUE if plugin should print one copy  */
00285                                 /* to default printer                                */
00286     void*       platformPrint;  /* Platform-specific printing info */
00287 };
00288 
00289 struct nsPluginEmbedPrint {
00290     nsPluginWindow    window;
00291     void*             platformPrint;      /* Platform-specific printing info */
00292 };
00293 
00294 struct nsPluginPrint {
00295     PRUint16                  mode;         /* nsPluginMode_Full or nsPluginMode_Embedded */
00296     union
00297     {
00298         nsPluginFullPrint     fullPrint;  /* if mode is nsPluginMode_Full */
00299         nsPluginEmbedPrint    embedPrint; /* if mode is nsPluginMode_Embedded */
00300     } print;
00301 };
00302 
00303 struct nsPluginEvent {
00304 
00305 #if defined(XP_MAC) || defined(XP_MACOSX)
00306     EventRecord*                event;
00307     nsPluginPlatformWindowRef   window;
00308 
00309 #elif defined(XP_OS2)
00310     uint32      event;
00311     uint32      wParam;
00312     uint32      lParam;
00313 
00314 #elif defined(XP_WIN)
00315     uint16      event;
00316     uint32      wParam;
00317     uint32      lParam;
00318 
00319 #elif defined(XP_UNIX) && defined(MOZ_X11)
00320     XEvent      event;
00321 #else
00322     void        *event;
00323 #endif
00324 };
00325 
00326 /*
00327  *  Non-standard event types that can be passed to HandleEvent
00328  *  (These need to be kept in sync with the events defined in npapi.h.)
00329  */
00330 enum nsPluginEventType {
00331 #if defined(XP_MAC) || defined(XP_MACOSX)
00332     nsPluginEventType_GetFocusEvent = (osEvt + 16),
00333     nsPluginEventType_LoseFocusEvent,
00334     nsPluginEventType_AdjustCursorEvent,
00335     nsPluginEventType_MenuCommandEvent,
00336     nsPluginEventType_ClippingChangedEvent,
00337     nsPluginEventType_ScrollingBeginsEvent,
00338     nsPluginEventType_ScrollingEndsEvent,
00339 #endif /* XP_MAC || XP_MACOSX */
00340     nsPluginEventType_Idle                 = 0
00341 };
00342 
00344 
00345 enum nsPluginReason {
00346     nsPluginReason_Base = 0,
00347     nsPluginReason_Done = 0,
00348     nsPluginReason_NetworkErr,
00349     nsPluginReason_UserBreak,
00350     nsPluginReason_NoReason
00351 };
00352 
00354 // Version Numbers for Structs
00355 
00356 // These version number are for structures whose fields may evolve over time.
00357 // When fields are added to the end of the struct, the minor version will be
00358 // incremented. When the struct changes in an incompatible way the major version
00359 // will be incremented. 
00360 
00361 #define nsMajorVersion(v)       (((PRInt32)(v) >> 16) & 0xffff)
00362 #define nsMinorVersion(v)       ((PRInt32)(v) & 0xffff)
00363 
00364 #define nsVersionOK(suppliedV, requiredV)                   \
00365     (nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
00366      && nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
00367 
00368 #define NP_POPUP_API_VERSION 16
00369 
00371 // Classes
00373 
00374 // Classes that must be implemented by the plugin DLL:
00375 class nsIPlugin;                        // plugin class (MIME-type handler)
00376 class nsIEventHandler;                  // event handler interface
00377 class nsIPluginInstance;                // plugin instance
00378 
00379 // Classes that are implemented by the browser:
00380 class nsIPluginManager;                 // minimum browser requirements
00381 class nsIFileUtilities;                 // file utilities (accessible from nsIPluginManager)
00382 class nsIPluginInstancePeer;            // parts of nsIPluginInstance implemented by the browser
00383 class nsIWindowlessPluginInstancePeer;  // subclass of nsIPluginInstancePeer for windowless plugins
00384 class nsIPluginTagInfo;                 // describes html tag (accessible from nsIPluginInstancePeer)
00386 
00387 #ifdef XP_MAC
00388 #pragma options align=reset
00389 #endif
00390 
00391 #endif /* RC_INVOKED */
00392 #ifdef __OS2__
00393 #pragma pack()
00394 #endif
00395 
00396 #endif // nsplugindefs_h___