added wxSize::IncTo/DecTo

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22167 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-20 20:04:22 +00:00
parent 9a0b7e3319
commit 5b087ae258
2 changed files with 31 additions and 0 deletions

View File

@@ -34,6 +34,19 @@ None
Creates a size object.
\membersection{wxSize::DecTo}\label{wxsizedecto}
\func{wxSize\&}{DecTo}{\param{const wxSize\& }{size}}
Decrements this object so that both of its dimensions are not greater than the
corresponding dimensions of the \arg{size}.
\wxheading{See also}
\helpref{IncTo}{wxsizeincto}
\membersection{wxSize::GetWidth}\label{wxsizegetwidth}
\constfunc{int}{GetWidth}{\void}
@@ -46,6 +59,19 @@ Gets the width member.
Gets the height member.
\membersection{wxSize::IncTo}\label{wxsizeincto}
\func{wxSize\&}{IncTo}{\param{const wxSize\& }{size}}
Increments this object so that both of its dimensions are not less than the
corresponding dimensions of the \arg{size}.
\wxheading{See also}
\helpref{DecTo}{wxsizedecto}
\membersection{wxSize::Set}\label{wxsizeset}
\func{void}{Set}{\param{int}{ width}, \param{int}{ height}}

View File

@@ -215,6 +215,11 @@ public:
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); }
void IncTo(const wxSize& sz)
{ if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; }
void DecTo(const wxSize& sz)
{ if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; }
// accessors
void Set(int xx, int yy) { x = xx; y = yy; }
void SetWidth(int w) { x = w; }