]>
Commit | Line | Data |
---|---|---|
2108f33a 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 |
2108f33a JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
6bdf5153 VZ |
12 | #ifndef __VIEW_H__ |
13 | #define __VIEW_H__ | |
2108f33a JS |
14 | |
15 | #include "wx/docview.h" | |
16 | ||
6bdf5153 VZ |
17 | class DrawingView; |
18 | class MyCanvas : public wxScrolledWindow | |
2108f33a | 19 | { |
354aa1e3 | 20 | public: |
6bdf5153 | 21 | DrawingView* m_view; |
2108f33a | 22 | |
6bdf5153 VZ |
23 | MyCanvas(DrawingView*, wxMDIChildFrame*, const wxPoint&, const wxSize&, long style); |
24 | virtual void OnDraw(wxDC&); | |
25 | protected: | |
26 | void OnMouseEvent(wxMouseEvent&); | |
354aa1e3 | 27 | DECLARE_EVENT_TABLE() |
2108f33a JS |
28 | }; |
29 | ||
30 | class MyTextWindow: public wxTextCtrl | |
31 | { | |
354aa1e3 | 32 | public: |
6bdf5153 VZ |
33 | wxView* m_view; |
34 | ||
35 | MyTextWindow(wxView*, wxMDIChildFrame*, const wxPoint&, const wxSize&, long style); | |
2108f33a JS |
36 | }; |
37 | ||
6bdf5153 VZ |
38 | class DrawingDocument; |
39 | class DrawingView : public wxView | |
2108f33a | 40 | { |
6bdf5153 | 41 | DECLARE_DYNAMIC_CLASS(DrawingView) |
354aa1e3 | 42 | public: |
6bdf5153 VZ |
43 | wxMDIChildFrame* m_frame; |
44 | MyCanvas* m_canvas; | |
2108f33a | 45 | |
6bdf5153 VZ |
46 | DrawingView() { m_canvas = NULL; m_frame = NULL; } |
47 | virtual ~DrawingView() {} | |
2108f33a | 48 | |
6bdf5153 VZ |
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); | |
2108f33a | 53 | |
6bdf5153 VZ |
54 | DrawingDocument* GetDocument(); |
55 | ||
56 | protected: | |
57 | void OnCut(wxCommandEvent& event); | |
354aa1e3 | 58 | DECLARE_EVENT_TABLE() |
2108f33a JS |
59 | }; |
60 | ||
61 | class TextEditView: public wxView | |
62 | { | |
354aa1e3 | 63 | public: |
6bdf5153 VZ |
64 | wxMDIChildFrame* m_frame; |
65 | MyTextWindow* m_textsw; | |
66 | ||
67 | TextEditView() : wxView() { m_frame = NULL; m_textsw = NULL; } | |
68 | virtual ~TextEditView() {} | |
2108f33a | 69 | |
6bdf5153 VZ |
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&); | |
4e553af1 VZ |
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) | |
2108f33a JS |
83 | }; |
84 | ||
85 | #endif |