]> git.saurik.com Git - wxWidgets.git/blob - contrib/samples/ogl/ogledit/view.h
wxHandleFatalExceptions() added, documented
[wxWidgets.git] / contrib / samples / ogl / ogledit / view.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: view.h
3 // Purpose: View-related classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 12/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _OGLSAMPLE_VIEW_H_
13 #define _OGLSAMPLE_VIEW_H_
14
15 #ifdef __GNUG__
16 // #pragma interface "view.h"
17 #endif
18
19 #include "doc.h"
20 #include <wx/ogl/ogl.h>
21
22 class MyCanvas: public wxShapeCanvas
23 {
24 // DECLARE_DYNAMIC_CLASS(wxShapeCanvas)
25 protected:
26 public:
27 wxView *view;
28
29 MyCanvas(wxView *view, wxWindow *parent = NULL, wxWindowID id = -1,
30 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
31 long style = wxRETAINED);
32 ~MyCanvas(void);
33
34 void OnMouseEvent(wxMouseEvent& event);
35 void OnPaint(wxPaintEvent& event);
36
37 virtual void OnLeftClick(double x, double y, int keys = 0);
38 virtual void OnRightClick(double x, double y, int keys = 0);
39
40 virtual void OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false
41 virtual void OnBeginDragLeft(double x, double y, int keys=0);
42 virtual void OnEndDragLeft(double x, double y, int keys=0);
43
44 virtual void OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false
45 virtual void OnBeginDragRight(double x, double y, int keys=0);
46 virtual void OnEndDragRight(double x, double y, int keys=0);
47
48 DECLARE_EVENT_TABLE()
49 };
50
51 class DiagramView: public wxView
52 {
53 DECLARE_DYNAMIC_CLASS(DiagramView)
54 private:
55 public:
56 wxFrame *frame;
57 MyCanvas *canvas;
58
59 DiagramView(void) { canvas = NULL; frame = NULL; };
60 ~DiagramView(void) {};
61
62 bool OnCreate(wxDocument *doc, long flags);
63 void OnDraw(wxDC *dc);
64 void OnUpdate(wxView *sender, wxObject *hint = NULL);
65 bool OnClose(bool deleteWindow = TRUE);
66
67 wxShape *FindSelectedShape(void);
68
69 // void OnMenuCommand(int cmd);
70
71 void OnCut(wxCommandEvent& event);
72 void OnChangeBackgroundColour(wxCommandEvent& event);
73 void OnEditLabel(wxCommandEvent& event);
74
75 DECLARE_EVENT_TABLE()
76 };
77
78 #endif
79 // _OGLSAMPLE_VIEW_H_