]> git.saurik.com Git - wxWidgets.git/blob - samples/mdi/mdi.h
adding a new topic overview about writing custom widgets; currently there's no offici...
[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 license
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 private:
49 void InitToolBar(wxToolBar* toolBar);
50
51 void OnSize(wxSizeEvent& event);
52 void OnAbout(wxCommandEvent& event);
53 void OnNewWindow(wxCommandEvent& event);
54 void OnQuit(wxCommandEvent& event);
55 void OnClose(wxCloseEvent& event);
56
57 wxTextCtrl *m_textWindow;
58
59 DECLARE_EVENT_TABLE()
60 };
61
62 class MyChild : public wxMDIChildFrame
63 {
64 public:
65 MyChild(wxMDIParentFrame *parent);
66 virtual ~MyChild();
67
68 static unsigned GetChildrenCount() { return ms_numChildren; }
69
70 private:
71 void OnActivate(wxActivateEvent& event);
72
73 void OnRefresh(wxCommandEvent& event);
74 void OnUpdateRefresh(wxUpdateUIEvent& event);
75 void OnChangeTitle(wxCommandEvent& event);
76 void OnChangePosition(wxCommandEvent& event);
77 void OnChangeSize(wxCommandEvent& event);
78 void OnClose(wxCommandEvent& event);
79 void OnSize(wxSizeEvent& event);
80 void OnMove(wxMoveEvent& event);
81 void OnCloseWindow(wxCloseEvent& event);
82
83 #if wxUSE_CLIPBOARD
84 void OnPaste(wxCommandEvent& event);
85 void OnUpdatePaste(wxUpdateUIEvent& event);
86 #endif // wxUSE_CLIPBOARD
87
88 static unsigned ms_numChildren;
89
90 MyCanvas *m_canvas;
91
92 DECLARE_EVENT_TABLE()
93 };
94
95 // menu items ids
96 enum
97 {
98 MDI_REFRESH,
99 MDI_CHANGE_TITLE,
100 MDI_CHANGE_POSITION,
101 MDI_CHANGE_SIZE
102 };