]> git.saurik.com Git - wxWidgets.git/blob - utils/nplugin/src/npapp.h
Unicode compilation fix
[wxWidgets.git] / utils / nplugin / src / npapp.h
1 /*
2 * File: NPApp.h
3 * Purpose: wxPluginApp declaration
4 * Author: Julian Smart
5 * Created: 1997
6 * Updated:
7 * Copyright: (c) Julian Smart
8 */
9
10 #ifndef __PLUGINAPP__
11 #define __PLUGINAPP__
12
13 #include "wx/wx.h"
14 #include "npapi.h"
15
16 class wxPluginFrame;
17
18 // Data passed to OnNewInstance
19 class wxPluginData
20 {
21 public:
22 NPP m_instance;
23 NPMIMEType m_type;
24 NPWindow* m_window;
25 int m_mode;
26 int m_argc;
27 wxString* m_argn;
28 wxString* m_argv;
29 };
30
31 class WXDLLEXPORT wxPluginApp: public wxApp
32 {
33 DECLARE_ABSTRACT_CLASS(wxPluginApp)
34
35 public:
36 wxPluginApp(void);
37 ~wxPluginApp(void);
38
39 // Find a frame given a NP instance
40 wxPluginFrame *FindFrame(NPP instance);
41
42 // Add a frame
43 void AddFrame(wxPluginFrame *frame);
44
45 // Remove a frame
46 void RemoveFrame(wxPluginFrame *frame);
47
48 // Set attribute/values for the last instance
49 void SetAttributeValues(const int n, char *argn[], char *argv[]);
50
51 ///////////////////////////////////////////////////////////////
52 // Higher-level API than NP API
53 virtual wxPluginFrame *OnNewInstance(const wxPluginData& data) = 0;
54
55 ///////////////////////////////////////////////////////////////
56 // Netscape Plugin API calls routed via wxPluginApp
57
58 virtual NPError NPP_Destroy(NPP instance, NPSavedData** save);
59 virtual NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason);
60 // virtual jref NPP_GetJavaClass(void);
61 virtual NPError NPP_Initialize(void);
62 virtual NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
63 int16 argc, char* argn[], char* argv[], NPSavedData* saved);
64 virtual NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream,
65 NPBool seekable, uint16* stype);
66 virtual void NPP_Print(NPP instance, NPPrint* platformPrint);
67 virtual NPError NPP_SetWindow(NPP instance, NPWindow* window);
68 virtual void NPP_Shutdown(void);
69 virtual void NPP_StreamAsFile(NPP instance, NPStream* stream, const char *fname);
70 /*
71 virtual void NPP_URLNotify(NPP instance, const char* url, NPReason reason,
72 void* notifyData);
73 */
74 virtual int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
75 void* buf);
76 virtual int32 NPP_WriteReady(NPP instance, NPStream* stream);
77
78 protected:
79
80 // List of plugin frames
81 wxList m_frames;
82
83 // Temporary NPP_New arguments so we can wait until NPP_SetWindow is called
84 // before creating a frame
85 wxPluginData m_data;
86 };
87
88 wxPluginApp *wxGetPluginApp(void);
89
90 #endif
91