X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ab7ce33c563651f790f99d64ee56727706047ae3..a19918eb353f1f266f92891eee07834d7cf09cd7:/contrib/include/wx/ogl/basic.h?ds=sidebyside diff --git a/contrib/include/wx/ogl/basic.h b/contrib/include/wx/ogl/basic.h index 30c23cea36..c0db18d8f4 100644 --- a/contrib/include/wx/ogl/basic.h +++ b/contrib/include/wx/ogl/basic.h @@ -6,14 +6,22 @@ // 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_ -#if defined(__GNUG__) && !defined(__APPLE__) -#pragma interface "basic.h" +#ifndef wxUSE_DEPRECATED +#define wxUSE_DEPRECATED 0 +#endif + +#if wxUSE_DEPRECATED + #include "wx/deprecated/setup.h" +#endif + +#ifndef wxUSE_PROLOGIO + #define wxUSE_PROLOGIO 0 #endif #define OGL_VERSION 2.0 @@ -22,11 +30,6 @@ #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; } @@ -297,24 +300,24 @@ class wxShape: public wxShapeEvtHandler inline void SetId(long i) { m_id = i; } inline long GetId() const { return m_id; } - void SetPen(wxPen *pen); - void SetBrush(wxBrush *brush); + void SetPen(const wxPen *pen); + void SetBrush(const wxBrush *brush); 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, @@ -326,8 +329,8 @@ class wxShape: public wxShapeEvtHandler void AddText(const wxString& string); - inline wxPen *GetPen() const { return m_pen; } - inline wxBrush *GetBrush() const { return m_brush; } + inline wxPen *GetPen() const { return wx_const_cast(wxPen*, m_pen); } + inline wxBrush *GetBrush() const { return wx_const_cast(wxBrush*, m_brush); } /* * Region-specific functions (defaults to the default region @@ -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(); @@ -522,10 +527,10 @@ class wxShape: public wxShapeEvtHandler wxShapeEvtHandler* m_eventHandler; bool m_formatted; double m_xpos, m_ypos; - wxPen* m_pen; - wxBrush* m_brush; + const wxPen* m_pen; + const wxBrush* m_brush; wxFont* m_font; - wxColour* m_textColour; + wxColour m_textColour; wxString m_textColourName; wxShapeCanvas* m_canvas; wxList m_lines; @@ -544,16 +549,16 @@ 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; int m_shadowMode; - wxBrush* m_shadowBrush; + const wxBrush* m_shadowBrush; int m_shadowOffsetX; int m_shadowOffsetY; int m_textMarginX; // Gap between text and border @@ -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: