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