]>
Commit | Line | Data |
---|---|---|
1 | <HTML> | |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
4 | <title>wxWindow</title></head> | |
5 | <BODY BGCOLOR="#FFFFFF"> | |
6 | <A NAME="wxwindow"></A><CENTER> | |
7 | <A HREF="http://www.wx.org/wx.zip#zip:wx.htm#anchor">Contents</A> <A HREF="wx22.htm#classref">Up</A> <A HREF="wx259.htm#wxwave"><<</A> <A HREF="wx261.htm#wxwindowdc">>></A> </CENTER><HR> | |
8 | ||
9 | <H2>wxWindow</H2> | |
10 | <P> | |
11 | wxWindow is the base class for all windows. Any | |
12 | children of the window will be deleted automatically by the destructor | |
13 | before the window itself is deleted.<P> | |
14 | <B><FONT COLOR="#FF0000">Derived from</FONT></B><P> | |
15 | <A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR> | |
16 | ||
17 | <A HREF="wx158.htm#wxobject">wxObject</A><P> | |
18 | <B><FONT COLOR="#FF0000">Include files</FONT></B><P> | |
19 | <wx/window.h><P> | |
20 | <B><FONT COLOR="#FF0000">Window styles</FONT></B><P> | |
21 | The following styles can apply to all windows, although they will not always make sense for a particular | |
22 | window class.<P> | |
23 | ||
24 | <TABLE BORDER> | |
25 | ||
26 | ||
27 | <TR><TD VALIGN=TOP> | |
28 | <B>wxSIMPLE_BORDER</B> | |
29 | </TD> | |
30 | ||
31 | <TD VALIGN=TOP> | |
32 | Displays a thin border around the window. wxBORDER is the old name | |
33 | for this style. | |
34 | </TD></TR> | |
35 | ||
36 | ||
37 | <TR><TD VALIGN=TOP> | |
38 | <B>wxDOUBLE_BORDER</B> | |
39 | </TD> | |
40 | ||
41 | <TD VALIGN=TOP> | |
42 | Displays a double border. Windows only. | |
43 | </TD></TR> | |
44 | ||
45 | ||
46 | <TR><TD VALIGN=TOP> | |
47 | <B>wxSUNKEN_BORDER</B> | |
48 | </TD> | |
49 | ||
50 | <TD VALIGN=TOP> | |
51 | Displays a sunken border. | |
52 | </TD></TR> | |
53 | ||
54 | ||
55 | <TR><TD VALIGN=TOP> | |
56 | <B>wxRAISED_BORDER</B> | |
57 | </TD> | |
58 | ||
59 | <TD VALIGN=TOP> | |
60 | Displays a raised border. | |
61 | </TD></TR> | |
62 | ||
63 | ||
64 | <TR><TD VALIGN=TOP> | |
65 | <B>wxSTATIC_BORDER</B> | |
66 | </TD> | |
67 | ||
68 | <TD VALIGN=TOP> | |
69 | Displays a border suitable for a static control. | |
70 | </TD></TR> | |
71 | ||
72 | ||
73 | <TR><TD VALIGN=TOP> | |
74 | <B>wxTRANSPARENT_WINDOW</B> | |
75 | </TD> | |
76 | ||
77 | <TD VALIGN=TOP> | |
78 | The window is transparent, that is, it will not receive paint | |
79 | events. Windows only. | |
80 | </TD></TR> | |
81 | ||
82 | ||
83 | <TR><TD VALIGN=TOP> | |
84 | <B>wxTAB_TRAVERSAL</B> | |
85 | </TD> | |
86 | ||
87 | <TD VALIGN=TOP> | |
88 | Use this to enable tab traversal for non-dialog windows. | |
89 | </TD></TR> | |
90 | ||
91 | ||
92 | <TR><TD VALIGN=TOP> | |
93 | <B>wxVSCROLL</B> | |
94 | </TD> | |
95 | ||
96 | <TD VALIGN=TOP> | |
97 | Use this style to enable a vertical scrollbar. | |
98 | </TD></TR> | |
99 | ||
100 | ||
101 | <TR><TD VALIGN=TOP> | |
102 | <B>wxHSCROLL</B> | |
103 | </TD> | |
104 | ||
105 | <TD VALIGN=TOP> | |
106 | Use this style to enable a horizontal scrollbar. | |
107 | </TD></TR> | |
108 | ||
109 | ||
110 | <TR><TD VALIGN=TOP> | |
111 | <B>wxCLIP_CHILDREN</B> | |
112 | </TD> | |
113 | ||
114 | <TD VALIGN=TOP> | |
115 | Use this style to eliminate flicker caused by the background being | |
116 | repainted, then children being painted over them. Windows-only. | |
117 | </TD></TR> | |
118 | ||
119 | ||
120 | </TABLE> | |
121 | <P> | |
122 | See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P> | |
123 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
124 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
125 | <B><FONT COLOR="#FF0000">Members</FONT></B><P> | |
126 | <A HREF="#topic1026">wxWindow::wxWindow</A><BR> | |
127 | <A HREF="#topic1027">wxWindow::~wxWindow</A><BR> | |
128 | <A HREF="#topic1028">wxWindow::AddChild</A><BR> | |
129 | <A HREF="#wxwindowcapturemouse">wxWindow::CaptureMouse</A><BR> | |
130 | <A HREF="#wxwindowcenter">wxWindow::Center</A><BR> | |
131 | <A HREF="#wxwindowcentre">wxWindow::Centre</A><BR> | |
132 | <A HREF="#wxwindowclear">wxWindow::Clear</A><BR> | |
133 | <A HREF="#topic1029">wxWindow::ClientToScreen</A><BR> | |
134 | <A HREF="#wxwindowclose">wxWindow::Close</A><BR> | |
135 | <A HREF="#wxwindowconvertdialogtopixels">wxWindow::ConvertDialogToPixels</A><BR> | |
136 | <A HREF="#wxwindowconvertpixelstodialog">wxWindow::ConvertPixelsToDialog</A><BR> | |
137 | <A HREF="#wxwindowdestroy">wxWindow::Destroy</A><BR> | |
138 | <A HREF="#topic1030">wxWindow::DestroyChildren</A><BR> | |
139 | <A HREF="#wxwindowdragacceptfiles">wxWindow::DragAcceptFiles</A><BR> | |
140 | <A HREF="#wxwindowenable">wxWindow::Enable</A><BR> | |
141 | <A HREF="#wxwindowfindfocus">wxWindow::FindFocus</A><BR> | |
142 | <A HREF="#wxwindowfindwindow">wxWindow::FindWindow</A><BR> | |
143 | <A HREF="#wxwindowfit">wxWindow::Fit</A><BR> | |
144 | <A HREF="#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A><BR> | |
145 | <A HREF="#topic1031">wxWindow::GetCharHeight</A><BR> | |
146 | <A HREF="#topic1032">wxWindow::GetCharWidth</A><BR> | |
147 | <A HREF="#topic1033">wxWindow::GetChildren</A><BR> | |
148 | <A HREF="#wxwindowgetclientsize">wxWindow::GetClientSize</A><BR> | |
149 | <A HREF="#wxwindowgetconstraints">wxWindow::GetConstraints</A><BR> | |
150 | <A HREF="#wxwindowgetdefaultitem">wxWindow::GetDefaultItem</A><BR> | |
151 | <A HREF="#wxwindowgetdroptarget">wxWindow::GetDropTarget</A><BR> | |
152 | <A HREF="#wxwindowgeteventhandler">wxWindow::GetEventHandler</A><BR> | |
153 | <A HREF="#wxwindowgetfont">wxWindow::GetFont</A><BR> | |
154 | <A HREF="#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A><BR> | |
155 | <A HREF="#topic1034">wxWindow::GetGrandParent</A><BR> | |
156 | <A HREF="#topic1035">wxWindow::GetHandle</A><BR> | |
157 | <A HREF="#wxwindowgetid">wxWindow::GetId</A><BR> | |
158 | <A HREF="#topic1036">wxWindow::GetPosition</A><BR> | |
159 | <A HREF="#topic1037">wxWindow::GetLabel</A><BR> | |
160 | <A HREF="#wxwindowgetname">wxWindow::GetName</A><BR> | |
161 | <A HREF="#topic1038">wxWindow::GetParent</A><BR> | |
162 | <A HREF="#wxwindowgetrect">wxWindow::GetRect</A><BR> | |
163 | <A HREF="#wxwindowgetreturncode">wxWindow::GetReturnCode</A><BR> | |
164 | <A HREF="#wxwindowgetscrollthumb">wxWindow::GetScrollThumb</A><BR> | |
165 | <A HREF="#wxwindowgetscrollpos">wxWindow::GetScrollPos</A><BR> | |
166 | <A HREF="#wxwindowgetscrollrange">wxWindow::GetScrollRange</A><BR> | |
167 | <A HREF="#wxwindowgetsize">wxWindow::GetSize</A><BR> | |
168 | <A HREF="#topic1039">wxWindow::GetTextExtent</A><BR> | |
169 | <A HREF="#wxwindowgettitle">wxWindow::GetTitle</A><BR> | |
170 | <A HREF="#wxwindowgetupdateregion">wxWindow::GetUpdateRegion</A><BR> | |
171 | <A HREF="#topic1040">wxWindow::GetWindowStyleFlag</A><BR> | |
172 | <A HREF="#wxwindowinitdialog">wxWindow::InitDialog</A><BR> | |
173 | <A HREF="#wxwindowisenabled">wxWindow::IsEnabled</A><BR> | |
174 | <A HREF="#wxwindowisretained">wxWindow::IsRetained</A><BR> | |
175 | <A HREF="#wxwindowisshown">wxWindow::IsShown</A><BR> | |
176 | <A HREF="#wxwindowlayout">wxWindow::Layout</A><BR> | |
177 | <A HREF="#wxwindowloadfromresource">wxWindow::LoadFromResource</A><BR> | |
178 | <A HREF="#wxwindowlower">wxWindow::Lower</A><BR> | |
179 | <A HREF="#wxwindowmakemodal">wxWindow::MakeModal</A><BR> | |
180 | <A HREF="#wxwindowmove">wxWindow::Move</A><BR> | |
181 | <A HREF="#wxwindowonactivate">wxWindow::OnActivate</A><BR> | |
182 | <A HREF="#wxwindowonchar">wxWindow::OnChar</A><BR> | |
183 | <A HREF="#wxwindowoncharhook">wxWindow::OnCharHook</A><BR> | |
184 | <A HREF="#wxwindowoncommand">wxWindow::OnCommand</A><BR> | |
185 | <A HREF="#wxwindowonclose">wxWindow::OnClose</A><BR> | |
186 | <A HREF="#wxwindowonclosewindow">wxWindow::OnCloseWindow</A><BR> | |
187 | <A HREF="#wxwindowondropfiles">wxWindow::OnDropFiles</A><BR> | |
188 | <A HREF="#wxwindowonerasebackground">wxWindow::OnEraseBackground</A><BR> | |
189 | <A HREF="#wxwindowonkeydown">wxWindow::OnKeyDown</A><BR> | |
190 | <A HREF="#wxwindowonkeyup">wxWindow::OnKeyUp</A><BR> | |
191 | <A HREF="#wxwindowonkillfocus">wxWindow::OnKillFocus</A><BR> | |
192 | <A HREF="#wxwindowonidle">wxWindow::OnIdle</A><BR> | |
193 | <A HREF="#wxwindowoninitdialog">wxWindow::OnInitDialog</A><BR> | |
194 | <A HREF="#wxwindowonmenuhighlight">wxWindow::OnMenuHighlight</A><BR> | |
195 | <A HREF="#wxwindowonmouseevent">wxWindow::OnMouseEvent</A><BR> | |
196 | <A HREF="#wxwindowonmove">wxWindow::OnMove</A><BR> | |
197 | <A HREF="#wxwindowonpaint">wxWindow::OnPaint</A><BR> | |
198 | <A HREF="#wxwindowonscroll">wxWindow::OnScroll</A><BR> | |
199 | <A HREF="#wxwindowonsetfocus">wxWindow::OnSetFocus</A><BR> | |
200 | <A HREF="#wxwindowonsize">wxWindow::OnSize</A><BR> | |
201 | <A HREF="#wxwindowonsyscolourchanged">wxWindow::OnSysColourChanged</A><BR> | |
202 | <A HREF="#wxwindowpopeventhandler">wxWindow::PopEventHandler</A><BR> | |
203 | <A HREF="#wxwindowpopupmenu">wxWindow::PopupMenu</A><BR> | |
204 | <A HREF="#wxwindowpusheventhandler">wxWindow::PushEventHandler</A><BR> | |
205 | <A HREF="#wxwindowraise">wxWindow::Raise</A><BR> | |
206 | <A HREF="#wxwindowrefresh">wxWindow::Refresh</A><BR> | |
207 | <A HREF="#wxwindowreleasemouse">wxWindow::ReleaseMouse</A><BR> | |
208 | <A HREF="#wxwindowremovechild">wxWindow::RemoveChild</A><BR> | |
209 | <A HREF="#wxwindowscreentoclient">wxWindow::ScreenToClient</A><BR> | |
210 | <A HREF="#wxwindowscrollwindow">wxWindow::ScrollWindow</A><BR> | |
211 | <A HREF="#wxwindowsetacceleratortable">wxWindow::SetAcceleratorTable</A><BR> | |
212 | <A HREF="#wxwindowsetautolayout">wxWindow::SetAutoLayout</A><BR> | |
213 | <A HREF="#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A><BR> | |
214 | <A HREF="#wxwindowsetclientsize">wxWindow::SetClientSize</A><BR> | |
215 | <A HREF="#wxwindowsetcursor">wxWindow::SetCursor</A><BR> | |
216 | <A HREF="#wxwindowseteventhandler">wxWindow::SetEventHandler</A><BR> | |
217 | <A HREF="#wxwindowsetconstraints">wxWindow::SetConstraints</A><BR> | |
218 | <A HREF="#wxwindowsetdroptarget">wxWindow::SetDropTarget</A><BR> | |
219 | <A HREF="#wxwindowsetfocus">wxWindow::SetFocus</A><BR> | |
220 | <A HREF="#wxwindowsetfont">wxWindow::SetFont</A><BR> | |
221 | <A HREF="#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A><BR> | |
222 | <A HREF="#wxwindowsetid">wxWindow::SetId</A><BR> | |
223 | <A HREF="#wxwindowsetname">wxWindow::SetName</A><BR> | |
224 | <A HREF="#wxwindowsetpalette">wxWindow::SetPalette</A><BR> | |
225 | <A HREF="#wxwindowsetreturncode">wxWindow::SetReturnCode</A><BR> | |
226 | <A HREF="#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><BR> | |
227 | <A HREF="#wxwindowsetscrollpos">wxWindow::SetScrollPos</A><BR> | |
228 | <A HREF="#wxwindowsetsize">wxWindow::SetSize</A><BR> | |
229 | <A HREF="#wxwindowsetsizehints">wxWindow::SetSizeHints</A><BR> | |
230 | <A HREF="#wxwindowsettitle">wxWindow::SetTitle</A><BR> | |
231 | <A HREF="#topic1041">wxWindow::Show</A><BR> | |
232 | <A HREF="#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A><BR> | |
233 | <A HREF="#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A><BR> | |
234 | <A HREF="#wxwindowvalidate">wxWindow::Validate</A><BR> | |
235 | <A HREF="#wxwindowwarppointer">wxWindow::WarpPointer</A><BR> | |
236 | <P> | |
237 | ||
238 | <HR> | |
239 | <A NAME="topic1026"></A> | |
240 | <H3>wxWindow::wxWindow</H3> | |
241 | <P> | |
242 | <B></B> <B>wxWindow</B>()<P> | |
243 | Default constructor.<P> | |
244 | <B></B> <B>wxWindow</B>(<B>wxWindow*</B><I> parent</I>, <B>wxWindowID </B><I>id</I>, | |
245 | <B>const wxPoint& </B><I>pos = wxDefaultPosition</I>, | |
246 | <B>const wxSize& </B><I>size = wxDefaultSize</I>, | |
247 | <B>long </B><I>style = 0</I>, | |
248 | <B>const wxString& </B><I>name = wxPanelNameStr</I>)<P> | |
249 | Constructs a window, which can be a child of a frame, dialog or any other non-control window.<P> | |
250 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
251 | <I>parent</I><UL><UL> | |
252 | Pointer to a parent window.</UL></UL> | |
253 | <P> | |
254 | <I>id</I><UL><UL> | |
255 | Window identifier. If -1, will automatically create an identifier.</UL></UL> | |
256 | <P> | |
257 | <I>pos</I><UL><UL> | |
258 | Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows | |
259 | should generate a default position for the window. If using the wxWindow class directly, supply | |
260 | an actual position.</UL></UL> | |
261 | <P> | |
262 | <I>size</I><UL><UL> | |
263 | Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows | |
264 | should generate a default size for the window.</UL></UL> | |
265 | <P> | |
266 | <I>style</I><UL><UL> | |
267 | Window style. For generic window styles, please see <A HREF="wx260.htm#wxwindow">wxWindow</A>.</UL></UL> | |
268 | <P> | |
269 | <I>name</I><UL><UL> | |
270 | Window name.</UL></UL> | |
271 | <P> | |
272 | ||
273 | <HR> | |
274 | <A NAME="topic1027"></A> | |
275 | <H3>wxWindow::~wxWindow</H3> | |
276 | <P> | |
277 | <B></B> <B>~wxWindow</B>()<P> | |
278 | Destructor. Deletes all subwindows, then deletes itself. Instead of using | |
279 | the <B>delete</B> operator explicitly, you should normally | |
280 | use <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A> so that wxWindows | |
281 | can delete a window only when it is safe to do so, in idle time.<P> | |
282 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
283 | <A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>, | |
284 | <A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A>, | |
285 | <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>, | |
286 | <A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A><P> | |
287 | ||
288 | <HR> | |
289 | <A NAME="topic1028"></A> | |
290 | <H3>wxWindow::AddChild</H3> | |
291 | <P> | |
292 | <B>virtual void</B> <B>AddChild</B>(<B>wxWindow* </B><I>child</I>)<P> | |
293 | Adds a child window. This is called automatically by window creation | |
294 | functions so should not be required by the application programmer.<P> | |
295 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
296 | <I>child</I><UL><UL> | |
297 | Child window to add.</UL></UL> | |
298 | <P> | |
299 | ||
300 | <HR> | |
301 | <A NAME="wxwindowcapturemouse"></A> | |
302 | <H3>wxWindow::CaptureMouse</H3> | |
303 | <P> | |
304 | <B>virtual void</B> <B>CaptureMouse</B>()<P> | |
305 | Directs all mouse input to this window. Call <A HREF="wx260.htm#wxwindowreleasemouse">wxWindow::ReleaseMouse</A> to | |
306 | release the capture.<P> | |
307 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
308 | <A HREF="wx260.htm#wxwindowreleasemouse">wxWindow::ReleaseMouse</A><P> | |
309 | ||
310 | <HR> | |
311 | <A NAME="wxwindowcenter"></A> | |
312 | <H3>wxWindow::Center</H3> | |
313 | <P> | |
314 | <B>void</B> <B>Center</B>(<B>int</B><I> direction</I>)<P> | |
315 | A synonym for <A HREF="wx260.htm#wxwindowcentre">Centre</A>.<P> | |
316 | ||
317 | <HR> | |
318 | <A NAME="wxwindowcentre"></A> | |
319 | <H3>wxWindow::Centre</H3> | |
320 | <P> | |
321 | <B>virtual void</B> <B>Centre</B>(<B>int</B><I> direction = wxHORIZONTAL</I>)<P> | |
322 | Centres the window.<P> | |
323 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
324 | <I>direction</I><UL><UL> | |
325 | Specifies the direction for the centering. May be <TT>wxHORIZONTAL</TT>, <TT>wxVERTICAL</TT> | |
326 | or <TT>wxBOTH</TT>.</UL></UL> | |
327 | <P> | |
328 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
329 | The actual behaviour depends on the derived window. For a frame or dialog box, | |
330 | centring is relative to the whole display. For a panel item, centring is | |
331 | relative to the panel.<P> | |
332 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
333 | <A HREF="wx260.htm#wxwindowcenter">wxWindow::Center</A><P> | |
334 | ||
335 | <HR> | |
336 | <A NAME="wxwindowclear"></A> | |
337 | <H3>wxWindow::Clear</H3> | |
338 | <P> | |
339 | <B>void</B> <B>Clear</B>()<P> | |
340 | Clears the window by filling it with the current background colour. Does not | |
341 | cause an erase background event to be generated.<P> | |
342 | ||
343 | <HR> | |
344 | <A NAME="topic1029"></A> | |
345 | <H3>wxWindow::ClientToScreen</H3> | |
346 | <P> | |
347 | <B>virtual void</B> <B>ClientToScreen</B>(<B>int* </B><I>x</I>, <B>int* </B><I>y</I>) <B>const</B><P> | |
348 | <B>virtual wxPoint</B> <B>ClientToScreen</B>(<B>const wxPoint&</B><I> pt</I>) <B>const</B><P> | |
349 | Converts to screen coordinates from coordinates relative to this window.<P> | |
350 | <I>x</I><UL><UL> | |
351 | A pointer to a integer value for the x coordinate. Pass the client coordinate in, and | |
352 | a screen coordinate will be passed out.</UL></UL> | |
353 | <P> | |
354 | <I>y</I><UL><UL> | |
355 | A pointer to a integer value for the y coordinate. Pass the client coordinate in, and | |
356 | a screen coordinate will be passed out.</UL></UL> | |
357 | <P> | |
358 | <I>pt</I><UL><UL> | |
359 | The client position for the second form of the function.</UL></UL> | |
360 | <P> | |
361 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
362 | In place of a single overloaded method name, wxPython | |
363 | implements the following methods:<P> | |
364 | ||
365 | <UL><UL> | |
366 | ||
367 | <TABLE> | |
368 | ||
369 | ||
370 | <TR><TD VALIGN=TOP> | |
371 | <B>ClientToScreen(point)</B> | |
372 | </TD> | |
373 | ||
374 | <TD VALIGN=TOP> | |
375 | Accepts and returns a wxPoint | |
376 | </TD></TR> | |
377 | ||
378 | ||
379 | <TR><TD VALIGN=TOP> | |
380 | <B>ClientToScreenXY(x, y)</B> | |
381 | </TD> | |
382 | ||
383 | <TD VALIGN=TOP> | |
384 | Returns a 2-tuple, (x, y) | |
385 | </TD></TR> | |
386 | ||
387 | ||
388 | </TABLE> | |
389 | </UL></UL> | |
390 | ||
391 | <P> | |
392 | ||
393 | ||
394 | <HR> | |
395 | <A NAME="wxwindowclose"></A> | |
396 | <H3>wxWindow::Close</H3> | |
397 | <P> | |
398 | <B>virtual bool</B> <B>Close</B>(<B>const bool</B><I> force = FALSE</I>)<P> | |
399 | The purpose of this call is to provide a safer way of destroying a window than using | |
400 | the <I>delete</I> operator.<P> | |
401 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
402 | <I>force</I><UL><UL> | |
403 | FALSE if the window's close handler should be able to veto the destruction | |
404 | of this window, TRUE if it cannot.</UL></UL> | |
405 | <P> | |
406 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
407 | Close calls the <A HREF="wx45.htm#wxcloseevent">close handler</A> for the window, providing an opportunity for the window to | |
408 | choose whether to destroy the window.<P> | |
409 | The close handler should check whether the window is being deleted forcibly, | |
410 | using <A HREF="wx45.htm#wxcloseeventgetforce">wxCloseEvent::GetForce</A>, in which case it should | |
411 | destroy the window using <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>.<P> | |
412 | Applies to managed windows (wxFrame and wxDialog classes) only.<P> | |
413 | <I>Note</I> that calling Close does not guarantee that the window will be destroyed; but it | |
414 | provides a way to simulate a manual close of a window, which may or may not be implemented by | |
415 | destroying the window. The default implementation of wxDialog::OnCloseWindow does not | |
416 | necessarily delete the dialog, since it will simply simulate an wxID_CANCEL event which | |
417 | itself only hides the dialog.<P> | |
418 | To guarantee that the window will be destroyed, call <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A> instead.<P> | |
419 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
420 | <A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>, | |
421 | <A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A>, | |
422 | <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>, | |
423 | <A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A><P> | |
424 | ||
425 | <HR> | |
426 | <A NAME="wxwindowconvertdialogtopixels"></A> | |
427 | <H3>wxWindow::ConvertDialogToPixels</H3> | |
428 | <P> | |
429 | <B>wxPoint</B> <B>ConvertDialogToPixels</B>(<B>const wxPoint&</B><I> pt</I>)<P> | |
430 | <B>wxSize</B> <B>ConvertDialogToPixels</B>(<B>const wxSize&</B><I> sz</I>)<P> | |
431 | Converts a point or size from dialog units to pixels.<P> | |
432 | For the x dimension, the dialog units are multiplied by the average character width | |
433 | and then divided by 4.<P> | |
434 | For the y dimension, the dialog units are multiplied by the average character height | |
435 | and then divided by 8.<P> | |
436 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
437 | Dialog units are used for maintaining a dialog's proportions even if the font changes. | |
438 | Dialogs created using Dialog Editor optionally use dialog units.<P> | |
439 | You can also use these functions programmatically. A convenience macro is defined:<P> | |
440 | <FONT SIZE=2> | |
441 | <PRE> | |
442 | #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) | |
443 | </PRE> | |
444 | </FONT><P> | |
445 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
446 | <A HREF="wx260.htm#wxwindowconvertpixelstodialog">wxWindow::ConvertPixelsToDialog</A><P> | |
447 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
448 | In place of a single overloaded method name, wxPython | |
449 | implements the following methods:<P> | |
450 | ||
451 | <UL><UL> | |
452 | ||
453 | <TABLE> | |
454 | ||
455 | ||
456 | <TR><TD VALIGN=TOP> | |
457 | <B>ConvertDialogPointToPixels(point)</B> | |
458 | </TD> | |
459 | ||
460 | <TD VALIGN=TOP> | |
461 | Accepts and returns a wxPoint | |
462 | </TD></TR> | |
463 | ||
464 | ||
465 | <TR><TD VALIGN=TOP> | |
466 | <B>ConvertDialogSizeToPixels(size)</B> | |
467 | </TD> | |
468 | ||
469 | <TD VALIGN=TOP> | |
470 | Accepts and returns a wxSize | |
471 | </TD></TR> | |
472 | ||
473 | ||
474 | </TABLE> | |
475 | </UL></UL> | |
476 | <P> | |
477 | Additionally, the following helper functions are defined:<P> | |
478 | ||
479 | <UL><UL> | |
480 | ||
481 | <TABLE> | |
482 | ||
483 | ||
484 | <TR><TD VALIGN=TOP> | |
485 | <B>wxDLG_PNT(win, point)</B> | |
486 | </TD> | |
487 | ||
488 | <TD VALIGN=TOP> | |
489 | Converts a wxPoint from dialog | |
490 | units to pixels | |
491 | </TD></TR> | |
492 | ||
493 | ||
494 | <TR><TD VALIGN=TOP> | |
495 | <B>wxDLG_SZE(win, size)</B> | |
496 | </TD> | |
497 | ||
498 | <TD VALIGN=TOP> | |
499 | Converts a wxSize from dialog | |
500 | units to pixels | |
501 | </TD></TR> | |
502 | ||
503 | ||
504 | </TABLE> | |
505 | </UL></UL> | |
506 | ||
507 | <P> | |
508 | ||
509 | ||
510 | <HR> | |
511 | <A NAME="wxwindowconvertpixelstodialog"></A> | |
512 | <H3>wxWindow::ConvertPixelsToDialog</H3> | |
513 | <P> | |
514 | <B>wxPoint</B> <B>ConvertPixelsToDialog</B>(<B>const wxPoint&</B><I> pt</I>)<P> | |
515 | <B>wxSize</B> <B>ConvertPixelsToDialog</B>(<B>const wxSize&</B><I> sz</I>)<P> | |
516 | Converts a point or size from pixels to dialog units.<P> | |
517 | For the x dimension, the pixels are multiplied by 4 and then divided by the average | |
518 | character width.<P> | |
519 | For the y dimension, the pixels are multipled by 8 and then divided by the average | |
520 | character height.<P> | |
521 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
522 | Dialog units are used for maintaining a dialog's proportions even if the font changes. | |
523 | Dialogs created using Dialog Editor optionally use dialog units.<P> | |
524 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
525 | <A HREF="wx260.htm#wxwindowconvertdialogtopixels">wxWindow::ConvertDialogToPixels</A><P> | |
526 | ||
527 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
528 | In place of a single overloaded method name, wxPython | |
529 | implements the following methods:<P> | |
530 | ||
531 | <UL><UL> | |
532 | ||
533 | <TABLE> | |
534 | ||
535 | ||
536 | <TR><TD VALIGN=TOP> | |
537 | <B>ConvertDialogPointToPixels(point)</B> | |
538 | </TD> | |
539 | ||
540 | <TD VALIGN=TOP> | |
541 | Accepts and returns a wxPoint | |
542 | </TD></TR> | |
543 | ||
544 | ||
545 | <TR><TD VALIGN=TOP> | |
546 | <B>ConvertDialogSizeToPixels(size)</B> | |
547 | </TD> | |
548 | ||
549 | <TD VALIGN=TOP> | |
550 | Accepts and returns a wxSize | |
551 | </TD></TR> | |
552 | ||
553 | ||
554 | </TABLE> | |
555 | </UL></UL> | |
556 | ||
557 | <P> | |
558 | ||
559 | <HR> | |
560 | <A NAME="wxwindowdestroy"></A> | |
561 | <H3>wxWindow::Destroy</H3> | |
562 | <P> | |
563 | <B>virtual bool</B> <B>Destroy</B>()<P> | |
564 | Destroys the window safely. Use this function instead of the delete operator, since | |
565 | different window classes can be destroyed differently. Frames and dialogs | |
566 | are not destroyed immediately when this function is called - they are added | |
567 | to a list of windows to be deleted on idle time, when all the window's events | |
568 | have been processed. This prevents problems with events being sent to non-existant | |
569 | windows.<P> | |
570 | <B><FONT COLOR="#FF0000">Return value</FONT></B><P> | |
571 | TRUE if the window has either been successfully deleted, or it has been added | |
572 | to the list of windows pending real deletion.<P> | |
573 | ||
574 | <HR> | |
575 | <A NAME="topic1030"></A> | |
576 | <H3>wxWindow::DestroyChildren</H3> | |
577 | <P> | |
578 | <B>virtual void</B> <B>DestroyChildren</B>()<P> | |
579 | Destroys all children of a window. Called automatically by the destructor.<P> | |
580 | ||
581 | <HR> | |
582 | <A NAME="wxwindowdragacceptfiles"></A> | |
583 | <H3>wxWindow::DragAcceptFiles</H3> | |
584 | <P> | |
585 | <B>virtual void</B> <B>DragAcceptFiles</B>(<B>const bool</B><I> accept</I>)<P> | |
586 | Enables or disables elibility for drop file events (OnDropFiles).<P> | |
587 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
588 | <I>accept</I><UL><UL> | |
589 | If TRUE, the window is eligible for drop file events. If FALSE, the window | |
590 | will not accept drop file events.</UL></UL> | |
591 | <P> | |
592 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
593 | Windows only.<P> | |
594 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
595 | <A HREF="wx260.htm#wxwindowondropfiles">wxWindow::OnDropFiles</A><P> | |
596 | ||
597 | <HR> | |
598 | <A NAME="wxwindowenable"></A> | |
599 | <H3>wxWindow::Enable</H3> | |
600 | <P> | |
601 | <B>virtual void</B> <B>Enable</B>(<B>const bool</B><I> enable</I>)<P> | |
602 | Enable or disable the window for user input.<P> | |
603 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
604 | <I>enable</I><UL><UL> | |
605 | If TRUE, enables the window for input. If FALSE, disables the window.</UL></UL> | |
606 | <P> | |
607 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
608 | <A HREF="wx260.htm#wxwindowisenabled">wxWindow::IsEnabled</A><P> | |
609 | ||
610 | <HR> | |
611 | <A NAME="wxwindowfindfocus"></A> | |
612 | <H3>wxWindow::FindFocus</H3> | |
613 | <P> | |
614 | <B>static wxWindow*</B> <B>FindFocus</B>()<P> | |
615 | Finds the window or control which currently has the keyboard focus.<P> | |
616 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
617 | Note that this is a static function, so it can be called without needing a wxWindow pointer.<P> | |
618 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
619 | <A HREF="wx260.htm#wxwindowsetfocus">wxWindow::SetFocus</A><P> | |
620 | ||
621 | <HR> | |
622 | <A NAME="wxwindowfindwindow"></A> | |
623 | <H3>wxWindow::FindWindow</H3> | |
624 | <P> | |
625 | <B>wxWindow*</B> <B>FindWindow</B>(<B>long</B><I> id</I>)<P> | |
626 | Find a child of this window, by identifier.<P> | |
627 | <B>wxWindow*</B> <B>FindWindow</B>(<B>const wxString&</B><I> name</I>)<P> | |
628 | Find a child of this window, by name.<P> | |
629 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
630 | In place of a single overloaded method name, wxPython | |
631 | implements the following methods:<P> | |
632 | ||
633 | <UL><UL> | |
634 | ||
635 | <TABLE> | |
636 | ||
637 | ||
638 | <TR><TD VALIGN=TOP> | |
639 | <B>FindWindowById(id)</B> | |
640 | </TD> | |
641 | ||
642 | <TD VALIGN=TOP> | |
643 | Accepts an integer | |
644 | </TD></TR> | |
645 | ||
646 | ||
647 | <TR><TD VALIGN=TOP> | |
648 | <B>FindWindowByName(name)</B> | |
649 | </TD> | |
650 | ||
651 | <TD VALIGN=TOP> | |
652 | Accepts a string | |
653 | </TD></TR> | |
654 | ||
655 | ||
656 | </TABLE> | |
657 | </UL></UL> | |
658 | ||
659 | <P> | |
660 | ||
661 | <HR> | |
662 | <A NAME="wxwindowfit"></A> | |
663 | <H3>wxWindow::Fit</H3> | |
664 | <P> | |
665 | <B>virtual void</B> <B>Fit</B>()<P> | |
666 | Sizes the window so that it fits around its subwindows.<P> | |
667 | ||
668 | <HR> | |
669 | <A NAME="wxwindowgetbackgroundcolour"></A> | |
670 | <H3>wxWindow::GetBackgroundColour</H3> | |
671 | <P> | |
672 | <B>virtual wxColour</B> <B>GetBackgroundColour</B>() <B>const</B><P> | |
673 | Returns the background colour of the window.<P> | |
674 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
675 | <A HREF="wx260.htm#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A>, | |
676 | <A HREF="wx260.htm#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A>, | |
677 | <A HREF="wx260.htm#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A>, | |
678 | <A HREF="wx260.htm#wxwindowonerasebackground">wxWindow::OnEraseBackground</A><P> | |
679 | ||
680 | <HR> | |
681 | <A NAME="topic1031"></A> | |
682 | <H3>wxWindow::GetCharHeight</H3> | |
683 | <P> | |
684 | <B>virtual int</B> <B>GetCharHeight</B>() <B>const</B><P> | |
685 | Returns the character height for this window.<P> | |
686 | ||
687 | <HR> | |
688 | <A NAME="topic1032"></A> | |
689 | <H3>wxWindow::GetCharWidth</H3> | |
690 | <P> | |
691 | <B>virtual int</B> <B>GetCharWidth</B>() <B>const</B><P> | |
692 | Returns the average character width for this window.<P> | |
693 | ||
694 | <HR> | |
695 | <A NAME="topic1033"></A> | |
696 | <H3>wxWindow::GetChildren</H3> | |
697 | <P> | |
698 | <B>wxList&</B> <B>GetChildren</B>()<P> | |
699 | Returns a reference to the list of the window's children.<P> | |
700 | ||
701 | <HR> | |
702 | <A NAME="wxwindowgetclientsize"></A> | |
703 | <H3>wxWindow::GetClientSize</H3> | |
704 | <P> | |
705 | <B>virtual void</B> <B>GetClientSize</B>(<B>int* </B><I>width</I>, <B>int* </B><I>height</I>) <B>const</B><P> | |
706 | <B>virtual wxSize</B> <B>GetClientSize</B>() <B>const</B><P> | |
707 | This gets the size of the window 'client area' in pixels. The client area is the | |
708 | area which may be drawn on by the programmer, excluding title bar, border etc.<P> | |
709 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
710 | <I>width</I><UL><UL> | |
711 | Receives the client width in pixels.</UL></UL> | |
712 | <P> | |
713 | <I>height</I><UL><UL> | |
714 | Receives the client height in pixels.</UL></UL> | |
715 | <P> | |
716 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
717 | In place of a single overloaded method name, wxPython | |
718 | implements the following methods:<P> | |
719 | ||
720 | <UL><UL> | |
721 | ||
722 | <TABLE> | |
723 | ||
724 | ||
725 | <TR><TD VALIGN=TOP> | |
726 | <B>wxGetClientSizeTuple()</B> | |
727 | </TD> | |
728 | ||
729 | <TD VALIGN=TOP> | |
730 | Returns a 2-tuple of (width, height) | |
731 | </TD></TR> | |
732 | ||
733 | ||
734 | <TR><TD VALIGN=TOP> | |
735 | <B>wxGetClientSize()</B> | |
736 | </TD> | |
737 | ||
738 | <TD VALIGN=TOP> | |
739 | Returns a wxSize object | |
740 | </TD></TR> | |
741 | ||
742 | ||
743 | </TABLE> | |
744 | </UL></UL> | |
745 | ||
746 | <P> | |
747 | ||
748 | <HR> | |
749 | <A NAME="wxwindowgetconstraints"></A> | |
750 | <H3>wxWindow::GetConstraints</H3> | |
751 | <P> | |
752 | <B>wxLayoutConstraints*</B> <B>GetConstraints</B>() <B>const</B><P> | |
753 | Returns a pointer to the window's layout constraints, or NULL if there are none.<P> | |
754 | ||
755 | <HR> | |
756 | <A NAME="wxwindowgetdefaultitem"></A> | |
757 | <H3>wxWindow::GetDefaultItem</H3> | |
758 | <P> | |
759 | <B>wxButton*</B> <B>GetDefaultItem</B>() <B>const</B><P> | |
760 | Returns a pointer to the button which is the default for this window, or NULL.<P> | |
761 | ||
762 | <HR> | |
763 | <A NAME="wxwindowgetdroptarget"></A> | |
764 | <H3>wxWindow::GetDropTarget</H3> | |
765 | <P> | |
766 | <B>wxDropTarget*</B> <B>GetDropTarget</B>() <B>const</B><P> | |
767 | Returns the associated drop target, which may be NULL.<P> | |
768 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
769 | <A HREF="wx260.htm#wxwindowsetdroptarget">wxWindow::SetDropTarget</A>, | |
770 | <A HREF="wx312.htm#wxdndoverview">Drag and drop overview</A><P> | |
771 | ||
772 | <HR> | |
773 | <A NAME="wxwindowgeteventhandler"></A> | |
774 | <H3>wxWindow::GetEventHandler</H3> | |
775 | <P> | |
776 | <B>wxEvtHandler*</B> <B>GetEventHandler</B>() <B>const</B><P> | |
777 | Returns the event handler for this window. By default, the window is its | |
778 | own event handler.<P> | |
779 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
780 | <A HREF="wx260.htm#wxwindowseteventhandler">wxWindow::SetEventHandler</A>, | |
781 | <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A>, | |
782 | <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PopEventHandler</A>, | |
783 | <A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>, | |
784 | <A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P> | |
785 | ||
786 | <HR> | |
787 | <A NAME="wxwindowgetfont"></A> | |
788 | <H3>wxWindow::GetFont</H3> | |
789 | <P> | |
790 | <B>wxFont&</B> <B>GetFont</B>() <B>const</B><P> | |
791 | Returns a reference to the font for this window.<P> | |
792 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
793 | <A HREF="wx260.htm#wxwindowsetfont">wxWindow::SetFont</A><P> | |
794 | ||
795 | <HR> | |
796 | <A NAME="wxwindowgetforegroundcolour"></A> | |
797 | <H3>wxWindow::GetForegroundColour</H3> | |
798 | <P> | |
799 | <B>virtual wxColour</B> <B>GetForegroundColour</B>()<P> | |
800 | Returns the foreground colour of the window.<P> | |
801 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
802 | The interpretation of foreground colour is open to interpretation according | |
803 | to the window class; it may be the text colour or other colour, or it may not | |
804 | be used at all.<P> | |
805 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
806 | <A HREF="wx260.htm#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A>, | |
807 | <A HREF="wx260.htm#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A>, | |
808 | <A HREF="wx260.htm#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A><P> | |
809 | ||
810 | <HR> | |
811 | <A NAME="topic1034"></A> | |
812 | <H3>wxWindow::GetGrandParent</H3> | |
813 | <P> | |
814 | <B>wxWindow*</B> <B>GetGrandParent</B>() <B>const</B><P> | |
815 | Returns the grandparent of a window, or NULL if there isn't one.<P> | |
816 | ||
817 | <HR> | |
818 | <A NAME="topic1035"></A> | |
819 | <H3>wxWindow::GetHandle</H3> | |
820 | <P> | |
821 | <B>void*</B> <B>GetHandle</B>() <B>const</B><P> | |
822 | Returns the platform-specific handle of the physical window. Cast it to an appropriate | |
823 | handle, such as <B>HWND</B> for Windows or <B>Widget</B> for Motif.<P> | |
824 | ||
825 | <HR> | |
826 | <A NAME="wxwindowgetid"></A> | |
827 | <H3>wxWindow::GetId</H3> | |
828 | <P> | |
829 | <B>int</B> <B>GetId</B>() <B>const</B><P> | |
830 | Returns the identifier of the window.<P> | |
831 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
832 | Each window has an integer identifier. If the application has not provided one, | |
833 | an identifier will be generated.<P> | |
834 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
835 | <A HREF="wx260.htm#wxwindowsetid">wxWindow::SetId</A> | |
836 | <A HREF="wx299.htm#windowids">Window identifiers</A><P> | |
837 | ||
838 | <HR> | |
839 | <A NAME="topic1036"></A> | |
840 | <H3>wxWindow::GetPosition</H3> | |
841 | <P> | |
842 | <B>virtual void</B> <B>GetPosition</B>(<B>int* </B><I>x</I>, <B>int* </B><I>y</I>) <B>const</B><P> | |
843 | This gets the position of the window in pixels, relative to the parent window or | |
844 | if no parent, relative to the whole display.<P> | |
845 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
846 | <I>x</I><UL><UL> | |
847 | Receives the x position of the window.</UL></UL> | |
848 | <P> | |
849 | <I>y</I><UL><UL> | |
850 | Receives the y position of the window.</UL></UL> | |
851 | <P> | |
852 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
853 | In place of a single overloaded method name, wxPython | |
854 | implements the following methods:<P> | |
855 | ||
856 | <UL><UL> | |
857 | ||
858 | <TABLE> | |
859 | ||
860 | ||
861 | <TR><TD VALIGN=TOP> | |
862 | <B>GetPosition()</B> | |
863 | </TD> | |
864 | ||
865 | <TD VALIGN=TOP> | |
866 | Returns a wxPoint | |
867 | </TD></TR> | |
868 | ||
869 | ||
870 | <TR><TD VALIGN=TOP> | |
871 | <B>GetPositionTuple()</B> | |
872 | </TD> | |
873 | ||
874 | <TD VALIGN=TOP> | |
875 | Returns a tuple (x, y) | |
876 | </TD></TR> | |
877 | ||
878 | ||
879 | </TABLE> | |
880 | </UL></UL> | |
881 | ||
882 | <P> | |
883 | ||
884 | <HR> | |
885 | <A NAME="topic1037"></A> | |
886 | <H3>wxWindow::GetLabel</H3> | |
887 | <P> | |
888 | <B>virtual wxString& </B> <B>GetLabel</B>() <B>const</B><P> | |
889 | Generic way of getting a label from any window, for | |
890 | identification purposes.<P> | |
891 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
892 | The interpretation of this function differs from class to class. | |
893 | For frames and dialogs, the value returned is the title. For buttons or static text controls, it is | |
894 | the button text. This function can be useful for meta-programs (such as testing | |
895 | tools or special-needs access programs) which need to identify windows | |
896 | by name.<P> | |
897 | ||
898 | <HR> | |
899 | <A NAME="wxwindowgetname"></A> | |
900 | <H3>wxWindow::GetName</H3> | |
901 | <P> | |
902 | <B>virtual wxString& </B> <B>GetName</B>() <B>const</B><P> | |
903 | Returns the window's name.<P> | |
904 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
905 | This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate | |
906 | name in the window constructor or via <A HREF="wx260.htm#wxwindowsetname">wxWindow::SetName</A>.<P> | |
907 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
908 | <A HREF="wx260.htm#wxwindowsetname">wxWindow::SetName</A><P> | |
909 | ||
910 | <HR> | |
911 | <A NAME="topic1038"></A> | |
912 | <H3>wxWindow::GetParent</H3> | |
913 | <P> | |
914 | <B>virtual wxWindow*</B> <B>GetParent</B>() <B>const</B><P> | |
915 | Returns the parent of the window, or NULL if there is no parent.<P> | |
916 | ||
917 | <HR> | |
918 | <A NAME="wxwindowgetrect"></A> | |
919 | <H3>wxWindow::GetRect</H3> | |
920 | <P> | |
921 | <B>virtual wxRect</B> <B>GetRect</B>() <B>const</B><P> | |
922 | Returns the size and position of the window as a <A HREF="wx193.htm#wxrect">wxRect</A> object.<P> | |
923 | ||
924 | <HR> | |
925 | <A NAME="wxwindowgetreturncode"></A> | |
926 | <H3>wxWindow::GetReturnCode</H3> | |
927 | <P> | |
928 | <B>int</B> <B>GetReturnCode</B>()<P> | |
929 | Gets the return code for this window.<P> | |
930 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
931 | A return code is normally associated with a modal dialog, where <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A> returns | |
932 | a code to the application.<P> | |
933 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
934 | <A HREF="wx260.htm#wxwindowsetreturncode">wxWindow::SetReturnCode</A>, <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A>, | |
935 | <A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A><P> | |
936 | ||
937 | <HR> | |
938 | <A NAME="wxwindowgetscrollthumb"></A> | |
939 | <H3>wxWindow::GetScrollThumb</H3> | |
940 | <P> | |
941 | <B>virtual int</B> <B>GetScrollThumb</B>(<B>int </B><I>orientation</I>)<P> | |
942 | Returns the built-in scrollbar thumb size.<P> | |
943 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
944 | <A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><P> | |
945 | ||
946 | <HR> | |
947 | <A NAME="wxwindowgetscrollpos"></A> | |
948 | <H3>wxWindow::GetScrollPos</H3> | |
949 | <P> | |
950 | <B>virtual int</B> <B>GetScrollPos</B>(<B>int </B><I>orientation</I>)<P> | |
951 | Returns the built-in scrollbar position.<P> | |
952 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
953 | See <A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><P> | |
954 | ||
955 | <HR> | |
956 | <A NAME="wxwindowgetscrollrange"></A> | |
957 | <H3>wxWindow::GetScrollRange</H3> | |
958 | <P> | |
959 | <B>virtual int</B> <B>GetScrollRange</B>(<B>int </B><I>orientation</I>)<P> | |
960 | Returns the built-in scrollbar range.<P> | |
961 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
962 | <A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><P> | |
963 | ||
964 | <HR> | |
965 | <A NAME="wxwindowgetsize"></A> | |
966 | <H3>wxWindow::GetSize</H3> | |
967 | <P> | |
968 | <B>virtual void</B> <B>GetSize</B>(<B>int* </B><I>width</I>, <B>int* </B><I>height</I>) <B>const</B><P> | |
969 | <B>virtual wxSize</B> <B>GetSize</B>() <B>const</B><P> | |
970 | This gets the size of the entire window in pixels.<P> | |
971 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
972 | <I>width</I><UL><UL> | |
973 | Receives the window width.</UL></UL> | |
974 | <P> | |
975 | <I>height</I><UL><UL> | |
976 | Receives the window height.</UL></UL> | |
977 | <P> | |
978 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
979 | In place of a single overloaded method name, wxPython | |
980 | implements the following methods:<P> | |
981 | ||
982 | <UL><UL> | |
983 | ||
984 | <TABLE> | |
985 | ||
986 | ||
987 | <TR><TD VALIGN=TOP> | |
988 | <B>GetSize()</B> | |
989 | </TD> | |
990 | ||
991 | <TD VALIGN=TOP> | |
992 | Returns a wxSize | |
993 | </TD></TR> | |
994 | ||
995 | ||
996 | <TR><TD VALIGN=TOP> | |
997 | <B>GetSizeTuple()</B> | |
998 | </TD> | |
999 | ||
1000 | <TD VALIGN=TOP> | |
1001 | Returns a 2-tuple (width, height) | |
1002 | </TD></TR> | |
1003 | ||
1004 | ||
1005 | </TABLE> | |
1006 | </UL></UL> | |
1007 | ||
1008 | <P> | |
1009 | ||
1010 | <HR> | |
1011 | <A NAME="topic1039"></A> | |
1012 | <H3>wxWindow::GetTextExtent</H3> | |
1013 | <P> | |
1014 | <B>virtual void</B> <B>GetTextExtent</B>(<B>const wxString& </B><I>string</I>, <B>int* </B><I>x</I>, <B>int* </B><I>y</I>, | |
1015 | <B>int* </B><I>descent = NULL</I>, <B>int* </B><I>externalLeading = NULL</I>, | |
1016 | <B>const wxFont* </B><I>font = NULL</I>, <B>const bool</B><I> use16 = FALSE</I>) <B>const</B><P> | |
1017 | Gets the dimensions of the string as it would be drawn on the | |
1018 | window with the currently selected font.<P> | |
1019 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1020 | <I>string</I><UL><UL> | |
1021 | String whose extent is to be measured.</UL></UL> | |
1022 | <P> | |
1023 | <I>x</I><UL><UL> | |
1024 | Return value for width.</UL></UL> | |
1025 | <P> | |
1026 | <I>y</I><UL><UL> | |
1027 | Return value for height.</UL></UL> | |
1028 | <P> | |
1029 | <I>descent</I><UL><UL> | |
1030 | Return value for descent (optional).</UL></UL> | |
1031 | <P> | |
1032 | <I>externalLeading</I><UL><UL> | |
1033 | Return value for external leading (optional).</UL></UL> | |
1034 | <P> | |
1035 | <I>font</I><UL><UL> | |
1036 | Font to use instead of the current window font (optional).</UL></UL> | |
1037 | <P> | |
1038 | <I>use16</I><UL><UL> | |
1039 | If TRUE, <I>string</I> contains 16-bit characters. The default is FALSE.</UL></UL> | |
1040 | <P> | |
1041 | ||
1042 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
1043 | In place of a single overloaded method name, wxPython | |
1044 | implements the following methods:<P> | |
1045 | ||
1046 | <UL><UL> | |
1047 | ||
1048 | <TABLE> | |
1049 | ||
1050 | ||
1051 | <TR><TD VALIGN=TOP> | |
1052 | <B>GetTextExtent(string)</B> | |
1053 | </TD> | |
1054 | ||
1055 | <TD VALIGN=TOP> | |
1056 | Returns a 2-tuple, (width, height) | |
1057 | </TD></TR> | |
1058 | ||
1059 | ||
1060 | <TR><TD VALIGN=TOP> | |
1061 | <B>GetFullTextExtent(string, font=NULL)</B> | |
1062 | </TD> | |
1063 | ||
1064 | <TD VALIGN=TOP> | |
1065 | Returns a | |
1066 | 4-tuple, (width, height, descent, externalLeading) | |
1067 | </TD></TR> | |
1068 | ||
1069 | ||
1070 | </TABLE> | |
1071 | </UL></UL> | |
1072 | ||
1073 | <P> | |
1074 | ||
1075 | ||
1076 | <HR> | |
1077 | <A NAME="wxwindowgettitle"></A> | |
1078 | <H3>wxWindow::GetTitle</H3> | |
1079 | <P> | |
1080 | <B>virtual wxString</B> <B>GetTitle</B>()<P> | |
1081 | Gets the window's title. Applicable only to frames and dialogs.<P> | |
1082 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1083 | <A HREF="wx260.htm#wxwindowsettitle">wxWindow::SetTitle</A><P> | |
1084 | ||
1085 | <HR> | |
1086 | <A NAME="wxwindowgetupdateregion"></A> | |
1087 | <H3>wxWindow::GetUpdateRegion</H3> | |
1088 | <P> | |
1089 | <B>virtual wxRegion</B> <B>GetUpdateRegion</B>() <B>const</B><P> | |
1090 | Returns the region specifying which parts of the window have been damaged. Should | |
1091 | only be called within an <A HREF="wx260.htm#wxwindowonpaint">OnPaint</A> event handler.<P> | |
1092 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1093 | <A HREF="wx195.htm#wxregion">wxRegion</A>, <A HREF="wx196.htm#wxregioniterator">wxRegionIterator</A>, <A HREF="wx260.htm#wxwindowonpaint">wxWindow::OnPaint</A><P> | |
1094 | ||
1095 | <HR> | |
1096 | <A NAME="topic1040"></A> | |
1097 | <H3>wxWindow::GetWindowStyleFlag</H3> | |
1098 | <P> | |
1099 | <B>long</B> <B>GetWindowStyleFlag</B>() <B>const</B><P> | |
1100 | Gets the window style that was passed to the consructor or <B>Create</B> member.<P> | |
1101 | ||
1102 | <HR> | |
1103 | <A NAME="wxwindowinitdialog"></A> | |
1104 | <H3>wxWindow::InitDialog</H3> | |
1105 | <P> | |
1106 | <B>void</B> <B>InitDialog</B>()<P> | |
1107 | Sends an <A HREF="wx260.htm#wxwindowoninitdialog">wxWindow::OnInitDialog</A> event, which | |
1108 | in turn transfers data to the dialog via validators.<P> | |
1109 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1110 | <A HREF="wx260.htm#wxwindowoninitdialog">wxWindow::OnInitDialog</A><P> | |
1111 | ||
1112 | <HR> | |
1113 | <A NAME="wxwindowisenabled"></A> | |
1114 | <H3>wxWindow::IsEnabled</H3> | |
1115 | <P> | |
1116 | <B>virtual bool</B> <B>IsEnabled</B>() <B>const</B><P> | |
1117 | Returns TRUE if the window is enabled for input, FALSE otherwise.<P> | |
1118 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1119 | <A HREF="wx260.htm#wxwindowenable">wxWindow::Enable</A><P> | |
1120 | ||
1121 | <HR> | |
1122 | <A NAME="wxwindowisretained"></A> | |
1123 | <H3>wxWindow::IsRetained</H3> | |
1124 | <P> | |
1125 | <B>virtual bool</B> <B>IsRetained</B>() <B>const</B><P> | |
1126 | Returns TRUE if the window is retained, FALSE otherwise.<P> | |
1127 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1128 | Retained windows are only available on X platforms.<P> | |
1129 | ||
1130 | <HR> | |
1131 | <A NAME="wxwindowisshown"></A> | |
1132 | <H3>wxWindow::IsShown</H3> | |
1133 | <P> | |
1134 | <B>virtual bool</B> <B>IsShown</B>() <B>const</B><P> | |
1135 | Returns TRUE if the window is shown, FALSE if it has been hidden.<P> | |
1136 | ||
1137 | <HR> | |
1138 | <A NAME="wxwindowlayout"></A> | |
1139 | <H3>wxWindow::Layout</H3> | |
1140 | <P> | |
1141 | <B>void</B> <B>Layout</B>()<P> | |
1142 | Invokes the constraint-based layout algorithm for this window. It is called | |
1143 | automatically by the default <B>wxWindow::OnSize</B> member.<P> | |
1144 | ||
1145 | <HR> | |
1146 | <A NAME="wxwindowloadfromresource"></A> | |
1147 | <H3>wxWindow::LoadFromResource</H3> | |
1148 | <P> | |
1149 | <B>virtual bool</B> <B>LoadFromResource</B>(<B>wxWindow* </B><I>parent</I>, | |
1150 | <B>const wxString& </B><I>resourceName</I>, <B>const wxResourceTable* </B><I>resourceTable = NULL</I>)<P> | |
1151 | Loads a panel or dialog from a resource file.<P> | |
1152 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1153 | <I>parent</I><UL><UL> | |
1154 | Parent window.</UL></UL> | |
1155 | <P> | |
1156 | <I>resourceName</I><UL><UL> | |
1157 | The name of the resource to load.</UL></UL> | |
1158 | <P> | |
1159 | <I>resourceTable</I><UL><UL> | |
1160 | The resource table to load it from. If this is NULL, the | |
1161 | default resource table will be used.</UL></UL> | |
1162 | <P> | |
1163 | <B><FONT COLOR="#FF0000">Return value</FONT></B><P> | |
1164 | TRUE if the operation succeeded, otherwise FALSE.<P> | |
1165 | ||
1166 | <HR> | |
1167 | <A NAME="wxwindowlower"></A> | |
1168 | <H3>wxWindow::Lower</H3> | |
1169 | <P> | |
1170 | <B>void</B> <B>Lower</B>()<P> | |
1171 | Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog | |
1172 | or frame).<P> | |
1173 | ||
1174 | <HR> | |
1175 | <A NAME="wxwindowmakemodal"></A> | |
1176 | <H3>wxWindow::MakeModal</H3> | |
1177 | <P> | |
1178 | <B>virtual void</B> <B>MakeModal</B>(<B>const bool </B><I>flag</I>)<P> | |
1179 | Disables all other windows in the application so that | |
1180 | the user can only interact with this window.<P> | |
1181 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1182 | <I>flag</I><UL><UL> | |
1183 | If TRUE, this call disables all other windows in the application so that | |
1184 | the user can only interact with this window. If FALSE, the effect is reversed.</UL></UL> | |
1185 | <P> | |
1186 | ||
1187 | <HR> | |
1188 | <A NAME="wxwindowmove"></A> | |
1189 | <H3>wxWindow::Move</H3> | |
1190 | <P> | |
1191 | <B>void</B> <B>Move</B>(<B>int</B><I> x</I>, <B>int</B><I> y</I>)<P> | |
1192 | <B>void</B> <B>Move</B>(<B>const wxPoint&</B><I> pt</I>)<P> | |
1193 | Moves the window to the given position.<P> | |
1194 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1195 | <I>x</I><UL><UL> | |
1196 | Required x position.</UL></UL> | |
1197 | <P> | |
1198 | <I>y</I><UL><UL> | |
1199 | Required y position.</UL></UL> | |
1200 | <P> | |
1201 | <I>pt</I><UL><UL> | |
1202 | <A HREF="wx171.htm#wxpoint">wxPoint</A> object representing the position.</UL></UL> | |
1203 | <P> | |
1204 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1205 | Implementations of SetSize can also implicitly implement the | |
1206 | wxWindow::Move function, which is defined in the base wxWindow class | |
1207 | as the call:<P> | |
1208 | <PRE> | |
1209 | SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); | |
1210 | </PRE> | |
1211 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1212 | <A HREF="wx260.htm#wxwindowsetsize">wxWindow::SetSize</A><P> | |
1213 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
1214 | In place of a single overloaded method name, wxPython | |
1215 | implements the following methods:<P> | |
1216 | ||
1217 | <UL><UL> | |
1218 | ||
1219 | <TABLE> | |
1220 | ||
1221 | ||
1222 | <TR><TD VALIGN=TOP> | |
1223 | <B>Move(point)</B> | |
1224 | </TD> | |
1225 | ||
1226 | <TD VALIGN=TOP> | |
1227 | Accepts a wxPoint | |
1228 | </TD></TR> | |
1229 | ||
1230 | ||
1231 | <TR><TD VALIGN=TOP> | |
1232 | <B>MoveXY(x, y)</B> | |
1233 | </TD> | |
1234 | ||
1235 | <TD VALIGN=TOP> | |
1236 | Accepts a pair of integers | |
1237 | </TD></TR> | |
1238 | ||
1239 | ||
1240 | </TABLE> | |
1241 | </UL></UL> | |
1242 | ||
1243 | <P> | |
1244 | ||
1245 | <HR> | |
1246 | <A NAME="wxwindowonactivate"></A> | |
1247 | <H3>wxWindow::OnActivate</H3> | |
1248 | <P> | |
1249 | <B>void</B> <B>OnActivate</B>(<B>wxActivateEvent&</B><I> event</I>)<P> | |
1250 | Called when a window is activated or deactivated.<P> | |
1251 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1252 | <I>event</I><UL><UL> | |
1253 | Object containing activation information.</UL></UL> | |
1254 | <P> | |
1255 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1256 | If the window is being activated, <A HREF="wx25.htm#wxactivateeventgetactive">wxActivateEvent::GetActive</A> returns TRUE, | |
1257 | otherwise it returns FALSE (it is being deactivated).<P> | |
1258 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1259 | <A HREF="wx25.htm#wxactivateevent">wxActivateEvent</A>, | |
1260 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1261 | ||
1262 | <HR> | |
1263 | <A NAME="wxwindowonchar"></A> | |
1264 | <H3>wxWindow::OnChar</H3> | |
1265 | <P> | |
1266 | <B>void</B> <B>OnChar</B>(<B>wxKeyEvent&</B><I> event</I>)<P> | |
1267 | Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).<P> | |
1268 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1269 | <I>event</I><UL><UL> | |
1270 | Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for | |
1271 | details about this class.</UL></UL> | |
1272 | <P> | |
1273 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1274 | This member function is called in response to a keypress. To intercept this event, | |
1275 | use the EVT_CHAR macro in an event table definition. Your <B>OnChar</B> handler may call this | |
1276 | default function to achieve default keypress functionality.<P> | |
1277 | Note that the ASCII values do not have explicit key codes: they are passed as ASCII | |
1278 | values.<P> | |
1279 | Note that not all keypresses can be intercepted this way. If you wish to intercept modifier | |
1280 | keypresses, then you will need to use <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A> or | |
1281 | <A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>.<P> | |
1282 | Most, but not all, windows allow keypresses to be intercepted.<P> | |
1283 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1284 | <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A>, <A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>, | |
1285 | <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>, | |
1286 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1287 | ||
1288 | <HR> | |
1289 | <A NAME="wxwindowoncharhook"></A> | |
1290 | <H3>wxWindow::OnCharHook</H3> | |
1291 | <P> | |
1292 | <B>void</B> <B>OnCharHook</B>(<B>wxKeyEvent&</B><I> event</I>)<P> | |
1293 | This member is called to allow the window to intercept keyboard events | |
1294 | before they are processed by child windows.<P> | |
1295 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1296 | <I>event</I><UL><UL> | |
1297 | Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for | |
1298 | details about this class.</UL></UL> | |
1299 | <P> | |
1300 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1301 | This member function is called in response to a keypress, if the window is active. To intercept this event, | |
1302 | use the EVT_CHAR_HOOK macro in an event table definition. If you do not process a particular | |
1303 | keypress, call <A HREF="wx84.htm#wxeventskip">wxEvent::Skip</A> to allow default processing.<P> | |
1304 | An example of using this function is in the implementation of escape-character processing for wxDialog, | |
1305 | where pressing ESC dismisses the dialog by <B>OnCharHook</B> 'forging' a cancel button press event.<P> | |
1306 | Note that the ASCII values do not have explicit key codes: they are passed as ASCII | |
1307 | values.<P> | |
1308 | This function is only relevant to top-level windows (frames and dialogs), and under | |
1309 | Windows only.<P> | |
1310 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1311 | <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>, | |
1312 | <A HREF="wx26.htm#wxapponcharhook">wxApp::OnCharHook</A>, | |
1313 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1314 | ||
1315 | <HR> | |
1316 | <A NAME="wxwindowoncommand"></A> | |
1317 | <H3>wxWindow::OnCommand</H3> | |
1318 | <P> | |
1319 | <B>virtual void</B> <B>OnCommand</B>(<B>wxEvtHandler& </B><I>object</I>, <B>wxCommandEvent& </B><I>event</I>)<P> | |
1320 | This virtual member function is called if the control does not handle the command event.<P> | |
1321 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1322 | <I>object</I><UL><UL> | |
1323 | Object receiving the command event.</UL></UL> | |
1324 | <P> | |
1325 | <I>event</I><UL><UL> | |
1326 | Command event</UL></UL> | |
1327 | <P> | |
1328 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1329 | This virtual function is provided mainly for backward compatibility. You can also intercept commands | |
1330 | from child controls by using an event table, with identifiers or identifier ranges to identify | |
1331 | the control(s) in question.<P> | |
1332 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1333 | <A HREF="wx52.htm#wxcommandevent">wxCommandEvent</A>, | |
1334 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1335 | ||
1336 | <HR> | |
1337 | <A NAME="wxwindowonclose"></A> | |
1338 | <H3>wxWindow::OnClose</H3> | |
1339 | <P> | |
1340 | <B>virtual bool</B> <B>OnClose</B>()<P> | |
1341 | Called when the user has tried to close a a frame | |
1342 | or dialog box using the window manager (X) or system menu (Windows).<P> | |
1343 | <B>Note:</B> This is an obsolete function. | |
1344 | It is superceded by the <A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A> event | |
1345 | handler.<P> | |
1346 | <B><FONT COLOR="#FF0000">Return value</FONT></B><P> | |
1347 | If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the | |
1348 | attempt will be ignored. Do not delete the window from within this handler, although | |
1349 | you may delete other windows.<P> | |
1350 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1351 | <A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>, | |
1352 | <A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A>, | |
1353 | <A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A>, | |
1354 | <A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A><P> | |
1355 | ||
1356 | <HR> | |
1357 | <A NAME="wxwindowonclosewindow"></A> | |
1358 | <H3>wxWindow::OnCloseWindow</H3> | |
1359 | <P> | |
1360 | <B>void</B> <B>OnCloseWindow</B>(<B>wxCloseEvent& </B><I>event</I>)<P> | |
1361 | This is an event handler function called when the user has tried to close a a frame | |
1362 | or dialog box using the window manager (X) or system menu (Windows). It is | |
1363 | called via the <A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A> function, so | |
1364 | that the application can also invoke the handler programmatically.<P> | |
1365 | Use the EVT_CLOSE event table macro to handle close events.<P> | |
1366 | You should check whether the application is forcing the deletion of the window | |
1367 | using <A HREF="wx45.htm#wxcloseeventgetforce">wxCloseEvent::GetForce</A>. If this is TRUE, | |
1368 | destroy the window using <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>. | |
1369 | If not, it is up to you whether you respond by destroying the window.<P> | |
1370 | (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of | |
1371 | the window is required, test for the negative of CanVeto. If CanVeto returns FALSE, | |
1372 | it is not possible to skip window deletion.)<P> | |
1373 | If you don't destroy the window, you should call <A HREF="wx45.htm#wxcloseeventveto">wxCloseEvent::Veto</A> to | |
1374 | let the calling code know that you did not destroy the window. This allows the <A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A> function | |
1375 | to return TRUE or FALSE depending on whether the close instruction was honoured or not.<P> | |
1376 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1377 | The <A HREF="wx260.htm#wxwindowonclose">wxWindow::OnClose</A> virtual function remains | |
1378 | for backward compatibility with earlier versions of wxWindows. The | |
1379 | default <B>OnCloseWindow</B> handler for wxFrame and wxDialog will call <B>OnClose</B>, | |
1380 | destroying the window if it returns TRUE or if the close is being forced.<P> | |
1381 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1382 | <A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>, | |
1383 | <A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A>, | |
1384 | <A HREF="wx260.htm#wxwindowonclose">wxWindow::OnClose</A>, | |
1385 | <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>, | |
1386 | <A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A>, | |
1387 | <A HREF="wx26.htm#wxapponqueryendsession">wxApp::OnQueryEndSession</A>, | |
1388 | <A HREF="wx26.htm#wxapponendsession">wxApp::OnEndSession</A><P> | |
1389 | ||
1390 | <HR> | |
1391 | <A NAME="wxwindowondropfiles"></A> | |
1392 | <H3>wxWindow::OnDropFiles</H3> | |
1393 | <P> | |
1394 | <B>void</B> <B>OnDropFiles</B>(<B>wxDropFilesEvent&</B><I> event</I>)<P> | |
1395 | Called when files have been dragged from the file manager to the window.<P> | |
1396 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1397 | <I>event</I><UL><UL> | |
1398 | Drop files event. For more information, see <A HREF="wx80.htm#wxdropfilesevent">wxDropFilesEvent</A>.</UL></UL> | |
1399 | <P> | |
1400 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1401 | The window must have previously been enabled for dropping by calling | |
1402 | <A HREF="wx260.htm#wxwindowdragacceptfiles">wxWindow::DragAcceptFiles</A>.<P> | |
1403 | This event is only generated under Windows.<P> | |
1404 | To intercept this event, use the EVT_DROP_FILES macro in an event table definition.<P> | |
1405 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1406 | <A HREF="wx80.htm#wxdropfilesevent">wxDropFilesEvent</A>, <A HREF="wx260.htm#wxwindowdragacceptfiles">wxWindow::DragAcceptFiles</A>, | |
1407 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1408 | ||
1409 | <HR> | |
1410 | <A NAME="wxwindowonerasebackground"></A> | |
1411 | <H3>wxWindow::OnEraseBackground</H3> | |
1412 | <P> | |
1413 | <B>void</B> <B>OnEraseBackground</B>(<B>wxEraseEvent&</B><I> event</I>)<P> | |
1414 | Called when the background of the window needs to be erased.<P> | |
1415 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1416 | <I>event</I><UL><UL> | |
1417 | Erase background event. For more information, see <A HREF="wx83.htm#wxeraseevent">wxEraseEvent</A>.</UL></UL> | |
1418 | <P> | |
1419 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1420 | This event is only generated under Windows.<P> | |
1421 | To intercept this event, use the EVT_ERASE_BACKGROUND macro in an event table definition.<P> | |
1422 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1423 | <A HREF="wx83.htm#wxeraseevent">wxEraseEvent</A>, <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1424 | ||
1425 | <HR> | |
1426 | <A NAME="wxwindowonkeydown"></A> | |
1427 | <H3>wxWindow::OnKeyDown</H3> | |
1428 | <P> | |
1429 | <B>void</B> <B>OnKeyDown</B>(<B>wxKeyEvent&</B><I> event</I>)<P> | |
1430 | Called when the user has pressed a key, before it is translated into an ASCII value using other | |
1431 | modifier keys that might be pressed at the same time.<P> | |
1432 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1433 | <I>event</I><UL><UL> | |
1434 | Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for | |
1435 | details about this class.</UL></UL> | |
1436 | <P> | |
1437 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1438 | This member function is called in response to a key down event. To intercept this event, | |
1439 | use the EVT_KEY_DOWN macro in an event table definition. Your <B>OnKeyDown</B> handler may call this | |
1440 | default function to achieve default keypress functionality.<P> | |
1441 | Note that not all keypresses can be intercepted this way. If you wish to intercept special | |
1442 | keys, such as shift, control, and function keys, then you will need to use <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A> or | |
1443 | <A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>.<P> | |
1444 | Most, but not all, windows allow keypresses to be intercepted.<P> | |
1445 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1446 | <A HREF="wx260.htm#wxwindowonchar">wxWindow::OnChar</A>, <A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>, | |
1447 | <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>, | |
1448 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1449 | ||
1450 | <HR> | |
1451 | <A NAME="wxwindowonkeyup"></A> | |
1452 | <H3>wxWindow::OnKeyUp</H3> | |
1453 | <P> | |
1454 | <B>void</B> <B>OnKeyUp</B>(<B>wxKeyEvent&</B><I> event</I>)<P> | |
1455 | Called when the user has released a key.<P> | |
1456 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1457 | <I>event</I><UL><UL> | |
1458 | Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for | |
1459 | details about this class.</UL></UL> | |
1460 | <P> | |
1461 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1462 | This member function is called in response to a key up event. To intercept this event, | |
1463 | use the EVT_KEY_UP macro in an event table definition. Your <B>OnKeyUp</B> handler may call this | |
1464 | default function to achieve default keypress functionality.<P> | |
1465 | Note that not all keypresses can be intercepted this way. If you wish to intercept special | |
1466 | keys, such as shift, control, and function keys, then you will need to use <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A> or | |
1467 | <A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>.<P> | |
1468 | Most, but not all, windows allow key up events to be intercepted.<P> | |
1469 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1470 | <A HREF="wx260.htm#wxwindowonchar">wxWindow::OnChar</A>, <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A>, | |
1471 | <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>, | |
1472 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1473 | ||
1474 | <HR> | |
1475 | <A NAME="wxwindowonkillfocus"></A> | |
1476 | <H3>wxWindow::OnKillFocus</H3> | |
1477 | <P> | |
1478 | <B>void</B> <B>OnKillFocus</B>(<B>wxFocusEvent& </B><I>event</I>)<P> | |
1479 | Called when a window's focus is being killed.<P> | |
1480 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1481 | <I>event</I><UL><UL> | |
1482 | The focus event. For more information, see <A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>.</UL></UL> | |
1483 | <P> | |
1484 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1485 | To intercept this event, use the macro EVT_KILL_FOCUS in an event table definition.<P> | |
1486 | Most, but not all, windows respond to this event.<P> | |
1487 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1488 | <A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>, <A HREF="wx260.htm#wxwindowonsetfocus">wxWindow::OnSetFocus</A>, | |
1489 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1490 | ||
1491 | <HR> | |
1492 | <A NAME="wxwindowonidle"></A> | |
1493 | <H3>wxWindow::OnIdle</H3> | |
1494 | <P> | |
1495 | <B>void</B> <B>OnIdle</B>(<B>wxIdleEvent& </B><I>event</I>)<P> | |
1496 | Provide this member function for any processing which needs to be done | |
1497 | when the application is idle.<P> | |
1498 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1499 | <A HREF="wx26.htm#wxapponidle">wxApp::OnIdle</A>, <A HREF="wx113.htm#wxidleevent">wxIdleEvent</A><P> | |
1500 | ||
1501 | <HR> | |
1502 | <A NAME="wxwindowoninitdialog"></A> | |
1503 | <H3>wxWindow::OnInitDialog</H3> | |
1504 | <P> | |
1505 | <B>void</B> <B>OnInitDialog</B>(<B>wxInitDialogEvent&</B><I> event</I>)<P> | |
1506 | Default handler for the wxEVT_INIT_DIALOG event. Calls <A HREF="wx260.htm#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A>.<P> | |
1507 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1508 | <I>event</I><UL><UL> | |
1509 | Dialog initialisation event.</UL></UL> | |
1510 | <P> | |
1511 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1512 | Gives the window the default behaviour of transferring data to child controls via | |
1513 | the validator that each control has.<P> | |
1514 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1515 | <A HREF="wx255.htm#wxvalidator">wxValidator</A>, <A HREF="wx260.htm#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A><P> | |
1516 | ||
1517 | <HR> | |
1518 | <A NAME="wxwindowonmenuhighlight"></A> | |
1519 | <H3>wxWindow::OnMenuHighlight</H3> | |
1520 | <P> | |
1521 | <B>void</B> <B>OnMenuHighlight</B>(<B>wxMenuEvent& </B><I>event</I>)<P> | |
1522 | Called when a menu select is received from a menu bar: that is, the | |
1523 | mouse cursor is over a menu item, but the left mouse button has not been | |
1524 | pressed.<P> | |
1525 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1526 | <I>event</I><UL><UL> | |
1527 | The menu highlight event. For more information, see <A HREF="wx143.htm#wxmenuevent">wxMenuEvent</A>.</UL></UL> | |
1528 | <P> | |
1529 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1530 | You can choose any member function to receive | |
1531 | menu select events, using the EVT_MENU_HIGHLIGHT macro for individual menu items or EVT_MENU_HIGHLIGHT_ALL macro | |
1532 | for all menu items.<P> | |
1533 | The default implementation for <A HREF="wx104.htm#wxframeonmenuhighlight">wxFrame::OnMenuHighlight</A> displays help | |
1534 | text in the first field of the status bar.<P> | |
1535 | This function was known as <B>OnMenuSelect</B> in earlier versions of wxWindows, but this was confusing | |
1536 | since a selection is normally a left-click action.<P> | |
1537 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1538 | <A HREF="wx143.htm#wxmenuevent">wxMenuEvent</A>, | |
1539 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1540 | ||
1541 | ||
1542 | <HR> | |
1543 | <A NAME="wxwindowonmouseevent"></A> | |
1544 | <H3>wxWindow::OnMouseEvent</H3> | |
1545 | <P> | |
1546 | <B>void</B> <B>OnMouseEvent</B>(<B>wxMouseEvent&</B><I> event</I>)<P> | |
1547 | Called when the user has initiated an event with the | |
1548 | mouse.<P> | |
1549 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1550 | <I>event</I><UL><UL> | |
1551 | The mouse event. See <A HREF="wx150.htm#wxmouseevent">wxMouseEvent</A> for | |
1552 | more details.</UL></UL> | |
1553 | <P> | |
1554 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1555 | Most, but not all, windows respond to this event.<P> | |
1556 | To intercept this event, use the EVT_MOUSE_EVENTS macro in an event table definition, or individual | |
1557 | mouse event macros such as EVT_LEFT_DOWN.<P> | |
1558 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1559 | <A HREF="wx150.htm#wxmouseevent">wxMouseEvent</A>, | |
1560 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1561 | ||
1562 | <HR> | |
1563 | <A NAME="wxwindowonmove"></A> | |
1564 | <H3>wxWindow::OnMove</H3> | |
1565 | <P> | |
1566 | <B>void</B> <B>OnMove</B>(<B>wxMoveEvent& </B><I>event</I>)<P> | |
1567 | Called when a window is moved.<P> | |
1568 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1569 | <I>event</I><UL><UL> | |
1570 | The move event. For more information, see <A HREF="wx151.htm#wxmoveevent">wxMoveEvent</A>.</UL></UL> | |
1571 | <P> | |
1572 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1573 | Use the EVT_MOVE macro to intercept move events.<P> | |
1574 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1575 | Not currently implemented.<P> | |
1576 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1577 | <A HREF="wx151.htm#wxmoveevent">wxMoveEvent</A>, | |
1578 | <A HREF="wx104.htm#wxframeonsize">wxFrame::OnSize</A>, | |
1579 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1580 | ||
1581 | <HR> | |
1582 | <A NAME="wxwindowonpaint"></A> | |
1583 | <H3>wxWindow::OnPaint</H3> | |
1584 | <P> | |
1585 | <B>void</B> <B>OnPaint</B>(<B>wxPaintEvent& </B><I>event</I>)<P> | |
1586 | Sent to the event handler when the window must be refreshed.<P> | |
1587 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1588 | <I>event</I><UL><UL> | |
1589 | Paint event. For more information, see <A HREF="wx164.htm#wxpaintevent">wxPaintEvent</A>.</UL></UL> | |
1590 | <P> | |
1591 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1592 | Use the EVT_PAINT macro in an event table definition to intercept paint events.<P> | |
1593 | In a paint event handler, the application should always create a <A HREF="wx163.htm#wxpaintdc">wxPaintDC</A> object.<P> | |
1594 | For example:<P> | |
1595 | <FONT SIZE=2><PRE> | |
1596 | void MyWindow::OnPaint(wxPaintEvent& event) | |
1597 | { | |
1598 | wxPaintDC dc(this); | |
1599 | ||
1600 | DrawMyDocument(dc); | |
1601 | } | |
1602 | </PRE> | |
1603 | </FONT>You can optimize painting by retrieving the rectangles | |
1604 | that have been damaged and only repainting these. The rectangles are in | |
1605 | terms of the client area, and are unscrolled, so you will need to do | |
1606 | some calculations using the current view position to obtain logical, | |
1607 | scrolled units.<P> | |
1608 | Here is an example of using the <A HREF="wx196.htm#wxregioniterator">wxRegionIterator</A> class:<P> | |
1609 | <FONT SIZE=2><PRE> | |
1610 | // Called when window needs to be repainted. | |
1611 | void MyWindow::OnPaint(wxPaintEvent& event) | |
1612 | { | |
1613 | wxPaintDC dc(this); | |
1614 | ||
1615 | // Find Out where the window is scrolled to | |
1616 | int vbX,vbY; // Top left corner of client | |
1617 | ViewStart(&vbX,&vbY); | |
1618 | ||
1619 | int vX,vY,vW,vH; // Dimensions of client area in pixels | |
1620 | wxRegionIterator upd(GetUpdateRegion()); // get the update rect list | |
1621 | ||
1622 | while (upd) | |
1623 | { | |
1624 | vX = upd.GetX(); | |
1625 | vY = upd.GetY(); | |
1626 | vW = upd.GetW(); | |
1627 | vH = upd.GetH(); | |
1628 | ||
1629 | // Alternatively we can do this: | |
1630 | // wxRect rect; | |
1631 | // upd.GetRect(&rect); | |
1632 | ||
1633 | // Repaint this rectangle | |
1634 | ...some code... | |
1635 | ||
1636 | upd ++ ; | |
1637 | } | |
1638 | } | |
1639 | </PRE> | |
1640 | </FONT><B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1641 | <A HREF="wx164.htm#wxpaintevent">wxPaintEvent</A>, | |
1642 | <A HREF="wx163.htm#wxpaintdc">wxPaintDC</A>, | |
1643 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1644 | ||
1645 | <HR> | |
1646 | <A NAME="wxwindowonscroll"></A> | |
1647 | <H3>wxWindow::OnScroll</H3> | |
1648 | <P> | |
1649 | <B>void</B> <B>OnScroll</B>(<B>wxScrollEvent& </B><I>event</I>)<P> | |
1650 | Called when a scroll event is received from one of the window's built-in scrollbars.<P> | |
1651 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1652 | <I>event</I><UL><UL> | |
1653 | Command event. Retrieve the new scroll position by | |
1654 | calling <A HREF="wx202.htm#wxscrolleventgetposition">wxScrollEvent::GetPosition</A>, and the | |
1655 | scrollbar orientation by calling <A HREF="wx202.htm#wxscrolleventgetorientation">wxScrollEvent::GetOrientation</A>.</UL></UL> | |
1656 | <P> | |
1657 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1658 | Note that it is not possible to distinguish between horizontal and vertical scrollbars | |
1659 | until the function is executing (you can't have one function for vertical, another | |
1660 | for horizontal events).<P> | |
1661 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1662 | <A HREF="wx202.htm#wxscrollevent">wxScrollEvent</A>, | |
1663 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1664 | ||
1665 | <HR> | |
1666 | <A NAME="wxwindowonsetfocus"></A> | |
1667 | <H3>wxWindow::OnSetFocus</H3> | |
1668 | <P> | |
1669 | <B>void</B> <B>OnSetFocus</B>(<B>wxFocusEvent& </B><I>event</I>)<P> | |
1670 | Called when a window's focus is being set.<P> | |
1671 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1672 | <I>event</I><UL><UL> | |
1673 | The focus event. For more information, see <A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>.</UL></UL> | |
1674 | <P> | |
1675 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1676 | To intercept this event, use the macro EVT_SET_FOCUS in an event table definition.<P> | |
1677 | Most, but not all, windows respond to this event.<P> | |
1678 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1679 | <A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>, <A HREF="wx260.htm#wxwindowonkillfocus">wxWindow::OnKillFocus</A>, | |
1680 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1681 | ||
1682 | <HR> | |
1683 | <A NAME="wxwindowonsize"></A> | |
1684 | <H3>wxWindow::OnSize</H3> | |
1685 | <P> | |
1686 | <B>void</B> <B>OnSize</B>(<B>wxSizeEvent& </B><I>event</I>)<P> | |
1687 | Called when the window has been resized.<P> | |
1688 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1689 | <I>event</I><UL><UL> | |
1690 | Size event. For more information, see <A HREF="wx206.htm#wxsizeevent">wxSizeEvent</A>.</UL></UL> | |
1691 | <P> | |
1692 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1693 | You may wish to use this for frames to resize their child windows as appropriate.<P> | |
1694 | Note that the size passed is of | |
1695 | the whole window: call <A HREF="wx260.htm#wxwindowgetclientsize">wxWindow::GetClientSize</A> for the area which may be | |
1696 | used by the application.<P> | |
1697 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1698 | <A HREF="wx206.htm#wxsizeevent">wxSizeEvent</A>, | |
1699 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1700 | ||
1701 | <HR> | |
1702 | <A NAME="wxwindowonsyscolourchanged"></A> | |
1703 | <H3>wxWindow::OnSysColourChanged</H3> | |
1704 | <P> | |
1705 | <B>void</B> <B>OnSysColourChanged</B>(<B>wxOnSysColourChangedEvent& </B><I>event</I>)<P> | |
1706 | Called when the user has changed the system colours.<P> | |
1707 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1708 | <I>event</I><UL><UL> | |
1709 | System colour change event. For more information, see <A HREF="wx227.htm#wxsyscolourchangedevent">wxSysColourChangedEvent</A>.</UL></UL> | |
1710 | <P> | |
1711 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1712 | <A HREF="wx227.htm#wxsyscolourchangedevent">wxSysColourChangedEvent</A>, | |
1713 | <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P> | |
1714 | ||
1715 | <HR> | |
1716 | <A NAME="wxwindowpopeventhandler"></A> | |
1717 | <H3>wxWindow::PopEventHandler</H3> | |
1718 | <P> | |
1719 | <B>wxEvtHandler*</B> <B>PopEventHandler</B>(<B>bool </B><I>deleteHandler = FALSE</I>) <B>const</B><P> | |
1720 | Removes and returns the top-most event handler on the event handler stack.<P> | |
1721 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1722 | <I>deleteHandler</I><UL><UL> | |
1723 | If this is TRUE, the handler will be deleted after it is removed. The | |
1724 | default value is FALSE.</UL></UL> | |
1725 | <P> | |
1726 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1727 | <A HREF="wx260.htm#wxwindowseteventhandler">wxWindow::SetEventHandler</A>, | |
1728 | <A HREF="wx260.htm#wxwindowgeteventhandler">wxWindow::GetEventHandler</A>, | |
1729 | <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A>, | |
1730 | <A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>, | |
1731 | <A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P> | |
1732 | ||
1733 | <HR> | |
1734 | <A NAME="wxwindowpopupmenu"></A> | |
1735 | <H3>wxWindow::PopupMenu</H3> | |
1736 | <P> | |
1737 | <B>virtual bool</B> <B>PopupMenu</B>(<B>wxMenu* </B><I>menu</I>, <B>int </B><I>x</I>, <B>int </B><I>y</I>)<P> | |
1738 | Pops up the given menu at the specified coordinates, relative to this | |
1739 | window, and returns control when the user has dismissed the menu. If a | |
1740 | menu item is selected, the callback defined for the menu is called with | |
1741 | wxMenu and wxCommandEvent reference arguments. The callback should access | |
1742 | the commandInt member of the event to check the selected menu identifier.<P> | |
1743 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1744 | <I>menu</I><UL><UL> | |
1745 | Menu to pop up.</UL></UL> | |
1746 | <P> | |
1747 | <I>x</I><UL><UL> | |
1748 | Required x position for the menu to appear.</UL></UL> | |
1749 | <P> | |
1750 | <I>y</I><UL><UL> | |
1751 | Required y position for the menu to appear.</UL></UL> | |
1752 | <P> | |
1753 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1754 | <A HREF="wx140.htm#wxmenu">wxMenu</A><P> | |
1755 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1756 | Just before the menu is popped up, <A HREF="wx140.htm#wxmenuupdateui">wxMenu::UpdateUI</A> is called | |
1757 | to ensure that the menu items are in the correct state.<P> | |
1758 | ||
1759 | <HR> | |
1760 | <A NAME="wxwindowpusheventhandler"></A> | |
1761 | <H3>wxWindow::PushEventHandler</H3> | |
1762 | <P> | |
1763 | <B>void</B> <B>PushEventHandler</B>(<B>wxEvtHandler* </B><I>handler</I>)<P> | |
1764 | Pushes this event handler onto the event stack for the window.<P> | |
1765 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1766 | <I>handler</I><UL><UL> | |
1767 | Specifies the handler to be pushed.</UL></UL> | |
1768 | <P> | |
1769 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1770 | An event handler is an object that is capable of processing the events | |
1771 | sent to a window. By default, the window is its own event handler, but | |
1772 | an application may wish to substitute another, for example to allow | |
1773 | central implementation of event-handling for a variety of different | |
1774 | window classes.<P> | |
1775 | <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A> allows | |
1776 | an application to set up a chain of event handlers, where an event not handled by one event handler is | |
1777 | handed to the next one in the chain. Use <A HREF="wx260.htm#wxwindowpopeventhandler">wxWindow::PopEventHandler</A> to | |
1778 | remove the event handler.<P> | |
1779 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1780 | <A HREF="wx260.htm#wxwindowseteventhandler">wxWindow::SetEventHandler</A>, | |
1781 | <A HREF="wx260.htm#wxwindowgeteventhandler">wxWindow::GetEventHandler</A>, | |
1782 | <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PopEventHandler</A>, | |
1783 | <A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>, | |
1784 | <A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P> | |
1785 | ||
1786 | <HR> | |
1787 | <A NAME="wxwindowraise"></A> | |
1788 | <H3>wxWindow::Raise</H3> | |
1789 | <P> | |
1790 | <B>void</B> <B>Raise</B>()<P> | |
1791 | Raises the window to the top of the window hierarchy if it is a managed window (dialog | |
1792 | or frame).<P> | |
1793 | ||
1794 | <HR> | |
1795 | <A NAME="wxwindowrefresh"></A> | |
1796 | <H3>wxWindow::Refresh</H3> | |
1797 | <P> | |
1798 | <B>virtual void</B> <B>Refresh</B>(<B>const bool</B><I> eraseBackground = TRUE</I>, <B>const wxRect* </B><I>rect | |
1799 | = NULL</I>)<P> | |
1800 | Causes a message or event to be generated to repaint the | |
1801 | window.<P> | |
1802 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1803 | <I>eraseBackground</I><UL><UL> | |
1804 | If TRUE, the background will be | |
1805 | erased.</UL></UL> | |
1806 | <P> | |
1807 | <I>rect</I><UL><UL> | |
1808 | If non-NULL, only the given rectangle will | |
1809 | be treated as damaged.</UL></UL> | |
1810 | <P> | |
1811 | ||
1812 | <HR> | |
1813 | <A NAME="wxwindowreleasemouse"></A> | |
1814 | <H3>wxWindow::ReleaseMouse</H3> | |
1815 | <P> | |
1816 | <B>virtual void</B> <B>ReleaseMouse</B>()<P> | |
1817 | Releases mouse input captured with <A HREF="wx260.htm#wxwindowcapturemouse">wxWindow::CaptureMouse</A>.<P> | |
1818 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1819 | <A HREF="wx260.htm#wxwindowcapturemouse">wxWindow::CaptureMouse</A><P> | |
1820 | ||
1821 | <HR> | |
1822 | <A NAME="wxwindowremovechild"></A> | |
1823 | <H3>wxWindow::RemoveChild</H3> | |
1824 | <P> | |
1825 | <B>virtual void</B> <B>RemoveChild</B>(<B>wxWindow* </B><I>child</I>)<P> | |
1826 | Removes a child window. This is called automatically by window deletion | |
1827 | functions so should not be required by the application programmer.<P> | |
1828 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1829 | <I>child</I><UL><UL> | |
1830 | Child window to remove.</UL></UL> | |
1831 | <P> | |
1832 | ||
1833 | <HR> | |
1834 | <A NAME="wxwindowscreentoclient"></A> | |
1835 | <H3>wxWindow::ScreenToClient</H3> | |
1836 | <P> | |
1837 | <B>virtual void</B> <B>ScreenToClient</B>(<B>int* </B><I>x</I>, <B>int* </B><I>y</I>) <B>const</B><P> | |
1838 | <B>virtual wxPoint</B> <B>ScreenToClient</B>(<B>const wxPoint& </B><I>pt</I>) <B>const</B><P> | |
1839 | Converts from screen to client window coordinates.<P> | |
1840 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1841 | <I>x</I><UL><UL> | |
1842 | Stores the screen x coordinate and receives the client x coordinate.</UL></UL> | |
1843 | <P> | |
1844 | <I>y</I><UL><UL> | |
1845 | Stores the screen x coordinate and receives the client x coordinate.</UL></UL> | |
1846 | <P> | |
1847 | <I>pt</I><UL><UL> | |
1848 | The screen position for the second form of the function.</UL></UL> | |
1849 | <P> | |
1850 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
1851 | In place of a single overloaded method name, wxPython | |
1852 | implements the following methods:<P> | |
1853 | ||
1854 | <UL><UL> | |
1855 | ||
1856 | <TABLE> | |
1857 | ||
1858 | ||
1859 | <TR><TD VALIGN=TOP> | |
1860 | <B>ScreenToClient(point)</B> | |
1861 | </TD> | |
1862 | ||
1863 | <TD VALIGN=TOP> | |
1864 | Accepts and returns a wxPoint | |
1865 | </TD></TR> | |
1866 | ||
1867 | ||
1868 | <TR><TD VALIGN=TOP> | |
1869 | <B>ScreenToClientXY(x, y)</B> | |
1870 | </TD> | |
1871 | ||
1872 | <TD VALIGN=TOP> | |
1873 | Returns a 2-tuple, (x, y) | |
1874 | </TD></TR> | |
1875 | ||
1876 | ||
1877 | </TABLE> | |
1878 | </UL></UL> | |
1879 | ||
1880 | <P> | |
1881 | ||
1882 | ||
1883 | <HR> | |
1884 | <A NAME="wxwindowscrollwindow"></A> | |
1885 | <H3>wxWindow::ScrollWindow</H3> | |
1886 | <P> | |
1887 | <B>virtual void</B> <B>ScrollWindow</B>(<B>int </B><I>dx</I>, <B>int </B><I>dy</I>, <B>const wxRect*</B><I> rect = NULL</I>)<P> | |
1888 | Physically scrolls the pixels in the window.<P> | |
1889 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1890 | <I>dx</I><UL><UL> | |
1891 | Amount to scroll horizontally.</UL></UL> | |
1892 | <P> | |
1893 | <I>dy</I><UL><UL> | |
1894 | Amount to scroll vertically.</UL></UL> | |
1895 | <P> | |
1896 | <I>rect</I><UL><UL> | |
1897 | Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you | |
1898 | pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler | |
1899 | can optimise painting by checking for the invalidated region.</UL></UL> | |
1900 | <P> | |
1901 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1902 | Available only under Windows.<P> | |
1903 | Use this function to optimise your scrolling implementations, to minimise the area that must be | |
1904 | redrawn.<P> | |
1905 | ||
1906 | <HR> | |
1907 | <A NAME="wxwindowsetacceleratortable"></A> | |
1908 | <H3>wxWindow::SetAcceleratorTable</H3> | |
1909 | <P> | |
1910 | <B>virtual void</B> <B>SetAcceleratorTable</B>(<B>const wxAcceleratorTable&</B><I> accel</I>)<P> | |
1911 | Sets the accelerator table for this window. See <A HREF="wx24.htm#wxacceleratortable">wxAcceleratorTable</A>.<P> | |
1912 | ||
1913 | <HR> | |
1914 | <A NAME="wxwindowsetautolayout"></A> | |
1915 | <H3>wxWindow::SetAutoLayout</H3> | |
1916 | <P> | |
1917 | <B>void</B> <B>SetAutoLayout</B>(<B>const bool</B><I> autoLayout</I>)<P> | |
1918 | Determines whether the <A HREF="wx260.htm#wxwindowlayout">wxWindow::Layout</A> function will | |
1919 | be called automatically when the window is resized.<P> | |
1920 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1921 | <I>autoLayout</I><UL><UL> | |
1922 | Set this to TRUE if you wish the Layout function to be called | |
1923 | from within wxWindow::OnSize functions.</UL></UL> | |
1924 | <P> | |
1925 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1926 | <A HREF="wx260.htm#wxwindowsetconstraints">wxWindow::SetConstraints</A><P> | |
1927 | ||
1928 | <HR> | |
1929 | <A NAME="wxwindowsetbackgroundcolour"></A> | |
1930 | <H3>wxWindow::SetBackgroundColour</H3> | |
1931 | <P> | |
1932 | <B>virtual void</B> <B>SetBackgroundColour</B>(<B>const wxColour& </B><I>colour</I>)<P> | |
1933 | Sets the background colour of the window.<P> | |
1934 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1935 | <I>colour</I><UL><UL> | |
1936 | The colour to be used as the background colour.</UL></UL> | |
1937 | <P> | |
1938 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
1939 | The background colour is usually painted by the default | |
1940 | <A HREF="wx260.htm#wxwindowonerasebackground">wxWindow::OnEraseBackground</A> event handler function.<P> | |
1941 | Note that setting the background colour does not cause an immediate refresh, so you | |
1942 | may wish to call <A HREF="wx260.htm#wxwindowclear">wxWindow::Clear</A> or <A HREF="wx260.htm#wxwindowrefresh">wxWindow::Refresh</A> after | |
1943 | calling this function.<P> | |
1944 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
1945 | <A HREF="wx260.htm#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A>, | |
1946 | <A HREF="wx260.htm#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A>, | |
1947 | <A HREF="wx260.htm#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A>, | |
1948 | <A HREF="wx260.htm#wxwindowclear">wxWindow::Clear</A>, | |
1949 | <A HREF="wx260.htm#wxwindowrefresh">wxWindow::Refresh</A>, | |
1950 | <A HREF="wx260.htm#wxwindowonerasebackground">wxWindow::OnEraseBackground</A><P> | |
1951 | ||
1952 | <HR> | |
1953 | <A NAME="wxwindowsetclientsize"></A> | |
1954 | <H3>wxWindow::SetClientSize</H3> | |
1955 | <P> | |
1956 | <B>virtual void</B> <B>SetClientSize</B>(<B>int</B><I> width</I>, <B>int</B><I> height</I>)<P> | |
1957 | <B>virtual void</B> <B>SetClientSize</B>(<B>const wxSize&</B><I> size</I>)<P> | |
1958 | This sets the size of the window client area in pixels. Using this function to size a window | |
1959 | tends to be more device-independent than <A HREF="wx260.htm#wxwindowsetsize">wxWindow::SetSize</A>, since the application need not | |
1960 | worry about what dimensions the border or title bar have when trying to fit the window | |
1961 | around panel items, for example.<P> | |
1962 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
1963 | <I>width</I><UL><UL> | |
1964 | The required client area width.</UL></UL> | |
1965 | <P> | |
1966 | <I>height</I><UL><UL> | |
1967 | The required client area height.</UL></UL> | |
1968 | <P> | |
1969 | <I>size</I><UL><UL> | |
1970 | The required client size.</UL></UL> | |
1971 | <P> | |
1972 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
1973 | In place of a single overloaded method name, wxPython | |
1974 | implements the following methods:<P> | |
1975 | ||
1976 | <UL><UL> | |
1977 | ||
1978 | <TABLE> | |
1979 | ||
1980 | ||
1981 | <TR><TD VALIGN=TOP> | |
1982 | <B>SetClientSize(size)</B> | |
1983 | </TD> | |
1984 | ||
1985 | <TD VALIGN=TOP> | |
1986 | Accepts a wxSize | |
1987 | </TD></TR> | |
1988 | ||
1989 | ||
1990 | <TR><TD VALIGN=TOP> | |
1991 | <B>SetClientSizeWH(width, height)</B> | |
1992 | </TD> | |
1993 | ||
1994 | <TD VALIGN=TOP> | |
1995 | ||
1996 | </TD></TR> | |
1997 | ||
1998 | ||
1999 | </TABLE> | |
2000 | </UL></UL> | |
2001 | ||
2002 | <P> | |
2003 | ||
2004 | <HR> | |
2005 | <A NAME="wxwindowsetcursor"></A> | |
2006 | <H3>wxWindow::SetCursor</H3> | |
2007 | <P> | |
2008 | <B>virtual void</B> <B>SetCursor</B>(<B>const wxCursor&</B><I>cursor</I>)<P> | |
2009 | Sets the window's cursor. Notice that setting the cursor for this window does | |
2010 | not set it for its children so you'll need to explicitly call SetCursor() for | |
2011 | them too if you need it.<P> | |
2012 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2013 | <I>cursor</I><UL><UL> | |
2014 | Specifies the cursor that the window should normally display.</UL></UL> | |
2015 | <P> | |
2016 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2017 | <A HREF="wx268.htm#wxsetcursor">::wxSetCursor</A>, <A HREF="wx59.htm#wxcursor">wxCursor</A><P> | |
2018 | ||
2019 | <HR> | |
2020 | <A NAME="wxwindowseteventhandler"></A> | |
2021 | <H3>wxWindow::SetEventHandler</H3> | |
2022 | <P> | |
2023 | <B>void</B> <B>SetEventHandler</B>(<B>wxEvtHandler* </B><I>handler</I>)<P> | |
2024 | Sets the event handler for this window.<P> | |
2025 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2026 | <I>handler</I><UL><UL> | |
2027 | Specifies the handler to be set.</UL></UL> | |
2028 | <P> | |
2029 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2030 | An event handler is an object that is capable of processing the events | |
2031 | sent to a window. By default, the window is its own event handler, but | |
2032 | an application may wish to substitute another, for example to allow | |
2033 | central implementation of event-handling for a variety of different | |
2034 | window classes.<P> | |
2035 | It is usually better to use <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A> since | |
2036 | this sets up a chain of event handlers, where an event not handled by one event handler is | |
2037 | handed to the next one in the chain.<P> | |
2038 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2039 | <A HREF="wx260.htm#wxwindowgeteventhandler">wxWindow::GetEventHandler</A>, | |
2040 | <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A>, | |
2041 | <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PopEventHandler</A>, | |
2042 | <A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>, | |
2043 | <A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P> | |
2044 | ||
2045 | <HR> | |
2046 | <A NAME="wxwindowsetconstraints"></A> | |
2047 | <H3>wxWindow::SetConstraints</H3> | |
2048 | <P> | |
2049 | <B>void</B> <B>SetConstraints</B>(<B>wxLayoutConstraints* </B><I>constraints</I>)<P> | |
2050 | Sets the window to have the given layout constraints. The window | |
2051 | will then own the object, and will take care of its deletion. | |
2052 | If an existing layout constraints object is already owned by the | |
2053 | window, it will be deleted.<P> | |
2054 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2055 | <I>constraints</I><UL><UL> | |
2056 | The constraints to set. Pass NULL to disassociate and delete the window's | |
2057 | constraints.</UL></UL> | |
2058 | <P> | |
2059 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2060 | You must call <A HREF="wx260.htm#wxwindowsetautolayout">wxWindow::SetAutoLayout</A> to tell a window to use | |
2061 | the constraints automatically in OnSize; otherwise, you must | |
2062 | override OnSize and call Layout explicitly.<P> | |
2063 | ||
2064 | <HR> | |
2065 | <A NAME="wxwindowsetdroptarget"></A> | |
2066 | <H3>wxWindow::SetDropTarget</H3> | |
2067 | <P> | |
2068 | <B>void</B> <B>SetDropTarget</B>(<B>wxDropTarget*</B><I> target</I>)<P> | |
2069 | Associates a drop target with this window.<P> | |
2070 | If the window already has a drop target, it is deleted.<P> | |
2071 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2072 | <A HREF="wx260.htm#wxwindowgetdroptarget">wxWindow::GetDropTarget</A>, | |
2073 | <A HREF="wx312.htm#wxdndoverview">Drag and drop overview</A><P> | |
2074 | ||
2075 | <HR> | |
2076 | <A NAME="wxwindowsetfocus"></A> | |
2077 | <H3>wxWindow::SetFocus</H3> | |
2078 | <P> | |
2079 | <B>virtual void</B> <B>SetFocus</B>()<P> | |
2080 | This sets the window to receive keyboard input.<P> | |
2081 | ||
2082 | <HR> | |
2083 | <A NAME="wxwindowsetfont"></A> | |
2084 | <H3>wxWindow::SetFont</H3> | |
2085 | <P> | |
2086 | <B>void</B> <B>SetFont</B>(<B>const wxFont& </B><I>font</I>)<P> | |
2087 | Sets the font for this window.<P> | |
2088 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2089 | <I>font</I><UL><UL> | |
2090 | Font to associate with this window.</UL></UL> | |
2091 | <P> | |
2092 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2093 | <A HREF="wx260.htm#wxwindowgetfont">wxWindow::GetFont</A><P> | |
2094 | ||
2095 | <HR> | |
2096 | <A NAME="wxwindowsetforegroundcolour"></A> | |
2097 | <H3>wxWindow::SetForegroundColour</H3> | |
2098 | <P> | |
2099 | <B>virtual void</B> <B>SetForegroundColour</B>(<B>const wxColour& </B><I>colour</I>)<P> | |
2100 | Sets the foreground colour of the window.<P> | |
2101 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2102 | <I>colour</I><UL><UL> | |
2103 | The colour to be used as the foreground colour.</UL></UL> | |
2104 | <P> | |
2105 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2106 | The interpretation of foreground colour is open to interpretation according | |
2107 | to the window class; it may be the text colour or other colour, or it may not | |
2108 | be used at all.<P> | |
2109 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2110 | <A HREF="wx260.htm#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A>, | |
2111 | <A HREF="wx260.htm#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A>, | |
2112 | <A HREF="wx260.htm#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A><P> | |
2113 | ||
2114 | <HR> | |
2115 | <A NAME="wxwindowsetid"></A> | |
2116 | <H3>wxWindow::SetId</H3> | |
2117 | <P> | |
2118 | <B>void</B> <B>SetId</B>(<B>int</B><I> id</I>)<P> | |
2119 | Sets the identifier of the window.<P> | |
2120 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2121 | Each window has an integer identifier. If the application has not provided one, | |
2122 | an identifier will be generated. Normally, the identifier should be provided | |
2123 | on creation and should not be modified subsequently.<P> | |
2124 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2125 | <A HREF="wx260.htm#wxwindowgetid">wxWindow::GetId</A>, | |
2126 | <A HREF="wx299.htm#windowids">Window identifiers</A><P> | |
2127 | ||
2128 | <HR> | |
2129 | <A NAME="wxwindowsetname"></A> | |
2130 | <H3>wxWindow::SetName</H3> | |
2131 | <P> | |
2132 | <B>virtual void</B> <B>SetName</B>(<B>const wxString& </B><I>name</I>)<P> | |
2133 | Sets the window's name.<P> | |
2134 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2135 | <I>name</I><UL><UL> | |
2136 | A name to set for the window.</UL></UL> | |
2137 | <P> | |
2138 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2139 | <A HREF="wx260.htm#wxwindowgetname">wxWindow::GetName</A><P> | |
2140 | ||
2141 | <HR> | |
2142 | <A NAME="wxwindowsetpalette"></A> | |
2143 | <H3>wxWindow::SetPalette</H3> | |
2144 | <P> | |
2145 | <B>virtual void</B> <B>SetPalette</B>(<B>wxPalette* </B><I>palette</I>)<P> | |
2146 | Obsolete - use <A HREF="wx65.htm#wxdcsetpalette">wxDC::SetPalette</A> instead.<P> | |
2147 | ||
2148 | <HR> | |
2149 | <A NAME="wxwindowsetreturncode"></A> | |
2150 | <H3>wxWindow::SetReturnCode</H3> | |
2151 | <P> | |
2152 | <B>void</B> <B>SetReturnCode</B>(<B>int </B><I>retCode</I>)<P> | |
2153 | Sets the return code for this window.<P> | |
2154 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2155 | <I>retCode</I><UL><UL> | |
2156 | The integer return code, usually a control identifier.</UL></UL> | |
2157 | <P> | |
2158 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2159 | A return code is normally associated with a modal dialog, where <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A> returns | |
2160 | a code to the application. The function <A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A> calls <B>SetReturnCode</B>.<P> | |
2161 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2162 | <A HREF="wx260.htm#wxwindowgetreturncode">wxWindow::GetReturnCode</A>, <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A>, | |
2163 | <A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A><P> | |
2164 | ||
2165 | <HR> | |
2166 | <A NAME="wxwindowsetscrollbar"></A> | |
2167 | <H3>wxWindow::SetScrollbar</H3> | |
2168 | <P> | |
2169 | <B>virtual void</B> <B>SetScrollbar</B>(<B>int </B><I>orientation</I>, <B>int </B><I>position</I>, | |
2170 | <B>int </B><I>thumbSize</I>, <B>int </B><I>range</I>, | |
2171 | <B>const bool </B><I>refresh = TRUE</I>)<P> | |
2172 | Sets the scrollbar properties of a built-in scrollbar.<P> | |
2173 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2174 | <I>orientation</I><UL><UL> | |
2175 | Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.</UL></UL> | |
2176 | <P> | |
2177 | <I>position</I><UL><UL> | |
2178 | The position of the scrollbar in scroll units.</UL></UL> | |
2179 | <P> | |
2180 | <I>thumbSize</I><UL><UL> | |
2181 | The size of the thumb, or visible portion of the scrollbar, in scroll units.</UL></UL> | |
2182 | <P> | |
2183 | <I>range</I><UL><UL> | |
2184 | The maximum position of the scrollbar.</UL></UL> | |
2185 | <P> | |
2186 | <I>refresh</I><UL><UL> | |
2187 | TRUE to redraw the scrollbar, FALSE otherwise.</UL></UL> | |
2188 | <P> | |
2189 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2190 | Let's say you wish to display 50 lines of text, using the same font. | |
2191 | The window is sized so that you can only see 16 lines at a time.<P> | |
2192 | You would use:<P> | |
2193 | <FONT SIZE=2><PRE> | |
2194 | SetScrollbar(wxVERTICAL, 0, 16, 50); | |
2195 | </PRE> | |
2196 | </FONT><P> | |
2197 | Note that with the window at this size, the thumb position can never go | |
2198 | above 50 minus 16, or 34.<P> | |
2199 | You can determine how many lines are currently visible by dividing the current view | |
2200 | size by the character height in pixels.<P> | |
2201 | When defining your own scrollbar behaviour, you will always need to recalculate | |
2202 | the scrollbar settings when the window size changes. You could therefore put your | |
2203 | scrollbar calculations and SetScrollbar | |
2204 | call into a function named AdjustScrollbars, which can be called initially and also | |
2205 | from your <A HREF="wx260.htm#wxwindowonsize">wxWindow::OnSize</A> event handler function.<P> | |
2206 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2207 | <A HREF="wx297.htm#scrollingoverview">Scrolling overview</A>, | |
2208 | <A HREF="wx201.htm#wxscrollbar">wxScrollBar</A>, <A HREF="wx203.htm#wxscrolledwindow">wxScrolledWindow</A><P> | |
2209 | ||
2210 | <HR> | |
2211 | <A NAME="wxwindowsetscrollpos"></A> | |
2212 | <H3>wxWindow::SetScrollPos</H3> | |
2213 | <P> | |
2214 | <B>virtual void</B> <B>SetScrollPos</B>(<B>int </B><I>orientation</I>, <B>int </B><I>pos</I>, <B>const bool </B><I>refresh = TRUE</I>)<P> | |
2215 | Sets the position of one of the built-in scrollbars.<P> | |
2216 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2217 | <I>orientation</I><UL><UL> | |
2218 | Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.</UL></UL> | |
2219 | <P> | |
2220 | <I>pos</I><UL><UL> | |
2221 | Position in scroll units.</UL></UL> | |
2222 | <P> | |
2223 | <I>refresh</I><UL><UL> | |
2224 | TRUE to redraw the scrollbar, FALSE otherwise.</UL></UL> | |
2225 | <P> | |
2226 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2227 | This function does not directly affect the contents of the window: it is up to the | |
2228 | application to take note of scrollbar attributes and redraw contents accordingly.<P> | |
2229 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2230 | <A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A>, | |
2231 | <A HREF="wx260.htm#wxwindowsetscrollpos">wxWindow::GetScrollPos</A>, | |
2232 | <A HREF="wx260.htm#wxwindowgetscrollthumb">wxWindow::GetScrollThumb</A>, | |
2233 | <A HREF="wx201.htm#wxscrollbar">wxScrollBar</A>, <A HREF="wx203.htm#wxscrolledwindow">wxScrolledWindow</A><P> | |
2234 | ||
2235 | <HR> | |
2236 | <A NAME="wxwindowsetsize"></A> | |
2237 | <H3>wxWindow::SetSize</H3> | |
2238 | <P> | |
2239 | <B>virtual void</B> <B>SetSize</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>, | |
2240 | <B>int</B><I> sizeFlags = wxSIZE_AUTO</I>)<P> | |
2241 | <B>virtual void</B> <B>SetSize</B>(<B>const wxRect&</B><I> rect</I>)<P> | |
2242 | Sets the size and position of the window in pixels.<P> | |
2243 | <B>virtual void</B> <B>SetSize</B>(<B>int</B><I> width</I>, <B>int</B><I> height</I>)<P> | |
2244 | <B>virtual void</B> <B>SetSize</B>(<B>const wxSize&</B><I> size</I>)<P> | |
2245 | Sets the size of the window in pixels.<P> | |
2246 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2247 | <I>x</I><UL><UL> | |
2248 | Required x position in pixels, or -1 to indicate that the existing | |
2249 | value should be used.</UL></UL> | |
2250 | <P> | |
2251 | <I>y</I><UL><UL> | |
2252 | Required y position in pixels, or -1 to indicate that the existing | |
2253 | value should be used.</UL></UL> | |
2254 | <P> | |
2255 | <I>width</I><UL><UL> | |
2256 | Required width in pixels, or -1 to indicate that the existing | |
2257 | value should be used.</UL></UL> | |
2258 | <P> | |
2259 | <I>height</I><UL><UL> | |
2260 | Required height position in pixels, or -1 to indicate that the existing | |
2261 | value should be used.</UL></UL> | |
2262 | <P> | |
2263 | <I>size</I><UL><UL> | |
2264 | <A HREF="wx205.htm#wxsize">wxSize</A> object for setting the size.</UL></UL> | |
2265 | <P> | |
2266 | <I>rect</I><UL><UL> | |
2267 | <A HREF="wx193.htm#wxrect">wxRect</A> object for setting the position and size.</UL></UL> | |
2268 | <P> | |
2269 | <I>sizeFlags</I><UL><UL> | |
2270 | Indicates the interpretation of other parameters. It is a bit list of the following:<P> | |
2271 | <B>wxSIZE_AUTO_WIDTH</B>: a -1 width value is taken to indicate | |
2272 | a wxWindows-supplied default width.<BR> | |
2273 | ||
2274 | <B>wxSIZE_AUTO_HEIGHT</B>: a -1 height value is taken to indicate | |
2275 | a wxWindows-supplied default width.<BR> | |
2276 | ||
2277 | <B>wxSIZE_AUTO</B>: -1 size values are taken to indicate | |
2278 | a wxWindows-supplied default size.<BR> | |
2279 | ||
2280 | <B>wxSIZE_USE_EXISTING</B>: existing dimensions should be used | |
2281 | if -1 values are supplied.<BR> | |
2282 | ||
2283 | <B>wxSIZE_ALLOW_MINUS_ONE</B>: allow dimensions of -1 and less to be interpreted | |
2284 | as real dimensions, not default values. | |
2285 | </UL></UL> | |
2286 | <P> | |
2287 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2288 | The second form is a convenience for calling the first form with default | |
2289 | x and y parameters, and must be used with non-default width and height values.<P> | |
2290 | The first form sets the position and optionally size, of the window. | |
2291 | Parameters may be -1 to indicate either that a default should be supplied | |
2292 | by wxWindows, or that the current value of the dimension should be used.<P> | |
2293 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2294 | <A HREF="wx260.htm#wxwindowmove">wxWindow::Move</A><P> | |
2295 | <B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR> | |
2296 | In place of a single overloaded method name, wxPython | |
2297 | implements the following methods:<P> | |
2298 | ||
2299 | <UL><UL> | |
2300 | ||
2301 | <TABLE> | |
2302 | ||
2303 | ||
2304 | <TR><TD VALIGN=TOP> | |
2305 | <B>SetDimensions(x, y, width, height, sizeFlags=wxSIZE_AUTO)</B> | |
2306 | </TD> | |
2307 | ||
2308 | <TD VALIGN=TOP> | |
2309 | ||
2310 | </TD></TR> | |
2311 | ||
2312 | ||
2313 | <TR><TD VALIGN=TOP> | |
2314 | <B>SetSize(size)</B> | |
2315 | </TD> | |
2316 | ||
2317 | <TD VALIGN=TOP> | |
2318 | ||
2319 | </TD></TR> | |
2320 | ||
2321 | ||
2322 | <TR><TD VALIGN=TOP> | |
2323 | <B>SetPosition(point)</B> | |
2324 | </TD> | |
2325 | ||
2326 | <TD VALIGN=TOP> | |
2327 | ||
2328 | </TD></TR> | |
2329 | ||
2330 | ||
2331 | </TABLE> | |
2332 | </UL></UL> | |
2333 | ||
2334 | <P> | |
2335 | ||
2336 | <HR> | |
2337 | <A NAME="wxwindowsetsizehints"></A> | |
2338 | <H3>wxWindow::SetSizeHints</H3> | |
2339 | <P> | |
2340 | <B>virtual void</B> <B>SetSizeHints</B>(<B>int</B><I> minW=-1</I>, <B>int</B><I> minH=-1</I>, <B>int</B><I> maxW=-1</I>, <B>int</B><I> maxH=-1</I>, | |
2341 | <B>int</B><I> incW=-1</I>, <B>int</B><I> incH=-1</I>)<P> | |
2342 | Allows specification of minimum and maximum window sizes, and window size increments. | |
2343 | If a pair of values is not set (or set to -1), the default values will be used.<P> | |
2344 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2345 | <I>minW</I><UL><UL> | |
2346 | Specifies the minimum width allowable.</UL></UL> | |
2347 | <P> | |
2348 | <I>minH</I><UL><UL> | |
2349 | Specifies the minimum height allowable.</UL></UL> | |
2350 | <P> | |
2351 | <I>maxW</I><UL><UL> | |
2352 | Specifies the maximum width allowable.</UL></UL> | |
2353 | <P> | |
2354 | <I>maxH</I><UL><UL> | |
2355 | Specifies the maximum height allowable.</UL></UL> | |
2356 | <P> | |
2357 | <I>incW</I><UL><UL> | |
2358 | Specifies the increment for sizing the width (Motif/Xt only).</UL></UL> | |
2359 | <P> | |
2360 | <I>incH</I><UL><UL> | |
2361 | Specifies the increment for sizing the height (Motif/Xt only).</UL></UL> | |
2362 | <P> | |
2363 | <B><FONT COLOR="#FF0000">Remarks</FONT></B><P> | |
2364 | If this function is called, the user will not be able to size the window outside the | |
2365 | given bounds.<P> | |
2366 | The resizing increments are only significant under Motif or Xt.<P> | |
2367 | ||
2368 | <HR> | |
2369 | <A NAME="wxwindowsettitle"></A> | |
2370 | <H3>wxWindow::SetTitle</H3> | |
2371 | <P> | |
2372 | <B>virtual void</B> <B>SetTitle</B>(<B>const wxString& </B><I>title</I>)<P> | |
2373 | Sets the window's title. Applicable only to frames and dialogs.<P> | |
2374 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2375 | <I>title</I><UL><UL> | |
2376 | The window's title.</UL></UL> | |
2377 | <P> | |
2378 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2379 | <A HREF="wx260.htm#wxwindowgettitle">wxWindow::GetTitle</A><P> | |
2380 | ||
2381 | <HR> | |
2382 | <A NAME="topic1041"></A> | |
2383 | <H3>wxWindow::Show</H3> | |
2384 | <P> | |
2385 | <B>virtual bool</B> <B>Show</B>(<B>const bool</B><I> show</I>)<P> | |
2386 | Shows or hides the window.<P> | |
2387 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2388 | <I>show</I><UL><UL> | |
2389 | If TRUE, displays the window and brings it to the front. Otherwise, | |
2390 | hides the window.</UL></UL> | |
2391 | <P> | |
2392 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2393 | <A HREF="wx260.htm#wxwindowisshown">wxWindow::IsShown</A><P> | |
2394 | ||
2395 | <HR> | |
2396 | <A NAME="wxwindowtransferdatafromwindow"></A> | |
2397 | <H3>wxWindow::TransferDataFromWindow</H3> | |
2398 | <P> | |
2399 | <B>virtual bool</B> <B>TransferDataFromWindow</B>()<P> | |
2400 | Transfers values from child controls to data areas specified by their validators. Returns | |
2401 | FALSE if a transfer failed.<P> | |
2402 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2403 | <A HREF="wx260.htm#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A>, | |
2404 | <A HREF="wx255.htm#wxvalidator">wxValidator</A>, <A HREF="wx260.htm#wxwindowvalidate">wxWindow::Validate</A><P> | |
2405 | ||
2406 | <HR> | |
2407 | <A NAME="wxwindowtransferdatatowindow"></A> | |
2408 | <H3>wxWindow::TransferDataToWindow</H3> | |
2409 | <P> | |
2410 | <B>virtual bool</B> <B>TransferDataToWindow</B>()<P> | |
2411 | Transfers values to child controls from data areas specified by their validators.<P> | |
2412 | <B><FONT COLOR="#FF0000">Return value</FONT></B><P> | |
2413 | Returns FALSE if a transfer failed.<P> | |
2414 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2415 | <A HREF="wx260.htm#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A>, | |
2416 | <A HREF="wx255.htm#wxvalidator">wxValidator</A>, <A HREF="wx260.htm#wxwindowvalidate">wxWindow::Validate</A><P> | |
2417 | ||
2418 | <HR> | |
2419 | <A NAME="wxwindowvalidate"></A> | |
2420 | <H3>wxWindow::Validate</H3> | |
2421 | <P> | |
2422 | <B>virtual bool</B> <B>Validate</B>()<P> | |
2423 | Validates the current values of the child controls using their validators.<P> | |
2424 | <B><FONT COLOR="#FF0000">Return value</FONT></B><P> | |
2425 | Returns FALSE if any of the validations failed.<P> | |
2426 | <B><FONT COLOR="#FF0000">See also</FONT></B><P> | |
2427 | <A HREF="wx260.htm#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A>, | |
2428 | <A HREF="wx260.htm#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A>, | |
2429 | <A HREF="wx255.htm#wxvalidator">wxValidator</A><P> | |
2430 | ||
2431 | <HR> | |
2432 | <A NAME="wxwindowwarppointer"></A> | |
2433 | <H3>wxWindow::WarpPointer</H3> | |
2434 | <P> | |
2435 | <B>void</B> <B>WarpPointer</B>(<B>int</B><I> x</I>, <B>int</B><I> y</I>)<P> | |
2436 | Moves the pointer to the given position on the window.<P> | |
2437 | <B><FONT COLOR="#FF0000">Parameters</FONT></B><P> | |
2438 | <I>x</I><UL><UL> | |
2439 | The new x position for the cursor.</UL></UL> | |
2440 | <P> | |
2441 | <I>y</I><UL><UL> | |
2442 | The new y position for the cursor.</UL></UL> | |
2443 | <P> | |
2444 | ||
2445 | </BODY></HTML> |