]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/ogl/canvas.h
use CXXFLAGS instead of CFLAGS in several places now that the tests are done using...
[wxWidgets.git] / contrib / include / wx / ogl / canvas.h
CommitLineData
1fc25a89
JS
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
2ba06d5a 9// Licence: wxWindows licence
1fc25a89
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _OGL_CANVAS_H_
13#define _OGL_CANVAS_H_
14
5f331691 15
1fc25a89
JS
16// Drag states
17#define NoDragging 0
18#define StartDraggingLeft 1
19#define ContinueDraggingLeft 2
20#define StartDraggingRight 3
21#define ContinueDraggingRight 4
22
5f331691 23WXDLLIMPEXP_OGL extern const wxChar* wxShapeCanvasNameStr;
4fcf77bc 24
1fc25a89
JS
25// When drag_count reaches 0, process drag message
26
5f331691 27class WXDLLIMPEXP_OGL wxDiagram;
1fc25a89 28
5f331691 29class WXDLLIMPEXP_OGL wxShapeCanvas: public wxScrolledWindow
1fc25a89
JS
30{
31 DECLARE_DYNAMIC_CLASS(wxShapeCanvas)
32 public:
2ba06d5a 33 wxShapeCanvas(wxWindow *parent = NULL, wxWindowID id = wxID_ANY,
4fcf77bc
RD
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 long style = wxBORDER | wxRETAINED,
37 const wxString& name = wxShapeCanvasNameStr);
1fc25a89
JS
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);
4fcf77bc 59
1fc25a89
JS
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_