]> git.saurik.com Git - wxWidgets.git/blob - utils/ogl/src/ogldiag.h
OGL improvements
[wxWidgets.git] / utils / ogl / src / 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 "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() { 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 inline void SetMouseTolerance(int tol) { m_mouseTolerance = tol; }
60 inline int GetMouseTolerance() const { return m_mouseTolerance; }
61 inline wxList *GetShapeList() const { return m_shapeList; }
62
63 // Make sure all text that should be centred, is centred.
64 void RecentreAll(wxDC& dc);
65
66 #ifdef PROLOGIO
67 // Prolog database stuff
68 virtual bool SaveFile(const wxString& filename);
69 virtual bool LoadFile(const wxString& filename);
70
71 virtual void ReadNodes(wxExprDatabase& database);
72 virtual void ReadLines(wxExprDatabase& database);
73 virtual void ReadContainerGeometry(wxExprDatabase& database);
74
75 // Allow for modifying file
76 virtual bool OnDatabaseLoad(wxExprDatabase& db);
77 virtual bool OnDatabaseSave(wxExprDatabase& db);
78 virtual bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
79 virtual bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
80 virtual bool OnHeaderSave(wxExprDatabase& db, wxExpr& expr);
81 virtual bool OnHeaderLoad(wxExprDatabase& db, wxExpr& expr);
82 #endif
83
84 protected:
85 wxShapeCanvas* m_diagramCanvas;
86 bool m_quickEditMode;
87 bool m_snapToGrid;
88 double m_gridSpacing;
89 int m_mouseTolerance;
90 wxList* m_shapeList;
91 };
92
93 #endif
94 // _OGL_OGLDIAG_H_