]>
Commit | Line | Data |
---|---|---|
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 | |
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 | 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 OnEvent(wxMouseEvent& event); | |
30 | ||
31 | private: | |
32 | bool m_dirty; | |
33 | ||
34 | DECLARE_EVENT_TABLE() | |
35 | }; | |
36 | ||
37 | // Define a new frame | |
38 | class MyFrame : public wxMDIParentFrame | |
39 | { | |
40 | public: | |
41 | wxTextCtrl *textWindow; | |
42 | ||
43 | MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, | |
44 | const wxPoint& pos, const wxSize& size, const long style); | |
45 | ||
46 | void InitToolBar(wxToolBar* toolBar); | |
47 | ||
48 | void OnSize(wxSizeEvent& event); | |
49 | void OnAbout(wxCommandEvent& event); | |
50 | void OnNewWindow(wxCommandEvent& event); | |
51 | void OnQuit(wxCommandEvent& event); | |
52 | void OnClose(wxCloseEvent& event); | |
53 | ||
54 | DECLARE_EVENT_TABLE() | |
55 | }; | |
56 | ||
57 | class MyChild: public wxMDIChildFrame | |
58 | { | |
59 | public: | |
60 | MyCanvas *canvas; | |
61 | MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); | |
62 | ~MyChild(); | |
63 | ||
64 | void OnActivate(wxActivateEvent& event); | |
65 | ||
66 | void OnRefresh(wxCommandEvent& event); | |
67 | void OnUpdateRefresh(wxUpdateUIEvent& event); | |
68 | void OnChangeTitle(wxCommandEvent& event); | |
69 | void OnChangePosition(wxCommandEvent& event); | |
70 | void OnChangeSize(wxCommandEvent& event); | |
71 | void OnQuit(wxCommandEvent& event); | |
72 | void OnSize(wxSizeEvent& event); | |
73 | void OnMove(wxMoveEvent& event); | |
74 | void OnClose(wxCloseEvent& event); | |
75 | ||
76 | DECLARE_EVENT_TABLE() | |
77 | }; | |
78 | ||
79 | // menu items ids | |
80 | enum | |
81 | { | |
82 | MDI_QUIT = 100, | |
83 | MDI_NEW_WINDOW, | |
84 | MDI_REFRESH, | |
85 | MDI_CHANGE_TITLE, | |
86 | MDI_CHANGE_POSITION, | |
87 | MDI_CHANGE_SIZE, | |
88 | MDI_CHILD_QUIT, | |
89 | MDI_ABOUT | |
90 | }; |