X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a23fd0e1d1329a4a258b4defb3e0b0001b700c6e..119143528d2ba3dc77ca533aece7982fdcb31bf5:/include/wx/gdicmn.h?ds=inline diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 564ed2e3fe..32569e0a49 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -174,6 +174,7 @@ public: // --------------------------------------------------------------------------- // Point classes: with real or integer coordinates // --------------------------------------------------------------------------- + class WXDLLEXPORT wxRealPoint { public: @@ -205,10 +206,16 @@ public: // no copy ctor or assignment operator - the defaults are ok - bool operator==(const wxPoint& pt) const { return x == pt.x && y == pt.y; } + // comparison + bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } + bool operator!=(const wxPoint& p) const { return !(*this == p); } + + // arithmetic operations (component wise) + wxPoint operator+(const wxPoint& p) { return wxPoint(x + p.x, y + p.y); } + wxPoint operator-(const wxPoint& p) { return wxPoint(x - p.x, y - p.y); } - wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); } - wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); } + wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } + wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } }; #if WXWIN_COMPATIBILITY @@ -243,17 +250,22 @@ public: long GetHeight() const { return height; } void SetHeight(long h) { height = h; } - wxPoint GetPosition() { return wxPoint(x, y); } - wxSize GetSize() { return wxSize(width, height); } + wxPoint GetPosition() const { return wxPoint(x, y); } + wxSize GetSize() const { return wxSize(width, height); } long GetLeft() const { return x; } long GetTop() const { return y; } long GetBottom() const { return y + height; } long GetRight() const { return x + width; } - bool operator == (const wxRect& rect) const; - bool operator != (const wxRect& rect) const { return !(*this == rect); } + bool operator==(const wxRect& rect) const; + bool operator!=(const wxRect& rect) const { return !(*this == rect); } + + bool Inside(int cx, int cy) const; + wxRect operator + (const wxRect& rect) const; + const wxRect& operator += (const wxRect& rect); + public: long x, y, width, height; };