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::Deflate
}\label{wxrectdeflate
}
86 \func{void
}{Deflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
88 \func{void
}{Deflate
}{\param{wxCoord
}{diff
}}
90 \constfunc{wxRect
}{Deflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
92 Decrease the rectangle size.
94 This method is the opposite from
\helpref{Inflate
}{wxrectinflate
}:
95 Deflate(a, b) is equivalent to Inflate(-a, -b).
96 Please refer to
\helpref{Inflate
}{wxrectinflate
} for full description.
100 \helpref{Inflate
}{wxrectinflate
}
103 \membersection{wxRect::GetBottom
}\label{wxrectgetbottom
}
105 \constfunc{int
}{GetBottom
}{\void}
107 Gets the bottom point of the rectangle.
110 \membersection{wxRect::GetHeight
}\label{wxrectgetheight
}
112 \constfunc{int
}{GetHeight
}{\void}
114 Gets the height member.
117 \membersection{wxRect::GetLeft
}\label{wxrectgetleft
}
119 \constfunc{int
}{GetLeft
}{\void}
121 Gets the left point of the rectangle (the same as
\helpref{wxRect::GetX
}{wxrectgetx
}).
124 \membersection{wxRect::GetPosition
}\label{wxrectgetposition
}
126 \constfunc{wxPoint
}{GetPosition
}{\void}
131 \membersection{wxRect::GetTopLeft
}\label{wxrectgettopleft
}
133 \constfunc{wxPoint
}{GetTopLeft
}{\void}
135 Gets the topleft position of the rectangle. (Same as GetPosition).
138 \membersection{wxRect::GetBottomRight
}\label{wxrectgetbottomright
}
140 \constfunc{wxPoint
}{GetBottomRight
}{\void}
142 Gets the bottom right position. Returns the bottom right point inside the rectangle.
145 \membersection{wxRect::GetRight
}\label{wxrectgetright
}
147 \constfunc{int
}{GetRight
}{\void}
149 Gets the right point of the rectangle.
152 \membersection{wxRect::GetSize
}\label{wxrectgetsize
}
154 \constfunc{wxSize
}{GetSize
}{\void}
160 \helpref{wxRect::SetSize
}{wxrectsetsize
}
163 \membersection{wxRect::GetTop
}\label{wxrectgettop
}
165 \constfunc{int
}{GetTop
}{\void}
167 Gets the top point of the rectangle (the same as
\helpref{wxRect::GetY
}{wxrectgety
}).
170 \membersection{wxRect::GetWidth
}\label{wxrectgetwidth
}
172 \constfunc{int
}{GetWidth
}{\void}
174 Gets the width member.
177 \membersection{wxRect::GetX
}\label{wxrectgetx
}
179 \constfunc{int
}{GetX
}{\void}
184 \membersection{wxRect::GetY
}\label{wxrectgety
}
186 \constfunc{int
}{GetY
}{\void}
191 \membersection{wxRect::Inflate
}\label{wxrectinflate
}
193 \func{void
}{Inflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
195 \func{void
}{Inflate
}{\param{wxCoord
}{diff
}}
197 \constfunc{wxRect
}{Inflate
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
199 Increases the size of the rectangle.
201 The second form uses the same
{\it diff
} for both
{\it dx
} and
{\it dy
}.
203 The first two versions modify the rectangle in place, the last one returns a
204 new rectangle leaving this one unchanged.
206 The left border is moved farther left and the right border is moved farther
207 right by
{\it dx
}. The upper border is moved farther up and the bottom border
208 is moved farther down by
{\it dy
}. (Note the the width and height of the
209 rectangle thus change by
2*
{\it dx
} and
2*
{\it dy
}, respectively.) If one or
210 both of
{\it dx
} and
{\it dy
} are negative, the opposite happens: the rectangle
211 size decreases in the respective direction.
213 Inflating and deflating behaves ``naturally''. Defined more precisely, that
216 \item ``Real'' inflates (that is,
{\it dx
} and/or
{\it dy
} >=
0) are not
217 constrained. Thus inflating a rectangle can cause its upper left corner
218 to move into the negative numbers. (the versions prior to
2.5.4 forced
219 the top left coordinate to not fall below (
0,
0), which implied a
220 forced move of the rectangle.)
222 \item Deflates are clamped to not reduce the width or height of the
223 rectangle below zero. In such cases, the top-left corner is nonetheless
224 handled properly. For example, a rectangle at (
10,
10) with size (
20,
225 40) that is inflated by (-
15, -
15) will become located at (
20,
25) at
226 size (
0,
10). Finally, observe that the width and height are treated
227 independently. In the above example, the width is reduced by
20,
228 whereas the height is reduced by the full
30 (rather than also stopping
229 at
20, when the width reached zero).
234 \helpref{Deflate
}{wxrectdeflate
}
237 \membersection{wxRect::Inside
}\label{wxrectinside
}
239 \constfunc{bool
}{Inside
}{\param{int
}{x
},
\param{int
}{y
}}
241 \constfunc{bool
}{Inside
}{\param{const wxPoint\&
}{pt
}}
243 Returns
{\tt true
} if the given point is inside the rectangle (or on its
244 boundary) and
{\tt false
} otherwise.
247 \membersection{wxRect::Intersects
}\label{wxrectintersects
}
249 \constfunc{bool
}{Intersects
}{\param{const wxRect\&
}{rect
}}
251 Returns
{\tt true
} if this rectangle has a non-empty intersection with the
252 rectangle
{\it rect
} and
{\tt false
} otherwise.
255 \membersection{wxRect::IsEmpty
}\label{wxrectisempty
}
257 \constfunc{bool
}{IsEmpty
}{}
259 Returns
{\tt true
} if this rectangle has a width or height less than or equal to
260 0 and
{\tt false
} otherwise.
263 \membersection{wxRect::Offset
}\label{wxrectoffset
}
265 \func{void
}{Offset
}{\param{wxCoord
}{dx
},
\param{wxCoord
}{dy
}}
267 \func{void
}{Offset
}{\param{const wxPoint\&
}{pt
}}
269 Moves the rectangle by the specified offset. If
{\it dx
} is positive, the
270 rectangle is moved to the right, if
{\it dy
} is positive, it is moved to the
271 bottom, otherwise it is moved to the left or top respectively.
274 \membersection{wxRect::SetHeight
}\label{wxrectsetheight
}
276 \func{void
}{SetHeight
}{\param{int
}{ height
}}
281 \membersection{wxRect::SetSize
}\label{wxrectsetsize
}
283 \func{void
}{SetSize
}{\param{const wxSize\&
}{ s
}}
289 \helpref{wxRect::GetSize
}{wxrectgetsize
}
292 \membersection{wxRect::SetWidth
}\label{wxrectsetwidth
}
294 \func{void
}{SetWidth
}{\param{int
}{ width
}}
299 \membersection{wxRect::SetX
}\label{wxrectsetx
}
301 \func{void
}{SetX
}{\param{int
}{ x
}}
306 \membersection{wxRect::SetY
}\label{wxrectsety
}
308 \func{void
}{SetY
}{\param{int
}{ y
}}
313 \membersection{wxRect::Union
}\label{wxrectunion
}
315 \constfunc{wxRect
}{Union
}{\param{const wxRect\&
}{ rect
}}
317 \func{wxRect\&
}{Union
}{\param{const wxRect\&
}{ rect
}}
319 Modifies the rectangle to contain the bounding box of this rectangle and the
320 one passed in as parameter. The const version returns the new rectangle, the
321 other one modifies this rectangle in place.
324 \membersection{wxRect::operator $=$
}\label{wxrectassign
}
326 \func{void
}{operator $=$
}{\param{const wxRect\&
}{rect
}}
331 \membersection{wxRect::operator $==$
}\label{wxrectequal
}
333 \func{bool
}{operator $==$
}{\param{const wxRect\&
}{rect
}}
338 \membersection{wxRect::operator $!=$
}\label{wxrectnotequal
}
340 \func{bool
}{operator $!=$
}{\param{const wxRect\&
}{rect
}}