]>
Commit | Line | Data |
---|---|---|
0fc1a713 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: basicp.h | |
3 | // Purpose: Private OGL classes and definitions | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 12/07/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _OGL_BASICP_H_ | |
13 | #define _OGL_BASICP_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "basicp.h" | |
17 | #endif | |
18 | ||
19 | #define CONTROL_POINT_SIZE 6 | |
20 | ||
21 | class wxShapeTextLine: public wxObject | |
22 | { | |
23 | DECLARE_DYNAMIC_CLASS(wxShapeTextLine) | |
24 | public: | |
25 | wxShapeTextLine(float the_x = 0.0, float the_y = 0.0, const wxString& the_line = ""); | |
26 | ~wxShapeTextLine(); | |
27 | ||
28 | inline float GetX() const { return m_x; } | |
29 | inline float GetY() const { return m_y; } | |
30 | ||
31 | inline void SetX(float x) { m_x = x; } | |
32 | inline void SetY(float y) { m_y = y; } | |
33 | ||
34 | inline void SetText(const wxString& text) { m_line = text; } | |
35 | inline wxString GetText() const { return m_line; } | |
36 | ||
37 | protected: | |
38 | wxString m_line; | |
39 | float m_x; | |
40 | float m_y; | |
41 | }; | |
42 | ||
43 | class wxControlPoint: public wxRectangleShape | |
44 | { | |
45 | DECLARE_DYNAMIC_CLASS(wxControlPoint) | |
46 | ||
47 | public: | |
48 | wxControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, float the_xoffset = 0.0, | |
49 | float the_yoffset = 0.0, int the_type = 0); | |
50 | ~wxControlPoint(); | |
51 | ||
52 | void OnDraw(wxDC& dc); | |
53 | void OnErase(wxDC& dc); | |
54 | void OnDrawContents(wxDC& dc); | |
55 | void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); | |
56 | void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); | |
57 | void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); | |
58 | ||
59 | bool GetAttachmentPosition(int attachment, float *x, float *y, | |
60 | int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); | |
61 | int GetNumberOfAttachments(); | |
62 | ||
63 | inline void SetEraseObject(bool er) { m_eraseObject = er; } | |
64 | ||
65 | public: | |
66 | int m_type; | |
67 | float m_xoffset; | |
68 | float m_yoffset; | |
69 | wxShape* m_shape; | |
70 | wxCursor* m_oldCursor; | |
71 | bool m_eraseObject; // If TRUE, erases object before dragging handle. | |
72 | ||
73 | }; | |
74 | ||
75 | class wxPolygonControlPoint: public wxControlPoint | |
76 | { | |
77 | DECLARE_DYNAMIC_CLASS(wxPolygonControlPoint) | |
78 | ||
79 | public: | |
80 | wxPolygonControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, wxRealPoint *vertex = NULL, | |
81 | float the_xoffset = 0.0, float the_yoffset = 0.0); | |
82 | ~wxPolygonControlPoint(); | |
83 | ||
84 | void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); | |
85 | void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); | |
86 | void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); | |
87 | ||
88 | public: | |
89 | wxRealPoint* m_polygonVertex; | |
90 | wxRealPoint m_originalSize; | |
91 | float m_originalDistance; | |
92 | }; | |
93 | ||
94 | /* | |
95 | * Object regions. | |
96 | * Every shape has one or more text regions with various | |
97 | * properties. Not all of a region's properties will be used | |
98 | * by a shape. | |
99 | * | |
100 | */ | |
101 | ||
102 | class wxShapeRegion: public wxObject | |
103 | { | |
104 | DECLARE_DYNAMIC_CLASS(wxShapeRegion) | |
105 | ||
106 | public: | |
107 | // Constructor | |
108 | wxShapeRegion(); | |
109 | // Copy constructor | |
110 | wxShapeRegion(wxShapeRegion& region); | |
111 | // Destructor | |
112 | ~wxShapeRegion(); | |
113 | ||
114 | // Accessors | |
115 | inline void SetText(const wxString& s) { m_regionText = s; } | |
116 | void SetFont(wxFont *f); | |
117 | void SetMinSize(float w, float h); | |
118 | void SetSize(float w, float h); | |
119 | void SetPosition(float x, float y); | |
120 | void SetProportions(float x, float y); | |
121 | void SetFormatMode(int mode); | |
122 | inline void SetName(const wxString& s) { m_regionName = s; }; | |
123 | void SetColour(const wxString& col); // Text colour | |
124 | ||
125 | inline wxString GetText() const { return m_regionText; } | |
126 | inline wxFont *GetFont() const { return m_font; } | |
127 | inline void GetMinSize(float *x, float *y) const { *x = m_minWidth; *y = m_minHeight; } | |
128 | inline void GetProportion(float *x, float *y) const { *x = m_regionProportionX; *y = m_regionProportionY; } | |
129 | inline void GetSize(float *x, float *y) const { *x = m_width; *y = m_height; } | |
130 | inline void GetPosition(float *xp, float *yp) const { *xp = m_x; *yp = m_y; } | |
131 | inline int GetFormatMode() const { return m_formatMode; } | |
132 | inline wxString GetName() const { return m_regionName; } | |
133 | inline wxString GetColour() const { return m_textColour; } | |
134 | wxColour *GetActualColourObject(); | |
135 | inline wxList& GetFormattedText() { return m_formattedText; } | |
136 | inline wxString GetPenColour() const { return m_penColour; } | |
137 | inline int GetPenStyle() const { return m_penStyle; } | |
138 | inline void SetPenStyle(int style) { m_penStyle = style; m_actualPenObject = NULL; } | |
139 | void SetPenColour(const wxString& col); | |
140 | wxPen *GetActualPen(); | |
141 | inline float GetWidth() const { return m_width; } | |
142 | inline float GetHeight() const { return m_height; } | |
143 | ||
144 | void ClearText(); | |
145 | ||
146 | public: | |
147 | wxString m_regionText; | |
148 | wxList m_formattedText; // List of wxShapeTextLines | |
149 | wxFont* m_font; | |
150 | float m_minHeight; // If zero, hide region. | |
151 | float m_minWidth; // If zero, hide region. | |
152 | float m_width; | |
153 | float m_height; | |
154 | float m_x; | |
155 | float m_y; | |
156 | ||
157 | float m_regionProportionX; // Proportion of total object size; | |
158 | // -1.0 indicates equal proportion | |
159 | float m_regionProportionY; // Proportion of total object size; | |
160 | // -1.0 indicates equal proportion | |
161 | ||
162 | int m_formatMode; // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE | |
163 | wxString m_regionName; | |
164 | wxString m_textColour; | |
165 | wxColour* m_actualColourObject; // For speed purposes | |
166 | ||
167 | // New members for specifying divided rectangle division colour/style 30/6/94 | |
168 | wxString m_penColour; | |
169 | int m_penStyle; | |
170 | wxPen* m_actualPenObject; | |
171 | ||
172 | }; | |
173 | ||
174 | /* | |
175 | * User-defined attachment point | |
176 | */ | |
177 | ||
178 | class wxAttachmentPoint: public wxObject | |
179 | { | |
180 | DECLARE_DYNAMIC_CLASS(wxAttachmentPoint) | |
181 | ||
182 | public: | |
183 | inline wxAttachmentPoint() | |
184 | { | |
185 | m_id = 0; m_x = 0.0; m_y = 0.0; | |
186 | } | |
187 | ||
188 | public: | |
189 | int m_id; // Identifier | |
190 | float m_x; // x offset from centre of object | |
191 | float m_y; // y offset from centre of object | |
192 | }; | |
193 | ||
194 | #endif | |
195 | // _OGL_BASICP_H_ |