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