X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/13b6e335236863073a5cd2e04e7cedf76a7475d7..adfed1ca928d27ec04f730883f0ba01900540056:/src/common/gdicmn.cpp diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 2c62bcefda..239278c28e 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -113,6 +113,29 @@ wxRect wxRect::operator + (const wxRect& rect) const return wxRect(x1, y1, x2-x1, y2-y1); } +wxRect& wxRect::Inflate(wxCoord dx, wxCoord dy) +{ + x -= dx; + y -= dy; + width += 2*dx; + height += 2*dy; + + // check that we didn't make the rectangle invalid by accident (you almost + // never want to have negative coords and never want negative size) + if ( x < 0 ) + x = 0; + if ( y < 0 ) + y = 0; + + // what else can we do? + if ( width < 0 ) + width = 0; + if ( height < 0 ) + height = 0; + + return *this; +} + bool wxRect::Inside(int cx, int cy) const { return ( (cx >= x) && (cy >= y) @@ -121,6 +144,40 @@ bool wxRect::Inside(int cx, int cy) const ); } +wxRect& wxRect::Intersect(const wxRect& rect) +{ + int x2 = GetRight(), + y2 = GetBottom(); + + if ( x < rect.x ) + x = rect.x; + if ( y < rect.y ) + y = rect.y; + if ( x2 > rect.GetRight() ) + x2 = rect.GetRight(); + if ( y2 > rect.GetBottom() ) + y2 = rect.GetBottom(); + + width = x2 - x + 1; + height = y2 - y + 1; + + if ( width <= 0 || height <= 0 ) + { + width = + height = 0; + } + + return *this; +} + +bool wxRect::Intersects(const wxRect& rect) const +{ + wxRect r = Intersect(rect); + + // if there is no intersection, both width and height are 0 + return r.width != 0; +} + wxColourDatabase::wxColourDatabase (int type) : wxList (type) { } @@ -283,6 +340,9 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour) #ifdef __WXPM__ return NULL; #endif +#ifdef __WXMGL__ + return NULL; +#endif // TODO for other implementations. This should really go into // platform-specific directories. @@ -723,6 +783,13 @@ wxSize wxGetDisplaySize() return wxSize(x, y); } +wxRect wxGetClientDisplayRect() +{ + int x, y, width, height; + wxClientDisplayRect(&x, &y, &width, &height); // call plat-specific version + return wxRect(x, y, width, height); +} + wxSize wxGetDisplaySizeMM() { int x, y;