]>
Commit | Line | Data |
---|---|---|
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*, wxFrame*, const wxPoint& pos, const wxSize& size, const long style); | |
24 | virtual void OnDraw(wxDC& dc); | |
25 | ||
26 | protected: | |
27 | void OnMouseEvent(wxMouseEvent& event); | |
28 | DECLARE_EVENT_TABLE() | |
29 | }; | |
30 | ||
31 | class MyTextWindow: public wxTextCtrl | |
32 | { | |
33 | public: | |
34 | wxView* m_view; | |
35 | ||
36 | MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style); | |
37 | }; | |
38 | ||
39 | class DrawingView : public wxView | |
40 | { | |
41 | public: | |
42 | wxFrame* m_frame; | |
43 | MyCanvas* m_canvas; | |
44 | ||
45 | DrawingView() { m_canvas = NULL; m_frame = NULL; }; | |
46 | virtual ~DrawingView() {}; | |
47 | ||
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); | |
52 | ||
53 | DrawingDocument* GetDocument(); | |
54 | ||
55 | protected: | |
56 | void OnCut(wxCommandEvent& event); | |
57 | ||
58 | private: | |
59 | DECLARE_EVENT_TABLE() | |
60 | DECLARE_DYNAMIC_CLASS(DrawingView) | |
61 | }; | |
62 | ||
63 | class TextEditView : public wxView | |
64 | { | |
65 | public: | |
66 | wxFrame* m_frame; | |
67 | MyTextWindow* m_textsw; | |
68 | ||
69 | TextEditView(): wxView() { m_frame = NULL; m_textsw = NULL; } | |
70 | virtual ~TextEditView() {} | |
71 | ||
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); | |
76 | ||
77 | private: | |
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(); } | |
81 | ||
82 | DECLARE_EVENT_TABLE() | |
83 | DECLARE_DYNAMIC_CLASS(TextEditView) | |
84 | }; | |
85 | ||
86 | #endif |