]> git.saurik.com Git - wxWidgets.git/blob - utils/ogl/src/basic.h
Removed warnings
[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 // Round up
110 #define WXROUND(x) ( (long) (x + 0.5) )
111
112 class wxShapeEvtHandler: public wxObject
113 {
114 DECLARE_DYNAMIC_CLASS(wxShapeEvtHandler)
115
116 public:
117 wxShapeEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL);
118 virtual ~wxShapeEvtHandler();
119
120 inline void SetShape(wxShape *sh) { m_handlerShape = sh; }
121 inline wxShape *GetShape() const { return m_handlerShape; }
122
123 inline void SetPreviousHandler(wxShapeEvtHandler* handler) { m_previousHandler = handler; }
124 inline wxShapeEvtHandler* GetPreviousHandler() const { return m_previousHandler; }
125
126 // This is called when the _shape_ is deleted.
127 virtual void OnDelete();
128 virtual void OnDraw(wxDC& dc);
129 virtual void OnDrawContents(wxDC& dc);
130 virtual void OnMoveLinks(wxDC& dc);
131 virtual void OnErase(wxDC& dc);
132 virtual void OnEraseContents(wxDC& dc);
133 virtual void OnHighlight(wxDC& dc);
134 virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
135 virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
136 virtual void OnSize(double x, double y);
137 virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
138 virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
139
140 virtual void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
141 virtual void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
142 virtual void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
143 virtual void OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
144 virtual void OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
145 virtual void OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
146 virtual void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
147 virtual void OnDrawControlPoints(wxDC& dc);
148 virtual void OnEraseControlPoints(wxDC& dc);
149 virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
150
151 // Control points ('handles') redirect control to the actual shape, to make it easier
152 // to override sizing behaviour.
153 virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
154 virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
155 virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
156
157 virtual void OnBeginSize(double WXUNUSED(w), double WXUNUSED(h)) { }
158 virtual void OnEndSize(double WXUNUSED(w), double WXUNUSED(h)) { }
159
160 // Can override this to prevent or intercept line reordering.
161 virtual void OnChangeAttachment(int attachment, wxLineShape* line, wxList& ordering);
162
163 // Creates a copy of this event handler.
164 wxShapeEvtHandler *CreateNewCopy();
165
166 // Does the copy - override for new event handlers which might store
167 // app-specific data.
168 virtual void CopyData(wxShapeEvtHandler& copy) {};
169
170 private:
171 wxShapeEvtHandler* m_previousHandler;
172 wxShape* m_handlerShape;
173 };
174
175 class wxShape: public wxShapeEvtHandler
176 {
177 DECLARE_ABSTRACT_CLASS(wxShape)
178
179 public:
180
181 wxShape(wxShapeCanvas *can = NULL);
182 virtual ~wxShape();
183 virtual void GetBoundingBoxMax(double *width, double *height);
184 virtual void GetBoundingBoxMin(double *width, double *height) = 0;
185 virtual bool GetPerimeterPoint(double x1, double y1,
186 double x2, double y2,
187 double *x3, double *y3);
188 inline wxShapeCanvas *GetCanvas() { return m_canvas; }
189 void SetCanvas(wxShapeCanvas *the_canvas);
190 virtual void AddToCanvas(wxShapeCanvas *the_canvas, wxShape *addAfter = NULL);
191 virtual void InsertInCanvas(wxShapeCanvas *the_canvas);
192
193 virtual void RemoveFromCanvas(wxShapeCanvas *the_canvas);
194 inline double GetX() const { return m_xpos; }
195 inline double GetY() const { return m_ypos; }
196 inline void SetX(double x) { m_xpos = x; }
197 inline void SetY(double y) { m_ypos = y; }
198
199 inline wxShape *GetParent() const { return m_parent; }
200 inline void SetParent(wxShape *p) { m_parent = p; }
201 wxShape *GetTopAncestor();
202 inline wxList& GetChildren() { return m_children; }
203
204 virtual void OnDraw(wxDC& dc);
205 virtual void OnDrawContents(wxDC& dc);
206 virtual void OnMoveLinks(wxDC& dc);
207 virtual void Unlink() { };
208 void SetDrawHandles(bool drawH);
209 inline bool GetDrawHandles() { return m_drawHandles; }
210 virtual void OnErase(wxDC& dc);
211 virtual void OnEraseContents(wxDC& dc);
212 virtual void OnHighlight(wxDC& dc);
213 virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
214 virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
215 virtual void OnSize(double x, double y);
216 virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
217 virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
218
219 virtual void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
220 virtual void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
221 virtual void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
222 virtual void OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
223 virtual void OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
224 virtual void OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
225 virtual void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
226 virtual void OnDrawControlPoints(wxDC& dc);
227 virtual void OnEraseControlPoints(wxDC& dc);
228
229 virtual void OnBeginSize(double WXUNUSED(w), double WXUNUSED(h)) { }
230 virtual void OnEndSize(double WXUNUSED(w), double WXUNUSED(h)) { }
231
232 // Control points ('handles') redirect control to the actual shape, to make it easier
233 // to override sizing behaviour.
234 virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
235 virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
236 virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
237
238 virtual void MakeControlPoints();
239 virtual void DeleteControlPoints(wxDC *dc = NULL);
240 virtual void ResetControlPoints();
241
242 inline wxShapeEvtHandler *GetEventHandler() { return m_eventHandler; }
243 inline void SetEventHandler(wxShapeEvtHandler *handler) { m_eventHandler = handler; }
244
245 // Mandatory control points, e.g. the divided line moving handles
246 // should appear even if a child of the 'selected' image
247 virtual void MakeMandatoryControlPoints();
248 virtual void ResetMandatoryControlPoints();
249
250 inline virtual bool Recompute() { return TRUE; };
251 // Calculate size recursively, if size changes. Size might depend on children.
252 inline virtual void CalculateSize() { };
253 virtual void Select(bool select = TRUE, wxDC* dc = NULL);
254 virtual void SetHighlight(bool hi = TRUE, bool recurse = FALSE);
255 inline virtual bool IsHighlighted() const { return m_highlighted; };
256 virtual bool Selected() const;
257 virtual bool AncestorSelected() const;
258 void SetSensitivityFilter(int sens = OP_ALL, bool recursive = FALSE);
259 int GetSensitivityFilter() const { return m_sensitivity; }
260 void SetDraggable(bool drag, bool recursive = FALSE);
261 inline void SetFixedSize(bool x, bool y) { m_fixedWidth = x; m_fixedHeight = y; };
262 inline void GetFixedSize(bool *x, bool *y) const { *x = m_fixedWidth; *y = m_fixedHeight; };
263 inline bool GetFixedWidth() const { return m_fixedWidth; }
264 inline bool GetFixedHeight() const { return m_fixedHeight; }
265 inline void SetSpaceAttachments(bool sp) { m_spaceAttachments = sp; };
266 inline bool GetSpaceAttachments() const { return m_spaceAttachments; };
267 void SetShadowMode(int mode, bool redraw = FALSE);
268 inline int GetShadowMode() const { return m_shadowMode; }
269 virtual bool HitTest(double x, double y, int *attachment, double *distance);
270 inline void SetCentreResize(bool cr) { m_centreResize = cr; }
271 inline bool GetCentreResize() const { return m_centreResize; }
272 inline wxList& GetLines() const { return (wxList&) m_lines; }
273 inline void SetDisableLabel(bool flag) { m_disableLabel = flag; }
274 inline bool GetDisableLabel() const { return m_disableLabel; }
275 inline void SetAttachmentMode(bool flag) { m_attachmentMode = flag; }
276 inline bool GetAttachmentMode() const { return m_attachmentMode; }
277 inline void SetId(long i) { m_id = i; }
278 inline long GetId() const { return m_id; }
279
280 void SetPen(wxPen *pen);
281 void SetBrush(wxBrush *brush);
282 inline void SetClientData(wxObject *client_data) { m_clientData = client_data; };
283 inline wxObject *GetClientData() const { return m_clientData; };
284
285 virtual void Show(bool show);
286 virtual bool IsShown() const { return m_visible; }
287 virtual void Move(wxDC& dc, double x1, double y1, bool display = TRUE);
288 virtual void Erase(wxDC& dc);
289 virtual void EraseContents(wxDC& dc);
290 virtual void Draw(wxDC& dc);
291 virtual void Flash();
292 virtual void MoveLinks(wxDC& dc);
293 virtual void DrawContents(wxDC& dc); // E.g. for drawing text label
294 virtual void SetSize(double x, double y, bool recursive = TRUE);
295 virtual void SetAttachmentSize(double x, double y);
296 void Attach(wxShapeCanvas *can);
297 void Detach();
298
299 inline virtual bool Constrain() { return FALSE; } ;
300
301 void AddLine(wxLineShape *line, wxShape *other,
302 int attachFrom = 0, int attachTo = 0,
303 // The line ordering
304 int positionFrom = -1, int positionTo = -1);
305
306 // Return the zero-based position in m_lines of line.
307 int GetLinePosition(wxLineShape* line);
308
309 void AddText(const wxString& string);
310
311 inline wxPen *GetPen() const { return m_pen; }
312 inline wxBrush *GetBrush() const { return m_brush; }
313
314 /*
315 * Region-specific functions (defaults to the default region
316 * for simple objects
317 */
318
319 // Set the default, single region size to be consistent
320 // with the object size
321 void SetDefaultRegionSize();
322 virtual void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
323 virtual void SetFormatMode(int mode, int regionId = 0);
324 virtual int GetFormatMode(int regionId = 0) const;
325 virtual void SetFont(wxFont *font, int regionId = 0);
326 virtual wxFont *GetFont(int regionId = 0) const;
327 virtual void SetTextColour(const wxString& colour, int regionId = 0);
328 virtual wxString GetTextColour(int regionId = 0) const;
329 virtual inline int GetNumberOfTextRegions() const { return m_regions.Number(); }
330 virtual void SetRegionName(const wxString& name, int regionId = 0);
331
332 // Get the name representing the region for this image alone.
333 // I.e. this image's region ids go from 0 to N-1.
334 // But the names might be "0.2.0", "0.2.1" etc. depending on position in composite.
335 // So the last digit represents the region Id, the others represent positions
336 // in composites.
337 virtual wxString GetRegionName(int regionId);
338
339 // Gets the region corresponding to the name, or -1 if not found.
340 virtual int GetRegionId(const wxString& name);
341
342 // Construct names for regions, unique even for children of a composite.
343 virtual void NameRegions(const wxString& parentName = "");
344
345 // Get list of regions
346 inline wxList& GetRegions() const { return (wxList&) m_regions; }
347
348 virtual void AddRegion(wxShapeRegion *region);
349
350 virtual void ClearRegions();
351
352 // Assign new ids to this image and children (if composite)
353 void AssignNewIds();
354
355 // Returns actual image (same as 'this' if non-composite) and region id
356 // for given region name.
357 virtual wxShape *FindRegion(const wxString& regionName, int *regionId);
358
359 // Finds all region names for this image (composite or simple).
360 // Supply empty string list.
361 virtual void FindRegionNames(wxStringList& list);
362
363 virtual void ClearText(int regionId = 0);
364 void RemoveLine(wxLineShape *line);
365
366 #ifdef PROLOGIO
367 // I/O
368 virtual void WriteAttributes(wxExpr *clause);
369 virtual void ReadAttributes(wxExpr *clause);
370
371 // In case the object has constraints it needs to read in in a different pass
372 inline virtual void ReadConstraints(wxExpr *WXUNUSED(clause), wxExprDatabase *WXUNUSED(database)) { };
373 virtual void WriteRegions(wxExpr *clause);
374 virtual void ReadRegions(wxExpr *clause);
375 #endif
376
377 // Attachment code
378 virtual bool GetAttachmentPosition(int attachment, double *x, double *y,
379 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
380 virtual int GetNumberOfAttachments() const;
381 virtual bool AttachmentIsValid(int attachment) const;
382
383 // Assuming the attachment lies along a vertical or horizontal line,
384 // calculate the position on that point.
385 virtual wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2,
386 int nth, int noArcs, wxLineShape* line);
387
388 // Returns TRUE if pt1 <= pt2 in the sense that one point comes before another on an
389 // edge of the shape.
390 // attachmentPoint is the attachment point (= side) in question.
391 virtual bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2);
392
393 virtual void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
394 virtual void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
395
396 virtual bool MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
397 double x, double y);
398
399 // Reorders the lines coming into the node image at this attachment
400 // position, in the order in which they appear in linesToSort.
401 virtual void SortLines(int attachment, wxList& linesToSort);
402
403 // Apply an attachment ordering change
404 void ApplyAttachmentOrdering(wxList& ordering);
405
406 // Can override this to prevent or intercept line reordering.
407 virtual void OnChangeAttachment(int attachment, wxLineShape* line, wxList& ordering);
408
409 // This is really to distinguish between lines and other images.
410 // For lines, want to pass drag to canvas, since lines tend to prevent
411 // dragging on a canvas (they get in the way.)
412 virtual bool Draggable() const { return TRUE; }
413
414 // Returns TRUE if image is a descendant of this image
415 bool HasDescendant(wxShape *image);
416
417 // Creates a copy of this shape.
418 wxShape *CreateNewCopy(bool resetMapping = TRUE, bool recompute = TRUE);
419
420 // Does the copying for this object
421 virtual void Copy(wxShape& copy);
422
423 // Does the copying for this object, including copying event
424 // handler data if any. Calls the virtual Copy function.
425 void CopyWithHandler(wxShape& copy);
426
427 // Rotate about the given axis by the given amount in radians
428 // (does nothing for most objects)
429 // But even non-rotating objects should record their notional
430 // rotation in case it's important (e.g. in dog-leg code).
431 virtual inline void Rotate(double WXUNUSED(x), double WXUNUSED(y), double theta) { m_rotation = theta; }
432 virtual inline double GetRotation() const { return m_rotation; }
433
434 void ClearAttachments();
435
436 // Recentres all the text regions for this object
437 void Recentre(wxDC& dc);
438
439 // Clears points from a list of wxRealPoints
440 void ClearPointList(wxList& list);
441
442 private:
443 wxObject* m_clientData;
444
445 protected:
446 wxShapeEvtHandler* m_eventHandler;
447 bool m_formatted;
448 double m_xpos, m_ypos;
449 wxPen* m_pen;
450 wxBrush* m_brush;
451 wxFont* m_font;
452 wxColour* m_textColour;
453 wxString m_textColourName;
454 wxShapeCanvas* m_canvas;
455 wxList m_lines;
456 wxList m_text;
457 wxList m_controlPoints;
458 wxList m_regions;
459 wxList m_attachmentPoints;
460 bool m_visible;
461 bool m_disableLabel;
462 long m_id;
463 bool m_selected;
464 bool m_highlighted; // Different from selected: user-defined highlighting,
465 // e.g. thick border.
466 double m_rotation;
467 int m_sensitivity;
468 bool m_draggable;
469 bool m_attachmentMode; // TRUE if using attachments, FALSE otherwise
470 bool m_spaceAttachments; // TRUE if lines at one side should be spaced
471 bool m_fixedWidth;
472 bool m_fixedHeight;
473 bool m_centreResize; // Default is to resize keeping the centre constant (TRUE)
474 bool m_drawHandles; // Don't draw handles if FALSE, usually TRUE
475 wxList m_children; // In case it's composite
476 wxShape* m_parent; // In case it's a child
477 int m_formatMode;
478 int m_shadowMode;
479 wxBrush* m_shadowBrush;
480 int m_shadowOffsetX;
481 int m_shadowOffsetY;
482 int m_textMarginX; // Gap between text and border
483 int m_textMarginY;
484 wxString m_regionName;
485 };
486
487 class wxPolygonShape: public wxShape
488 {
489 DECLARE_DYNAMIC_CLASS(wxPolygonShape)
490 public:
491 wxPolygonShape();
492 ~wxPolygonShape();
493
494 // Takes a list of wxRealPoints; each point is an OFFSET from the centre.
495 // Deletes user's points in destructor.
496 virtual void Create(wxList *points);
497 virtual void ClearPoints();
498
499 void GetBoundingBoxMin(double *w, double *h);
500 void CalculateBoundingBox();
501 bool GetPerimeterPoint(double x1, double y1,
502 double x2, double y2,
503 double *x3, double *y3);
504 bool HitTest(double x, double y, int *attachment, double *distance);
505 void SetSize(double x, double y, bool recursive = TRUE);
506 void OnDraw(wxDC& dc);
507 void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
508
509 // Control points ('handles') redirect control to the actual shape, to make it easier
510 // to override sizing behaviour.
511 virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
512 virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
513 virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
514
515 // A polygon should have a control point at each vertex,
516 // with the option of moving the control points individually
517 // to change the shape.
518 void MakeControlPoints();
519 void ResetControlPoints();
520
521 // If we've changed the shape, must make the original
522 // points match the working points
523 void UpdateOriginalPoints();
524
525 // Add a control point after the given point
526 virtual void AddPolygonPoint(int pos = 0);
527
528 // Delete a control point
529 virtual void DeletePolygonPoint(int pos = 0);
530
531 // Recalculates the centre of the polygon
532 virtual void CalculatePolygonCentre();
533
534 #ifdef PROLOGIO
535 // Prolog database stuff
536 void WriteAttributes(wxExpr *clause);
537 void ReadAttributes(wxExpr *clause);
538 #endif
539
540 int GetNumberOfAttachments() const;
541 bool GetAttachmentPosition(int attachment, double *x, double *y,
542 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
543 bool AttachmentIsValid(int attachment);
544 // Does the copying for this object
545 void Copy(wxShape& copy);
546
547 inline wxList *GetPoints() { return m_points; }
548
549 private:
550 wxList* m_points;
551 wxList* m_originalPoints;
552 double m_boundWidth;
553 double m_boundHeight;
554 double m_originalWidth;
555 double m_originalHeight;
556 };
557
558 class wxRectangleShape: public wxShape
559 {
560 DECLARE_DYNAMIC_CLASS(wxRectangleShape)
561 public:
562 wxRectangleShape(double w = 0.0, double h = 0.0);
563 void GetBoundingBoxMin(double *w, double *h);
564 bool GetPerimeterPoint(double x1, double y1,
565 double x2, double y2,
566 double *x3, double *y3);
567 void OnDraw(wxDC& dc);
568 void SetSize(double x, double y, bool recursive = TRUE);
569 void SetCornerRadius(double rad); // If > 0, rounded corners
570
571 #ifdef PROLOGIO
572 // Prolog database stuff
573 void WriteAttributes(wxExpr *clause);
574 void ReadAttributes(wxExpr *clause);
575 #endif
576
577 int GetNumberOfAttachments() const;
578 bool GetAttachmentPosition(int attachment, double *x, double *y,
579 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
580 // Does the copying for this object
581 void Copy(wxShape& copy);
582
583 inline double GetWidth() const { return m_width; }
584 inline double GetHeight() const { return m_height; }
585 inline void SetWidth(double w) { m_width = w; }
586 inline void SetHeight(double h) { m_height = h; }
587
588 protected:
589 double m_width;
590 double m_height;
591 double m_cornerRadius;
592 };
593
594 class wxTextShape: public wxRectangleShape
595 {
596 DECLARE_DYNAMIC_CLASS(wxTextShape)
597 public:
598 wxTextShape(double width = 0.0, double height = 0.0);
599
600 void OnDraw(wxDC& dc);
601
602 #ifdef PROLOGIO
603 void WriteAttributes(wxExpr *clause);
604 #endif
605
606 // Does the copying for this object
607 void Copy(wxShape& copy);
608 };
609
610 class wxEllipseShape: public wxShape
611 {
612 DECLARE_DYNAMIC_CLASS(wxEllipseShape)
613 public:
614 wxEllipseShape(double w = 0.0, double h = 0.0);
615
616 void GetBoundingBoxMin(double *w, double *h);
617 bool GetPerimeterPoint(double x1, double y1,
618 double x2, double y2,
619 double *x3, double *y3);
620
621 void OnDraw(wxDC& dc);
622 void SetSize(double x, double y, bool recursive = TRUE);
623
624 #ifdef PROLOGIO
625 // Prolog database stuff
626 void WriteAttributes(wxExpr *clause);
627 void ReadAttributes(wxExpr *clause);
628 #endif
629
630 int GetNumberOfAttachments() const;
631 bool GetAttachmentPosition(int attachment, double *x, double *y,
632 int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
633
634 // Does the copying for this object
635 void Copy(wxShape& copy);
636
637 inline double GetWidth() const { return m_width; }
638 inline double GetHeight() const { return m_height; }
639
640 inline void SetWidth(double w) { m_width = w; }
641 inline void SetHeight(double h) { m_height = h; }
642
643 protected:
644 double m_width;
645 double m_height;
646 };
647
648 class wxCircleShape: public wxEllipseShape
649 {
650 DECLARE_DYNAMIC_CLASS(wxCircleShape)
651 public:
652 wxCircleShape(double w = 0.0);
653
654 bool GetPerimeterPoint(double x1, double y1,
655 double x2, double y2,
656 double *x3, double *y3);
657 // Does the copying for this object
658 void Copy(wxShape& copy);
659 };
660
661 #endif
662 // _OGL_BASIC_H_