X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/119727ad9e58e42326764a259a5b88267bb43528..29c8694822a192934278ba0f98eaf437024c0278:/include/wx/gdicmn.h diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 86d16717a7..10e7b6b5ee 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -117,7 +117,7 @@ enum wxStockCursor wxCURSOR_DEFAULT, // standard X11 cursor #endif #ifdef __WXMAC__ - wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow + wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow #endif #ifdef __X__ // Not yet implemented for Windows @@ -182,23 +182,18 @@ enum wxStockCursor #if defined(__WXMSW__) || defined(__WXPM__) #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) -#elif defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXCOCOA__) +#elif defined(__WXGTK__) || \ + defined(__WXMOTIF__) || \ + defined(__WXX11__) || \ + defined(__WXMAC__) || \ + defined(__WXMGL__) || \ + defined(__WXCOCOA__) // Initialize from an included XPM #define wxBITMAP(name) wxBitmap( (const char**) name##_xpm ) #else // other platforms #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) #endif // platform -/* Macro for avoiding #ifdefs when value have to be different depending on size of - device we display on - */ - -#if defined(__SMARTPHONE__) - #define wxLARGESMALL(large,small) small -#else - #define wxLARGESMALL(large,small) large -#endif - // =========================================================================== // classes // =========================================================================== @@ -222,9 +217,15 @@ public: bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; } bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; } - // FIXME are these really useful? If they're, we should have += &c as well wxSize operator+(const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); } wxSize operator-(const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); } + wxSize operator/(const int i) { return wxSize(x / i, y / i); } + wxSize operator*(const int i) { return wxSize(x * i, y * i); } + + wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } + wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } + wxSize& operator/=(const int i) { x /= i; y /= i; return *this; } + wxSize& operator*=(const int i) { x *= i; y *= i; return *this; } void IncTo(const wxSize& sz) { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } @@ -239,15 +240,15 @@ public: int GetWidth() const { return x; } int GetHeight() const { return y; } - bool IsFullySpecified() const { return x != -1 && y != -1; } + bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } // combine this size with the other one replacing the default (i.e. equal - // to -1) components of this object with those of the other + // to wxDefaultCoord) components of this object with those of the other void SetDefaults(const wxSize& size) { - if ( x == -1 ) + if ( x == wxDefaultCoord ) x = size.x; - if ( y == -1 ) + if ( y == wxDefaultCoord ) y = size.y; } @@ -318,7 +319,12 @@ public: : x(xx), y(yy), width(ww), height(hh) { } wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); - wxRect(const wxPoint& pos, const wxSize& size); + wxRect(const wxPoint& pt, const wxSize& size) + : x(pt.x), y(pt.y), width(size.x), height(size.y) + { } + wxRect(const wxSize& size) + : x(0), y(0), width(size.x), height(size.y) + { } // default copy ctor and assignment operators ok @@ -390,20 +396,35 @@ public: return r; } - wxRect operator+(const wxRect& rect) const; - wxRect& operator+=(const wxRect& rect); + wxRect& Union(const wxRect& rect); + wxRect Union(const wxRect& rect) const + { + wxRect r = *this; + r.Union(rect); + return r; + } // compare rectangles bool operator==(const wxRect& rect) const; bool operator!=(const wxRect& rect) const { return !(*this == rect); } - // return TRUE if the point is (not strcitly) inside the rect + // return true if the point is (not strcitly) inside the rect bool Inside(int x, int y) const; bool Inside(const wxPoint& pt) const { return Inside(pt.x, pt.y); } - // return TRUE if the rectangles have a non empty intersection + // return true if the rectangles have a non empty intersection bool Intersects(const wxRect& rect) const; + + // these are like Union() but don't ignore empty rectangles + wxRect operator+(const wxRect& rect) const; + wxRect& operator+=(const wxRect& rect) + { + *this = *this + rect; + return *this; + } + + public: int x, y, width, height; }; @@ -445,7 +466,7 @@ public: void AddFont(wxFont *font); void RemoveFont(wxFont *font); wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, - bool underline = FALSE, + bool underline = false, const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); }; @@ -486,7 +507,7 @@ private: class WXDLLEXPORT wxBitmapList : public wxList { public: - wxBitmapList(); + wxBitmapList(){} ~wxBitmapList(); void AddBitmap(wxBitmap *bitmap);