]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/ogl/basicp.h
generate makefile.unx files using bakefile
[wxWidgets.git] / contrib / include / wx / ogl / basicp.h
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 #define CONTROL_POINT_SIZE 6
16
17 class WXDLLIMPEXP_OGL wxShapeTextLine: public wxObject
18 {
19 DECLARE_DYNAMIC_CLASS(wxShapeTextLine)
20 public:
21 wxShapeTextLine(double the_x = 0.0, double the_y = 0.0, const wxString& the_line = wxEmptyString);
22 ~wxShapeTextLine();
23
24 inline double GetX() const { return m_x; }
25 inline double GetY() const { return m_y; }
26
27 inline void SetX(double x) { m_x = x; }
28 inline void SetY(double y) { m_y = y; }
29
30 inline void SetText(const wxString& text) { m_line = text; }
31 inline wxString GetText() const { return m_line; }
32
33 protected:
34 wxString m_line;
35 double m_x;
36 double m_y;
37 };
38
39 class WXDLLIMPEXP_OGL wxShape;
40 class WXDLLIMPEXP_OGL wxControlPoint: public wxRectangleShape
41 {
42 DECLARE_DYNAMIC_CLASS(wxControlPoint)
43
44 friend class WXDLLIMPEXP_OGL wxShapeEvtHandler;
45 friend class WXDLLIMPEXP_OGL wxShape;
46
47 public:
48 wxControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0, double the_xoffset = 0.0,
49 double 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, double x, double y, int keys=0, int attachment = 0);
56 void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
57 void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
58
59 bool GetAttachmentPosition(int attachment, double *x, double *y,
60 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
61 int GetNumberOfAttachments() const;
62
63 inline void SetEraseObject(bool er) { m_eraseObject = er; }
64
65 public:
66 int m_type;
67 double m_xoffset;
68 double m_yoffset;
69 wxShape* m_shape;
70 const wxCursor* m_oldCursor;
71 bool m_eraseObject; // If true, erases object before dragging handle.
72
73 /*
74 * Store original top-left, bottom-right coordinates
75 * in case we're doing non-vertical resizing.
76 */
77 static double sm_controlPointDragStartX;
78 static double sm_controlPointDragStartY;
79 static double sm_controlPointDragStartWidth;
80 static double sm_controlPointDragStartHeight;
81 static double sm_controlPointDragEndWidth;
82 static double sm_controlPointDragEndHeight;
83 static double sm_controlPointDragPosX;
84 static double sm_controlPointDragPosY;
85 };
86
87 class WXDLLIMPEXP_OGL wxPolygonShape;
88 class WXDLLIMPEXP_OGL wxPolygonControlPoint: public wxControlPoint
89 {
90 DECLARE_DYNAMIC_CLASS(wxPolygonControlPoint)
91 friend class WXDLLIMPEXP_OGL wxPolygonShape;
92 public:
93 wxPolygonControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0, wxRealPoint *vertex = NULL,
94 double the_xoffset = 0.0, double the_yoffset = 0.0);
95 ~wxPolygonControlPoint();
96
97 void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
98 void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
99 void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
100
101 // Calculate what new size would be, at end of resize
102 virtual void CalculateNewSize(double x, double y);
103
104 // Get new size
105 inline wxRealPoint GetNewSize() const { return m_newSize; };
106
107 public:
108 wxRealPoint* m_polygonVertex;
109 wxRealPoint m_originalSize;
110 double m_originalDistance;
111 wxRealPoint m_newSize;
112 };
113
114 /*
115 * Object regions.
116 * Every shape has one or more text regions with various
117 * properties. Not all of a region's properties will be used
118 * by a shape.
119 *
120 */
121
122 class WXDLLIMPEXP_OGL wxShapeRegion: public wxObject
123 {
124 DECLARE_DYNAMIC_CLASS(wxShapeRegion)
125
126 public:
127 // Constructor
128 wxShapeRegion();
129 // Copy constructor
130 wxShapeRegion(wxShapeRegion& region);
131 // Destructor
132 ~wxShapeRegion();
133
134 // Accessors
135 inline void SetText(const wxString& s)
136 { m_regionText = s; }
137 void SetFont(wxFont *f);
138 void SetMinSize(double w, double h);
139 void SetSize(double w, double h);
140 void SetPosition(double x, double y);
141 void SetProportions(double x, double y);
142 void SetFormatMode(int mode);
143 inline void SetName(const wxString& s) { m_regionName = s; };
144 void SetColour(const wxString& col); // Text colour
145
146 inline wxString GetText() const { return m_regionText; }
147 inline wxFont *GetFont() const { return m_font; }
148 inline void GetMinSize(double *x, double *y) const { *x = m_minWidth; *y = m_minHeight; }
149 inline void GetProportion(double *x, double *y) const { *x = m_regionProportionX; *y = m_regionProportionY; }
150 inline void GetSize(double *x, double *y) const { *x = m_width; *y = m_height; }
151 inline void GetPosition(double *xp, double *yp) const { *xp = m_x; *yp = m_y; }
152 inline int GetFormatMode() const { return m_formatMode; }
153 inline wxString GetName() const { return m_regionName; }
154 inline wxString GetColour() const { return m_textColour; }
155 wxColour GetActualColourObject();
156 inline wxList& GetFormattedText() { return m_formattedText; }
157 inline wxString GetPenColour() const { return m_penColour; }
158 inline int GetPenStyle() const { return m_penStyle; }
159 inline void SetPenStyle(int style) { m_penStyle = style; m_actualPenObject = NULL; }
160 void SetPenColour(const wxString& col);
161 wxPen *GetActualPen();
162 inline double GetWidth() const { return m_width; }
163 inline double GetHeight() const { return m_height; }
164
165 void ClearText();
166
167 public:
168 wxString m_regionText;
169 wxList m_formattedText; // List of wxShapeTextLines
170 wxFont* m_font;
171 double m_minHeight; // If zero, hide region.
172 double m_minWidth; // If zero, hide region.
173 double m_width;
174 double m_height;
175 double m_x;
176 double m_y;
177
178 double m_regionProportionX; // Proportion of total object size;
179 // -1.0 indicates equal proportion
180 double m_regionProportionY; // Proportion of total object size;
181 // -1.0 indicates equal proportion
182
183 int m_formatMode; // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE
184 wxString m_regionName;
185 wxString m_textColour;
186 wxColour m_actualColourObject; // For speed purposes
187
188 // New members for specifying divided rectangle division colour/style 30/6/94
189 wxString m_penColour;
190 int m_penStyle;
191 wxPen* m_actualPenObject;
192
193 };
194
195 /*
196 * User-defined attachment point
197 */
198
199 class WXDLLIMPEXP_OGL wxAttachmentPoint: public wxObject
200 {
201 DECLARE_DYNAMIC_CLASS(wxAttachmentPoint)
202
203 public:
204 inline wxAttachmentPoint()
205 {
206 m_id = 0; m_x = 0.0; m_y = 0.0;
207 }
208 inline wxAttachmentPoint(int id, double x, double y)
209 {
210 m_id = id; m_x = x; m_y = y;
211 }
212
213 public:
214 int m_id; // Identifier
215 double m_x; // x offset from centre of object
216 double m_y; // y offset from centre of object
217 };
218
219 #endif
220 // _OGL_BASICP_H_