]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/ogl/canvas.h
new VC++ workspace file for wxBase
[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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _OGL_CANVAS_H_
13#define _OGL_CANVAS_H_
14
15#ifdef __GNUG__
16#pragma interface "canvas.h"
17#endif
18
19// Drag states
20#define NoDragging 0
21#define StartDraggingLeft 1
22#define ContinueDraggingLeft 2
23#define StartDraggingRight 3
24#define ContinueDraggingRight 4
25
26// When drag_count reaches 0, process drag message
27
28class wxDiagram;
29
30class wxShapeCanvas: public wxScrolledWindow
31{
32 DECLARE_DYNAMIC_CLASS(wxShapeCanvas)
33 public:
34 wxShapeCanvas(wxWindow *parent = NULL, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
35 long style = wxBORDER | wxRETAINED);
36 ~wxShapeCanvas();
37
38 inline void SetDiagram(wxDiagram *diag) { m_shapeDiagram = diag; }
39 inline wxDiagram *GetDiagram() const { return m_shapeDiagram; }
40
41 virtual void OnLeftClick(double x, double y, int keys = 0);
42 virtual void OnRightClick(double x, double y, int keys = 0);
43
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);
47
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);
51
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);
57
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);
65
66 // Events
67 void OnPaint(wxPaintEvent& event);
68 void OnMouseEvent(wxMouseEvent& event);
69
70 protected:
71 wxDiagram* m_shapeDiagram;
72 int m_dragState;
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;
78
79DECLARE_EVENT_TABLE()
80};
81
82#endif
83 // _OGL_CANVAS_H_