]> git.saurik.com Git - wxWidgets.git/blob - samples/mdi/mdi.h
Add a very simple example of a Win32 application using wx DLL.
[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 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 DECLARE_EVENT_TABLE()
98 };
99
100 // menu items ids
101 enum
102 {
103 MDI_FULLSCREEN = 100,
104 MDI_REFRESH,
105 MDI_CHANGE_TITLE,
106 MDI_CHANGE_POSITION,
107 MDI_CHANGE_SIZE
108 };