]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/canvas.h
Applied [ 714756 ] Clean warnings on build
[wxWidgets.git] / contrib / include / wx / ogl / canvas.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: canvas.h
3 // Purpose: wxShapeCanvas
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 _OGL_CANVAS_H_
13 #define _OGL_CANVAS_H_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "canvas.h"
17 #endif
18
19 // Drag states
20 #define NoDragging 0
21 #define StartDraggingLeft 1
22 #define ContinueDraggingLeft 2
23 #define StartDraggingRight 3
24 #define ContinueDraggingRight 4
25
26 extern const wxChar* wxShapeCanvasNameStr;
27
28 // When drag_count reaches 0, process drag message
29
30 class wxDiagram;
31
32 class wxShapeCanvas: public wxScrolledWindow
33 {
34 DECLARE_DYNAMIC_CLASS(wxShapeCanvas)
35 public:
36 wxShapeCanvas(wxWindow *parent = NULL, wxWindowID id = -1,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = wxBORDER | wxRETAINED,
40 const wxString& name = wxShapeCanvasNameStr);
41 ~wxShapeCanvas();
42
43 inline void SetDiagram(wxDiagram *diag) { m_shapeDiagram = diag; }
44 inline wxDiagram *GetDiagram() const { return m_shapeDiagram; }
45
46 virtual void OnLeftClick(double x, double y, int keys = 0);
47 virtual void OnRightClick(double x, double y, int keys = 0);
48
49 virtual void OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false
50 virtual void OnBeginDragLeft(double x, double y, int keys=0);
51 virtual void OnEndDragLeft(double x, double y, int keys=0);
52
53 virtual void OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false
54 virtual void OnBeginDragRight(double x, double y, int keys=0);
55 virtual void OnEndDragRight(double x, double y, int keys=0);
56
57 // Find object for mouse click, of given wxClassInfo (NULL for any type).
58 // If notImage is non-NULL, don't find an object that is equal to or a descendant of notImage
59 virtual wxShape *FindShape(double x, double y, int *attachment, wxClassInfo *info = NULL, wxShape *notImage = NULL);
60 wxShape *FindFirstSensitiveShape(double x, double y, int *new_attachment, int op);
61 wxShape *FindFirstSensitiveShape1(wxShape *image, int op);
62
63 // Redirect to wxDiagram object
64 virtual void AddShape(wxShape *object, wxShape *addAfter = NULL);
65 virtual void InsertShape(wxShape *object);
66 virtual void RemoveShape(wxShape *object);
67 virtual bool GetQuickEditMode();
68 virtual void Redraw(wxDC& dc);
69 void Snap(double *x, double *y);
70
71 // Events
72 void OnPaint(wxPaintEvent& event);
73 void OnMouseEvent(wxMouseEvent& event);
74
75 protected:
76 wxDiagram* m_shapeDiagram;
77 int m_dragState;
78 double m_oldDragX, m_oldDragY; // Previous drag coordinates
79 double m_firstDragX, m_firstDragY; // INITIAL drag coordinates
80 bool m_checkTolerance; // Whether to check drag tolerance
81 wxShape* m_draggedShape;
82 int m_draggedAttachment;
83
84 DECLARE_EVENT_TABLE()
85 };
86
87 #endif
88 // _OGL_CANVAS_H_