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