]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxSize::IncTo/DecTo
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jul 2003 20:04:22 +0000 (20:04 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jul 2003 20:04:22 +0000 (20:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22167 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/size.tex
include/wx/gdicmn.h

index a29fc0648403e270d5ca0d3a21dae2be04d61189..738f5b2eddbc9f9f4cc773a958d2274ea6cc4b88 100644 (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}}
index ff35a9f297e4f6639a4544178ea64019602dd560..392cd820c48aebe9dba2b7fa73ce8fe3924d83ae 100644 (file)
@@ -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; }