added wxRect::Inflate()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-02-17 14:06:00 +00:00
parent 19a9df0980
commit 45816ddded
3 changed files with 43 additions and 23 deletions

View File

@@ -118,6 +118,18 @@ Gets the x member.
Gets the y member.
\membersection{wxRect::Inflate}\label{wxrectinflate}
\func{void}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
\func{void}{Inflate}{\param{wxCoord }{diff}}
Increase the rectangle size by {\it dx} in x direction and {\it dy} in y
direction. Both (or one of) parameters may be negative to decrease the
rectngle size.
The second form uses the same {\it diff} for both {\it dx} and {\it dy}.
\membersection{wxRect::SetHeight}\label{wxrectsetheight}
\func{void}{SetHeight}{\param{int}{ height}}

View File

@@ -285,8 +285,6 @@ public:
wxPoint GetPosition() const { return wxPoint(x, y); }
wxSize GetSize() const { return wxSize(width, height); }
// MFC-like functions
int GetLeft() const { return x; }
int GetTop() const { return y; }
int GetBottom() const { return y + height - 1; }
@@ -297,12 +295,22 @@ public:
void SetTop(int top) { y = top; }
void SetBottom(int bottom) { height = bottom - y + 1; }
void Inflate(wxCoord dx, wxCoord dy)
{
x -= dx;
y -= dy;
width += 2*dx;
height += 2*dy;
}
void Inflate(wxCoord d) { Inflate(d, d); }
bool operator==(const wxRect& rect) const;
bool operator!=(const wxRect& rect) const { return !(*this == rect); }
bool Inside(int cx, int cy) const;
wxRect operator+(const wxRect& rect) const;
const wxRect& operator += (const wxRect& rect);
wxRect& operator+=(const wxRect& rect);
public:
int x, y, width, height;

View File

@@ -93,7 +93,7 @@ bool wxRect::operator==(const wxRect& rect) const
(height == rect.height));
}
const wxRect& wxRect::operator += (const wxRect& rect)
wxRect& wxRect::operator += (const wxRect& rect)
{
*this = (*this + rect);
return ( *this ) ;