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