]> git.saurik.com Git - wxWidgets.git/blob - utils/ogl/src/basic.h
Various bug fixes to OGL; wxStripExtension prototype added to filefn.h
[wxWidgets.git] / utils / ogl / src / basic.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: basic.h
3 // Purpose: Basic 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_BASIC_H_
13 #define _OGL_BASIC_H_
14
15 #ifdef __GNUG__
16 #pragma interface "basic.h"
17 #endif
18
19 #define OGL_VERSION 2.0
20
21 #ifndef DEFAULT_MOUSE_TOLERANCE
22 #define DEFAULT_MOUSE_TOLERANCE 3
23 #endif
24
25 // Edit these lines if you positively don't want PROLOGIO support
26 #ifndef PROLOGIO
27 #define PROLOGIO
28 #endif
29
30 // Key identifiers
31 #define KEY_SHIFT 1
32 #define KEY_CTRL 2
33
34 // Arrow styles
35
36 #define ARROW_NONE 0
37 #define ARROW_END 1
38 #define ARROW_BOTH 2
39 #define ARROW_MIDDLE 3
40 #define ARROW_START 4
41
42 // Control point types
43 // Rectangle and most other shapes
44 #define CONTROL_POINT_VERTICAL 1
45 #define CONTROL_POINT_HORIZONTAL 2
46 #define CONTROL_POINT_DIAGONAL 3
47
48 // Line
49 #define CONTROL_POINT_ENDPOINT_TO 4
50 #define CONTROL_POINT_ENDPOINT_FROM 5
51 #define CONTROL_POINT_LINE 6
52
53 // Types of formatting: can be combined in a bit list
54 #define FORMAT_NONE 0
55 // Left justification
56 #define FORMAT_CENTRE_HORIZ 1
57 // Centre horizontally
58 #define FORMAT_CENTRE_VERT 2
59 // Centre vertically
60 #define FORMAT_SIZE_TO_CONTENTS 4
61 // Resize shape to contents
62
63 // Shadow mode
64 #define SHADOW_NONE 0
65 #define SHADOW_LEFT 1
66 #define SHADOW_RIGHT 2
67
68 /*
69 * Declare types
70 *
71 */
72
73 #define SHAPE_BASIC wxTYPE_USER + 1
74 #define SHAPE_RECTANGLE wxTYPE_USER + 2
75 #define SHAPE_ELLIPSE wxTYPE_USER + 3
76 #define SHAPE_POLYGON wxTYPE_USER + 4
77 #define SHAPE_CIRCLE wxTYPE_USER + 5
78 #define SHAPE_LINE wxTYPE_USER + 6
79 #define SHAPE_DIVIDED_RECTANGLE wxTYPE_USER + 8
80 #define SHAPE_COMPOSITE wxTYPE_USER + 9
81 #define SHAPE_CONTROL_POINT wxTYPE_USER + 10
82 #define SHAPE_DRAWN wxTYPE_USER + 11
83 #define SHAPE_DIVISION wxTYPE_USER + 12
84 #define SHAPE_LABEL_OBJECT wxTYPE_USER + 13
85 #define SHAPE_BITMAP wxTYPE_USER + 14
86 #define SHAPE_DIVIDED_OBJECT_CONTROL_POINT wxTYPE_USER + 15
87
88 #define OBJECT_REGION wxTYPE_USER + 20
89
90 #define OP_CLICK_LEFT 1
91 #define OP_CLICK_RIGHT 2
92 #define OP_DRAG_LEFT 4
93 #define OP_DRAG_RIGHT 8
94
95 #define OP_ALL (OP_CLICK_LEFT | OP_CLICK_RIGHT | OP_DRAG_LEFT | OP_DRAG_RIGHT)
96
97 class wxShapeTextLine;
98 class wxShapeCanvas;
99 class wxLineShape;
100 class wxControlPoint;
101 class wxShapeRegion;
102 class wxShape;
103
104 #ifdef PROLOGIO
105 class WXDLLEXPORT wxExpr;
106 class WXDLLEXPORT wxExprDatabase;
107 #endif
108
109 class wxShapeEvtHandler: public wxObject
110 {
111 DECLARE_DYNAMIC_CLASS(wxShapeEvtHandler)
112
113 public:
114 wxShapeEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL);
115 virtual ~wxShapeEvtHandler();
116
117 inline void SetShape(wxShape *sh) { m_handlerShape = sh; }
118 inline wxShape *GetShape() const { return m_handlerShape; }
119
120 inline void SetPreviousHandler(wxShapeEvtHandler* handler) { m_previousHandler = handler; }
121 inline wxShapeEvtHandler* GetPreviousHandler() const { return m_previousHandler; }
122
123 // This is called when the _shape_ is deleted.
124 virtual void OnDelete();
125 virtual void OnDraw(wxDC& dc);
126 virtual void OnDrawContents(wxDC& dc);
127 virtual void OnMoveLinks(wxDC& dc);
128 virtual void OnErase(wxDC& dc);
129 virtual void OnEraseContents(wxDC& dc);
130 virtual void OnHighlight(wxDC& dc);
131 virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
132 virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
133 virtual void OnSize(float x, float y);
134 virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
135 virtual void OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
136
137 virtual void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
138 virtual void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
139 virtual void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
140 virtual void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
141 virtual void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0);
142 virtual void OnEndDragRight(float x, float y, int keys=0, int attachment = 0);
143 virtual void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
144 virtual void OnDrawControlPoints(wxDC& dc);
145 virtual void OnEraseControlPoints(wxDC& dc);
146 virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
147
148 // Control points ('handles') redirect control to the actual shape, to make it easier
149 // to override sizing behaviour.
150 virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
151 virtual void OnSizingBeginDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
152 virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
153
154 virtual void OnBeginSize(float WXUNUSED(w), float WXUNUSED(h)) { }
155 virtual void OnEndSize(float WXUNUSED(w), float WXUNUSED(h)) { }
156
157 // Creates a copy of this event handler.
158 wxShapeEvtHandler *CreateNewCopy();
159
160 // Does the copy - override for new event handlers which might store
161 // app-specific data.
162 virtual void CopyData(wxShapeEvtHandler& copy) {};
163
164 private:
165 wxShapeEvtHandler* m_previousHandler;
166 wxShape* m_handlerShape;
167 };
168
169 class wxShape: public wxShapeEvtHandler
170 {
171 DECLARE_ABSTRACT_CLASS(wxShape)
172
173 public:
174
175 wxShape(wxShapeCanvas *can = NULL);
176 virtual ~wxShape();
177 virtual void GetBoundingBoxMax(float *width, float *height);
178 virtual void GetBoundingBoxMin(float *width, float *height) = 0;
179 virtual bool GetPerimeterPoint(float x1, float y1,
180 float x2, float y2,
181 float *x3, float *y3);
182 inline wxShapeCanvas *GetCanvas() { return m_canvas; }
183 void SetCanvas(wxShapeCanvas *the_canvas);
184 virtual void AddToCanvas(wxShapeCanvas *the_canvas, wxShape *addAfter = NULL);
185 virtual void InsertInCanvas(wxShapeCanvas *the_canvas);
186
187 virtual void RemoveFromCanvas(wxShapeCanvas *the_canvas);
188 inline float GetX() const { return m_xpos; }
189 inline float GetY() const { return m_ypos; }
190 inline void SetX(float x) { m_xpos = x; }
191 inline void SetY(float y) { m_ypos = y; }
192
193 inline wxShape *GetParent() const { return m_parent; }
194 inline void SetParent(wxShape *p) { m_parent = p; }
195 wxShape *GetTopAncestor();
196 inline wxList& GetChildren() { return m_children; }
197
198 virtual void OnDraw(wxDC& dc);
199 virtual void OnDrawContents(wxDC& dc);
200 virtual void OnMoveLinks(wxDC& dc);
201 virtual void Unlink() { };
202 void SetDrawHandles(bool drawH);
203 inline bool GetDrawHandles() { return m_drawHandles; }
204 virtual void OnErase(wxDC& dc);
205 virtual void OnEraseContents(wxDC& dc);
206 virtual void OnHighlight(wxDC& dc);
207 virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
208 virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
209 virtual void OnSize(float x, float y);
210 virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
211 virtual void OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
212
213 virtual void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
214 virtual void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
215 virtual void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
216 virtual void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
217 virtual void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0);
218 virtual void OnEndDragRight(float x, float y, int keys=0, int attachment = 0);
219 virtual void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
220 virtual void OnDrawControlPoints(wxDC& dc);
221 virtual void OnEraseControlPoints(wxDC& dc);
222
223 virtual void OnBeginSize(float WXUNUSED(w), float WXUNUSED(h)) { }
224 virtual void OnEndSize(float WXUNUSED(w), float WXUNUSED(h)) { }
225
226 // Control points ('handles') redirect control to the actual shape, to make it easier
227 // to override sizing behaviour.
228 virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
229 virtual void OnSizingBeginDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
230 virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
231
232 virtual void MakeControlPoints();
233 virtual void DeleteControlPoints(wxDC *dc = NULL);
234 virtual void ResetControlPoints();
235
236 inline wxShapeEvtHandler *GetEventHandler() { return m_eventHandler; }
237 inline void SetEventHandler(wxShapeEvtHandler *handler) { m_eventHandler = handler; }
238
239 // Mandatory control points, e.g. the divided line moving handles
240 // should appear even if a child of the 'selected' image
241 virtual void MakeMandatoryControlPoints();
242 virtual void ResetMandatoryControlPoints();
243
244 inline virtual bool Recompute() { return TRUE; };
245 // Calculate size recursively, if size changes. Size might depend on children.
246 inline virtual void CalculateSize() { };
247 virtual void Select(bool select = TRUE, wxDC* dc = NULL);
248 virtual void SetHighlight(bool hi = TRUE, bool recurse = FALSE);
249 inline virtual bool IsHighlighted() const { return m_highlighted; };
250 virtual bool Selected() const;
251 virtual bool AncestorSelected() const;
252 void SetSensitivityFilter(int sens = OP_ALL, bool recursive = FALSE);
253 int GetSensitivityFilter() const { return m_sensitivity; }
254 void SetDraggable(bool drag, bool recursive = FALSE);
255 inline void SetFixedSize(bool x, bool y) { m_fixedWidth = x; m_fixedHeight = y; };
256 inline void GetFixedSize(bool *x, bool *y) const { *x = m_fixedWidth; *y = m_fixedHeight; };
257 inline bool GetFixedWidth() const { return m_fixedWidth; }
258 inline bool GetFixedHeight() const { return m_fixedHeight; }
259 inline void SetSpaceAttachments(bool sp) { m_spaceAttachments = sp; };
260 inline bool GetSpaceAttachments() const { return m_spaceAttachments; };
261 void SetShadowMode(int mode, bool redraw = FALSE);
262 inline int GetShadowMode() const { return m_shadowMode; }
263 virtual bool HitTest(float x, float y, int *attachment, float *distance);
264 inline void SetCentreResize(bool cr) { m_centreResize = cr; }
265 inline bool GetCentreResize() const { return m_centreResize; }
266 inline wxList& GetLines() { return m_lines; }
267 inline void SetDisableLabel(bool flag) { m_disableLabel = flag; }
268 inline bool GetDisableLabel() const { return m_disableLabel; }
269 inline void SetAttachmentMode(bool flag) { m_attachmentMode = flag; }
270 inline bool GetAttachmentMode() const { return m_attachmentMode; }
271 inline void SetId(long i) { m_id = i; }
272 inline long GetId() const { return m_id; }
273
274 void SetPen(wxPen *pen);
275 void SetBrush(wxBrush *brush);
276 inline void SetClientData(wxObject *client_data) { m_clientData = client_data; };
277 inline wxObject *GetClientData() const { return m_clientData; };
278
279 virtual void Show(bool show);
280 virtual bool IsShown() const { return m_visible; }
281 virtual void Move(wxDC& dc, float x1, float y1, bool display = TRUE);
282 virtual void Erase(wxDC& dc);
283 virtual void EraseContents(wxDC& dc);
284 virtual void Draw(wxDC& dc);
285 virtual void Flash();
286 virtual void MoveLinks(wxDC& dc);
287 virtual void DrawContents(wxDC& dc); // E.g. for drawing text label
288 virtual void SetSize(float x, float y, bool recursive = TRUE);
289 virtual void SetAttachmentSize(float x, float y);
290 void Attach(wxShapeCanvas *can);
291 void Detach();
292
293 inline virtual bool Constrain() { return FALSE; } ;
294
295 void AddLine(wxLineShape *line, wxShape *other,
296 int attachFrom = 0, int attachTo = 0);
297 void AddText(const wxString& string);
298
299 inline wxPen *GetPen() const { return m_pen; }
300 inline wxBrush *GetBrush() const { return m_brush; }
301
302 /*
303 * Region-specific functions (defaults to the default region
304 * for simple objects
305 */
306
307 // Set the default, single region size to be consistent
308 // with the object size
309 void SetDefaultRegionSize();
310 virtual void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
311 virtual void SetFormatMode(int mode, int regionId = 0);
312 virtual int GetFormatMode(int regionId = 0) const;
313 virtual void SetFont(wxFont *font, int regionId = 0);
314 virtual wxFont *GetFont(int regionId = 0) const;
315 virtual void SetTextColour(const wxString& colour, int regionId = 0);
316 virtual wxString GetTextColour(int regionId = 0) const;
317 virtual inline int GetNumberOfTextRegions() const { return m_regions.Number(); }
318 virtual void SetRegionName(const wxString& name, int regionId = 0);
319
320 // Get the name representing the region for this image alone.
321 // I.e. this image's region ids go from 0 to N-1.
322 // But the names might be "0.2.0", "0.2.1" etc. depending on position in composite.
323 // So the last digit represents the region Id, the others represent positions
324 // in composites.
325 virtual wxString GetRegionName(int regionId);
326
327 // Gets the region corresponding to the name, or -1 if not found.
328 virtual int GetRegionId(const wxString& name);
329
330 // Construct names for regions, unique even for children of a composite.
331 virtual void NameRegions(const wxString& parentName = "");
332
333 // Get list of regions
334 inline wxList& GetRegions() const { return (wxList&) m_regions; }
335
336 virtual void AddRegion(wxShapeRegion *region);
337
338 virtual void ClearRegions();
339
340 // Assign new ids to this image and children (if composite)
341 void AssignNewIds();
342
343 // Returns actual image (same as 'this' if non-composite) and region id
344 // for given region name.
345 virtual wxShape *FindRegion(const wxString& regionName, int *regionId);
346
347 // Finds all region names for this image (composite or simple).
348 // Supply empty string list.
349 virtual void FindRegionNames(wxStringList& list);
350
351 virtual void ClearText(int regionId = 0);
352 void RemoveLine(wxLineShape *line);
353
354 #ifdef PROLOGIO
355 // Prolog database stuff
356 virtual char *GetFunctor();
357 virtual void WritePrologAttributes(wxExpr *clause);
358 virtual void ReadPrologAttributes(wxExpr *clause);
359
360 // In case the object has constraints it needs to read in in a different pass
361 inline virtual void ReadConstraints(wxExpr *WXUNUSED(clause), wxExprDatabase *WXUNUSED(database)) { };
362 virtual void WriteRegions(wxExpr *clause);
363 virtual void ReadRegions(wxExpr *clause);
364 #endif
365
366 // Attachment code
367 virtual bool GetAttachmentPosition(int attachment, float *x, float *y,
368 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
369 virtual int GetNumberOfAttachments();
370 virtual bool AttachmentIsValid(int attachment);
371
372 virtual void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
373 virtual void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
374
375 virtual void MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
376 float x, float y);
377
378 // Reorders the lines coming into the node image at this attachment
379 // position, in the order in which they appear in linesToSort.
380 virtual void SortLines(int attachment, wxList& linesToSort);
381
382 // This is really to distinguish between lines and other images.
383 // For lines, want to pass drag to canvas, since lines tend to prevent
384 // dragging on a canvas (they get in the way.)
385 virtual bool Draggable() const { return TRUE; }
386
387 // Returns TRUE if image is a descendant of this image
388 bool HasDescendant(wxShape *image);
389
390 // Creates a copy of this shape.
391 wxShape *CreateNewCopy(bool resetMapping = TRUE, bool recompute = TRUE);
392
393 // Does the copying for this object
394 virtual void Copy(wxShape& copy);
395
396 // Does the copying for this object, including copying event
397 // handler data if any. Calls the virtual Copy function.
398 void CopyWithHandler(wxShape& copy);
399
400 // Rotate about the given axis by the given amount in radians
401 // (does nothing for most objects)
402 // But even non-rotating objects should record their notional
403 // rotation in case it's important (e.g. in dog-leg code).
404 virtual inline void Rotate(float WXUNUSED(x), float WXUNUSED(y), float theta) { m_rotation = theta; }
405 virtual inline float GetRotation() const { return m_rotation; }
406
407 void ClearAttachments();
408
409 // Recentres all the text regions for this object
410 void Recentre(wxDC& dc);
411
412 // Clears points from a list of wxRealPoints
413 void ClearPointList(wxList& list);
414
415 private:
416 wxObject* m_clientData;
417
418 protected:
419 wxShapeEvtHandler* m_eventHandler;
420 bool m_formatted;
421 float m_xpos, m_ypos;
422 wxPen* m_pen;
423 wxBrush* m_brush;
424 wxFont* m_font;
425 wxColour* m_textColour;
426 wxString m_textColourName;
427 wxShapeCanvas* m_canvas;
428 wxList m_lines;
429 wxList m_text;
430 wxList m_controlPoints;
431 wxList m_regions;
432 wxList m_attachmentPoints;
433 bool m_visible;
434 bool m_disableLabel;
435 long m_id;
436 bool m_selected;
437 bool m_highlighted; // Different from selected: user-defined highlighting,
438 // e.g. thick border.
439 float m_rotation;
440 int m_sensitivity;
441 bool m_draggable;
442 bool m_attachmentMode; // TRUE if using attachments, FALSE otherwise
443 bool m_spaceAttachments; // TRUE if lines at one side should be spaced
444 bool m_fixedWidth;
445 bool m_fixedHeight;
446 bool m_centreResize; // Default is to resize keeping the centre constant (TRUE)
447 bool m_drawHandles; // Don't draw handles if FALSE, usually TRUE
448 wxList m_children; // In case it's composite
449 wxShape* m_parent; // In case it's a child
450 int m_formatMode;
451 int m_shadowMode;
452 wxBrush* m_shadowBrush;
453 int m_shadowOffsetX;
454 int m_shadowOffsetY;
455 int m_textMarginX; // Gap between text and border
456 int m_textMarginY;
457 wxString m_regionName;
458 };
459
460 class wxPolygonShape: public wxShape
461 {
462 DECLARE_DYNAMIC_CLASS(wxPolygonShape)
463 public:
464 wxPolygonShape();
465 ~wxPolygonShape();
466
467 // Takes a list of wxRealPoints; each point is an OFFSET from the centre.
468 // Deletes user's points in destructor.
469 virtual void Create(wxList *points);
470
471 void GetBoundingBoxMin(float *w, float *h);
472 void CalculateBoundingBox();
473 bool GetPerimeterPoint(float x1, float y1,
474 float x2, float y2,
475 float *x3, float *y3);
476 bool HitTest(float x, float y, int *attachment, float *distance);
477 void SetSize(float x, float y, bool recursive = TRUE);
478 void OnDraw(wxDC& dc);
479 void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
480
481 // Control points ('handles') redirect control to the actual shape, to make it easier
482 // to override sizing behaviour.
483 virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, float x, float y, int keys=0, int attachment = 0);
484 virtual void OnSizingBeginDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
485 virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
486
487 // A polygon should have a control point at each vertex,
488 // with the option of moving the control points individually
489 // to change the shape.
490 void MakeControlPoints();
491 void ResetControlPoints();
492
493 // If we've changed the shape, must make the original
494 // points match the working points
495 void UpdateOriginalPoints();
496
497 // Add a control point after the given point
498 virtual void AddPolygonPoint(int pos = 0);
499
500 // Delete a control point
501 virtual void DeletePolygonPoint(int pos = 0);
502
503 // Recalculates the centre of the polygon
504 virtual void CalculatePolygonCentre();
505
506 #ifdef PROLOGIO
507 // Prolog database stuff
508 void WritePrologAttributes(wxExpr *clause);
509 void ReadPrologAttributes(wxExpr *clause);
510 #endif
511
512 int GetNumberOfAttachments();
513 bool GetAttachmentPosition(int attachment, float *x, float *y,
514 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
515 bool AttachmentIsValid(int attachment);
516 // Does the copying for this object
517 void Copy(wxShape& copy);
518
519 inline wxList *GetPoints() { return m_points; }
520
521 private:
522 wxList* m_points;
523 wxList* m_originalPoints;
524 float m_boundWidth;
525 float m_boundHeight;
526 float m_originalWidth;
527 float m_originalHeight;
528 };
529
530 class wxRectangleShape: public wxShape
531 {
532 DECLARE_DYNAMIC_CLASS(wxRectangleShape)
533 public:
534 wxRectangleShape(float w = 0.0, float h = 0.0);
535 void GetBoundingBoxMin(float *w, float *h);
536 bool GetPerimeterPoint(float x1, float y1,
537 float x2, float y2,
538 float *x3, float *y3);
539 void OnDraw(wxDC& dc);
540 void SetSize(float x, float y, bool recursive = TRUE);
541 void SetCornerRadius(float rad); // If > 0, rounded corners
542
543 #ifdef PROLOGIO
544 // Prolog database stuff
545 void WritePrologAttributes(wxExpr *clause);
546 void ReadPrologAttributes(wxExpr *clause);
547 #endif
548
549 int GetNumberOfAttachments();
550 bool GetAttachmentPosition(int attachment, float *x, float *y,
551 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
552 // Does the copying for this object
553 void Copy(wxShape& copy);
554
555 inline float GetWidth() const { return m_width; }
556 inline float GetHeight() const { return m_height; }
557
558 protected:
559 float m_width;
560 float m_height;
561 float m_cornerRadius;
562 };
563
564 class wxTextShape: public wxRectangleShape
565 {
566 DECLARE_DYNAMIC_CLASS(wxTextShape)
567 public:
568 wxTextShape(float width = 0.0, float height = 0.0);
569
570 void OnDraw(wxDC& dc);
571
572 #ifdef PROLOGIO
573 void WritePrologAttributes(wxExpr *clause);
574 #endif
575
576 // Does the copying for this object
577 void Copy(wxShape& copy);
578 };
579
580 class wxEllipseShape: public wxShape
581 {
582 DECLARE_DYNAMIC_CLASS(wxEllipseShape)
583 public:
584 wxEllipseShape(float w = 0.0, float h = 0.0);
585
586 void GetBoundingBoxMin(float *w, float *h);
587 bool GetPerimeterPoint(float x1, float y1,
588 float x2, float y2,
589 float *x3, float *y3);
590
591 void OnDraw(wxDC& dc);
592 void SetSize(float x, float y, bool recursive = TRUE);
593
594 #ifdef PROLOGIO
595 // Prolog database stuff
596 void WritePrologAttributes(wxExpr *clause);
597 void ReadPrologAttributes(wxExpr *clause);
598 #endif
599
600 int GetNumberOfAttachments();
601 bool GetAttachmentPosition(int attachment, float *x, float *y,
602 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
603
604 // Does the copying for this object
605 void Copy(wxShape& copy);
606
607 inline float GetWidth() const { return m_width; }
608 inline float GetHeight() const { return m_height; }
609
610 protected:
611 float m_width;
612 float m_height;
613 };
614
615 class wxCircleShape: public wxEllipseShape
616 {
617 DECLARE_DYNAMIC_CLASS(wxCircleShape)
618 public:
619 wxCircleShape(float w = 0.0);
620
621 bool GetPerimeterPoint(float x1, float y1,
622 float x2, float y2,
623 float *x3, float *y3);
624 // Does the copying for this object
625 void Copy(wxShape& copy);
626 };
627
628 #endif
629 // _OGL_BASIC_H_