]>
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$ | |
8 | // Copyright: (c) Julian Smart and Markus Holzem | |
c52d95b4 | 9 | // Licence: wxWindows license |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
b979f877 | 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 KB |
60 | MyCanvas *canvas; |
61 | MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); | |
c52d95b4 VZ |
62 | ~MyChild(); |
63 | ||
c801d85f | 64 | void OnActivate(wxActivateEvent& event); |
c52d95b4 VZ |
65 | |
66 | void OnRefresh(wxCommandEvent& event); | |
f6bcfd97 | 67 | void OnChangeTitle(wxCommandEvent& event); |
c801d85f | 68 | void OnQuit(wxCommandEvent& event); |
c52d95b4 | 69 | void OnClose(wxCloseEvent& event); |
c801d85f | 70 | |
c52d95b4 | 71 | DECLARE_EVENT_TABLE() |
c801d85f KB |
72 | }; |
73 | ||
c52d95b4 VZ |
74 | // menu items ids |
75 | enum | |
76 | { | |
77 | MDI_QUIT = 100, | |
78 | MDI_NEW_WINDOW, | |
79 | MDI_REFRESH, | |
f6bcfd97 | 80 | MDI_CHANGE_TITLE, |
c52d95b4 VZ |
81 | MDI_CHILD_QUIT, |
82 | MDI_ABOUT | |
83 | }; |