]>
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 | ||
c9f856af VZ |
31 | void SetText(const wxString& text) { m_text = text; Refresh(); } |
32 | ||
c52d95b4 | 33 | private: |
c9f856af VZ |
34 | wxString m_text; |
35 | ||
c52d95b4 VZ |
36 | bool m_dirty; |
37 | ||
c801d85f KB |
38 | DECLARE_EVENT_TABLE() |
39 | }; | |
40 | ||
c801d85f | 41 | // Define a new frame |
c52d95b4 | 42 | class MyFrame : public wxMDIParentFrame |
c801d85f | 43 | { |
c52d95b4 | 44 | public: |
c801d85f | 45 | wxTextCtrl *textWindow; |
c52d95b4 VZ |
46 | |
47 | MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, | |
48 | const wxPoint& pos, const wxSize& size, const long style); | |
81d66cf3 JS |
49 | |
50 | void InitToolBar(wxToolBar* toolBar); | |
51 | ||
c801d85f KB |
52 | void OnSize(wxSizeEvent& event); |
53 | void OnAbout(wxCommandEvent& event); | |
54 | void OnNewWindow(wxCommandEvent& event); | |
55 | void OnQuit(wxCommandEvent& event); | |
c52d95b4 | 56 | void OnClose(wxCloseEvent& event); |
c801d85f | 57 | |
c52d95b4 | 58 | DECLARE_EVENT_TABLE() |
c801d85f KB |
59 | }; |
60 | ||
61 | class MyChild: public wxMDIChildFrame | |
62 | { | |
c52d95b4 | 63 | public: |
c801d85f | 64 | MyCanvas *canvas; |
eb839c84 | 65 | MyChild(wxMDIParentFrame *parent, const wxString& title); |
c52d95b4 VZ |
66 | ~MyChild(); |
67 | ||
c801d85f | 68 | void OnActivate(wxActivateEvent& event); |
c52d95b4 VZ |
69 | |
70 | void OnRefresh(wxCommandEvent& event); | |
fa762db4 | 71 | void OnUpdateRefresh(wxUpdateUIEvent& event); |
f6bcfd97 | 72 | void OnChangeTitle(wxCommandEvent& event); |
fa762db4 VZ |
73 | void OnChangePosition(wxCommandEvent& event); |
74 | void OnChangeSize(wxCommandEvent& event); | |
c801d85f | 75 | void OnQuit(wxCommandEvent& event); |
fa762db4 VZ |
76 | void OnSize(wxSizeEvent& event); |
77 | void OnMove(wxMoveEvent& event); | |
c52d95b4 | 78 | void OnClose(wxCloseEvent& event); |
c801d85f | 79 | |
c9f856af VZ |
80 | #if wxUSE_CLIPBOARD |
81 | void OnPaste(wxCommandEvent& event); | |
82 | void OnUpdatePaste(wxUpdateUIEvent& event); | |
83 | #endif // wxUSE_CLIPBOARD | |
84 | ||
c52d95b4 | 85 | DECLARE_EVENT_TABLE() |
c801d85f KB |
86 | }; |
87 | ||
c52d95b4 VZ |
88 | // menu items ids |
89 | enum | |
90 | { | |
91b07357 JS |
91 | MDI_QUIT = wxID_EXIT, |
92 | MDI_NEW_WINDOW = 101, | |
c52d95b4 | 93 | MDI_REFRESH, |
f6bcfd97 | 94 | MDI_CHANGE_TITLE, |
fa762db4 VZ |
95 | MDI_CHANGE_POSITION, |
96 | MDI_CHANGE_SIZE, | |
c52d95b4 | 97 | MDI_CHILD_QUIT, |
91b07357 | 98 | MDI_ABOUT = wxID_ABOUT |
c52d95b4 | 99 | }; |