X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a23fd0e1d1329a4a258b4defb3e0b0001b700c6e..ddb6bc71266486f2e7222915740393eddea620f5:/include/wx/gdicmn.h diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 564ed2e3fe..b742531d92 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 @@ -251,8 +258,8 @@ public: 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); } public: long x, y, width, height;