]> git.saurik.com Git - wxWidgets.git/blob - samples/docvwmdi/view.h
d146d8cff4225de9c6deb566ba3786b3b5b0ef2c
[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 DECLARE_DYNAMIC_CLASS(TextEditView)
64 public:
65 wxMDIChildFrame* m_frame;
66 MyTextWindow* m_textsw;
67
68 TextEditView() : wxView() { m_frame = NULL; m_textsw = NULL; }
69 virtual ~TextEditView() {}
70
71 virtual bool OnCreate(wxDocument*, long flags);
72 virtual void OnDraw(wxDC* dc);
73 virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
74 virtual bool OnClose(bool deleteWindow = true);
75 virtual bool ProcessEvent(wxEvent&);
76 };
77
78 #endif