1 \section{\class{wxRect
}}\label{wxrect
}
3 A class for manipulating rectangles.
5 \wxheading{Derived from
}
9 \wxheading{Include files
}
15 \helpref{wxPoint
}{wxpoint
},
\helpref{wxSize
}{wxsize
}
17 \latexignore{\rtfignore{\wxheading{Members
}}}
20 \membersection{wxRect::wxRect
}\label{wxrectctor
}
22 \func{}{wxRect
}{\void}
26 \func{}{wxRect
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
}}
28 Creates a wxRect object from x, y, width and height values.
30 \func{}{wxRect
}{\param{const wxPoint\&
}{ topLeft
},
\param{const wxPoint\&
}{ bottomRight
}}
32 Creates a wxRect object from top-left and bottom-right points.
34 \func{}{wxRect
}{\param{const wxPoint\&
}{ pos
},
\param{const wxSize\&
}{ size
}}
36 Creates a wxRect object from position and size values.
38 \func{}{wxRect
}{\param{const wxSize\&
}{ size
}}
40 Creates a wxRect object from size values at the origin.
43 \membersection{wxRect::x
}\label{wxrectx
}
47 x coordinate of the top-level corner of the rectangle.
50 \membersection{wxRect::y
}\label{wxrecty
}
54 y coordinate of the top-level corner of the rectangle.
57 \membersection{wxRect::width
}\label{wxrectwidth
}
64 \membersection{wxRect::height
}\label{wxrectheight
}
71 \membersection{wxRect::CentreIn
}\label{wxrectcentrein
}
73 \constfunc{wxRect
}{CentreIn
}{\param{const wxRect\&
}{r
},
\param{int
}{dir = wxBOTH
}}
75 \constfunc{wxRect
}{CenterIn
}{\param{const wxRect\&
}{r
},
\param{int
}{dir = wxBOTH
}}
77 Returns the rectangle having the same size as this one but centered relatively
78 to the given rectangle
\arg{r
}. By default, rectangle is centred in both
79 directions but if
\arg{dir
} includes only
\texttt{wxVERTICAL
} or only
80 \texttt{wxHORIZONTAL
} flag, then it is only centered in this direction while
81 the other component of its position remains unchanged.
84 \membersection{wxRect::Contains
}\label{wxrectcontains
}
86 \constfunc{bool
}{Contains
}{\param{int
}{x
},
\param{int
}{y
}}
88 \constfunc{bool
}{Contains
}{\param{const wxPoint\&
}{pt
}}
90 Returns
{\tt true
} if the given point is inside the rectangle (or on its
91 boundary) and
{\tt false
} otherwise.
93 \constfunc{bool
}{Contains
}{\param{const wxRect\&
}{rect
}}
95 Returns
\true if the given rectangle is completely inside this rectangle
96 (or touches its boundary) and
\false otherwise.
99 \membersection{wxRect::Deflate
}\label{wxrectdeflate
}
101 \func{void
}{Deflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
103 \func{void
}{Deflate
}{\param{wxCoord
}{diff
}}
105 \constfunc{wxRect
}{Deflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
107 Decrease the rectangle size.
109 This method is the opposite from
\helpref{Inflate
}{wxrectinflate
}:
110 Deflate(a, b) is equivalent to Inflate(-a, -b).
111 Please refer to
\helpref{Inflate
}{wxrectinflate
} for full description.
115 \helpref{Inflate
}{wxrectinflate
}
118 \membersection{wxRect::GetBottom
}\label{wxrectgetbottom
}
120 \constfunc{int
}{GetBottom
}{\void}
122 Gets the bottom point of the rectangle.
125 \membersection{wxRect::GetHeight
}\label{wxrectgetheight
}
127 \constfunc{int
}{GetHeight
}{\void}
129 Gets the height member.
132 \membersection{wxRect::GetLeft
}\label{wxrectgetleft
}
134 \constfunc{int
}{GetLeft
}{\void}
136 Gets the left point of the rectangle (the same as
\helpref{wxRect::GetX
}{wxrectgetx
}).
139 \membersection{wxRect::GetPosition
}\label{wxrectgetposition
}
141 \constfunc{wxPoint
}{GetPosition
}{\void}
146 \membersection{wxRect::GetTopLeft
}\label{wxrectgettopleft
}
148 \constfunc{wxPoint
}{GetTopLeft
}{\void}
150 Gets the position of the top left corner of the rectangle, same as
151 \helpref{GetPosition
}{wxrectgetposition
}.
154 \membersection{wxRect::GetTopRight
}\label{wxrectgettopright
}
156 \constfunc{wxPoint
}{GetTopRight
}{\void}
158 Gets the position of the top right corner.
161 \membersection{wxRect::GetBottomLeft
}\label{wxrectgetbottomleft
}
163 \constfunc{wxPoint
}{GetBottomLeft
}{\void}
165 Gets the position of the bottom left corner.
168 \membersection{wxRect::GetBottomRight
}\label{wxrectgetbottomright
}
170 \constfunc{wxPoint
}{GetBottomRight
}{\void}
172 Gets the position of the bottom right corner.
175 \membersection{wxRect::GetRight
}\label{wxrectgetright
}
177 \constfunc{int
}{GetRight
}{\void}
179 Gets the right point of the rectangle.
182 \membersection{wxRect::GetSize
}\label{wxrectgetsize
}
184 \constfunc{wxSize
}{GetSize
}{\void}
190 \helpref{wxRect::SetSize
}{wxrectsetsize
}
193 \membersection{wxRect::GetTop
}\label{wxrectgettop
}
195 \constfunc{int
}{GetTop
}{\void}
197 Gets the top point of the rectangle (the same as
\helpref{wxRect::GetY
}{wxrectgety
}).
200 \membersection{wxRect::GetWidth
}\label{wxrectgetwidth
}
202 \constfunc{int
}{GetWidth
}{\void}
204 Gets the width member.
207 \membersection{wxRect::GetX
}\label{wxrectgetx
}
209 \constfunc{int
}{GetX
}{\void}
214 \membersection{wxRect::GetY
}\label{wxrectgety
}
216 \constfunc{int
}{GetY
}{\void}
221 \membersection{wxRect::Inflate
}\label{wxrectinflate
}
223 \func{void
}{Inflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
225 \func{void
}{Inflate
}{\param{wxCoord
}{diff
}}
227 \constfunc{wxRect
}{Inflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
229 Increases the size of the rectangle.
231 The second form uses the same
{\it diff
} for both
{\it dx
} and
{\it dy
}.
233 The first two versions modify the rectangle in place, the last one returns a
234 new rectangle leaving this one unchanged.
236 The left border is moved farther left and the right border is moved farther
237 right by
{\it dx
}. The upper border is moved farther up and the bottom border
238 is moved farther down by
{\it dy
}. (Note the the width and height of the
239 rectangle thus change by
2*
{\it dx
} and
2*
{\it dy
}, respectively.) If one or
240 both of
{\it dx
} and
{\it dy
} are negative, the opposite happens: the rectangle
241 size decreases in the respective direction.
243 Inflating and deflating behaves ``naturally''. Defined more precisely, that
246 \item ``Real'' inflates (that is,
{\it dx
} and/or
{\it dy
} >=
0) are not
247 constrained. Thus inflating a rectangle can cause its upper left corner
248 to move into the negative numbers. (the versions prior to
2.5.4 forced
249 the top left coordinate to not fall below (
0,
0), which implied a
250 forced move of the rectangle.)
252 \item Deflates are clamped to not reduce the width or height of the
253 rectangle below zero. In such cases, the top-left corner is nonetheless
254 handled properly. For example, a rectangle at (
10,
10) with size (
20,
255 40) that is inflated by (-
15, -
15) will become located at (
20,
25) at
256 size (
0,
10). Finally, observe that the width and height are treated
257 independently. In the above example, the width is reduced by
20,
258 whereas the height is reduced by the full
30 (rather than also stopping
259 at
20, when the width reached zero).
264 \helpref{Deflate
}{wxrectdeflate
}
267 \membersection{wxRect::Intersects
}\label{wxrectintersects
}
269 \constfunc{bool
}{Intersects
}{\param{const wxRect\&
}{rect
}}
271 Returns
{\tt true
} if this rectangle has a non-empty intersection with the
272 rectangle
{\it rect
} and
{\tt false
} otherwise.
275 \membersection{wxRect::IsEmpty
}\label{wxrectisempty
}
277 \constfunc{bool
}{IsEmpty
}{}
279 Returns
{\tt true
} if this rectangle has a width or height less than or equal to
280 0 and
{\tt false
} otherwise.
283 \membersection{wxRect::Offset
}\label{wxrectoffset
}
285 \func{void
}{Offset
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
287 \func{void
}{Offset
}{\param{const wxPoint\&
}{pt
}}
289 Moves the rectangle by the specified offset. If
{\it dx
} is positive, the
290 rectangle is moved to the right, if
{\it dy
} is positive, it is moved to the
291 bottom, otherwise it is moved to the left or top respectively.
294 \membersection{wxRect::SetHeight
}\label{wxrectsetheight
}
296 \func{void
}{SetHeight
}{\param{int
}{ height
}}
301 \membersection{wxRect::SetSize
}\label{wxrectsetsize
}
303 \func{void
}{SetSize
}{\param{const wxSize\&
}{ s
}}
309 \helpref{wxRect::GetSize
}{wxrectgetsize
}
312 \membersection{wxRect::SetWidth
}\label{wxrectsetwidth
}
314 \func{void
}{SetWidth
}{\param{int
}{ width
}}
319 \membersection{wxRect::SetX
}\label{wxrectsetx
}
321 \func{void
}{SetX
}{\param{int
}{ x
}}
326 \membersection{wxRect::SetY
}\label{wxrectsety
}
328 \func{void
}{SetY
}{\param{int
}{ y
}}
333 \membersection{wxRect::Union
}\label{wxrectunion
}
335 \constfunc{wxRect
}{Union
}{\param{const wxRect\&
}{ rect
}}
337 \func{wxRect\&
}{Union
}{\param{const wxRect\&
}{ rect
}}
339 Modifies the rectangle to contain the bounding box of this rectangle and the
340 one passed in as parameter. The const version returns the new rectangle, the
341 other one modifies this rectangle in place.
344 \membersection{wxRect::operator $=$
}\label{wxrectassign
}
346 \func{void
}{operator $=$
}{\param{const wxRect\&
}{rect
}}
351 \membersection{wxRect::operator $==$
}\label{wxrectequal
}
353 \func{bool
}{operator $==$
}{\param{const wxRect\&
}{rect
}}
358 \membersection{wxRect::operator $!=$
}\label{wxrectnotequal
}
360 \func{bool
}{operator $!=$
}{\param{const wxRect\&
}{rect
}}