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