]> git.saurik.com Git - wxWidgets.git/blame - samples/mdi/mdi.h
Fix testing for existence of paths with trailing separators in wxMSW.
[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
526954c5 9// Licence: wxWindows licence
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
4f7cd56c
VZ
48 static wxMenuBar *CreateMainMenubar();
49
d2824cdb 50private:
81d66cf3
JS
51 void InitToolBar(wxToolBar* toolBar);
52
c801d85f
KB
53 void OnSize(wxSizeEvent& event);
54 void OnAbout(wxCommandEvent& event);
55 void OnNewWindow(wxCommandEvent& event);
9089cffb 56 void OnFullScreen(wxCommandEvent& event);
c801d85f 57 void OnQuit(wxCommandEvent& event);
1483e5db
VZ
58 void OnCloseAll(wxCommandEvent& event);
59
c52d95b4 60 void OnClose(wxCloseEvent& event);
c801d85f 61
d2824cdb
VZ
62 wxTextCtrl *m_textWindow;
63
c52d95b4 64 DECLARE_EVENT_TABLE()
c801d85f
KB
65};
66
d2824cdb 67class MyChild : public wxMDIChildFrame
c801d85f 68{
c52d95b4 69public:
d2824cdb
VZ
70 MyChild(wxMDIParentFrame *parent);
71 virtual ~MyChild();
c52d95b4 72
d2824cdb
VZ
73 static unsigned GetChildrenCount() { return ms_numChildren; }
74
75private:
c801d85f 76 void OnActivate(wxActivateEvent& event);
c52d95b4
VZ
77
78 void OnRefresh(wxCommandEvent& event);
fa762db4 79 void OnUpdateRefresh(wxUpdateUIEvent& event);
f6bcfd97 80 void OnChangeTitle(wxCommandEvent& event);
fa762db4
VZ
81 void OnChangePosition(wxCommandEvent& event);
82 void OnChangeSize(wxCommandEvent& event);
d2824cdb 83 void OnClose(wxCommandEvent& event);
fa762db4
VZ
84 void OnSize(wxSizeEvent& event);
85 void OnMove(wxMoveEvent& event);
d2824cdb 86 void OnCloseWindow(wxCloseEvent& event);
c801d85f 87
c9f856af
VZ
88#if wxUSE_CLIPBOARD
89 void OnPaste(wxCommandEvent& event);
90 void OnUpdatePaste(wxUpdateUIEvent& event);
91#endif // wxUSE_CLIPBOARD
92
d2824cdb
VZ
93 static unsigned ms_numChildren;
94
95 MyCanvas *m_canvas;
96
396e9eb8
VZ
97 // simple test event handler class
98 class EventHandler : public wxEvtHandler
99 {
100 public:
101 EventHandler(unsigned numChild) : m_numChild(numChild) { }
102
103 private:
104 void OnRefresh(wxCommandEvent& event)
105 {
106 wxLogMessage("Child #%u refreshed.", m_numChild);
107 event.Skip();
108 }
109
110 const unsigned m_numChild;
111
112 DECLARE_EVENT_TABLE()
113
114 wxDECLARE_NO_COPY_CLASS(EventHandler);
115 };
116
c52d95b4 117 DECLARE_EVENT_TABLE()
c801d85f
KB
118};
119
c52d95b4
VZ
120// menu items ids
121enum
122{
2140f273 123 MDI_FULLSCREEN = 100,
c52d95b4 124 MDI_REFRESH,
f6bcfd97 125 MDI_CHANGE_TITLE,
fa762db4 126 MDI_CHANGE_POSITION,
d2824cdb 127 MDI_CHANGE_SIZE
c52d95b4 128};