]> git.saurik.com Git - wxWidgets.git/blob - samples/docvwmdi/view.h
fix sizing of extra control
[wxWidgets.git] / samples / docvwmdi / view.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: view.h
3 // Purpose: View classes
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 #ifndef __VIEW_H__
13 #define __VIEW_H__
14
15 #include "wx/docview.h"
16
17 class DrawingView;
18 class MyCanvas : public wxScrolledWindow
19 {
20 public:
21 DrawingView* m_view;
22
23 MyCanvas(DrawingView*, wxMDIChildFrame*, const wxPoint&, const wxSize&, long style);
24 virtual void OnDraw(wxDC&);
25 protected:
26 void OnMouseEvent(wxMouseEvent&);
27 DECLARE_EVENT_TABLE()
28 };
29
30 class MyTextWindow: public wxTextCtrl
31 {
32 public:
33 wxView* m_view;
34
35 MyTextWindow(wxView*, wxMDIChildFrame*, const wxPoint&, const wxSize&, long style);
36 };
37
38 class DrawingDocument;
39 class DrawingView : public wxView
40 {
41 DECLARE_DYNAMIC_CLASS(DrawingView)
42 public:
43 wxMDIChildFrame* m_frame;
44 MyCanvas* m_canvas;
45
46 DrawingView() { m_canvas = NULL; m_frame = NULL; }
47 virtual ~DrawingView() {}
48
49 virtual bool OnCreate(wxDocument *doc, long flags);
50 virtual void OnDraw(wxDC *dc);
51 virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
52 virtual bool OnClose(bool deleteWindow = true);
53
54 DrawingDocument* GetDocument();
55
56 protected:
57 void OnCut(wxCommandEvent& event);
58 DECLARE_EVENT_TABLE()
59 };
60
61 class TextEditView: public wxView
62 {
63 public:
64 wxMDIChildFrame* m_frame;
65 MyTextWindow* m_textsw;
66
67 TextEditView() : wxView() { m_frame = NULL; m_textsw = NULL; }
68 virtual ~TextEditView() {}
69
70 virtual bool OnCreate(wxDocument*, long flags);
71 virtual void OnDraw(wxDC* dc);
72 virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
73 virtual bool OnClose(bool deleteWindow = true);
74 virtual bool ProcessEvent(wxEvent&);
75
76 private:
77 void OnCopy(wxCommandEvent& WXUNUSED(event)) { m_textsw->Copy(); }
78 void OnPaste(wxCommandEvent& WXUNUSED(event)) { m_textsw->Paste(); }
79 void OnSelectAll(wxCommandEvent& WXUNUSED(event)) { m_textsw->SelectAll(); }
80
81 DECLARE_EVENT_TABLE()
82 DECLARE_DYNAMIC_CLASS(TextEditView)
83 };
84
85 #endif