]>
git.saurik.com Git - wxWidgets.git/blob - contrib/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_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "ogldiag.h"
19 #include <wx/deprecated/setup.h>
22 #include <wx/deprecated/wxexpr.h>
25 #include <wx/ogl/basic.h>
27 class wxDiagram
: public wxObject
29 DECLARE_DYNAMIC_CLASS(wxDiagram
)
36 void SetCanvas(wxShapeCanvas
*can
);
38 inline wxShapeCanvas
*GetCanvas() const { return m_diagramCanvas
; }
40 virtual void Redraw(wxDC
& dc
);
41 virtual void Clear(wxDC
& dc
);
42 virtual void DrawOutline(wxDC
& dc
, double x1
, double y1
, double x2
, double y2
);
44 // Add object to end of object list (if addAfter is NULL)
45 // or just after addAfter.
46 virtual void AddShape(wxShape
*object
, wxShape
*addAfter
= NULL
);
48 // Add object to front of object list
49 virtual void InsertShape(wxShape
*object
);
51 void SetSnapToGrid(bool snap
);
52 void SetGridSpacing(double spacing
);
53 inline double GetGridSpacing() const { return m_gridSpacing
; }
54 inline bool GetSnapToGrid() const { return m_snapToGrid
; }
55 void Snap(double *x
, double *y
);
57 inline void SetQuickEditMode(bool qem
) { m_quickEditMode
= qem
; }
58 inline bool GetQuickEditMode() const { return m_quickEditMode
; }
60 virtual void RemoveShape(wxShape
*object
);
61 virtual void RemoveAllShapes();
62 virtual void DeleteAllShapes();
63 virtual void ShowAll(bool show
);
65 // Find a shape by its id
66 wxShape
* FindShape(long id
) const;
68 inline void SetMouseTolerance(int tol
) { m_mouseTolerance
= tol
; }
69 inline int GetMouseTolerance() const { return m_mouseTolerance
; }
70 inline wxList
*GetShapeList() const { return m_shapeList
; }
71 inline int GetCount() const { return m_shapeList
->GetCount(); }
73 // Make sure all text that should be centred, is centred.
74 void RecentreAll(wxDC
& dc
);
77 virtual bool SaveFile(const wxString
& filename
);
78 virtual bool LoadFile(const wxString
& filename
);
80 virtual void ReadNodes(wxExprDatabase
& database
);
81 virtual void ReadLines(wxExprDatabase
& database
);
82 virtual void ReadContainerGeometry(wxExprDatabase
& database
);
84 // Allow for modifying file
85 virtual bool OnDatabaseLoad(wxExprDatabase
& db
);
86 virtual bool OnDatabaseSave(wxExprDatabase
& db
);
87 virtual bool OnShapeSave(wxExprDatabase
& db
, wxShape
& shape
, wxExpr
& expr
);
88 virtual bool OnShapeLoad(wxExprDatabase
& db
, wxShape
& shape
, wxExpr
& expr
);
89 virtual bool OnHeaderSave(wxExprDatabase
& db
, wxExpr
& expr
);
90 virtual bool OnHeaderLoad(wxExprDatabase
& db
, wxExpr
& expr
);
94 wxShapeCanvas
* m_diagramCanvas
;
102 class wxLineCrossing
: public wxObject
105 wxLineCrossing() { m_lineShape1
= NULL
; m_lineShape2
= NULL
; }
106 wxRealPoint m_pt1
; // First line
108 wxRealPoint m_pt3
; // Second line
110 wxRealPoint m_intersect
;
111 wxLineShape
* m_lineShape1
;
112 wxLineShape
* m_lineShape2
;
115 class wxLineCrossings
: public wxObject
121 void FindCrossings(wxDiagram
& diagram
);
122 void DrawCrossings(wxDiagram
& diagram
, wxDC
& dc
);
123 void ClearCrossings();