]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/ogl/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 // Find a shape by its id
60 wxShape
* FindShape(long id
) const;
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(); }
67 // Make sure all text that should be centred, is centred.
68 void RecentreAll(wxDC
& dc
);
71 virtual bool SaveFile(const wxString
& filename
);
72 virtual bool LoadFile(const wxString
& filename
);
74 virtual void ReadNodes(wxExprDatabase
& database
);
75 virtual void ReadLines(wxExprDatabase
& database
);
76 virtual void ReadContainerGeometry(wxExprDatabase
& database
);
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
);
88 wxShapeCanvas
* m_diagramCanvas
;
96 class wxLineCrossing
: public wxObject
99 wxLineCrossing() { m_lineShape1
= NULL
; m_lineShape2
= NULL
; }
100 wxRealPoint m_pt1
; // First line
102 wxRealPoint m_pt3
; // Second line
104 wxRealPoint m_intersect
;
105 wxLineShape
* m_lineShape1
;
106 wxLineShape
* m_lineShape2
;
109 class wxLineCrossings
: public wxObject
115 void FindCrossings(wxDiagram
& diagram
);
116 void DrawCrossings(wxDiagram
& diagram
, wxDC
& dc
);
117 void ClearCrossings();