/wxPython-src-2.8.12.0/docs/html/wx/wx_wxrect.html
HTML | 419 lines | 344 code | 75 blank | 0 comment | 0 complexity | 30bdb34752396319ccce65c6b43e1061 MD5 | raw file
Possible License(s): BSD-2-Clause, GPL-2.0, LGPL-2.0, LGPL-3.0, AGPL-3.0, CC-BY-SA-3.0, BSD-3-Clause
- <HTML>
- <head><link rel=stylesheet type="text/css" href="wx.css"><title>wxRect</title></head>
- <BODY BGCOLOR=#FFFFFF>
- <A NAME="wxrect"></A><CENTER>
- <A HREF="wx_contents.html"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx_classref.html#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx_wxrealpoint.html#wxrealpoint"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx_wxrecursionguard.html#wxrecursionguard"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
- <H2>wxRect</H2>
- <P>
- A class for manipulating rectangles.<P>
- <B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
- None<P>
- <B><FONT COLOR="#FF0000">Include files</FONT></B><P>
- <wx/gdicmn.h><P>
- <B><FONT COLOR="#FF0000">See also</FONT></B><P>
- <A HREF="wx_wxpoint.html#wxpoint">wxPoint</A>, <A HREF="wx_wxsize.html#wxsize">wxSize</A><P>
- <B><FONT COLOR="#FF0000">Members</FONT></B><P>
- <A HREF="#wxrectctor">wxRect::wxRect</A><BR>
- <A HREF="#wxrectx">wxRect::x</A><BR>
- <A HREF="#wxrecty">wxRect::y</A><BR>
- <A HREF="#wxrectwidth">wxRect::width</A><BR>
- <A HREF="#wxrectheight">wxRect::height</A><BR>
- <A HREF="#wxrectcentrein">wxRect::CentreIn</A><BR>
- <A HREF="#wxrectcontains">wxRect::Contains</A><BR>
- <A HREF="#wxrectdeflate">wxRect::Deflate</A><BR>
- <A HREF="#wxrectgetbottom">wxRect::GetBottom</A><BR>
- <A HREF="#wxrectgetheight">wxRect::GetHeight</A><BR>
- <A HREF="#wxrectgetleft">wxRect::GetLeft</A><BR>
- <A HREF="#wxrectgetposition">wxRect::GetPosition</A><BR>
- <A HREF="#wxrectgettopleft">wxRect::GetTopLeft</A><BR>
- <A HREF="#wxrectgettopright">wxRect::GetTopRight</A><BR>
- <A HREF="#wxrectgetbottomleft">wxRect::GetBottomLeft</A><BR>
- <A HREF="#wxrectgetbottomright">wxRect::GetBottomRight</A><BR>
- <A HREF="#wxrectgetright">wxRect::GetRight</A><BR>
- <A HREF="#wxrectgetsize">wxRect::GetSize</A><BR>
- <A HREF="#wxrectgettop">wxRect::GetTop</A><BR>
- <A HREF="#wxrectgetwidth">wxRect::GetWidth</A><BR>
- <A HREF="#wxrectgetx">wxRect::GetX</A><BR>
- <A HREF="#wxrectgety">wxRect::GetY</A><BR>
- <A HREF="#wxrectinflate">wxRect::Inflate</A><BR>
- <A HREF="#wxrectintersect">wxRect::Intersect</A><BR>
- <A HREF="#wxrectintersects">wxRect::Intersects</A><BR>
- <A HREF="#wxrectisempty">wxRect::IsEmpty</A><BR>
- <A HREF="#wxrectoffset">wxRect::Offset</A><BR>
- <A HREF="#wxrectsetheight">wxRect::SetHeight</A><BR>
- <A HREF="#wxrectsetsize">wxRect::SetSize</A><BR>
- <A HREF="#wxrectsetwidth">wxRect::SetWidth</A><BR>
- <A HREF="#wxrectsetx">wxRect::SetX</A><BR>
- <A HREF="#wxrectsety">wxRect::SetY</A><BR>
- <A HREF="#wxrectunion">wxRect::Union</A><BR>
- <A HREF="#wxrectassign">wxRect::operator =</A><BR>
- <A HREF="#wxrectequal">wxRect::operator ==</A><BR>
- <A HREF="#wxrectnotequal">wxRect::operator !=</A><BR>
- <P>
- <HR>
- <A NAME="wxrectctor"></A>
- <H3>wxRect::wxRect</H3>
- <P>
- <B></B> <B>wxRect</B>()<P>
- Default constructor.<P>
- <B></B> <B>wxRect</B>(<B>int</B><I> x</I>, <B>int</B><I> y</I>, <B>int</B><I> width</I>, <B>int</B><I> height</I>)<P>
- Creates a wxRect object from x, y, width and height values.<P>
- <B></B> <B>wxRect</B>(<B>const <A HREF="wx_wxpoint.html#wxpoint">wxPoint</A>&</B></B><I> topLeft</I>, <B>const <A HREF="wx_wxpoint.html#wxpoint">wxPoint</A>&</B></B><I> bottomRight</I>)<P>
- Creates a wxRect object from top-left and bottom-right points.<P>
- <B></B> <B>wxRect</B>(<B>const <A HREF="wx_wxpoint.html#wxpoint">wxPoint</A>&</B></B><I> pos</I>, <B>const <A HREF="wx_wxsize.html#wxsize">wxSize</A>&</B></B><I> size</I>)<P>
- Creates a wxRect object from position and size values.<P>
- <B></B> <B>wxRect</B>(<B>const <A HREF="wx_wxsize.html#wxsize">wxSize</A>&</B></B><I> size</I>)<P>
- Creates a wxRect object from size values at the origin.<P>
- <HR>
- <A NAME="wxrectx"></A>
- <H3>wxRect::x</H3>
- <P>
- int x<P>
- x coordinate of the top-level corner of the rectangle.<P>
- <HR>
- <A NAME="wxrecty"></A>
- <H3>wxRect::y</H3>
- <P>
- int y<P>
- y coordinate of the top-level corner of the rectangle.<P>
- <HR>
- <A NAME="wxrectwidth"></A>
- <H3>wxRect::width</H3>
- <P>
- int width<P>
- Width member.<P>
- <HR>
- <A NAME="wxrectheight"></A>
- <H3>wxRect::height</H3>
- <P>
- int height<P>
- Height member.<P>
- <HR>
- <A NAME="wxrectcentrein"></A>
- <H3>wxRect::CentreIn</H3>
- <P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A></B> </B> <B>CentreIn</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>r</I>, <B>int </B><I>dir = wxBOTH</I>) <B>const</B><P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A></B> </B> <B>CenterIn</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>r</I>, <B>int </B><I>dir = wxBOTH</I>) <B>const</B><P>
- Returns the rectangle having the same size as this one but centered relatively
- to the given rectangle <I>r</I>. By default, rectangle is centred in both
- directions but if <I>dir</I> includes only <TT>wxVERTICAL</TT> or only
- <TT>wxHORIZONTAL</TT> flag, then it is only centered in this direction while
- the other component of its position remains unchanged.<P>
- <HR>
- <A NAME="wxrectcontains"></A>
- <H3>wxRect::Contains</H3>
- <P>
- <B>bool</B> <B>Contains</B>(<B>int </B><I>x</I>, <B>int </B><I>y</I>) <B>const</B><P>
- <B>bool</B> <B>Contains</B>(<B>const <A HREF="wx_wxpoint.html#wxpoint">wxPoint</A>& </B></B><I>pt</I>) <B>const</B><P>
- Returns <TT>true</TT> if the given point is inside the rectangle (or on its
- boundary) and <TT>false</TT> otherwise.<P>
- <B>bool</B> <B>Contains</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>rect</I>) <B>const</B><P>
- Returns <TT>true</TT> if the given rectangle is completely inside this rectangle
- (or touches its boundary) and <TT>false</TT> otherwise.<P>
- <HR>
- <A NAME="wxrectdeflate"></A>
- <H3>wxRect::Deflate</H3>
- <P>
- <B>void</B> <B>Deflate</B>(<B>wxCoord </B><I>dx</I>, <B>wxCoord </B><I>dy</I>)<P>
- <B>void</B> <B>Deflate</B>(<B>const <A HREF="wx_wxsize.html#wxsize">wxSize</A>& </B></B><I>diff</I>)<P>
- <B>void</B> <B>Deflate</B>(<B>wxCoord </B><I>diff</I>)<P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A></B> </B> <B>Deflate</B>(<B>wxCoord </B><I>dx</I>, <B>wxCoord </B><I>dy</I>) <B>const</B><P>
- Decrease the rectangle size.<P>
- This method is the opposite from <A HREF="wx_wxrect.html#wxrectinflate">Inflate</A>:
- Deflate(a, b) is equivalent to Inflate(-a, -b).
- Please refer to <A HREF="wx_wxrect.html#wxrectinflate">Inflate</A> for full description.<P>
- <B><FONT COLOR="#FF0000">See also</FONT></B><P>
- <A HREF="wx_wxrect.html#wxrectinflate">Inflate</A><P>
- <HR>
- <A NAME="wxrectgetbottom"></A>
- <H3>wxRect::GetBottom</H3>
- <P>
- <B>int</B> <B>GetBottom</B>() <B>const</B><P>
- Gets the bottom point of the rectangle.<P>
- <HR>
- <A NAME="wxrectgetheight"></A>
- <H3>wxRect::GetHeight</H3>
- <P>
- <B>int</B> <B>GetHeight</B>() <B>const</B><P>
- Gets the height member.<P>
- <HR>
- <A NAME="wxrectgetleft"></A>
- <H3>wxRect::GetLeft</H3>
- <P>
- <B>int</B> <B>GetLeft</B>() <B>const</B><P>
- Gets the left point of the rectangle (the same as <A HREF="wx_wxrect.html#wxrectgetx">wxRect::GetX</A>).<P>
- <HR>
- <A NAME="wxrectgetposition"></A>
- <H3>wxRect::GetPosition</H3>
- <P>
- <B><A HREF="wx_wxpoint.html#wxpoint">wxPoint</A></B> </B> <B>GetPosition</B>() <B>const</B><P>
- Gets the position.<P>
- <HR>
- <A NAME="wxrectgettopleft"></A>
- <H3>wxRect::GetTopLeft</H3>
- <P>
- <B><A HREF="wx_wxpoint.html#wxpoint">wxPoint</A></B> </B> <B>GetTopLeft</B>() <B>const</B><P>
- Gets the position of the top left corner of the rectangle, same as
- <A HREF="wx_wxrect.html#wxrectgetposition">GetPosition</A>.<P>
- <HR>
- <A NAME="wxrectgettopright"></A>
- <H3>wxRect::GetTopRight</H3>
- <P>
- <B><A HREF="wx_wxpoint.html#wxpoint">wxPoint</A></B> </B> <B>GetTopRight</B>() <B>const</B><P>
- Gets the position of the top right corner.<P>
- <HR>
- <A NAME="wxrectgetbottomleft"></A>
- <H3>wxRect::GetBottomLeft</H3>
- <P>
- <B><A HREF="wx_wxpoint.html#wxpoint">wxPoint</A></B> </B> <B>GetBottomLeft</B>() <B>const</B><P>
- Gets the position of the bottom left corner.<P>
- <HR>
- <A NAME="wxrectgetbottomright"></A>
- <H3>wxRect::GetBottomRight</H3>
- <P>
- <B><A HREF="wx_wxpoint.html#wxpoint">wxPoint</A></B> </B> <B>GetBottomRight</B>() <B>const</B><P>
- Gets the position of the bottom right corner.<P>
- <HR>
- <A NAME="wxrectgetright"></A>
- <H3>wxRect::GetRight</H3>
- <P>
- <B>int</B> <B>GetRight</B>() <B>const</B><P>
- Gets the right point of the rectangle.<P>
- <HR>
- <A NAME="wxrectgetsize"></A>
- <H3>wxRect::GetSize</H3>
- <P>
- <B><A HREF="wx_wxsize.html#wxsize">wxSize</A></B> </B> <B>GetSize</B>() <B>const</B><P>
- Gets the size.<P>
- <B><FONT COLOR="#FF0000">See also</FONT></B><P>
- <A HREF="wx_wxrect.html#wxrectsetsize">wxRect::SetSize</A><P>
- <HR>
- <A NAME="wxrectgettop"></A>
- <H3>wxRect::GetTop</H3>
- <P>
- <B>int</B> <B>GetTop</B>() <B>const</B><P>
- Gets the top point of the rectangle (the same as <A HREF="wx_wxrect.html#wxrectgety">wxRect::GetY</A>).<P>
- <HR>
- <A NAME="wxrectgetwidth"></A>
- <H3>wxRect::GetWidth</H3>
- <P>
- <B>int</B> <B>GetWidth</B>() <B>const</B><P>
- Gets the width member.<P>
- <HR>
- <A NAME="wxrectgetx"></A>
- <H3>wxRect::GetX</H3>
- <P>
- <B>int</B> <B>GetX</B>() <B>const</B><P>
- Gets the x member.<P>
- <HR>
- <A NAME="wxrectgety"></A>
- <H3>wxRect::GetY</H3>
- <P>
- <B>int</B> <B>GetY</B>() <B>const</B><P>
- Gets the y member.<P>
- <HR>
- <A NAME="wxrectinflate"></A>
- <H3>wxRect::Inflate</H3>
- <P>
- <B>void</B> <B>Inflate</B>(<B>wxCoord </B><I>dx</I>, <B>wxCoord </B><I>dy</I>)<P>
- <B>void</B> <B>Inflate</B>(<B>const <A HREF="wx_wxsize.html#wxsize">wxSize</A>& </B></B><I>diff</I>)<P>
- <B>void</B> <B>Inflate</B>(<B>wxCoord </B><I>diff</I>)<P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A></B> </B> <B>Inflate</B>(<B>wxCoord </B><I>dx</I>, <B>wxCoord </B><I>dy</I>) <B>const</B><P>
- Increases the size of the rectangle.<P>
- The second form uses the same <I>diff</I> for both <I>dx</I> and <I>dy</I>.<P>
- The first two versions modify the rectangle in place, the last one returns a
- new rectangle leaving this one unchanged.<P>
- The left border is moved farther left and the right border is moved farther
- right by <I>dx</I>. The upper border is moved farther up and the bottom border
- is moved farther down by <I>dy</I>. (Note the the width and height of the
- rectangle thus change by 2*<I>dx</I> and 2*<I>dy</I>, respectively.) If one or
- both of <I>dx</I> and <I>dy</I> are negative, the opposite happens: the rectangle
- size decreases in the respective direction.<P>
- Inflating and deflating behaves "naturally''. Defined more precisely, that
- means:
- <OL>
- <LI> "Real'' inflates (that is, <I>dx</I> and/or <I>dy</I> >= 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.)<P>
- <LI> 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).
- </OL>
- <P>
- <B><FONT COLOR="#FF0000">See also</FONT></B><P>
- <A HREF="wx_wxrect.html#wxrectdeflate">Deflate</A><P>
- <HR>
- <A NAME="wxrectintersect"></A>
- <H3>wxRect::Intersect</H3>
- <P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A></B> </B> <B>Intersect</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>rect</I>) <B>const</B><P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A>&</B> </B> <B>Intersect</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>rect</I>)<P>
- Modifies the rectangle to contain the overlapping box of this rectangle and the
- one passed in as parameter. The const version returns the new rectangle, the
- other one modifies this rectangle in place.<P>
- <HR>
- <A NAME="wxrectintersects"></A>
- <H3>wxRect::Intersects</H3>
- <P>
- <B>bool</B> <B>Intersects</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>rect</I>) <B>const</B><P>
- Returns <TT>true</TT> if this rectangle has a non-empty intersection with the
- rectangle <I>rect</I> and <TT>false</TT> otherwise.<P>
- <HR>
- <A NAME="wxrectisempty"></A>
- <H3>wxRect::IsEmpty</H3>
- <P>
- <B>bool</B> <B>IsEmpty</B>() <B>const</B><P>
- Returns <TT>true</TT> if this rectangle has a width or height less than or equal to
- 0 and <TT>false</TT> otherwise.<P>
- <HR>
- <A NAME="wxrectoffset"></A>
- <H3>wxRect::Offset</H3>
- <P>
- <B>void</B> <B>Offset</B>(<B>wxCoord </B><I>dx</I>, <B>wxCoord </B><I>dy</I>)<P>
- <B>void</B> <B>Offset</B>(<B>const <A HREF="wx_wxpoint.html#wxpoint">wxPoint</A>& </B></B><I>pt</I>)<P>
- Moves the rectangle by the specified offset. If <I>dx</I> is positive, the
- rectangle is moved to the right, if <I>dy</I> is positive, it is moved to the
- bottom, otherwise it is moved to the left or top respectively.<P>
- <HR>
- <A NAME="wxrectsetheight"></A>
- <H3>wxRect::SetHeight</H3>
- <P>
- <B>void</B> <B>SetHeight</B>(<B>int</B><I> height</I>)<P>
- Sets the height.<P>
- <HR>
- <A NAME="wxrectsetsize"></A>
- <H3>wxRect::SetSize</H3>
- <P>
- <B>void</B> <B>SetSize</B>(<B>const <A HREF="wx_wxsize.html#wxsize">wxSize</A>&</B></B><I> s</I>)<P>
- Sets the size.<P>
- <B><FONT COLOR="#FF0000">See also</FONT></B><P>
- <A HREF="wx_wxrect.html#wxrectgetsize">wxRect::GetSize</A><P>
- <HR>
- <A NAME="wxrectsetwidth"></A>
- <H3>wxRect::SetWidth</H3>
- <P>
- <B>void</B> <B>SetWidth</B>(<B>int</B><I> width</I>)<P>
- Sets the width.<P>
- <HR>
- <A NAME="wxrectsetx"></A>
- <H3>wxRect::SetX</H3>
- <P>
- <B>void</B> <B>SetX</B>(<B>int</B><I> x</I>)<P>
- Sets the x position.<P>
- <HR>
- <A NAME="wxrectsety"></A>
- <H3>wxRect::SetY</H3>
- <P>
- <B>void</B> <B>SetY</B>(<B>int</B><I> y</I>)<P>
- Sets the y position.<P>
- <HR>
- <A NAME="wxrectunion"></A>
- <H3>wxRect::Union</H3>
- <P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A></B> </B> <B>Union</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>&</B></B><I> rect</I>) <B>const</B><P>
- <B><A HREF="wx_wxrect.html#wxrect">wxRect</A>&</B> </B> <B>Union</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>&</B></B><I> rect</I>)<P>
- Modifies the rectangle to contain the bounding box of this rectangle and the
- one passed in as parameter. The const version returns the new rectangle, the
- other one modifies this rectangle in place.<P>
- <HR>
- <A NAME="wxrectassign"></A>
- <H3>wxRect::operator =</H3>
- <P>
- <B>void</B> <B>operator =</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>rect</I>)<P>
- Assignment operator.<P>
- <HR>
- <A NAME="wxrectequal"></A>
- <H3>wxRect::operator ==</H3>
- <P>
- <B>bool</B> <B>operator ==</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>rect</I>)<P>
- Equality operator.<P>
- <HR>
- <A NAME="wxrectnotequal"></A>
- <H3>wxRect::operator !=</H3>
- <P>
- <B>bool</B> <B>operator !=</B>(<B>const <A HREF="wx_wxrect.html#wxrect">wxRect</A>& </B></B><I>rect</I>)<P>
- Inequality operator.<P>
- </FONT></BODY></HTML>