]> git.saurik.com Git - wxWidgets.git/blob - utils/nplugin/src/npframe.h
Fixes to my last commit.
[wxWidgets.git] / utils / nplugin / src / npframe.h
1 /*
2 * File: NPFrame.h
3 * Purpose: wxPluginFrame declaration
4 * Author: Julian Smart
5 * Created: 1997
6 * Updated:
7 * Copyright: (c) Julian Smart
8 */
9
10 #ifndef __PLUGINFRAME__
11 #define __PLUGINFRAME__
12
13 #include "wx/frame.h"
14 #include "NPApp.h"
15 #include "npapi.h"
16
17 WXDLLEXPORT extern const char *wxFrameNameStr;
18
19 class wxPrinterDC;
20 class WXDLLEXPORT wxPluginFrame: public wxFrame
21 {
22 DECLARE_DYNAMIC_CLASS(wxPluginFrame)
23
24 public:
25 wxPluginFrame(void);
26 inline wxPluginFrame(const wxPluginData& data)
27 {
28 m_npWindow = NULL;
29 m_npInstance = NULL;
30 m_nAttributes = 0;
31 m_names = NULL;
32 m_values = NULL;
33
34 Create(data);
35 }
36
37 ~wxPluginFrame(void);
38
39 bool Create(const wxPluginData& data);
40
41 // Sets and subclasses the platform-specific window handle
42 virtual bool SetNPWindow(NPWindow *window);
43 inline NPWindow *GetNPWindow(void) { return m_npWindow; }
44
45 void SetClientSize(const int width, const int height);
46 void GetClientSize(int *width, int *height) const;
47
48 void GetSize(int *width, int *height) const ;
49 void GetPosition(int *x, int *y) const ;
50 void SetSize(const int x, const int y, const int width, const int height, const int sizeFlags = wxSIZE_AUTO);
51
52 // Accessors
53 inline int GetAttributeCount(void) const { return m_nAttributes; }
54 inline wxString GetAttributeName(const int n) { return m_names[n]; }
55 inline wxString GetAttributeValue(const int n) { return m_values[n]; }
56
57 void SetAttributeValues(const int n, const char* argn[], const char *argv[]);
58 void SetAttributeValues(const int n, const wxString* argn, const wxString* argv);
59 inline void SetInstance(const NPP instance) { m_npInstance = instance; };
60 inline NPP GetInstance(void) { return m_npInstance; }
61
62 // Overridables: low-level
63 virtual NPError OnNPNewStream(NPMIMEType type, NPStream *stream, bool seekable, uint16* stype);
64 virtual void OnNPNewFile(NPStream *stream, const wxString& fname);
65 virtual void OnNPPrint(NPPrint* printInfo);
66
67 // Overridables: high-level
68 virtual void OnPrint(wxPrinterDC& dc, wxRect& rect);
69 virtual void OnDraw(wxDC& dc);
70
71 protected:
72
73 wxString* m_names;
74 wxString* m_values;
75 int m_nAttributes;
76 NPP m_npInstance;
77 NPWindow* m_npWindow;
78 };
79
80 #endif
81