front_idill/extern/fajran-npTuioClient/src/pluginbase.h
author bastiena
Fri, 06 Apr 2012 10:44:54 +0200
changeset 21 e4e5f02787a1
permissions -rw-r--r--
Front IDILL : Added Communication extern named fajran-npTuioClient It contains the project generating a dll used as a browser plugin.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     1
// 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     2
//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     3
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     4
// This program is free software; you can redistribute it and/or modify
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     5
// it under the terms of the GNU General Public License as published by
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     6
// the Free Software Foundation; either version 3 of the License, or
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     7
// (at your option) any later version.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     8
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     9
// This program is distributed in the hope that it will be useful,
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    12
// GNU General Public License for more details.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    13
// 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    14
// You should have received a copy of the GNU General Public License
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    15
// along with this program; if not, write to the Free Software
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    16
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    17
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    18
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    19
#ifndef PLUGINBASE_H_
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    20
#define PLUGINBASE_H_
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    22
#include <npapi.h>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    23
#include <npupp.h>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    24
#include <npruntime.h>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    25
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    26
#ifndef HIBYTE
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    27
#define HIBYTE(i) (i >> 8)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    28
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    29
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    30
#ifndef LOBYTE
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    31
#define LOBYTE(i) (i & 0xff)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    32
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    33
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    34
struct nsPluginCreateData
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    35
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    36
  NPP instance;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    37
  NPMIMEType type; 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    38
  uint16 mode; 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    39
  int16 argc; 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    40
  char** argn; 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    41
  char** argv; 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    42
  NPSavedData* saved;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    43
};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    44
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    45
class nsPluginInstanceBase
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    46
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    47
 public:
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    48
  virtual ~nsPluginInstanceBase() { return; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    49
 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    50
  // these three methods must be implemented in the derived
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    51
  // class platform specific way
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    52
  virtual NPBool init(NPWindow* aWindow) = 0;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    53
  virtual void shut() = 0;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    54
  virtual NPBool isInitialized() = 0;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    55
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    56
  // implement all or part of those methods in the derived 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    57
  // class as needed
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    58
  virtual NPError SetWindow(NPWindow* /*pNPWindow*/)                    { return NPERR_NO_ERROR; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    59
  virtual NPError WriteStatus(const char* /*msg*/) const                     { return NPERR_NO_ERROR; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    60
  virtual NPError NewStream(NPMIMEType /*type*/, NPStream* /*stream*/, 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    61
                            NPBool /*seekable*/, uint16* /*stype*/)         { return NPERR_NO_ERROR; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    62
  virtual NPError DestroyStream(NPStream* /*stream*/, NPError /*reason*/)   { return NPERR_NO_ERROR; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    63
  virtual void    StreamAsFile(NPStream* /*stream*/, const char* /*fname*/) { return; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    64
  virtual int32_t WriteReady(NPStream* /*stream*/)                      { return 0x0fffffff; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    65
  virtual int32   Write(NPStream* /*stream*/, int32 /*offset*/, 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    66
                        int32 len, void* /*buffer*/)                    { return len; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    67
  virtual void    Print(NPPrint* /*printInfo*/)                         { return; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    68
  virtual uint16  HandleEvent(void* /*event*/)                          { return 0; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    69
  virtual void    URLNotify(const char* /*url*/, NPReason /*reason*/, 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    70
                            void* /*notifyData*/)                       { return; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    71
  virtual NPError GetValue(NPPVariable /*variable*/, void* /*value*/)       { return NPERR_NO_ERROR; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    72
  virtual NPError SetValue(NPNVariable /*variable*/, void* /*value*/)       { return NPERR_NO_ERROR; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    73
};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    74
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    75
// functions that should be implemented for each specific plugin
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    76
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    77
// creation and destruction of the object of the derived class
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    78
nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData * aCreateDataStruct);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    79
void NS_DestroyPluginInstance(nsPluginInstanceBase * aPlugin);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    80
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    81
// global plugin initialization and shutdown
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    82
NPError NS_PluginInitialize();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    83
void NS_PluginShutdown();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    84
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    85
// FIXME #ifdef XP_UNIX
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    86
// global to get plugins name & description 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    87
NPError NS_PluginGetValue(NPPVariable aVariable, void *aValue);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    88
// FIXME #endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    89
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    90
#endif // __PLUGININSTANCEBASE_H__