]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/dllwidget/test_dll.cpp
Somehow the Validate(), TransferDataToWindow(),
[wxWidgets.git] / wxPython / demo / dllwidget / test_dll.cpp
1
2 #include <wx/defs.h>
3 #include <wx/window.h>
4 #include <wx/msgdlg.h>
5
6 #include "../../contrib/dllwidget/dllwidget.h"
7
8 class TestWindow : public wxWindow
9 {
10 public:
11 TestWindow(wxWindow *parent, long style)
12 : wxWindow(parent, -1)
13 {
14 SetBackgroundColour(wxColour("white"));
15 }
16
17 int HandleCommand(int cmd, const wxString& param)
18 {
19 if (cmd == 1)
20 {
21 SetBackgroundColour(wxColour("red"));
22 Refresh();
23 }
24
25 if (cmd == 2)
26 {
27 SetBackgroundColour(wxColour(param));
28 Refresh();
29 }
30
31 else if (cmd == 3)
32 {
33 wxMessageBox("Message from embedded widget:\n\n" + param);
34 }
35
36 return 0;
37 }
38 private:
39 DECLARE_ABSTRACT_CLASS(TestWindow)
40 };
41
42 IMPLEMENT_ABSTRACT_CLASS(TestWindow, wxWindow)
43
44
45 //DECLARE_DLL_WIDGET(TestWindow)
46 static int SendCommandToTestWindow(wxWindow *wnd, int cmd, const wxString& param)
47 {
48 return wxStaticCast(wnd, TestWindow)->HandleCommand(cmd, param);
49 }
50
51
52 BEGIN_WIDGET_LIBRARY()
53 REGISTER_WIDGET(TestWindow)
54 END_WIDGET_LIBRARY()