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