]>
Commit | Line | Data |
---|---|---|
457814b5 JS |
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$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
2f6c54eb | 9 | // Licence: wxWindows license |
457814b5 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
6bdf5153 VZ |
12 | #ifndef __VIEW_H__ |
13 | #define __VIEW_H__ | |
457814b5 JS |
14 | |
15 | #include "wx/docview.h" | |
16 | ||
6bdf5153 VZ |
17 | class DrawingView; |
18 | class MyCanvas : public wxScrolledWindow | |
457814b5 | 19 | { |
f6bcfd97 | 20 | public: |
6bdf5153 VZ |
21 | DrawingView* m_view; |
22 | ||
23 | MyCanvas(DrawingView*, wxFrame*, const wxPoint& pos, const wxSize& size, const long style); | |
457814b5 | 24 | virtual void OnDraw(wxDC& dc); |
6bdf5153 VZ |
25 | |
26 | protected: | |
457814b5 | 27 | void OnMouseEvent(wxMouseEvent& event); |
f6bcfd97 | 28 | DECLARE_EVENT_TABLE() |
457814b5 JS |
29 | }; |
30 | ||
31 | class MyTextWindow: public wxTextCtrl | |
32 | { | |
f6bcfd97 | 33 | public: |
6bdf5153 VZ |
34 | wxView* m_view; |
35 | ||
457814b5 JS |
36 | MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style); |
37 | }; | |
38 | ||
6bdf5153 | 39 | class DrawingView : public wxView |
457814b5 | 40 | { |
f6bcfd97 | 41 | public: |
6bdf5153 VZ |
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: | |
f6bcfd97 | 56 | void OnCut(wxCommandEvent& event); |
6bdf5153 VZ |
57 | |
58 | private: | |
f6bcfd97 | 59 | DECLARE_EVENT_TABLE() |
6bdf5153 | 60 | DECLARE_DYNAMIC_CLASS(DrawingView) |
457814b5 JS |
61 | }; |
62 | ||
6bdf5153 | 63 | class TextEditView : public wxView |
457814b5 | 64 | { |
f6bcfd97 | 65 | public: |
6bdf5153 VZ |
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); | |
6bdf5153 VZ |
76 | |
77 | private: | |
4e553af1 VZ |
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() | |
6bdf5153 | 83 | DECLARE_DYNAMIC_CLASS(TextEditView) |
457814b5 JS |
84 | }; |
85 | ||
86 | #endif |