X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d8fbb9d1bf9d40e840a9c4e80842049fb7ef1ff..08422003083270640e23c2563a5fa72d131add96:/src/common/gdicmn.cpp diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 58f901a085..6cbe1a5d9e 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -119,18 +119,6 @@ wxRect::wxRect(const wxPoint& point1, const wxPoint& point2) height++; } -wxRect::wxRect(const wxPoint& point, const wxSize& size) -{ - x = point.x; y = point.y; - width = size.x; height = size.y; -} - -wxRect::wxRect(const wxSize& size) -{ - x = 0; y = 0; - width = size.x; height = size.y; -} - bool wxRect::operator==(const wxRect& rect) const { return ((x == rect.x) && @@ -139,13 +127,7 @@ bool wxRect::operator==(const wxRect& rect) const (height == rect.height)); } -wxRect& wxRect::operator += (const wxRect& rect) -{ - *this = (*this + rect); - return ( *this ) ; -} - -wxRect wxRect::operator + (const wxRect& rect) const +wxRect wxRect::operator+(const wxRect& rect) const { int x1 = wxMin(this->x, rect.x); int y1 = wxMin(this->y, rect.y); @@ -154,6 +136,25 @@ wxRect wxRect::operator + (const wxRect& rect) const return wxRect(x1, y1, x2-x1, y2-y1); } +wxRect& wxRect::Union(const wxRect& rect) +{ + // ignore empty rectangles + if ( rect.width && rect.height ) + { + int x1 = wxMin(x, rect.x); + int y1 = wxMin(y, rect.y); + int y2 = wxMax(y + height, rect.height + rect.y); + int x2 = wxMax(x + width, rect.width + rect.x); + + x = x1; + y = y1; + width = x2 - x1; + height = y2 - y1; + } + + return *this; +} + wxRect& wxRect::Inflate(wxCoord dx, wxCoord dy) { x -= dx; @@ -387,7 +388,7 @@ void wxColourDatabase::AddColour(const wxString& name, const wxColour& colour) } else // new colour { - (*m_map)[name] = new wxColour(colour); + (*m_map)[colName] = new wxColour(colour); } }