]> git.saurik.com Git - wxWidgets.git/blob - samples/mdi/mdi.h
Fixed problems caused by duplicated names across different style types.
[wxWidgets.git] / samples / mdi / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mdi.cpp
3 // Purpose: MDI sample
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/toolbar.h"
13
14 // Define a new application
15 class MyApp : public wxApp
16 {
17 public:
18 virtual bool OnInit();
19 };
20
21 class MyCanvas : public wxScrolledWindow
22 {
23 public:
24 MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
25 virtual void OnDraw(wxDC& dc);
26
27 bool IsDirty() const { return m_dirty; }
28
29 void SetText(const wxString& text) { m_text = text; Refresh(); }
30
31 private:
32 void OnEvent(wxMouseEvent& event);
33
34 wxString m_text;
35
36 bool m_dirty;
37
38 DECLARE_EVENT_TABLE()
39 };
40
41 // Define a new frame
42 class MyFrame : public wxMDIParentFrame
43 {
44 public:
45 MyFrame();
46 virtual ~MyFrame();
47
48 static wxMenuBar *CreateMainMenubar();
49
50 private:
51 void InitToolBar(wxToolBar* toolBar);
52
53 void OnSize(wxSizeEvent& event);
54 void OnAbout(wxCommandEvent& event);
55 void OnNewWindow(wxCommandEvent& event);
56 void OnFullScreen(wxCommandEvent& event);
57 void OnQuit(wxCommandEvent& event);
58 void OnCloseAll(wxCommandEvent& event);
59
60 void OnClose(wxCloseEvent& event);
61
62 wxTextCtrl *m_textWindow;
63
64 DECLARE_EVENT_TABLE()
65 };
66
67 class MyChild : public wxMDIChildFrame
68 {
69 public:
70 MyChild(wxMDIParentFrame *parent);
71 virtual ~MyChild();
72
73 static unsigned GetChildrenCount() { return ms_numChildren; }
74
75 private:
76 void OnActivate(wxActivateEvent& event);
77
78 void OnRefresh(wxCommandEvent& event);
79 void OnUpdateRefresh(wxUpdateUIEvent& event);
80 void OnChangeTitle(wxCommandEvent& event);
81 void OnChangePosition(wxCommandEvent& event);
82 void OnChangeSize(wxCommandEvent& event);
83 void OnClose(wxCommandEvent& event);
84 void OnSize(wxSizeEvent& event);
85 void OnMove(wxMoveEvent& event);
86 void OnCloseWindow(wxCloseEvent& event);
87
88 #if wxUSE_CLIPBOARD
89 void OnPaste(wxCommandEvent& event);
90 void OnUpdatePaste(wxUpdateUIEvent& event);
91 #endif // wxUSE_CLIPBOARD
92
93 static unsigned ms_numChildren;
94
95 MyCanvas *m_canvas;
96
97 // simple test event handler class
98 class EventHandler : public wxEvtHandler
99 {
100 public:
101 EventHandler(unsigned numChild) : m_numChild(numChild) { }
102
103 private:
104 void OnRefresh(wxCommandEvent& event)
105 {
106 wxLogMessage("Child #%u refreshed.", m_numChild);
107 event.Skip();
108 }
109
110 const unsigned m_numChild;
111
112 DECLARE_EVENT_TABLE()
113
114 wxDECLARE_NO_COPY_CLASS(EventHandler);
115 };
116
117 DECLARE_EVENT_TABLE()
118 };
119
120 // menu items ids
121 enum
122 {
123 MDI_FULLSCREEN = 100,
124 MDI_REFRESH,
125 MDI_CHANGE_TITLE,
126 MDI_CHANGE_POSITION,
127 MDI_CHANGE_SIZE
128 };