]>
git.saurik.com Git - wxWidgets.git/blob - samples/docview/view.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: View classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/docview.h"
18 class MyCanvas
: public wxScrolledWindow
23 MyCanvas(DrawingView
*, wxFrame
*, const wxPoint
& pos
, const wxSize
& size
, const long style
);
24 virtual void OnDraw(wxDC
& dc
);
27 void OnMouseEvent(wxMouseEvent
& event
);
31 class MyTextWindow
: public wxTextCtrl
36 MyTextWindow(wxView
*v
, wxFrame
*frame
, const wxPoint
& pos
, const wxSize
& size
, const long style
);
39 class DrawingView
: public wxView
45 DrawingView() { m_canvas
= NULL
; m_frame
= NULL
; };
46 virtual ~DrawingView() {};
48 virtual bool OnCreate(wxDocument
*doc
, long flags
);
49 virtual void OnDraw(wxDC
*dc
);
50 virtual void OnUpdate(wxView
*sender
, wxObject
*hint
= NULL
);
51 virtual bool OnClose(bool deleteWindow
= true);
53 DrawingDocument
* GetDocument();
56 void OnCut(wxCommandEvent
& event
);
60 DECLARE_DYNAMIC_CLASS(DrawingView
)
63 class TextEditView
: public wxView
67 MyTextWindow
* m_textsw
;
69 TextEditView(): wxView() { m_frame
= NULL
; m_textsw
= NULL
; }
70 virtual ~TextEditView() {}
72 virtual bool OnCreate(wxDocument
*doc
, long flags
);
73 virtual void OnDraw(wxDC
*dc
);
74 virtual void OnUpdate(wxView
*sender
, wxObject
*hint
= NULL
);
75 virtual bool OnClose(bool deleteWindow
= true);
78 void OnCopy(wxCommandEvent
& WXUNUSED(event
)) { m_textsw
->Copy(); }
79 void OnPaste(wxCommandEvent
& WXUNUSED(event
)) { m_textsw
->Paste(); }
80 void OnSelectAll(wxCommandEvent
& WXUNUSED(event
)) { m_textsw
->SelectAll(); }
83 DECLARE_DYNAMIC_CLASS(TextEditView
)