]>
git.saurik.com Git - wxWidgets.git/blob - utils/ogl/src/ogldiag.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: OGL - wxDiagram class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _OGL_OGLDIAG_H_
13 #define _OGL_OGLDIAG_H_
16 #pragma interface "ogldiag.h"
21 class wxDiagram
: public wxObject
23 DECLARE_DYNAMIC_CLASS(wxDiagram
)
30 void SetCanvas(wxShapeCanvas
*can
);
32 inline wxShapeCanvas
*GetCanvas() const { return m_diagramCanvas
; }
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
);
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
);
42 // Add object to front of object list
43 virtual void InsertShape(wxShape
*object
);
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
);
51 inline void SetQuickEditMode(bool qem
) { m_quickEditMode
= qem
; }
52 inline bool GetQuickEditMode() const { return m_quickEditMode
; }
54 virtual void RemoveShape(wxShape
*object
);
55 virtual void RemoveAllShapes();
56 virtual void DeleteAllShapes();
57 virtual void ShowAll(bool show
);
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
; }
63 // Make sure all text that should be centred, is centred.
64 void RecentreAll(wxDC
& dc
);
67 // Prolog database stuff
68 virtual bool SaveFile(const wxString
& filename
);
69 virtual bool LoadFile(const wxString
& filename
);
71 virtual void ReadNodes(wxExprDatabase
& database
);
72 virtual void ReadLines(wxExprDatabase
& database
);
73 virtual void ReadContainerGeometry(wxExprDatabase
& database
);
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
);
85 wxShapeCanvas
* m_diagramCanvas
;