]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/ogldiag.h
0f907a2962cd49f21a4d64cb0fbf7913134a7a19
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_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "ogldiag.h"
20 #include <wx/deprecated/wxexpr.h>
24 #include <wx/deprecated/wxexpr.h>
27 #include <wx/ogl/basic.h>
29 class wxDiagram
: public wxObject
31 DECLARE_DYNAMIC_CLASS(wxDiagram
)
38 void SetCanvas(wxShapeCanvas
*can
);
40 inline wxShapeCanvas
*GetCanvas() const { return m_diagramCanvas
; }
42 virtual void Redraw(wxDC
& dc
);
43 virtual void Clear(wxDC
& dc
);
44 virtual void DrawOutline(wxDC
& dc
, double x1
, double y1
, double x2
, double y2
);
46 // Add object to end of object list (if addAfter is NULL)
47 // or just after addAfter.
48 virtual void AddShape(wxShape
*object
, wxShape
*addAfter
= NULL
);
50 // Add object to front of object list
51 virtual void InsertShape(wxShape
*object
);
53 void SetSnapToGrid(bool snap
);
54 void SetGridSpacing(double spacing
);
55 inline double GetGridSpacing() const { return m_gridSpacing
; }
56 inline bool GetSnapToGrid() const { return m_snapToGrid
; }
57 void Snap(double *x
, double *y
);
59 inline void SetQuickEditMode(bool qem
) { m_quickEditMode
= qem
; }
60 inline bool GetQuickEditMode() const { return m_quickEditMode
; }
62 virtual void RemoveShape(wxShape
*object
);
63 virtual void RemoveAllShapes();
64 virtual void DeleteAllShapes();
65 virtual void ShowAll(bool show
);
67 // Find a shape by its id
68 wxShape
* FindShape(long id
) const;
70 inline void SetMouseTolerance(int tol
) { m_mouseTolerance
= tol
; }
71 inline int GetMouseTolerance() const { return m_mouseTolerance
; }
72 inline wxList
*GetShapeList() const { return m_shapeList
; }
73 inline int GetCount() const { return m_shapeList
->GetCount(); }
75 // Make sure all text that should be centred, is centred.
76 void RecentreAll(wxDC
& dc
);
79 virtual bool SaveFile(const wxString
& filename
);
80 virtual bool LoadFile(const wxString
& filename
);
82 virtual void ReadNodes(wxExprDatabase
& database
);
83 virtual void ReadLines(wxExprDatabase
& database
);
84 virtual void ReadContainerGeometry(wxExprDatabase
& database
);
86 // Allow for modifying file
87 virtual bool OnDatabaseLoad(wxExprDatabase
& db
);
88 virtual bool OnDatabaseSave(wxExprDatabase
& db
);
89 virtual bool OnShapeSave(wxExprDatabase
& db
, wxShape
& shape
, wxExpr
& expr
);
90 virtual bool OnShapeLoad(wxExprDatabase
& db
, wxShape
& shape
, wxExpr
& expr
);
91 virtual bool OnHeaderSave(wxExprDatabase
& db
, wxExpr
& expr
);
92 virtual bool OnHeaderLoad(wxExprDatabase
& db
, wxExpr
& expr
);
96 wxShapeCanvas
* m_diagramCanvas
;
100 int m_mouseTolerance
;
104 class wxLineCrossing
: public wxObject
107 wxLineCrossing() { m_lineShape1
= NULL
; m_lineShape2
= NULL
; }
108 wxRealPoint m_pt1
; // First line
110 wxRealPoint m_pt3
; // Second line
112 wxRealPoint m_intersect
;
113 wxLineShape
* m_lineShape1
;
114 wxLineShape
* m_lineShape2
;
117 class wxLineCrossings
: public wxObject
123 void FindCrossings(wxDiagram
& diagram
);
124 void DrawCrossings(wxDiagram
& diagram
, wxDC
& dc
);
125 void ClearCrossings();