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