]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/dllwidget/dllwidget_.i
compilation fix
[wxWidgets.git] / wxPython / contrib / dllwidget / dllwidget_.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dllwidget_.i
3 // Purpose: Load wx widgets from external DLLs
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 04-Dec-2001
8 // RCS-ID: $Id$
9 // Copyright: (c) 2001 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %module dllwidget_
14
15
16 %{
17 #include "export.h"
18 #include "dllwidget.h"
19 %}
20
21 //---------------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25
26 %extern wx.i
27 %extern windows.i
28 %extern _defs.i
29
30 //---------------------------------------------------------------------------
31
32 /*
33
34 wxDllWidget can be used to embed a wxWindow implemented in C++ in your
35 wxPython application without the need to write a SWIG interface. Widget's code
36 is stored in shared library or DLL that exports DLL_WidgetFactory symbol
37 and loaded at runtime. All you have to do is to pass the name of DLL and the class
38 to create to wxDllWidget's ctor.
39
40 Runtime-loadable widget must have HandleCommand method (see the example) that is
41 used to communicate with Python app. You call wxDllWidget.SendCommand(cmd,param) from
42 Python and it in turn calls HandleCommand of the loaded widget.
43
44 You must use DECLARE_DLL_WIDGET, BEGIN_WIDGET_LIBRARY, END_WIDGET_LIBRARY and
45 REGISTER_WIDGET macros in your C++ module in order to provide all the meat
46 wxDllWidget needs.
47
48 Example of use:
49
50 #define CMD_MAKEWHITE 1
51
52 class MyWindow : public wxWindow
53 {
54 public:
55 MyWindow(wxWindow *parent, long style)
56 : wxWindow(parent, -1) {}
57
58 int HandleCommand(int cmd, const wxString& param)
59 {
60 if (cmd == CMD_MAKEWHITE)
61 SetBackgroundColour(*wxWHITE);
62 return 0;
63 }
64 };
65 DECLARE_DLL_WIDGET(MyWindow)
66
67 class MyCanvasWindow : public wxScrolledWindow
68 {
69 ...
70 };
71 DECLARE_DLL_WIDGET(MyCanvasWindow)
72
73 BEGIN_WIDGET_LIBRARY()
74 REGISTER_WIDGET(MyWindow)
75 REGISTER_WIDGET(MyCanvasWindow)
76 END_WIDGET_LIBRARY()
77
78 */
79
80 class wxDllWidget : public wxPanel
81 {
82 public:
83 wxDllWidget(wxWindow *parent,
84 wxWindowID id = -1,
85 const wxString& dllName = wxEmptyString,
86 const wxString& className = wxEmptyString,
87 const wxPoint& pos = wxDefaultPosition,
88 const wxSize& size = wxDefaultSize,
89 long style = 0);
90
91 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
92
93 bool Ok();
94
95 int SendCommand(int cmd, const wxString& param = wxEmptyString);
96 wxWindow* GetWidgetWindow();
97
98 static wxString GetDllExt();
99 };
100
101 //---------------------------------------------------------------------------
102
103 %init %{
104
105 wxClassInfo::CleanUpClasses();
106 wxClassInfo::InitializeClasses();
107
108 %}
109
110
111 //---------------------------------------------------------------------------