]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/ogl/canvas.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxShapeCanvas
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _OGL_CANVAS_H_
13 #define _OGL_CANVAS_H_
16 #pragma interface "canvas.h"
21 #define StartDraggingLeft 1
22 #define ContinueDraggingLeft 2
23 #define StartDraggingRight 3
24 #define ContinueDraggingRight 4
26 // When drag_count reaches 0, process drag message
30 class wxShapeCanvas
: public wxScrolledWindow
32 DECLARE_DYNAMIC_CLASS(wxShapeCanvas
)
34 wxShapeCanvas(wxWindow
*parent
= NULL
, wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
35 long style
= wxBORDER
| wxRETAINED
);
38 inline void SetDiagram(wxDiagram
*diag
) { m_shapeDiagram
= diag
; }
39 inline wxDiagram
*GetDiagram() const { return m_shapeDiagram
; }
41 virtual void OnLeftClick(double x
, double y
, int keys
= 0);
42 virtual void OnRightClick(double x
, double y
, int keys
= 0);
44 virtual void OnDragLeft(bool draw
, double x
, double y
, int keys
=0); // Erase if draw false
45 virtual void OnBeginDragLeft(double x
, double y
, int keys
=0);
46 virtual void OnEndDragLeft(double x
, double y
, int keys
=0);
48 virtual void OnDragRight(bool draw
, double x
, double y
, int keys
=0); // Erase if draw false
49 virtual void OnBeginDragRight(double x
, double y
, int keys
=0);
50 virtual void OnEndDragRight(double x
, double y
, int keys
=0);
52 // Find object for mouse click, of given wxClassInfo (NULL for any type).
53 // If notImage is non-NULL, don't find an object that is equal to or a descendant of notImage
54 virtual wxShape
*FindShape(double x
, double y
, int *attachment
, wxClassInfo
*info
= NULL
, wxShape
*notImage
= NULL
);
55 wxShape
*FindFirstSensitiveShape(double x
, double y
, int *new_attachment
, int op
);
56 wxShape
*FindFirstSensitiveShape1(wxShape
*image
, int op
);
58 // Redirect to wxDiagram object
59 virtual void AddShape(wxShape
*object
, wxShape
*addAfter
= NULL
);
60 virtual void InsertShape(wxShape
*object
);
61 virtual void RemoveShape(wxShape
*object
);
62 virtual bool GetQuickEditMode();
63 virtual void Redraw(wxDC
& dc
);
64 void Snap(double *x
, double *y
);
67 void OnPaint(wxPaintEvent
& event
);
68 void OnMouseEvent(wxMouseEvent
& event
);
71 wxDiagram
* m_shapeDiagram
;
73 double m_oldDragX
, m_oldDragY
; // Previous drag coordinates
74 double m_firstDragX
, m_firstDragY
; // INITIAL drag coordinates
75 bool m_checkTolerance
; // Whether to check drag tolerance
76 wxShape
* m_draggedShape
;
77 int m_draggedAttachment
;