]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/contrib/dllwidget/dllwidget_.i
Added missing CreateManifest() to initialisation
[wxWidgets.git] / wxPython / contrib / dllwidget / dllwidget_.i
... / ...
CommitLineData
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 // Put some wx default wxChar* values into wxStrings.
34 static const wxString wxPyEmptyString(wxT(""));
35%}
36
37//---------------------------------------------------------------------------
38
39/*
40
41wxDllWidget can be used to embed a wxWindow implemented in C++ in your
42wxPython application without the need to write a SWIG interface. Widget's code
43is stored in shared library or DLL that exports DLL_WidgetFactory symbol
44and loaded at runtime. All you have to do is to pass the name of DLL and the class
45to create to wxDllWidget's ctor.
46
47Runtime-loadable widget must have HandleCommand method (see the example) that is
48used to communicate with Python app. You call wxDllWidget.SendCommand(cmd,param) from
49Python and it in turn calls HandleCommand of the loaded widget.
50
51You must use DECLARE_DLL_WIDGET, BEGIN_WIDGET_LIBRARY, END_WIDGET_LIBRARY and
52REGISTER_WIDGET macros in your C++ module in order to provide all the meat
53wxDllWidget needs.
54
55Example of use:
56
57 #define CMD_MAKEWHITE 1
58
59 class MyWindow : public wxWindow
60 {
61 public:
62 MyWindow(wxWindow *parent, long style)
63 : wxWindow(parent, -1) {}
64
65 int HandleCommand(int cmd, const wxString& param)
66 {
67 if (cmd == CMD_MAKEWHITE)
68 SetBackgroundColour(*wxWHITE);
69 return 0;
70 }
71 };
72 DECLARE_DLL_WIDGET(MyWindow)
73
74 class MyCanvasWindow : public wxScrolledWindow
75 {
76 ...
77 };
78 DECLARE_DLL_WIDGET(MyCanvasWindow)
79
80 BEGIN_WIDGET_LIBRARY()
81 REGISTER_WIDGET(MyWindow)
82 REGISTER_WIDGET(MyCanvasWindow)
83 END_WIDGET_LIBRARY()
84
85*/
86
87class wxDllWidget : public wxPanel
88{
89public:
90 wxDllWidget(wxWindow *parent,
91 wxWindowID id = -1,
92 const wxString& dllName = wxPyEmptyString,
93 const wxString& className = wxPyEmptyString,
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize,
96 long style = 0);
97
98 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
99
100 bool Ok();
101
102 int SendCommand(int cmd, const wxString& param = wxPyEmptyString);
103 wxWindow* GetWidgetWindow();
104
105 static wxString GetDllExt();
106};
107
108//---------------------------------------------------------------------------
109
110%init %{
111
112 wxClassInfo::CleanUpClasses();
113 wxClassInfo::InitializeClasses();
114
115%}
116
117
118//---------------------------------------------------------------------------