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