]> git.saurik.com Git - wxWidgets.git/blob - samples/docvwmdi/view.h
don't crash when invalid colour is set as fg/bg colour
[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 and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 // #pragma interface
14 #endif
15
16 #ifndef __VIEWSAMPLEH__
17 #define __VIEWSAMPLEH__
18
19 #include "wx/docview.h"
20
21 class MyCanvas: public wxScrolledWindow
22 {
23 public:
24 wxView *view;
25
26 MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);
27 virtual void OnDraw(wxDC& dc);
28 void OnMouseEvent(wxMouseEvent& event);
29
30 private:
31 DECLARE_EVENT_TABLE()
32 };
33
34 class MyTextWindow: public wxTextCtrl
35 {
36 public:
37 wxView *view;
38
39 MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);
40 };
41
42 class DrawingView: public wxView
43 {
44 public:
45 wxFrame *frame;
46 MyCanvas *canvas;
47
48 DrawingView() { canvas = (MyCanvas *) NULL; frame = (wxFrame *) NULL; }
49 ~DrawingView() {}
50
51 bool OnCreate(wxDocument *doc, long flags);
52 void OnDraw(wxDC *dc);
53 void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
54 bool OnClose(bool deleteWindow = TRUE);
55
56 void OnCut(wxCommandEvent& event);
57
58 private:
59 DECLARE_DYNAMIC_CLASS(DrawingView)
60 DECLARE_EVENT_TABLE()
61 };
62
63 class TextEditView: public wxView
64 {
65 public:
66 wxFrame *frame;
67 MyTextWindow *textsw;
68
69 TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; }
70 ~TextEditView() {}
71
72 bool OnCreate(wxDocument *doc, long flags);
73 void OnDraw(wxDC *dc);
74 void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
75 bool OnClose(bool deleteWindow = TRUE);
76
77 private:
78 DECLARE_DYNAMIC_CLASS(TextEditView)
79 };
80
81 #endif