X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1dc302a8ae2b0e74197723f08a76b883ea9c2c3b..695fe764bd0ebfdc01d854033c26adb9ff248560:/contrib/include/wx/ogl/basic.h diff --git a/contrib/include/wx/ogl/basic.h b/contrib/include/wx/ogl/basic.h index 1288c3c057..0e4e5f34a1 100644 --- a/contrib/include/wx/ogl/basic.h +++ b/contrib/include/wx/ogl/basic.h @@ -6,27 +6,30 @@ // Created: 12/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _OGL_BASIC_H_ #define _OGL_BASIC_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "basic.h" #endif +#ifndef wxUSE_DEPRECATED +#define wxUSE_DEPRECATED 1 +#endif + +#if wxUSE_DEPRECATED +#include +#endif + #define OGL_VERSION 2.0 #ifndef DEFAULT_MOUSE_TOLERANCE #define DEFAULT_MOUSE_TOLERANCE 3 #endif -// Edit these lines if you positively don't want PROLOGIO support -#ifndef PROLOGIO -#define PROLOGIO -#endif - // Key identifiers #define KEY_SHIFT 1 #define KEY_CTRL 2 @@ -110,7 +113,7 @@ class wxControlPoint; class wxShapeRegion; class wxShape; -#ifdef PROLOGIO +#if wxUSE_PROLOGIO class WXDLLEXPORT wxExpr; class WXDLLEXPORT wxExprDatabase; #endif @@ -124,7 +127,7 @@ class WXDLLEXPORT wxExprDatabase; -class wxShapeEvtHandler: public wxObject, public wxClientDataContainer +class WXDLLIMPEXP_OGL wxShapeEvtHandler: public wxObject, public wxClientDataContainer { DECLARE_DYNAMIC_CLASS(wxShapeEvtHandler) @@ -142,7 +145,7 @@ class wxShapeEvtHandler: public wxObject, public wxClientDataContainer virtual void OnDelete(); virtual void OnDraw(wxDC& dc); virtual void OnDrawContents(wxDC& dc); - virtual void OnDrawBranches(wxDC& dc, bool erase = FALSE); + virtual void OnDrawBranches(wxDC& dc, bool erase = false); virtual void OnMoveLinks(wxDC& dc); virtual void OnErase(wxDC& dc); virtual void OnEraseContents(wxDC& dc); @@ -151,8 +154,8 @@ class wxShapeEvtHandler: public wxObject, public wxClientDataContainer virtual void OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0); virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0); virtual void OnSize(double x, double y); - virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE); - virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE); + virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true); + virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true); virtual void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false virtual void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0); @@ -163,7 +166,7 @@ class wxShapeEvtHandler: public wxObject, public wxClientDataContainer virtual void OnDrawOutline(wxDC& dc, double x, double y, double w, double h); virtual void OnDrawControlPoints(wxDC& dc); virtual void OnEraseControlPoints(wxDC& dc); - virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE); + virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = true); // Control points ('handles') redirect control to the actual shape, to make it easier // to override sizing behaviour. @@ -182,14 +185,14 @@ class wxShapeEvtHandler: public wxObject, public wxClientDataContainer // Does the copy - override for new event handlers which might store // app-specific data. - virtual void CopyData(wxShapeEvtHandler& copy) {}; + virtual void CopyData(wxShapeEvtHandler& WXUNUSED(copy)) {}; private: wxShapeEvtHandler* m_previousHandler; wxShape* m_handlerShape; }; -class wxShape: public wxShapeEvtHandler +class WXDLLIMPEXP_OGL wxShape: public wxShapeEvtHandler { DECLARE_ABSTRACT_CLASS(wxShape) @@ -228,11 +231,11 @@ class wxShape: public wxShapeEvtHandler virtual void OnEraseContents(wxDC& dc); virtual void OnHighlight(wxDC& dc); virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0); - virtual void OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0) {} + virtual void OnLeftDoubleClick(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys) = 0, int WXUNUSED(attachment) = 0) {} virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0); virtual void OnSize(double x, double y); - virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE); - virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE); + virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true); + virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true); virtual void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false virtual void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0); @@ -265,24 +268,24 @@ class wxShape: public wxShapeEvtHandler virtual void MakeMandatoryControlPoints(); virtual void ResetMandatoryControlPoints(); - inline virtual bool Recompute() { return TRUE; }; + inline virtual bool Recompute() { return true; }; // Calculate size recursively, if size changes. Size might depend on children. inline virtual void CalculateSize() { }; - virtual void Select(bool select = TRUE, wxDC* dc = NULL); - virtual void SetHighlight(bool hi = TRUE, bool recurse = FALSE); + virtual void Select(bool select = true, wxDC* dc = NULL); + virtual void SetHighlight(bool hi = true, bool recurse = false); inline virtual bool IsHighlighted() const { return m_highlighted; }; virtual bool Selected() const; virtual bool AncestorSelected() const; - void SetSensitivityFilter(int sens = OP_ALL, bool recursive = FALSE); + void SetSensitivityFilter(int sens = OP_ALL, bool recursive = false); int GetSensitivityFilter() const { return m_sensitivity; } - void SetDraggable(bool drag, bool recursive = FALSE); + void SetDraggable(bool drag, bool recursive = false); inline void SetFixedSize(bool x, bool y) { m_fixedWidth = x; m_fixedHeight = y; }; inline void GetFixedSize(bool *x, bool *y) const { *x = m_fixedWidth; *y = m_fixedHeight; }; inline bool GetFixedWidth() const { return m_fixedWidth; } inline bool GetFixedHeight() const { return m_fixedHeight; } inline void SetSpaceAttachments(bool sp) { m_spaceAttachments = sp; }; inline bool GetSpaceAttachments() const { return m_spaceAttachments; }; - void SetShadowMode(int mode, bool redraw = FALSE); + void SetShadowMode(int mode, bool redraw = false); inline int GetShadowMode() const { return m_shadowMode; } virtual bool HitTest(double x, double y, int *attachment, double *distance); inline void SetCentreResize(bool cr) { m_centreResize = cr; } @@ -302,19 +305,19 @@ class wxShape: public wxShapeEvtHandler virtual void Show(bool show); virtual bool IsShown() const { return m_visible; } - virtual void Move(wxDC& dc, double x1, double y1, bool display = TRUE); + virtual void Move(wxDC& dc, double x1, double y1, bool display = true); virtual void Erase(wxDC& dc); virtual void EraseContents(wxDC& dc); virtual void Draw(wxDC& dc); virtual void Flash(); virtual void MoveLinks(wxDC& dc); virtual void DrawContents(wxDC& dc); // E.g. for drawing text label - virtual void SetSize(double x, double y, bool recursive = TRUE); + virtual void SetSize(double x, double y, bool recursive = true); virtual void SetAttachmentSize(double x, double y); void Attach(wxShapeCanvas *can); void Detach(); - inline virtual bool Constrain() { return FALSE; } ; + inline virtual bool Constrain() { return false; } ; void AddLine(wxLineShape *line, wxShape *other, int attachFrom = 0, int attachTo = 0, @@ -344,7 +347,7 @@ class wxShape: public wxShapeEvtHandler virtual wxFont *GetFont(int regionId = 0) const; virtual void SetTextColour(const wxString& colour, int regionId = 0); virtual wxString GetTextColour(int regionId = 0) const; - virtual inline int GetNumberOfTextRegions() const { return m_regions.Number(); } + virtual inline int GetNumberOfTextRegions() const { return m_regions.GetCount(); } virtual void SetRegionName(const wxString& name, int regionId = 0); // Get the name representing the region for this image alone. @@ -358,7 +361,7 @@ class wxShape: public wxShapeEvtHandler virtual int GetRegionId(const wxString& name); // Construct names for regions, unique even for children of a composite. - virtual void NameRegions(const wxString& parentName = ""); + virtual void NameRegions(const wxString& parentName = wxEmptyString); // Get list of regions inline wxList& GetRegions() const { return (wxList&) m_regions; } @@ -381,7 +384,7 @@ class wxShape: public wxShapeEvtHandler virtual void ClearText(int regionId = 0); void RemoveLine(wxLineShape *line); -#ifdef PROLOGIO +#if wxUSE_PROLOGIO // I/O virtual void WriteAttributes(wxExpr *clause); virtual void ReadAttributes(wxExpr *clause); @@ -397,6 +400,7 @@ class wxShape: public wxShapeEvtHandler int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); virtual int GetNumberOfAttachments() const; virtual bool AttachmentIsValid(int attachment) const; + virtual wxList& GetAttachments() { return m_attachmentPoints; } // Only get the attachment position at the _edge_ of the shape, ignoring // branching mode. This is used e.g. to indicate the edge of interest, not the point @@ -409,13 +413,13 @@ class wxShape: public wxShapeEvtHandler virtual wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2, int nth, int noArcs, wxLineShape* line); - // Returns TRUE if pt1 <= pt2 in the sense that one point comes before another on an + // Returns true if pt1 <= pt2 in the sense that one point comes before another on an // edge of the shape. // attachmentPoint is the attachment point (= side) in question. virtual bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2); - virtual void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE); - virtual void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE); + virtual void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = false); + virtual void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = false); virtual bool MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move, double x, double y); @@ -458,8 +462,8 @@ class wxShape: public wxShapeEvtHandler virtual int GetAttachmentLineCount(int attachment) const; // Draw the branches (not the actual arcs though) - virtual void OnDrawBranches(wxDC& dc, int attachment, bool erase = FALSE); - virtual void OnDrawBranches(wxDC& dc, bool erase = FALSE); + virtual void OnDrawBranches(wxDC& dc, int attachment, bool erase = false); + virtual void OnDrawBranches(wxDC& dc, bool erase = false); // Branching attachment settings inline void SetBranchNeckLength(int len) { m_branchNeckLength = len; } @@ -486,13 +490,13 @@ class wxShape: public wxShapeEvtHandler // This is really to distinguish between lines and other images. // For lines, want to pass drag to canvas, since lines tend to prevent // dragging on a canvas (they get in the way.) - virtual bool Draggable() const { return TRUE; } + virtual bool Draggable() const { return true; } - // Returns TRUE if image is a descendant of this image + // Returns true if image is a descendant of this image bool HasDescendant(wxShape *image); // Creates a copy of this shape. - wxShape *CreateNewCopy(bool resetMapping = TRUE, bool recompute = TRUE); + wxShape *CreateNewCopy(bool resetMapping = true, bool recompute = true); // Does the copying for this object virtual void Copy(wxShape& copy); @@ -503,7 +507,8 @@ class wxShape: public wxShapeEvtHandler // Rotate about the given axis by the given amount in radians. virtual void Rotate(double x, double y, double theta); - virtual inline double GetRotation() const { return m_rotation; } + virtual double GetRotation() const { return m_rotation; } + virtual void SetRotation(double rotation) { m_rotation = rotation; } void ClearAttachments(); @@ -525,7 +530,7 @@ class wxShape: public wxShapeEvtHandler wxPen* m_pen; wxBrush* m_brush; wxFont* m_font; - wxColour* m_textColour; + wxColour m_textColour; wxString m_textColourName; wxShapeCanvas* m_canvas; wxList m_lines; @@ -544,11 +549,11 @@ class wxShape: public wxShapeEvtHandler bool m_draggable; int m_attachmentMode; // 0 for no attachments, 1 if using normal attachments, // 2 for branching attachments - bool m_spaceAttachments; // TRUE if lines at one side should be spaced + bool m_spaceAttachments; // true if lines at one side should be spaced bool m_fixedWidth; bool m_fixedHeight; - bool m_centreResize; // Default is to resize keeping the centre constant (TRUE) - bool m_drawHandles; // Don't draw handles if FALSE, usually TRUE + bool m_centreResize; // Default is to resize keeping the centre constant (true) + bool m_drawHandles; // Don't draw handles if false, usually true wxList m_children; // In case it's composite wxShape* m_parent; // In case it's a child int m_formatMode; @@ -566,7 +571,7 @@ class wxShape: public wxShapeEvtHandler long m_branchStyle; }; -class wxPolygonShape: public wxShape +class WXDLLIMPEXP_OGL wxPolygonShape: public wxShape { DECLARE_DYNAMIC_CLASS(wxPolygonShape) public: @@ -584,7 +589,7 @@ class wxPolygonShape: public wxShape double x2, double y2, double *x3, double *y3); bool HitTest(double x, double y, int *attachment, double *distance); - void SetSize(double x, double y, bool recursive = TRUE); + void SetSize(double x, double y, bool recursive = true); void OnDraw(wxDC& dc); void OnDrawOutline(wxDC& dc, double x, double y, double w, double h); @@ -613,7 +618,7 @@ class wxPolygonShape: public wxShape // Recalculates the centre of the polygon virtual void CalculatePolygonCentre(); -#ifdef PROLOGIO +#if wxUSE_PROLOGIO void WriteAttributes(wxExpr *clause); void ReadAttributes(wxExpr *clause); #endif @@ -621,15 +626,22 @@ class wxPolygonShape: public wxShape int GetNumberOfAttachments() const; bool GetAttachmentPosition(int attachment, double *x, double *y, int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); - bool AttachmentIsValid(int attachment); + bool AttachmentIsValid(int attachment) const; // Does the copying for this object void Copy(wxShape& copy); inline wxList *GetPoints() { return m_points; } + inline wxList *GetOriginalPoints() { return m_originalPoints; } // Rotate about the given axis by the given amount in radians virtual void Rotate(double x, double y, double theta); + double GetOriginalWidth() const { return m_originalWidth; } + double GetOriginalHeight() const { return m_originalHeight; } + + void SetOriginalWidth(double w) { m_originalWidth = w; } + void SetOriginalHeight(double h) { m_originalHeight = h; } + private: wxList* m_points; wxList* m_originalPoints; @@ -639,7 +651,7 @@ class wxPolygonShape: public wxShape double m_originalHeight; }; -class wxRectangleShape: public wxShape +class WXDLLIMPEXP_OGL wxRectangleShape: public wxShape { DECLARE_DYNAMIC_CLASS(wxRectangleShape) public: @@ -649,10 +661,11 @@ class wxRectangleShape: public wxShape double x2, double y2, double *x3, double *y3); void OnDraw(wxDC& dc); - void SetSize(double x, double y, bool recursive = TRUE); + void SetSize(double x, double y, bool recursive = true); void SetCornerRadius(double rad); // If > 0, rounded corners + double GetCornerRadius() const { return m_cornerRadius; } -#ifdef PROLOGIO +#if wxUSE_PROLOGIO void WriteAttributes(wxExpr *clause); void ReadAttributes(wxExpr *clause); #endif @@ -674,7 +687,7 @@ protected: double m_cornerRadius; }; -class wxTextShape: public wxRectangleShape +class WXDLLIMPEXP_OGL wxTextShape: public wxRectangleShape { DECLARE_DYNAMIC_CLASS(wxTextShape) public: @@ -682,15 +695,15 @@ class wxTextShape: public wxRectangleShape void OnDraw(wxDC& dc); -#ifdef PROLOGIO - void WriteAttributes(wxExpr *clause); +#if wxUSE_PROLOGIO + void WriteAttributes(wxExpr *clause); #endif // Does the copying for this object void Copy(wxShape& copy); }; -class wxEllipseShape: public wxShape +class WXDLLIMPEXP_OGL wxEllipseShape: public wxShape { DECLARE_DYNAMIC_CLASS(wxEllipseShape) public: @@ -702,9 +715,9 @@ class wxEllipseShape: public wxShape double *x3, double *y3); void OnDraw(wxDC& dc); - void SetSize(double x, double y, bool recursive = TRUE); + void SetSize(double x, double y, bool recursive = true); -#ifdef PROLOGIO +#if wxUSE_PROLOGIO void WriteAttributes(wxExpr *clause); void ReadAttributes(wxExpr *clause); #endif @@ -727,7 +740,7 @@ protected: double m_height; }; -class wxCircleShape: public wxEllipseShape +class WXDLLIMPEXP_OGL wxCircleShape: public wxEllipseShape { DECLARE_DYNAMIC_CLASS(wxCircleShape) public: