]>
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 KB |
48 | void OnSize(wxSizeEvent& event); |
49 | void OnAbout(wxCommandEvent& event); | |
50 | void OnNewWindow(wxCommandEvent& event); | |
51 | void OnQuit(wxCommandEvent& event); | |
c52d95b4 | 52 | void OnClose(wxCloseEvent& event); |
c801d85f | 53 | |
c52d95b4 | 54 | DECLARE_EVENT_TABLE() |
c801d85f KB |
55 | }; |
56 | ||
57 | class MyChild: public wxMDIChildFrame | |
58 | { | |
c52d95b4 | 59 | public: |
c801d85f | 60 | MyCanvas *canvas; |
eb839c84 | 61 | MyChild(wxMDIParentFrame *parent, const wxString& title); |
c52d95b4 VZ |
62 | ~MyChild(); |
63 | ||
c801d85f | 64 | void OnActivate(wxActivateEvent& event); |
c52d95b4 VZ |
65 | |
66 | void OnRefresh(wxCommandEvent& event); | |
fa762db4 | 67 | void OnUpdateRefresh(wxUpdateUIEvent& event); |
f6bcfd97 | 68 | void OnChangeTitle(wxCommandEvent& event); |
fa762db4 VZ |
69 | void OnChangePosition(wxCommandEvent& event); |
70 | void OnChangeSize(wxCommandEvent& event); | |
c801d85f | 71 | void OnQuit(wxCommandEvent& event); |
fa762db4 VZ |
72 | void OnSize(wxSizeEvent& event); |
73 | void OnMove(wxMoveEvent& event); | |
c52d95b4 | 74 | void OnClose(wxCloseEvent& event); |
c801d85f | 75 | |
c52d95b4 | 76 | DECLARE_EVENT_TABLE() |
c801d85f KB |
77 | }; |
78 | ||
c52d95b4 VZ |
79 | // menu items ids |
80 | enum | |
81 | { | |
91b07357 JS |
82 | MDI_QUIT = wxID_EXIT, |
83 | MDI_NEW_WINDOW = 101, | |
c52d95b4 | 84 | MDI_REFRESH, |
f6bcfd97 | 85 | MDI_CHANGE_TITLE, |
fa762db4 VZ |
86 | MDI_CHANGE_POSITION, |
87 | MDI_CHANGE_SIZE, | |
c52d95b4 | 88 | MDI_CHILD_QUIT, |
91b07357 | 89 | MDI_ABOUT = wxID_ABOUT |
c52d95b4 | 90 | }; |