]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/ogldiag.h
don't log mouse events by default
[wxWidgets.git] / contrib / include / wx / ogl / ogldiag.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: ogldiag.h
3 // Purpose: OGL - wxDiagram class
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_OGLDIAG_H_
13 #define _OGL_OGLDIAG_H_
14
15 #ifdef __GNUG__
16 #pragma interface "ogldiag.h"
17 #endif
18
19 #include <wx/ogl/basic.h>
20
21 class wxDiagram: public wxObject
22 {
23 DECLARE_DYNAMIC_CLASS(wxDiagram)
24
25 public:
26
27 wxDiagram();
28 virtual ~wxDiagram();
29
30 void SetCanvas(wxShapeCanvas *can);
31
32 inline wxShapeCanvas *GetCanvas() const { return m_diagramCanvas; }
33
34 virtual void Redraw(wxDC& dc);
35 virtual void Clear(wxDC& dc);
36 virtual void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
37
38 // Add object to end of object list (if addAfter is NULL)
39 // or just after addAfter.
40 virtual void AddShape(wxShape *object, wxShape *addAfter = NULL);
41
42 // Add object to front of object list
43 virtual void InsertShape(wxShape *object);
44
45 void SetSnapToGrid(bool snap);
46 void SetGridSpacing(double spacing);
47 inline double GetGridSpacing() const { return m_gridSpacing; }
48 inline bool GetSnapToGrid() const { return m_snapToGrid; }
49 void Snap(double *x, double *y);
50
51 inline void SetQuickEditMode(bool qem) { m_quickEditMode = qem; }
52 inline bool GetQuickEditMode() const { return m_quickEditMode; }
53
54 virtual void RemoveShape(wxShape *object);
55 virtual void RemoveAllShapes();
56 virtual void DeleteAllShapes();
57 virtual void ShowAll(bool show);
58
59 // Find a shape by its id
60 wxShape* FindShape(long id) const;
61
62 inline void SetMouseTolerance(int tol) { m_mouseTolerance = tol; }
63 inline int GetMouseTolerance() const { return m_mouseTolerance; }
64 inline wxList *GetShapeList() const { return m_shapeList; }
65 inline int GetCount() const { return m_shapeList->Number(); }
66
67 // Make sure all text that should be centred, is centred.
68 void RecentreAll(wxDC& dc);
69
70 #ifdef PROLOGIO
71 virtual bool SaveFile(const wxString& filename);
72 virtual bool LoadFile(const wxString& filename);
73
74 virtual void ReadNodes(wxExprDatabase& database);
75 virtual void ReadLines(wxExprDatabase& database);
76 virtual void ReadContainerGeometry(wxExprDatabase& database);
77
78 // Allow for modifying file
79 virtual bool OnDatabaseLoad(wxExprDatabase& db);
80 virtual bool OnDatabaseSave(wxExprDatabase& db);
81 virtual bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
82 virtual bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
83 virtual bool OnHeaderSave(wxExprDatabase& db, wxExpr& expr);
84 virtual bool OnHeaderLoad(wxExprDatabase& db, wxExpr& expr);
85 #endif
86
87 protected:
88 wxShapeCanvas* m_diagramCanvas;
89 bool m_quickEditMode;
90 bool m_snapToGrid;
91 double m_gridSpacing;
92 int m_mouseTolerance;
93 wxList* m_shapeList;
94 };
95
96 class wxLineCrossing: public wxObject
97 {
98 public:
99 wxLineCrossing() { m_lineShape1 = NULL; m_lineShape2 = NULL; }
100 wxRealPoint m_pt1; // First line
101 wxRealPoint m_pt2;
102 wxRealPoint m_pt3; // Second line
103 wxRealPoint m_pt4;
104 wxRealPoint m_intersect;
105 wxLineShape* m_lineShape1;
106 wxLineShape* m_lineShape2;
107 };
108
109 class wxLineCrossings: public wxObject
110 {
111 public:
112 wxLineCrossings();
113 ~wxLineCrossings();
114
115 void FindCrossings(wxDiagram& diagram);
116 void DrawCrossings(wxDiagram& diagram, wxDC& dc);
117 void ClearCrossings();
118
119 public:
120 wxList m_crossings;
121 };
122
123 #endif
124 // _OGL_OGLDIAG_H_