]>
git.saurik.com Git - wxWidgets.git/blob - contrib/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 extern wxChar
* wxShapeCanvasNameStr
;
28 // When drag_count reaches 0, process drag message
32 class wxShapeCanvas
: public wxScrolledWindow
34 DECLARE_DYNAMIC_CLASS(wxShapeCanvas
)
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
);
43 inline void SetDiagram(wxDiagram
*diag
) { m_shapeDiagram
= diag
; }
44 inline wxDiagram
*GetDiagram() const { return m_shapeDiagram
; }
46 virtual void OnLeftClick(double x
, double y
, int keys
= 0);
47 virtual void OnRightClick(double x
, double y
, int keys
= 0);
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);
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);
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
);
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
);
72 void OnPaint(wxPaintEvent
& event
);
73 void OnMouseEvent(wxMouseEvent
& event
);
76 wxDiagram
* m_shapeDiagram
;
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
;