]> git.saurik.com Git - wxWidgets.git/blame - samples/mdi/mdi.h
miscellaneous small enhancements
[wxWidgets.git] / samples / mdi / mdi.h
CommitLineData
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 15class MyApp : public wxApp
c801d85f 16{
c52d95b4 17public:
d2824cdb 18 virtual bool OnInit();
c801d85f
KB
19};
20
c52d95b4 21class MyCanvas : public wxScrolledWindow
c801d85f 22{
c52d95b4 23public:
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
c9f856af
VZ
29 void SetText(const wxString& text) { m_text = text; Refresh(); }
30
c52d95b4 31private:
d2824cdb
VZ
32 void OnEvent(wxMouseEvent& event);
33
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 42class MyFrame : public wxMDIParentFrame
c801d85f 43{
c52d95b4 44public:
d2824cdb
VZ
45 MyFrame();
46 virtual ~MyFrame();
81d66cf3 47
d2824cdb 48private:
81d66cf3
JS
49 void InitToolBar(wxToolBar* toolBar);
50
c801d85f
KB
51 void OnSize(wxSizeEvent& event);
52 void OnAbout(wxCommandEvent& event);
53 void OnNewWindow(wxCommandEvent& event);
54 void OnQuit(wxCommandEvent& event);
c52d95b4 55 void OnClose(wxCloseEvent& event);
c801d85f 56
d2824cdb
VZ
57 wxTextCtrl *m_textWindow;
58
c52d95b4 59 DECLARE_EVENT_TABLE()
c801d85f
KB
60};
61
d2824cdb 62class MyChild : public wxMDIChildFrame
c801d85f 63{
c52d95b4 64public:
d2824cdb
VZ
65 MyChild(wxMDIParentFrame *parent);
66 virtual ~MyChild();
c52d95b4 67
d2824cdb
VZ
68 static unsigned GetChildrenCount() { return ms_numChildren; }
69
70private:
c801d85f 71 void OnActivate(wxActivateEvent& event);
c52d95b4
VZ
72
73 void OnRefresh(wxCommandEvent& event);
fa762db4 74 void OnUpdateRefresh(wxUpdateUIEvent& event);
f6bcfd97 75 void OnChangeTitle(wxCommandEvent& event);
fa762db4
VZ
76 void OnChangePosition(wxCommandEvent& event);
77 void OnChangeSize(wxCommandEvent& event);
d2824cdb 78 void OnClose(wxCommandEvent& event);
fa762db4
VZ
79 void OnSize(wxSizeEvent& event);
80 void OnMove(wxMoveEvent& event);
d2824cdb 81 void OnCloseWindow(wxCloseEvent& event);
c801d85f 82
c9f856af
VZ
83#if wxUSE_CLIPBOARD
84 void OnPaste(wxCommandEvent& event);
85 void OnUpdatePaste(wxUpdateUIEvent& event);
86#endif // wxUSE_CLIPBOARD
87
d2824cdb
VZ
88 static unsigned ms_numChildren;
89
90 MyCanvas *m_canvas;
91
c52d95b4 92 DECLARE_EVENT_TABLE()
c801d85f
KB
93};
94
c52d95b4
VZ
95// menu items ids
96enum
97{
c52d95b4 98 MDI_REFRESH,
f6bcfd97 99 MDI_CHANGE_TITLE,
fa762db4 100 MDI_CHANGE_POSITION,
d2824cdb 101 MDI_CHANGE_SIZE
c52d95b4 102};