]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/dllwidget/test_dll.cpp
fixed wxConfig memory leak in wxFontMapper
[wxWidgets.git] / wxPython / demo / dllwidget / test_dll.cpp
CommitLineData
4a61305d
RD
1
2#include <wx/defs.h>
3#include <wx/window.h>
4#include <wx/msgdlg.h>
5
be050baf 6#include "../../contrib/dllwidget/dllwidget.h"
4a61305d
RD
7
8class TestWindow : public wxWindow
9{
10public:
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 }
38private:
39 DECLARE_ABSTRACT_CLASS(TestWindow)
40};
41
42IMPLEMENT_ABSTRACT_CLASS(TestWindow, wxWindow)
43
44
45//DECLARE_DLL_WIDGET(TestWindow)
46static int SendCommandToTestWindow(wxWindow *wnd, int cmd, const wxString& param)
47{
48 return wxStaticCast(wnd, TestWindow)->HandleCommand(cmd, param);
49}
50
51
52BEGIN_WIDGET_LIBRARY()
53 REGISTER_WIDGET(TestWindow)
54END_WIDGET_LIBRARY()