]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
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$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
c52d95b4 | 9 | // Licence: wxWindows license |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
012f2cb2 | 12 | #include "wx/toolbar.h" |
6b0eb19f | 13 | |
c801d85f | 14 | // Define a new application |
c52d95b4 | 15 | class MyApp : public wxApp |
c801d85f | 16 | { |
c52d95b4 VZ |
17 | public: |
18 | bool OnInit(); | |
c801d85f KB |
19 | }; |
20 | ||
c52d95b4 | 21 | class MyCanvas : public wxScrolledWindow |
c801d85f | 22 | { |
c52d95b4 | 23 | public: |
c801d85f KB |
24 | MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size); |
25 | virtual void OnDraw(wxDC& dc); | |
c52d95b4 VZ |
26 | |
27 | bool IsDirty() const { return m_dirty; } | |
28 | ||
c801d85f KB |
29 | void OnEvent(wxMouseEvent& event); |
30 | ||
c52d95b4 VZ |
31 | private: |
32 | bool m_dirty; | |
33 | ||
c801d85f KB |
34 | DECLARE_EVENT_TABLE() |
35 | }; | |
36 | ||
c801d85f | 37 | // Define a new frame |
c52d95b4 | 38 | class MyFrame : public wxMDIParentFrame |
c801d85f | 39 | { |
c52d95b4 | 40 | public: |
c801d85f | 41 | wxTextCtrl *textWindow; |
c52d95b4 VZ |
42 | |
43 | MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, | |
44 | const wxPoint& pos, const wxSize& size, const long style); | |
81d66cf3 JS |
45 | |
46 | void InitToolBar(wxToolBar* toolBar); | |
47 | ||
c801d85f | 48 | void OnSize(wxSizeEvent& event); |
77380b5c | 49 | void OnIconize(wxIconizeEvent& event); |
c801d85f KB |
50 | void OnAbout(wxCommandEvent& event); |
51 | void OnNewWindow(wxCommandEvent& event); | |
52 | void OnQuit(wxCommandEvent& event); | |
c52d95b4 | 53 | void OnClose(wxCloseEvent& event); |
c801d85f | 54 | |
c52d95b4 | 55 | DECLARE_EVENT_TABLE() |
c801d85f KB |
56 | }; |
57 | ||
58 | class MyChild: public wxMDIChildFrame | |
59 | { | |
c52d95b4 | 60 | public: |
c801d85f | 61 | MyCanvas *canvas; |
eb839c84 | 62 | MyChild(wxMDIParentFrame *parent, const wxString& title); |
c52d95b4 VZ |
63 | ~MyChild(); |
64 | ||
c801d85f | 65 | void OnActivate(wxActivateEvent& event); |
c52d95b4 VZ |
66 | |
67 | void OnRefresh(wxCommandEvent& event); | |
fa762db4 | 68 | void OnUpdateRefresh(wxUpdateUIEvent& event); |
f6bcfd97 | 69 | void OnChangeTitle(wxCommandEvent& event); |
fa762db4 VZ |
70 | void OnChangePosition(wxCommandEvent& event); |
71 | void OnChangeSize(wxCommandEvent& event); | |
c801d85f | 72 | void OnQuit(wxCommandEvent& event); |
fa762db4 VZ |
73 | void OnSize(wxSizeEvent& event); |
74 | void OnMove(wxMoveEvent& event); | |
c52d95b4 | 75 | void OnClose(wxCloseEvent& event); |
c801d85f | 76 | |
c52d95b4 | 77 | DECLARE_EVENT_TABLE() |
c801d85f KB |
78 | }; |
79 | ||
c52d95b4 VZ |
80 | // menu items ids |
81 | enum | |
82 | { | |
91b07357 JS |
83 | MDI_QUIT = wxID_EXIT, |
84 | MDI_NEW_WINDOW = 101, | |
c52d95b4 | 85 | MDI_REFRESH, |
f6bcfd97 | 86 | MDI_CHANGE_TITLE, |
fa762db4 VZ |
87 | MDI_CHANGE_POSITION, |
88 | MDI_CHANGE_SIZE, | |
c52d95b4 | 89 | MDI_CHILD_QUIT, |
91b07357 | 90 | MDI_ABOUT = wxID_ABOUT |
c52d95b4 | 91 | }; |