From: Vadim Zeitlin Date: Sun, 20 Jul 2003 20:04:22 +0000 (+0000) Subject: added wxSize::IncTo/DecTo X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5b087ae2588d2988491d8e0621af82d4c44eb7a8 added wxSize::IncTo/DecTo git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22167 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/size.tex b/docs/latex/wx/size.tex index a29fc06484..738f5b2edd 100644 --- a/docs/latex/wx/size.tex +++ b/docs/latex/wx/size.tex @@ -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}} diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index ff35a9f297..392cd820c4 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -214,6 +214,11 @@ public: // 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); } + + 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; }