X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/df83b840bbf6441a0166848d49a093557e562926..81c882b613b5d99ddb1e5ab69fcd7ebccc287025:/docs/latex/wx/rect.tex diff --git a/docs/latex/wx/rect.tex b/docs/latex/wx/rect.tex index 729b214952..4885f61c97 100644 --- a/docs/latex/wx/rect.tex +++ b/docs/latex/wx/rect.tex @@ -68,22 +68,49 @@ Width member. Height member. +\membersection{wxRect::CentreIn}\label{wxrectcentrein} + +\constfunc{wxRect}{CentreIn}{\param{const wxRect\& }{r}, \param{int }{dir = wxBOTH}} + +\constfunc{wxRect}{CenterIn}{\param{const wxRect\& }{r}, \param{int }{dir = wxBOTH}} + +Returns the rectangle having the same size as this one but centered relatively +to the given rectangle \arg{r}. By default, rectangle is centred in both +directions but if \arg{dir} includes only \texttt{wxVERTICAL} or only +\texttt{wxHORIZONTAL} flag, then it is only centered in this direction while +the other component of its position remains unchanged. + + +\membersection{wxRect::Contains}\label{wxrectcontains} + +\constfunc{bool}{Contains}{\param{int }{x}, \param{int }{y}} + +\constfunc{bool}{Contains}{\param{const wxPoint\& }{pt}} + +Returns {\tt true} if the given point is inside the rectangle (or on its +boundary) and {\tt false} otherwise. + +\constfunc{bool}{Contains}{\param{const wxRect\& }{rect}} + +Returns \true if the given rectangle is completely inside this rectangle +(or touches its boundary) and \false otherwise. + + \membersection{wxRect::Deflate}\label{wxrectdeflate} \func{void}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}} +\func{void}{Deflate}{\param{const wxSize\& }{diff}} + \func{void}{Deflate}{\param{wxCoord }{diff}} \constfunc{wxRect}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}} -Decrease the rectangle size by {\it dx} in x direction and {\it dy} in y -direction. Both (or one of) parameters may be negative to increase the -rectngle size. This method is the opposite of \helpref{Inflate}{wxrectinflate}. +Decrease the rectangle size. -The second form uses the same {\it diff} for both {\it dx} and {\it dy}. - -The first two versions modify the rectangle in place, the last one returns a -new rectangle leaving this one unchanged. +This method is the opposite from \helpref{Inflate}{wxrectinflate}: +Deflate(a, b) is equivalent to Inflate(-a, -b). +Please refer to \helpref{Inflate}{wxrectinflate} for full description. \wxheading{See also} @@ -122,14 +149,29 @@ Gets the position. \constfunc{wxPoint}{GetTopLeft}{\void} -Gets the topleft position of the rectangle. (Same as GetPosition). +Gets the position of the top left corner of the rectangle, same as +\helpref{GetPosition}{wxrectgetposition}. + + +\membersection{wxRect::GetTopRight}\label{wxrectgettopright} + +\constfunc{wxPoint}{GetTopRight}{\void} + +Gets the position of the top right corner. + + +\membersection{wxRect::GetBottomLeft}\label{wxrectgetbottomleft} + +\constfunc{wxPoint}{GetBottomLeft}{\void} + +Gets the position of the bottom left corner. \membersection{wxRect::GetBottomRight}\label{wxrectgetbottomright} \constfunc{wxPoint}{GetBottomRight}{\void} -Gets the the bottom right position. Returns the bottom right point inside the rectangle. +Gets the position of the bottom right corner. \membersection{wxRect::GetRight}\label{wxrectgetright} @@ -145,6 +187,10 @@ Gets the right point of the rectangle. Gets the size. +\wxheading{See also} + +\helpref{wxRect::SetSize}{wxrectsetsize} + \membersection{wxRect::GetTop}\label{wxrectgettop} @@ -178,40 +224,64 @@ Gets the y member. \func{void}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}} +\func{void}{Inflate}{\param{const wxSize\& }{diff}} + \func{void}{Inflate}{\param{wxCoord }{diff}} \constfunc{wxRect}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}} -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 -rectangle size. +Increases the size of the rectangle. The second form uses the same {\it diff} for both {\it dx} and {\it dy}. The first two versions modify the rectangle in place, the last one returns a new rectangle leaving this one unchanged. +The left border is moved farther left and the right border is moved farther +right by {\it dx}. The upper border is moved farther up and the bottom border +is moved farther down by {\it dy}. (Note the the width and height of the +rectangle thus change by 2*{\it dx} and 2*{\it dy}, respectively.) If one or +both of {\it dx} and {\it dy} are negative, the opposite happens: the rectangle +size decreases in the respective direction. + +Inflating and deflating behaves ``naturally''. Defined more precisely, that +means: +\begin{enumerate} + \item ``Real'' inflates (that is, {\it dx} and/or {\it dy} >= 0) are not + constrained. Thus inflating a rectangle can cause its upper left corner + to move into the negative numbers. (the versions prior to 2.5.4 forced + the top left coordinate to not fall below (0, 0), which implied a + forced move of the rectangle.) + + \item Deflates are clamped to not reduce the width or height of the + rectangle below zero. In such cases, the top-left corner is nonetheless + handled properly. For example, a rectangle at (10, 10) with size (20, + 40) that is inflated by (-15, -15) will become located at (20, 25) at + size (0, 10). Finally, observe that the width and height are treated + independently. In the above example, the width is reduced by 20, + whereas the height is reduced by the full 30 (rather than also stopping + at 20, when the width reached zero). +\end{enumerate} + \wxheading{See also} \helpref{Deflate}{wxrectdeflate} -\membersection{wxRect::Inside}\label{wxrectinside} +\membersection{wxRect::Intersects}\label{wxrectintersects} -\constfunc{bool}{Inside}{\param{int }{x}, \param{int }{y}} +\constfunc{bool}{Intersects}{\param{const wxRect\& }{rect}} -\constfunc{bool}{Inside}{\param{const wxPoint\& }{pt}} +Returns {\tt true} if this rectangle has a non-empty intersection with the +rectangle {\it rect} and {\tt false} otherwise. -Returns {\tt true} if the given point is inside the rectangle (or on its -boundary) and {\tt false} otherwise. +\membersection{wxRect::IsEmpty}\label{wxrectisempty} -\membersection{wxRect::Intersects}\label{wxrectintersects} +\constfunc{bool}{IsEmpty}{} -\constfunc{bool}{Intersects}{\param{const wxRect\& }{rect}} - -Returns {\tt true} if this rectangle has a non empty intersection with the -rectangle {\it rect} and {\tt false} otherwise. +Returns {\tt true} if this rectangle has a width or height less than or equal to +0 and {\tt false} otherwise. \membersection{wxRect::Offset}\label{wxrectoffset} @@ -232,6 +302,17 @@ bottom, otherwise it is moved to the left or top respectively. Sets the height. +\membersection{wxRect::SetSize}\label{wxrectsetsize} + +\func{void}{SetSize}{\param{const wxSize\&}{ s}} + +Sets the size. + +\wxheading{See also} + +\helpref{wxRect::GetSize}{wxrectgetsize} + + \membersection{wxRect::SetWidth}\label{wxrectsetwidth} \func{void}{SetWidth}{\param{int}{ width}} @@ -273,14 +354,32 @@ Assignment operator. \membersection{wxRect::operator $==$}\label{wxrectequal} -\func{bool}{operator $==$}{\param{const wxRect\& }{rect}} +\func{bool}{operator $==$}{\param{const wxRect\& }{r1}, \param{const wxRect\& }{r2}} Equality operator. \membersection{wxRect::operator $!=$}\label{wxrectnotequal} -\func{bool}{operator $!=$}{\param{const wxRect\& }{rect}} +\func{bool}{operator $!=$}{\param{const wxRect\& }{r1}, \param{const wxRect\& }{r2}} Inequality operator. + +\func{wxRect}{operator $+$}{\param{const wxRect\& }{r1}, \param{const wxRect\& }{r2}} + +\func{wxRect\&}{operator $+=$}{\param{const wxRect\& }{r}} + +Like \helpref{Union}{wxrectunion} but don't treat empty rectangles specially. + +\wxheading{See also} + +\helpref{wxRect::Union}{wxrectunion} + + +\func{wxRect}{operator $*$}{\param{const wxRect\& }{r1}, \param{const wxRect\& }{r2}} + +\func{wxRect\&}{operator $*=$}{\param{const wxRect\& }{r}} + +Returns the intersection of two rectangles (which may be empty). +