Add wxSize::IncBy() and DecBy() overloads taking wxPoint.

It seems to make at least as much sense to extend a wxSize by wxPoint than by
another wxSize (which doesn't make much size to me...) so add Inc/DecBy()
overloads doing this.

We might also add operator+=() overloads taking wxPoint for consistency but
for now don't add more operator overloads unnecessarily, let's wait if anybody
asks about this first.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64883 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2010-07-11 10:44:03 +00:00
parent e61fedabe7
commit 89b799cccf
2 changed files with 29 additions and 20 deletions

View File

@ -255,10 +255,12 @@ public:
{ if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; }
void IncBy(int dx, int dy) { x += dx; y += dy; }
void IncBy(const wxPoint& pt);
void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); }
void IncBy(int d) { IncBy(d, d); }
void DecBy(int dx, int dy) { IncBy(-dx, -dy); }
void DecBy(const wxPoint& pt);
void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); }
void DecBy(int d) { DecBy(d, d); }
@ -827,6 +829,11 @@ inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); }
#endif // WXWIN_COMPATIBILITY_2_6
// define functions which couldn't be defined above because of declarations
// order
inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); }
inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); }
// ---------------------------------------------------------------------------
// Management of pens, brushes and fonts
// ---------------------------------------------------------------------------

View File

@ -772,6 +772,7 @@ public:
@see IncBy()
*/
void DecBy(const wxPoint& pt);
void DecBy(const wxSize& size);
void DecBy(int dx, int dy);
void DecBy(int d);
@ -801,6 +802,7 @@ public:
@see DecBy()
*/
void IncBy(const wxPoint& pt);
void IncBy(const wxSize& size);
void IncBy(int dx, int dy);
void IncBy(int d);