]>
Commit | Line | Data |
---|---|---|
1fc25a89 | 1 | ///////////////////////////////////////////////////////////////////////////// |
f4ec6bd2 | 2 | // Name: contrib/samples/ogl/ogledit/view.h |
1fc25a89 JS |
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 | |
2ba06d5a | 9 | // Licence: wxWindows licence |
1fc25a89 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _OGLSAMPLE_VIEW_H_ | |
13 | #define _OGLSAMPLE_VIEW_H_ | |
14 | ||
1fc25a89 | 15 | #include "doc.h" |
f4ec6bd2 | 16 | #include "wx/ogl/ogl.h" |
1fc25a89 JS |
17 | |
18 | class MyCanvas: public wxShapeCanvas | |
19 | { | |
20 | // DECLARE_DYNAMIC_CLASS(wxShapeCanvas) | |
21 | protected: | |
22 | public: | |
23 | wxView *view; | |
24 | ||
2ba06d5a | 25 | MyCanvas(wxView *view, wxWindow *parent = NULL, wxWindowID id = wxID_ANY, |
1fc25a89 JS |
26 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
27 | long style = wxRETAINED); | |
28 | ~MyCanvas(void); | |
29 | ||
30 | void OnMouseEvent(wxMouseEvent& event); | |
31 | void OnPaint(wxPaintEvent& event); | |
32 | ||
33 | virtual void OnLeftClick(double x, double y, int keys = 0); | |
34 | virtual void OnRightClick(double x, double y, int keys = 0); | |
35 | ||
36 | virtual void OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false | |
37 | virtual void OnBeginDragLeft(double x, double y, int keys=0); | |
38 | virtual void OnEndDragLeft(double x, double y, int keys=0); | |
39 | ||
40 | virtual void OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false | |
41 | virtual void OnBeginDragRight(double x, double y, int keys=0); | |
42 | virtual void OnEndDragRight(double x, double y, int keys=0); | |
43 | ||
44 | DECLARE_EVENT_TABLE() | |
45 | }; | |
46 | ||
47 | class DiagramView: public wxView | |
48 | { | |
49 | DECLARE_DYNAMIC_CLASS(DiagramView) | |
50 | private: | |
51 | public: | |
52 | wxFrame *frame; | |
53 | MyCanvas *canvas; | |
5e06d749 | 54 | |
1fc25a89 JS |
55 | DiagramView(void) { canvas = NULL; frame = NULL; }; |
56 | ~DiagramView(void) {}; | |
57 | ||
58 | bool OnCreate(wxDocument *doc, long flags); | |
59 | void OnDraw(wxDC *dc); | |
60 | void OnUpdate(wxView *sender, wxObject *hint = NULL); | |
2ba06d5a | 61 | bool OnClose(bool deleteWindow = true); |
1fc25a89 JS |
62 | |
63 | wxShape *FindSelectedShape(void); | |
64 | ||
1fc25a89 JS |
65 | void OnCut(wxCommandEvent& event); |
66 | void OnChangeBackgroundColour(wxCommandEvent& event); | |
67 | void OnEditLabel(wxCommandEvent& event); | |
68 | ||
69 | DECLARE_EVENT_TABLE() | |
70 | }; | |
71 | ||
72 | #endif | |
73 | // _OGLSAMPLE_VIEW_H_ |