]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/ogl/ogldiag.h
[#1472076] Fixes after stock gdi changes within core library.
[wxWidgets.git] / contrib / include / wx / ogl / ogldiag.h
CommitLineData
1fc25a89
JS
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
2ba06d5a 9// Licence: wxWindows licence
1fc25a89
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _OGL_OGLDIAG_H_
13#define _OGL_OGLDIAG_H_
14
39b9cdaf 15#include "wx/ogl/basic.h"
7c9955d1
JS
16
17#if wxUSE_PROLOGIO
6b62c9ad 18#include "wx/deprecated/wxexpr.h"
7c9955d1
JS
19#endif
20
1fc25a89 21
5f331691 22class WXDLLIMPEXP_OGL wxDiagram: public wxObject
1fc25a89
JS
23{
24 DECLARE_DYNAMIC_CLASS(wxDiagram)
25
26public:
27
28 wxDiagram();
29 virtual ~wxDiagram();
30
31 void SetCanvas(wxShapeCanvas *can);
32
33 inline wxShapeCanvas *GetCanvas() const { return m_diagramCanvas; }
34
35 virtual void Redraw(wxDC& dc);
36 virtual void Clear(wxDC& dc);
37 virtual void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
38
39 // Add object to end of object list (if addAfter is NULL)
40 // or just after addAfter.
41 virtual void AddShape(wxShape *object, wxShape *addAfter = NULL);
42
43 // Add object to front of object list
44 virtual void InsertShape(wxShape *object);
45
46 void SetSnapToGrid(bool snap);
47 void SetGridSpacing(double spacing);
48 inline double GetGridSpacing() const { return m_gridSpacing; }
49 inline bool GetSnapToGrid() const { return m_snapToGrid; }
50 void Snap(double *x, double *y);
51
52 inline void SetQuickEditMode(bool qem) { m_quickEditMode = qem; }
53 inline bool GetQuickEditMode() const { return m_quickEditMode; }
54
55 virtual void RemoveShape(wxShape *object);
56 virtual void RemoveAllShapes();
57 virtual void DeleteAllShapes();
58 virtual void ShowAll(bool show);
59
60 // Find a shape by its id
61 wxShape* FindShape(long id) const;
62
63 inline void SetMouseTolerance(int tol) { m_mouseTolerance = tol; }
64 inline int GetMouseTolerance() const { return m_mouseTolerance; }
65 inline wxList *GetShapeList() const { return m_shapeList; }
b9ac87bc 66 inline int GetCount() const { return m_shapeList->GetCount(); }
1fc25a89
JS
67
68 // Make sure all text that should be centred, is centred.
69 void RecentreAll(wxDC& dc);
70
2b5f62a0 71#if wxUSE_PROLOGIO
1fc25a89
JS
72 virtual bool SaveFile(const wxString& filename);
73 virtual bool LoadFile(const wxString& filename);
74
75 virtual void ReadNodes(wxExprDatabase& database);
76 virtual void ReadLines(wxExprDatabase& database);
77 virtual void ReadContainerGeometry(wxExprDatabase& database);
78
79 // Allow for modifying file
80 virtual bool OnDatabaseLoad(wxExprDatabase& db);
81 virtual bool OnDatabaseSave(wxExprDatabase& db);
82 virtual bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
83 virtual bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
84 virtual bool OnHeaderSave(wxExprDatabase& db, wxExpr& expr);
85 virtual bool OnHeaderLoad(wxExprDatabase& db, wxExpr& expr);
86#endif
87
88protected:
89 wxShapeCanvas* m_diagramCanvas;
90 bool m_quickEditMode;
91 bool m_snapToGrid;
92 double m_gridSpacing;
93 int m_mouseTolerance;
94 wxList* m_shapeList;
95};
96
5f331691 97class WXDLLIMPEXP_OGL wxLineCrossing: public wxObject
1fc25a89
JS
98{
99public:
100 wxLineCrossing() { m_lineShape1 = NULL; m_lineShape2 = NULL; }
101 wxRealPoint m_pt1; // First line
102 wxRealPoint m_pt2;
103 wxRealPoint m_pt3; // Second line
104 wxRealPoint m_pt4;
105 wxRealPoint m_intersect;
106 wxLineShape* m_lineShape1;
107 wxLineShape* m_lineShape2;
108};
109
5f331691 110class WXDLLIMPEXP_OGL wxLineCrossings: public wxObject
1fc25a89
JS
111{
112public:
113 wxLineCrossings();
114 ~wxLineCrossings();
115
116 void FindCrossings(wxDiagram& diagram);
117 void DrawCrossings(wxDiagram& diagram, wxDC& dc);
118 void ClearCrossings();
119
120public:
121 wxList m_crossings;
122};
123
124#endif
125 // _OGL_OGLDIAG_H_