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::Deflate
}\label{wxrectdeflate
}
73 \func{void
}{Deflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
75 \func{void
}{Deflate
}{\param{wxCoord
}{diff
}}
77 \constfunc{wxRect
}{Deflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
79 Decrease the rectangle size.
81 This method is the opposite from
\helpref{Inflate
}{wxrectinflate
}:
82 Deflate(a, b) is equivalent to Inflate(-a, -b).
83 Please refer to
\helpref{Inflate
}{wxrectinflate
} for full description.
87 \helpref{Inflate
}{wxrectinflate
}
90 \membersection{wxRect::GetBottom
}\label{wxrectgetbottom
}
92 \constfunc{int
}{GetBottom
}{\void}
94 Gets the bottom point of the rectangle.
97 \membersection{wxRect::GetHeight
}\label{wxrectgetheight
}
99 \constfunc{int
}{GetHeight
}{\void}
101 Gets the height member.
104 \membersection{wxRect::GetLeft
}\label{wxrectgetleft
}
106 \constfunc{int
}{GetLeft
}{\void}
108 Gets the left point of the rectangle (the same as
\helpref{wxRect::GetX
}{wxrectgetx
}).
111 \membersection{wxRect::GetPosition
}\label{wxrectgetposition
}
113 \constfunc{wxPoint
}{GetPosition
}{\void}
118 \membersection{wxRect::GetTopLeft
}\label{wxrectgettopleft
}
120 \constfunc{wxPoint
}{GetTopLeft
}{\void}
122 Gets the topleft position of the rectangle. (Same as GetPosition).
125 \membersection{wxRect::GetBottomRight
}\label{wxrectgetbottomright
}
127 \constfunc{wxPoint
}{GetBottomRight
}{\void}
129 Gets the the bottom right position. Returns the bottom right point inside the rectangle.
132 \membersection{wxRect::GetRight
}\label{wxrectgetright
}
134 \constfunc{int
}{GetRight
}{\void}
136 Gets the right point of the rectangle.
139 \membersection{wxRect::GetSize
}\label{wxrectgetsize
}
141 \constfunc{wxSize
}{GetSize
}{\void}
147 \helpref{wxRect::SetSize
}{wxrectsetsize
}
150 \membersection{wxRect::GetTop
}\label{wxrectgettop
}
152 \constfunc{int
}{GetTop
}{\void}
154 Gets the top point of the rectangle (the same as
\helpref{wxRect::GetY
}{wxrectgety
}).
157 \membersection{wxRect::GetWidth
}\label{wxrectgetwidth
}
159 \constfunc{int
}{GetWidth
}{\void}
161 Gets the width member.
164 \membersection{wxRect::GetX
}\label{wxrectgetx
}
166 \constfunc{int
}{GetX
}{\void}
171 \membersection{wxRect::GetY
}\label{wxrectgety
}
173 \constfunc{int
}{GetY
}{\void}
178 \membersection{wxRect::Inflate
}\label{wxrectinflate
}
180 \func{void
}{Inflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
182 \func{void
}{Inflate
}{\param{wxCoord
}{diff
}}
184 \constfunc{wxRect
}{Inflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
186 Increases the size of the rectangle.
188 The second form uses the same
{\it diff
} for both
{\it dx
} and
{\it dy
}.
190 The first two versions modify the rectangle in place, the last one returns a
191 new rectangle leaving this one unchanged.
193 The left border is moved farther left and the right border is moved farther
194 right by
{\it dx
}. The upper border is moved farther up and the bottom border
195 is moved farther down by
{\it dy
}. (Note the the width and height of the
196 rectangle thus change by
2*
{\it dx
} and
2*
{\it dy
}, respectively.) If one or
197 both of
{\it dx
} and
{\it dy
} are negative, the opposite happens: the rectangle
198 size decreases in the respective direction.
200 Inflating and deflating behaves ``naturally''. Defined more precisely, that
203 \item ``Real'' inflates (that is,
{\it dx
} and/or
{\it dy
} >=
0) are not
204 constrained. Thus inflating a rectangle can cause its upper left corner
205 to move into the negative numbers. (the versions prior to
2.5.4 forced
206 the top left coordinate to not fall below (
0,
0), which implied a
207 forced move of the rectangle.)
209 \item Deflates are clamped to not reduce the width or height of the
210 rectangle below zero. In such cases, the top-left corner is nonetheless
211 handled properly. For example, a rectangle at (
10,
10) with size (
20,
212 40) that is inflated by (-
15, -
15) will become located at (
20,
25) at
213 size (
0,
10). Finally, observe that the width and height are treated
214 independently. In the above example, the width is reduced by
20,
215 whereas the height is reduced by the full
30 (rather than also stopping
216 at
20, when the width reached zero).
221 \helpref{Deflate
}{wxrectdeflate
}
224 \membersection{wxRect::Inside
}\label{wxrectinside
}
226 \constfunc{bool
}{Inside
}{\param{int
}{x
},
\param{int
}{y
}}
228 \constfunc{bool
}{Inside
}{\param{const wxPoint\&
}{pt
}}
230 Returns
{\tt true
} if the given point is inside the rectangle (or on its
231 boundary) and
{\tt false
} otherwise.
234 \membersection{wxRect::Intersects
}\label{wxrectintersects
}
236 \constfunc{bool
}{Intersects
}{\param{const wxRect\&
}{rect
}}
238 Returns
{\tt true
} if this rectangle has a non empty intersection with the
239 rectangle
{\it rect
} and
{\tt false
} otherwise.
242 \membersection{wxRect::IsEmpty
}\label{wxrectisempty
}
244 \constfunc{bool
}{IsEmpty
}{}
246 Returns
{\tt true
} if this rectangle has a width or height less than or equal to
247 0 and
{\tt false
} otherwise.
250 \membersection{wxRect::Offset
}\label{wxrectoffset
}
252 \func{void
}{Offset
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
254 \func{void
}{Offset
}{\param{const wxPoint\&
}{pt
}}
256 Moves the rectangle by the specified offset. If
{\it dx
} is positive, the
257 rectangle is moved to the right, if
{\it dy
} is positive, it is moved to the
258 bottom, otherwise it is moved to the left or top respectively.
261 \membersection{wxRect::SetHeight
}\label{wxrectsetheight
}
263 \func{void
}{SetHeight
}{\param{int
}{ height
}}
268 \membersection{wxRect::SetSize
}\label{wxrectsetsize
}
270 \func{void
}{SetSize
}{\param{const wxSize\&
}{ s
}}
276 \helpref{wxRect::GetSize
}{wxrectgetsize
}
279 \membersection{wxRect::SetWidth
}\label{wxrectsetwidth
}
281 \func{void
}{SetWidth
}{\param{int
}{ width
}}
286 \membersection{wxRect::SetX
}\label{wxrectsetx
}
288 \func{void
}{SetX
}{\param{int
}{ x
}}
293 \membersection{wxRect::SetY
}\label{wxrectsety
}
295 \func{void
}{SetY
}{\param{int
}{ y
}}
300 \membersection{wxRect::Union
}\label{wxrectunion
}
302 \constfunc{wxRect
}{Union
}{\param{const wxRect\&
}{ rect
}}
304 \func{wxRect\&
}{Union
}{\param{const wxRect\&
}{ rect
}}
306 Modifies the rectangle to contain the bounding box of this rectangle and the
307 one passed in as parameter. The const version returns the new rectangle, the
308 other one modifies this rectangle in place.
311 \membersection{wxRect::operator $=$
}\label{wxrectassign
}
313 \func{void
}{operator $=$
}{\param{const wxRect\&
}{rect
}}
318 \membersection{wxRect::operator $==$
}\label{wxrectequal
}
320 \func{bool
}{operator $==$
}{\param{const wxRect\&
}{rect
}}
325 \membersection{wxRect::operator $!=$
}\label{wxrectnotequal
}
327 \func{bool
}{operator $!=$
}{\param{const wxRect\&
}{rect
}}