]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/mdi/mdi.h
fix sizing of extra control
[wxWidgets.git] / samples / mdi / mdi.h
... / ...
CommitLineData
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
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/toolbar.h"
13
14// Define a new application
15class MyApp : public wxApp
16{
17public:
18 bool OnInit();
19};
20
21class MyCanvas : public wxScrolledWindow
22{
23public:
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 void SetText(const wxString& text) { m_text = text; Refresh(); }
32
33private:
34 wxString m_text;
35
36 bool m_dirty;
37
38 DECLARE_EVENT_TABLE()
39};
40
41// Define a new frame
42class MyFrame : public wxMDIParentFrame
43{
44public:
45 wxTextCtrl *textWindow;
46
47 MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
48 const wxPoint& pos, const wxSize& size, const long style);
49
50 void InitToolBar(wxToolBar* toolBar);
51
52 void OnSize(wxSizeEvent& event);
53 void OnAbout(wxCommandEvent& event);
54 void OnNewWindow(wxCommandEvent& event);
55 void OnQuit(wxCommandEvent& event);
56 void OnClose(wxCloseEvent& event);
57
58 DECLARE_EVENT_TABLE()
59};
60
61class MyChild: public wxMDIChildFrame
62{
63public:
64 MyCanvas *canvas;
65 MyChild(wxMDIParentFrame *parent, const wxString& title);
66 ~MyChild();
67
68 void OnActivate(wxActivateEvent& event);
69
70 void OnRefresh(wxCommandEvent& event);
71 void OnUpdateRefresh(wxUpdateUIEvent& event);
72 void OnChangeTitle(wxCommandEvent& event);
73 void OnChangePosition(wxCommandEvent& event);
74 void OnChangeSize(wxCommandEvent& event);
75 void OnQuit(wxCommandEvent& event);
76 void OnSize(wxSizeEvent& event);
77 void OnMove(wxMoveEvent& event);
78 void OnClose(wxCloseEvent& event);
79
80#if wxUSE_CLIPBOARD
81 void OnPaste(wxCommandEvent& event);
82 void OnUpdatePaste(wxUpdateUIEvent& event);
83#endif // wxUSE_CLIPBOARD
84
85 DECLARE_EVENT_TABLE()
86};
87
88// menu items ids
89enum
90{
91 MDI_QUIT = wxID_EXIT,
92 MDI_NEW_WINDOW = 101,
93 MDI_REFRESH,
94 MDI_CHANGE_TITLE,
95 MDI_CHANGE_POSITION,
96 MDI_CHANGE_SIZE,
97 MDI_CHILD_QUIT,
98 MDI_ABOUT = wxID_ABOUT
99};