]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/window.tex
Added wxDC::GetPartialTextExtents
[wxWidgets.git] / docs / latex / wx / window.tex
CommitLineData
a660d684
KB
1\section{\class{wxWindow}}\label{wxwindow}
2
c66c3af1
VZ
3wxWindow is the base class for all windows and represents any visible objecto n
4screen. All controls, top level windows and so on are windows. Sizers and
5device contexts are not, however, as they don't appear on screen themselves.
6
7Please note that all children of the window will be deleted automatically by
8the destructor before the window itself is deleted which means that you don't
9have to worry about deleting them manually. Please see the \helpref{window
10deletion overview}{windowdeletionoverview} for more information.
11
12Also note that in this, and many others, wxWindows classes some
13\texttt{GetXXX()} methods may be overloaded (as, for example,
14\helpref{GetSize}{wxwindowgetsize} or
15\helpref{GetClientSize}{wxwindowgetclientsize}). In this case, the overloads
16are non-virtual because having multiple virtual functions with the same name
17results in a virtual function name hiding at the derived class level (in
18English, this means that the derived class has to override all overloaded
19variants if it overrides any of them). To allow overriding them in the derived
20class, wxWindows uses a unique protected virtual \texttt{DoGetXXX()} method
21and all \texttt{GetXXX()} ones are forwarded to it, so overriding the former
22changes the behaviour of the latter.
4130b487 23
a660d684
KB
24
25\wxheading{Derived from}
26
27\helpref{wxEvtHandler}{wxevthandler}\\
28\helpref{wxObject}{wxobject}
29
954b8ae6
JS
30\wxheading{Include files}
31
32<wx/window.h>
33
a660d684
KB
34\wxheading{Window styles}
35
36The following styles can apply to all windows, although they will not always make sense for a particular
4130b487 37window class or on all platforms.
a660d684
KB
38
39\twocolwidtha{5cm}%
40\begin{twocollist}\itemsep=0pt
41\twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
27d029c7 42for this style. }
69a126b0 43\twocolitem{\windowstyle{wxDOUBLE\_BORDER}}{Displays a double border. Windows and Mac only.}
a660d684 44\twocolitem{\windowstyle{wxSUNKEN\_BORDER}}{Displays a sunken border.}
69a126b0 45\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border.}
6453876e 46\twocolitem{\windowstyle{wxSTATIC\_BORDER}}{Displays a border suitable for a static control. Windows only. }
8d99dec0 47\twocolitem{\windowstyle{wxNO\_BORDER}}{Displays no border, overriding the default border style for the window.}
a660d684
KB
48\twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paint
49events. Windows only.}
a660d684 50\twocolitem{\windowstyle{wxTAB\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.}
a729c344
RD
51\twocolitem{\windowstyle{wxWANTS\_CHARS}}{Use this to indicate that
52the window wants to get all char/key events for all keys - even for
53keys like TAB or ENTER which are usually used for dialog navigation
54and which wouldn't be generated without this style. If you need to
55use this style in order to get the arrows or etc., but would still like to have
56normal keyboard navigation take place, you should create and send a
57wxNavigationKeyEvent in response to the key events for Tab and
58Shift-Tab.}
f6bcfd97 59\twocolitem{\windowstyle{wxNO\_FULL\_REPAINT\_ON\_RESIZE}}{Disables repainting
895fc9cb 60the window completely when its size is changed - you will have to repaint the
f6bcfd97 61new window area manually if you use this style. Currently only has an effect for
4130b487 62Windows.}
aab49a0b
JS
63\twocolitem{\windowstyle{wxVSCROLL}}{Use this style to enable a vertical scrollbar.}
64\twocolitem{\windowstyle{wxHSCROLL}}{Use this style to enable a horizontal scrollbar.}
3c9676ea 65\twocolitem{\windowstyle{wxALWAYS\_SHOW\_SB}}{If a window has scrollbars,
a647d42a
VZ
66disable them instead of hiding them when they are not needed (i.e. when the
67size of the window is big enough to not require the scrollbars to navigate it).
68This style is currently only implemented for wxMSW and wxUniversal and does
69nothing on the other platforms.}
884360bc 70\twocolitem{\windowstyle{wxCLIP\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
6453876e 71repainted, then children being painted over them. Windows only.}
e441e1f4
VZ
72\twocolitem{\windowstyle{wxFULL\_REPAINT\_ON\_RESIZE}}{Use this style to force
73a complete redraw of the window whenever it is resized instead of redrawing
74just the part of the window affected by resizing. Note that this was the
75behaviour by default before 2.5.1 release and that if you experience redraw
76problems with the code which previously used to work you may want to try this.}
a660d684
KB
77\end{twocollist}
78
79See also \helpref{window styles overview}{windowstyles}.
80
e39af974
JS
81\wxheading{Extra window styles}
82
83The following are extra styles, set using \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle}.
84
85\twocolwidtha{5cm}%
86\begin{twocollist}\itemsep=0pt
87\twocolitem{\windowstyle{wxWS\_EX\_VALIDATE\_RECURSIVELY}}{By default, Validate/TransferDataTo/FromWindow()
88only work on direct children of the window (compatible behaviour). Set this flag to make them recursively
89descend into all subwindows.}
90\twocolitem{\windowstyle{wxWS\_EX\_BLOCK\_EVENTS}}{wxCommandEvents and the objects of the derived classes are forwarded to the
91parent window and so on recursively by default. Using this flag for the
92given window allows to block this propagation at this window, i.e. prevent
93the events from being propagated further upwards. Dialogs have this
94flag on by default.}
95\twocolitem{\windowstyle{wxWS\_EX\_TRANSIENT}}{Don't use this window as an implicit parent for the other windows: this must
96be used with transient windows as otherwise there is the risk of creating a
97dialog/frame with this window as a parent which would lead to a crash if the
98parent is destroyed before the child.}
99\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_IDLE}}{This window should always process idle events, even
100if the mode set by \helpref{wxIdleEvent::SetMode}{wxidleeventsetmode} is wxIDLE\_PROCESS\_SPECIFIED.}
101\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_UI\_UPDATES}}{This window should always process UI update events,
102even if the mode set by \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} is wxUPDATE\_UI\_PROCESS\_SPECIFIED.}
103\end{twocollist}
104
a660d684
KB
105\wxheading{See also}
106
107\helpref{Event handling overview}{eventhandlingoverview}
108
109\latexignore{\rtfignore{\wxheading{Members}}}
110
8c4b73d1 111
f6bcfd97 112\membersection{wxWindow::wxWindow}\label{wxwindowctor}
a660d684
KB
113
114\func{}{wxWindow}{\void}
115
116Default constructor.
117
eaaa6a06 118\func{}{wxWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},
a660d684
KB
119 \param{const wxPoint\& }{pos = wxDefaultPosition},
120 \param{const wxSize\& }{size = wxDefaultSize},
eaaa6a06 121 \param{long }{style = 0},
a660d684
KB
122 \param{const wxString\& }{name = wxPanelNameStr}}
123
124Constructs a window, which can be a child of a frame, dialog or any other non-control window.
125
126\wxheading{Parameters}
127
128\docparam{parent}{Pointer to a parent window.}
129
130\docparam{id}{Window identifier. If -1, will automatically create an identifier.}
131
132\docparam{pos}{Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows
133should generate a default position for the window. If using the wxWindow class directly, supply
134an actual position.}
135
136\docparam{size}{Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows
6453876e
RR
137should generate a default size for the window. If no suitable size can be found, the
138window will be sized to 20x20 pixels so that the window is visible but obviously not
139correctly sized. }
a660d684
KB
140
141\docparam{style}{Window style. For generic window styles, please see \helpref{wxWindow}{wxwindow}.}
142
143\docparam{name}{Window name.}
144
8c4b73d1 145
a660d684
KB
146\membersection{wxWindow::\destruct{wxWindow}}
147
148\func{}{\destruct{wxWindow}}{\void}
149
150Destructor. Deletes all subwindows, then deletes itself. Instead of using
151the {\bf delete} operator explicitly, you should normally
152use \helpref{wxWindow::Destroy}{wxwindowdestroy} so that wxWindows
153can delete a window only when it is safe to do so, in idle time.
154
155\wxheading{See also}
156
157\helpref{Window deletion overview}{windowdeletionoverview},\rtfsp
a660d684
KB
158\helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp
159\helpref{wxCloseEvent}{wxcloseevent}
160
8c4b73d1 161
a660d684
KB
162\membersection{wxWindow::AddChild}
163
164\func{virtual void}{AddChild}{\param{wxWindow* }{child}}
165
166Adds a child window. This is called automatically by window creation
167functions so should not be required by the application programmer.
168
afbdbdb4
VZ
169Notice that this function is mostly internal to wxWindows and shouldn't be
170called by the user code.
171
a660d684
KB
172\wxheading{Parameters}
173
174\docparam{child}{Child window to add.}
175
8c4b73d1 176
a660d684
KB
177\membersection{wxWindow::CaptureMouse}\label{wxwindowcapturemouse}
178
179\func{virtual void}{CaptureMouse}{\void}
180
181Directs all mouse input to this window. Call \helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse} to
182release the capture.
183
47a9a87d
VZ
184Note that wxWindows maintains the stack of windows having captured the mouse
185and when the mouse is released the capture returns to the window which had had
186captured it previously and it is only really released if there were no previous
187window. In particular, this means that you must release the mouse as many times
188as you capture it.
189
a660d684
KB
190\wxheading{See also}
191
192\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}
193
8c4b73d1 194
a660d684
KB
195\membersection{wxWindow::Center}\label{wxwindowcenter}
196
eaaa6a06 197\func{void}{Center}{\param{int}{ direction}}
a660d684
KB
198
199A synonym for \helpref{Centre}{wxwindowcentre}.
200
8c4b73d1 201
7631a292
RD
202\membersection{wxWindow::CenterOnParent}\label{wxwindowcenteronparent}
203
204\func{void}{CenterOnParent}{\param{int}{ direction}}
205
206A synonym for \helpref{CentreOnParent}{wxwindowcentreonparent}.
207
8c4b73d1 208
7eb4e9cc
VZ
209\membersection{wxWindow::CenterOnScreen}\label{wxwindowcenteronscreen}
210
211\func{void}{CenterOnScreen}{\param{int}{ direction}}
212
213A synonym for \helpref{CentreOnScreen}{wxwindowcentreonscreen}.
214
8c4b73d1 215
a660d684
KB
216\membersection{wxWindow::Centre}\label{wxwindowcentre}
217
7eb4e9cc 218\func{void}{Centre}{\param{int}{ direction = wxBOTH}}
a660d684
KB
219
220Centres the window.
221
222\wxheading{Parameters}
223
224\docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfsp
18ac8d69
RD
225or {\tt wxBOTH}. It may also include {\tt wxCENTRE\_ON\_SCREEN} flag
226if you want to center the window on the entire screen and not on its
227parent window.}
d22699b5 228
7eb4e9cc
VZ
229The flag {\tt wxCENTRE\_FRAME} is obsolete and should not be used any longer
230(it has no effect).
a660d684
KB
231
232\wxheading{Remarks}
233
d22699b5
VZ
234If the window is a top level one (i.e. doesn't have a parent), it will be
235centered relative to the screen anyhow.
a660d684
KB
236
237\wxheading{See also}
238
239\helpref{wxWindow::Center}{wxwindowcenter}
240
8c4b73d1 241
7631a292
RD
242\membersection{wxWindow::CentreOnParent}\label{wxwindowcentreonparent}
243
7eb4e9cc 244\func{void}{CentreOnParent}{\param{int}{ direction = wxBOTH}}
7631a292 245
c9f00eeb 246Centres the window on its parent. This is a more readable synonym for
7eb4e9cc 247\helpref{Centre}{wxwindowcentre}.
7631a292
RD
248
249\wxheading{Parameters}
250
251\docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfsp
252or {\tt wxBOTH}.}
253
254\wxheading{Remarks}
255
256This methods provides for a way to center top level windows over their
257parents instead of the entire screen. If there is no parent or if the
c9f00eeb 258window is not a top level window, then behaviour is the same as
7631a292
RD
259\helpref{wxWindow::Centre}{wxwindowcentre}.
260
261\wxheading{See also}
262
7eb4e9cc
VZ
263\helpref{wxWindow::CentreOnScreen}{wxwindowcenteronscreen}
264
8c4b73d1 265
7eb4e9cc
VZ
266\membersection{wxWindow::CentreOnScreen}\label{wxwindowcentreonscreen}
267
268\func{void}{CentreOnScreen}{\param{int}{ direction = wxBOTH}}
269
270Centres the window on screen. This only works for top level windows -
271otherwise, the window will still be centered on its parent.
272
273\wxheading{Parameters}
274
275\docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfsp
276or {\tt wxBOTH}.}
277
278\wxheading{See also}
279
280\helpref{wxWindow::CentreOnParent}{wxwindowcenteronparent}
7631a292 281
8c4b73d1 282
5da0803c 283\membersection{wxWindow::ClearBackground}\label{wxwindowclearbackground}
a660d684 284
5da0803c 285\func{void}{ClearBackground}{\void}
a660d684 286
5b6aa0ff
JS
287Clears the window by filling it with the current background colour. Does not
288cause an erase background event to be generated.
a660d684 289
8c4b73d1 290
a660d684
KB
291\membersection{wxWindow::ClientToScreen}
292
293\constfunc{virtual void}{ClientToScreen}{\param{int* }{x}, \param{int* }{y}}
294
2edb0bde 295\perlnote{In wxPerl this method returns a 2-element list instead of
5873607e
VZ
296modifying its parameters.}
297
a974387a
JS
298\constfunc{virtual wxPoint}{ClientToScreen}{\param{const wxPoint\&}{ pt}}
299
a660d684
KB
300Converts to screen coordinates from coordinates relative to this window.
301
302\docparam{x}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
303a screen coordinate will be passed out.}
304
305\docparam{y}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
306a screen coordinate will be passed out.}
307
a974387a
JS
308\docparam{pt}{The client position for the second form of the function.}
309
06d20283
RD
310\pythonnote{In place of a single overloaded method name, wxPython
311implements the following methods:\par
312\indented{2cm}{\begin{twocollist}
c9110876
VS
313\twocolitem{{\bf ClientToScreen(point)}}{Accepts and returns a wxPoint}
314\twocolitem{{\bf ClientToScreenXY(x, y)}}{Returns a 2-tuple, (x, y)}
06d20283
RD
315\end{twocollist}}
316}
317
8c4b73d1 318
a660d684
KB
319\membersection{wxWindow::Close}\label{wxwindowclose}
320
cc81d32f 321\func{bool}{Close}{\param{bool}{ force = {\tt false}}}
a660d684 322
24174c30
VZ
323This function simply generates a \helpref{wxCloseEvent}{wxcloseevent} whose
324handler usually tries to close the window. It doesn't close the window itself,
325however.
a660d684
KB
326
327\wxheading{Parameters}
328
cc81d32f
VS
329\docparam{force}{{\tt false} if the window's close handler should be able to veto the destruction
330of this window, {\tt true} if it cannot.}
a660d684
KB
331
332\wxheading{Remarks}
333
24174c30
VZ
334Close calls the \helpref{close handler}{wxcloseevent} for the window, providing
335an opportunity for the window to choose whether to destroy the window.
336Usually it is only used with the top level windows (wxFrame and wxDialog
337classes) as the others are not supposed to have any special OnClose() logic.
a660d684
KB
338
339The close handler should check whether the window is being deleted forcibly,
24174c30
VZ
340using \helpref{wxCloseEvent::GetForce}{wxcloseeventgetforce}, in which case it
341should destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}.
a660d684 342
24174c30
VZ
343{\it Note} that calling Close does not guarantee that the window will be
344destroyed; but it provides a way to simulate a manual close of a window, which
345may or may not be implemented by destroying the window. The default
346implementation of wxDialog::OnCloseWindow does not necessarily delete the
347dialog, since it will simply simulate an wxID\_CANCEL event which is handled by
348the appropriate button event handler and may do anything at all.
a660d684 349
24174c30
VZ
350To guarantee that the window will be destroyed, call
351\helpref{wxWindow::Destroy}{wxwindowdestroy} instead
532372a3 352
a660d684
KB
353\wxheading{See also}
354
355\helpref{Window deletion overview}{windowdeletionoverview},\rtfsp
a660d684
KB
356\helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp
357\helpref{wxCloseEvent}{wxcloseevent}
358
8c4b73d1 359
387a3b02
JS
360\membersection{wxWindow::ConvertDialogToPixels}\label{wxwindowconvertdialogtopixels}
361
362\func{wxPoint}{ConvertDialogToPixels}{\param{const wxPoint\&}{ pt}}
363
364\func{wxSize}{ConvertDialogToPixels}{\param{const wxSize\&}{ sz}}
365
366Converts a point or size from dialog units to pixels.
367
368For the x dimension, the dialog units are multiplied by the average character width
369and then divided by 4.
370
371For the y dimension, the dialog units are multiplied by the average character height
372and then divided by 8.
373
374\wxheading{Remarks}
375
376Dialog units are used for maintaining a dialog's proportions even if the font changes.
377Dialogs created using Dialog Editor optionally use dialog units.
378
379You can also use these functions programmatically. A convenience macro is defined:
380
381{\small
382\begin{verbatim}
383#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
384\end{verbatim}
385}
386
387\wxheading{See also}
388
389\helpref{wxWindow::ConvertPixelsToDialog}{wxwindowconvertpixelstodialog}
390
06d20283
RD
391\pythonnote{In place of a single overloaded method name, wxPython
392implements the following methods:\par
393\indented{2cm}{\begin{twocollist}
c9110876
VS
394\twocolitem{{\bf ConvertDialogPointToPixels(point)}}{Accepts and returns a wxPoint}
395\twocolitem{{\bf ConvertDialogSizeToPixels(size)}}{Accepts and returns a wxSize}
06d20283
RD
396\end{twocollist}}
397
398Additionally, the following helper functions are defined:\par
399\indented{2cm}{\begin{twocollist}
c9110876 400\twocolitem{{\bf wxDLG\_PNT(win, point)}}{Converts a wxPoint from dialog
06d20283 401units to pixels}
c9110876 402\twocolitem{{\bf wxDLG\_SZE(win, size)}}{Converts a wxSize from dialog
06d20283
RD
403units to pixels}
404\end{twocollist}}
405}
406
407
8c4b73d1 408
387a3b02
JS
409\membersection{wxWindow::ConvertPixelsToDialog}\label{wxwindowconvertpixelstodialog}
410
411\func{wxPoint}{ConvertPixelsToDialog}{\param{const wxPoint\&}{ pt}}
412
413\func{wxSize}{ConvertPixelsToDialog}{\param{const wxSize\&}{ sz}}
414
415Converts a point or size from pixels to dialog units.
416
417For the x dimension, the pixels are multiplied by 4 and then divided by the average
418character width.
419
2edb0bde 420For the y dimension, the pixels are multiplied by 8 and then divided by the average
387a3b02
JS
421character height.
422
423\wxheading{Remarks}
424
425Dialog units are used for maintaining a dialog's proportions even if the font changes.
426Dialogs created using Dialog Editor optionally use dialog units.
427
428\wxheading{See also}
429
430\helpref{wxWindow::ConvertDialogToPixels}{wxwindowconvertdialogtopixels}
431
06d20283
RD
432
433\pythonnote{In place of a single overloaded method name, wxPython
434implements the following methods:\par
435\indented{2cm}{\begin{twocollist}
c9110876
VS
436\twocolitem{{\bf ConvertDialogPointToPixels(point)}}{Accepts and returns a wxPoint}
437\twocolitem{{\bf ConvertDialogSizeToPixels(size)}}{Accepts and returns a wxSize}
06d20283
RD
438\end{twocollist}}
439}
440
8c4b73d1 441
a660d684
KB
442\membersection{wxWindow::Destroy}\label{wxwindowdestroy}
443
444\func{virtual bool}{Destroy}{\void}
445
446Destroys the window safely. Use this function instead of the delete operator, since
447different window classes can be destroyed differently. Frames and dialogs
24174c30 448are not destroyed immediately when this function is called -- they are added
a660d684 449to a list of windows to be deleted on idle time, when all the window's events
2edb0bde 450have been processed. This prevents problems with events being sent to non-existent
a660d684
KB
451windows.
452
453\wxheading{Return value}
454
cc81d32f 455{\tt true} if the window has either been successfully deleted, or it has been added
a660d684
KB
456to the list of windows pending real deletion.
457
8c4b73d1 458
a660d684
KB
459\membersection{wxWindow::DestroyChildren}
460
461\func{virtual void}{DestroyChildren}{\void}
462
463Destroys all children of a window. Called automatically by the destructor.
464
8c4b73d1 465
6ba68e88
VZ
466\membersection{wxWindow::Disable}\label{wxwindowdisable}
467
c222be41 468\func{bool}{Disable}{\void}
6ba68e88 469
cc81d32f 470Disables the window, same as \helpref{Enable({\tt false})}{wxwindowenable}.
6ba68e88 471
df001660
VZ
472\wxheading{Return value}
473
cc81d32f 474Returns {\tt true} if the window has been disabled, {\tt false} if it had been
df001660
VZ
475already disabled before the call to this function.
476
8c4b73d1 477
e39af974
JS
478\membersection{wxWindow::DoUpdateWindowUI}\label{wxwindowdoupdatewindowui}
479
480\func{virtual void}{DoUpdateWindowUI}{\param{wxUpdateUIEvent\&}{ event}}
481
482Does the window-specific updating after processing the update event.
483This function is called by \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui}
484in order to check return values in the \helpref{wxUpdateUIEvent}{wxupdateuievent} and
485act appropriately. For example, to allow frame and dialog title updating, wxWindows
486implements this function as follows:
487
488\begin{verbatim}
489// do the window-specific processing after processing the update event
490void wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
491{
492 if ( event.GetSetEnabled() )
493 Enable(event.GetEnabled());
494
495 if ( event.GetSetText() )
496 {
497 if ( event.GetText() != GetTitle() )
498 SetTitle(event.GetText());
499 }
500}
501\end{verbatim}
502
8c4b73d1 503
a660d684
KB
504\membersection{wxWindow::DragAcceptFiles}\label{wxwindowdragacceptfiles}
505
8a293590 506\func{virtual void}{DragAcceptFiles}{\param{bool}{ accept}}
a660d684 507
2edb0bde 508Enables or disables eligibility for drop file events (OnDropFiles).
a660d684
KB
509
510\wxheading{Parameters}
511
cc81d32f 512\docparam{accept}{If {\tt true}, the window is eligible for drop file events. If {\tt false}, the window
a660d684
KB
513will not accept drop file events.}
514
515\wxheading{Remarks}
516
517Windows only.
518
8c4b73d1 519
a660d684
KB
520\membersection{wxWindow::Enable}\label{wxwindowenable}
521
cc81d32f 522\func{virtual bool}{Enable}{\param{bool}{ enable = {\tt true}}}
a660d684 523
d7cbabe0
VZ
524Enable or disable the window for user input. Note that when a parent window is
525disabled, all of its children are disabled as well and they are reenabled again
526when the parent is.
a660d684
KB
527
528\wxheading{Parameters}
529
cc81d32f 530\docparam{enable}{If {\tt true}, enables the window for input. If {\tt false}, disables the window.}
a660d684 531
df001660
VZ
532\wxheading{Return value}
533
cc81d32f 534Returns {\tt true} if the window has been enabled or disabled, {\tt false} if
df001660
VZ
535nothing was done, i.e. if the window had already been in the specified state.
536
a660d684
KB
537\wxheading{See also}
538
6ba68e88
VZ
539\helpref{wxWindow::IsEnabled}{wxwindowisenabled},\rtfsp
540\helpref{wxWindow::Disable}{wxwindowdisable}
a660d684 541
8c4b73d1 542
a660d684
KB
543\membersection{wxWindow::FindFocus}\label{wxwindowfindfocus}
544
545\func{static wxWindow*}{FindFocus}{\void}
546
547Finds the window or control which currently has the keyboard focus.
548
549\wxheading{Remarks}
550
551Note that this is a static function, so it can be called without needing a wxWindow pointer.
552
553\wxheading{See also}
554
555\helpref{wxWindow::SetFocus}{wxwindowsetfocus}
556
8c4b73d1 557
dfad0599
JS
558\membersection{wxWindow::FindWindow}\label{wxwindowfindwindow}
559
560\func{wxWindow*}{FindWindow}{\param{long}{ id}}
561
562Find a child of this window, by identifier.
563
564\func{wxWindow*}{FindWindow}{\param{const wxString\&}{ name}}
565
566Find a child of this window, by name.
567
06d20283
RD
568\pythonnote{In place of a single overloaded method name, wxPython
569implements the following methods:\par
570\indented{2cm}{\begin{twocollist}
c9110876
VS
571\twocolitem{{\bf FindWindowById(id)}}{Accepts an integer}
572\twocolitem{{\bf FindWindowByName(name)}}{Accepts a string}
06d20283
RD
573\end{twocollist}}
574}
575
8c4b73d1 576
f89a1397 577\membersection{wxWindow::FindWindowById}\label{wxwindowfindwindowbyid}
146ba0fe 578
f89a1397 579\func{static wxWindow*}{FindWindowById}{\param{long}{ id}, \param{wxWindow*}{ parent = NULL}}
146ba0fe
VZ
580
581Find the first window with the given {\it id}.
582
583If {\it parent} is NULL, the search will start from all top-level
584frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
585The search is recursive in both cases.
586
587\wxheading{See also}
588
f89a1397 589\helpref{FindWindow}{wxwindowfindwindow}
146ba0fe 590
8c4b73d1 591
146ba0fe
VZ
592\membersection{wxWindow::FindWindowByName}\label{wxwindowfindwindowbyname}
593
f89a1397 594\func{static wxWindow*}{FindWindowByName}{\param{const wxString\&}{ name}, \param{wxWindow*}{ parent = NULL}}
146ba0fe
VZ
595
596Find a window by its name (as given in a window constructor or {\bf Create} function call).
597If {\it parent} is NULL, the search will start from all top-level
598frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
599The search is recursive in both cases.
600
601If no window with such name is found,
602\helpref{FindWindowByLabel}{wxwindowfindwindowbylabel} is called.
603
604\wxheading{See also}
605
f89a1397 606\helpref{FindWindow}{wxwindowfindwindow}
146ba0fe 607
8c4b73d1 608
146ba0fe
VZ
609\membersection{wxWindow::FindWindowByLabel}\label{wxwindowfindwindowbylabel}
610
f89a1397 611\func{static wxWindow*}{FindWindowByLabel}{\param{const wxString\&}{ label}, \param{wxWindow*}{ parent = NULL}}
146ba0fe
VZ
612
613Find a window by its label. Depending on the type of window, the label may be a window title
614or panel item label. If {\it parent} is NULL, the search will start from all top-level
615frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
616The search is recursive in both cases.
617
618\wxheading{See also}
619
f89a1397 620\helpref{FindWindow}{wxwindowfindwindow}
146ba0fe 621
8c4b73d1 622
a660d684
KB
623\membersection{wxWindow::Fit}\label{wxwindowfit}
624
625\func{virtual void}{Fit}{\void}
626
f68586e5 627Sizes the window so that it fits around its subwindows. This function won't do
b19d494b
VZ
628anything if there are no subwindows and will only really work correctly if the
629sizers are used for the subwindows layout. Also, if the window has exactly one
630subwindow it is better (faster and the result is more precise as Fit adds some
631margin to account for fuzziness of its calculations) to call
632
633\begin{verbatim}
634 window->SetClientSize(child->GetSize());
635\end{verbatim}
636
637instead of calling Fit.
a660d684 638
8c4b73d1 639
2b5f62a0
VZ
640\membersection{wxWindow::FitInside}\label{wxwindowfitinside}
641
642\func{virtual void}{FitInside}{\void}
643
644Similar to \helpref{Fit}{wxwindowfit}, but sizes the interior (virtual) size
645of a window. Mainly useful with scrolled windows to reset scrollbars after
646sizing changes that do not trigger a size event, and/or scrolled windows without
647an interior sizer. This function similarly won't do anything if there are no
648subwindows.
649
8c4b73d1 650
0cc7251e
VZ
651\membersection{wxWindow::Freeze}\label{wxwindowfreeze}
652
653\func{virtual void}{Freeze}{\void}
654
655Freezes the window or, in other words, prevents any updates from taking place
656on screen, the window is not redrawn at all. \helpref{Thaw}{wxwindowthaw} must
657be called to reenable window redrawing.
658
659This method is useful for visual appearance optimization (for example, it
660is a good idea to use it before inserting large amount of text into a
661wxTextCtrl under wxGTK) but is not implemented on all platforms nor for all
662controls so it is mostly just a hint to wxWindows and not a mandatory
663directive.
664
8c4b73d1 665
d3e78bab
JS
666\membersection{wxWindow::GetAcceleratorTable}\label{wxwindowgetacceleratortable}
667
668\constfunc{wxAcceleratorTable*}{GetAcceleratorTable}{\void}
669
670Gets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxacceleratortable}.
671
2dab56e9
JS
672\membersection{wxWindow::GetAccessible}\label{wxwindowgetaccessible}
673
674\func{wxAccessibile*}{GetAccessible}{\void}
675
676Returns the accessible object for this window, if any.
677
678See also \helpref{wxAccessible}{wxaccessible}.
679
8c4b73d1 680
2b5f62a0
VZ
681\membersection{wxWindow::GetAdjustedBestSize}\label{wxwindowgetadjustedbestsize}
682
683\constfunc{wxSize}{GetAdjustedBestSize}{\void}
684
685This method is similar to \helpref{GetBestSize}{wxwindowgetbestsize}, except
686in one thing. GetBestSize should return the minimum untruncated size of the
687window, while this method will return the largest of BestSize and any user
688specified minimum size. ie. it is the minimum size the window should currently
689be drawn at, not the minimal size it can possibly tolerate.
690
8c4b73d1 691
a660d684
KB
692\membersection{wxWindow::GetBackgroundColour}\label{wxwindowgetbackgroundcolour}
693
694\constfunc{virtual wxColour}{GetBackgroundColour}{\void}
695
696Returns the background colour of the window.
697
698\wxheading{See also}
699
700\helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp
701\helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp
9866d9c2 702\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour}
a660d684 703
8c4b73d1 704
7f071e73 705\membersection{wxWindow::GetBestSize}\label{wxwindowgetbestsize}
f68586e5 706
c66c3af1 707\constfunc{wxSize}{GetBestSize}{\void}
f68586e5
VZ
708
709This functions returns the best acceptable minimal size for the window. For
710example, for a static control, it will be the minimal size such that the
3e02f5ed 711control label is not truncated. For windows containing subwindows (typically
8771a323 712\helpref{wxPanel}{wxpanel}), the size returned by this function will be the
3e02f5ed 713same as the size the window would have had after calling
f68586e5
VZ
714\helpref{Fit}{wxwindowfit}.
715
8c4b73d1 716
f6bcfd97
BP
717\membersection{wxWindow::GetCaret}\label{wxwindowgetcaret}
718
719\constfunc{wxCaret *}{GetCaret}{\void}
720
721Returns the \helpref{caret}{wxcaret} associated with the window.
722
8c4b73d1 723
a5e84126
JS
724\membersection{wxWindow::GetCapture}\label{wxwindowgetcapture}
725
726\func{static wxWindow *}{GetCapture}{\void}
727
728Returns the currently captured window.
729
730\wxheading{See also}
731
732\helpref{wxWindow::HasCapture}{wxwindowhascapture},
733\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},
734\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},
735\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}
736
8c4b73d1 737
a660d684
KB
738\membersection{wxWindow::GetCharHeight}
739
740\constfunc{virtual int}{GetCharHeight}{\void}
741
742Returns the character height for this window.
743
8c4b73d1 744
a660d684
KB
745\membersection{wxWindow::GetCharWidth}
746
747\constfunc{virtual int}{GetCharWidth}{\void}
748
749Returns the average character width for this window.
750
8c4b73d1 751
a660d684
KB
752\membersection{wxWindow::GetChildren}
753
c0ed460c 754\func{wxList\&}{GetChildren}{\void}
a660d684 755
c0ed460c 756Returns a reference to the list of the window's children.
a660d684 757
8c4b73d1 758
a660d684
KB
759\membersection{wxWindow::GetClientSize}\label{wxwindowgetclientsize}
760
c66c3af1 761\constfunc{void}{GetClientSize}{\param{int* }{width}, \param{int* }{height}}
a660d684 762
c9f00eeb 763\perlnote{In wxPerl this method takes no parameter and returns
5873607e
VZ
764a 2-element list {\tt ( width, height )}.}
765
c66c3af1 766\constfunc{wxSize}{GetClientSize}{\void}
a974387a 767
8ddffcda
GD
768This gets the size of the window `client area' in pixels.
769The client area is the area which may be drawn on by the programmer,
770excluding title bar, border, scrollbars, etc.
a660d684
KB
771
772\wxheading{Parameters}
773
774\docparam{width}{Receives the client width in pixels.}
775
776\docparam{height}{Receives the client height in pixels.}
777
06d20283
RD
778\pythonnote{In place of a single overloaded method name, wxPython
779implements the following methods:\par
780\indented{2cm}{\begin{twocollist}
c9f00eeb
RD
781\twocolitem{{\bf GetClientSizeTuple()}}{Returns a 2-tuple of (width, height)}
782\twocolitem{{\bf GetClientSize()}}{Returns a wxSize object}
06d20283
RD
783\end{twocollist}}
784}
785
8ddffcda
GD
786\wxheading{See also}
787
788\helpref{GetSize}{wxwindowgetsize}
566d84a7 789\helpref{GetVirtualSize}{wxwindowgetvirtualsize}
8ddffcda 790
8c4b73d1 791
a660d684
KB
792\membersection{wxWindow::GetConstraints}\label{wxwindowgetconstraints}
793
794\constfunc{wxLayoutConstraints*}{GetConstraints}{\void}
795
796Returns a pointer to the window's layout constraints, or NULL if there are none.
797
8c4b73d1 798
be90c029
RD
799\membersection{wxWindow::GetContainingSizer}\label{wxwindowgetcontainingsizer}
800
801\constfunc{const wxSizer *}{GetContainingSizer}{\void}
802
803Return the sizer that this window is a member of, if any, otherwise
804{\tt NULL}.
805
d3e78bab
JS
806\membersection{wxWindow::GetCursor}\label{wxwindowgetcursor}
807
808\constfunc{const wxCursor\&}{GetCursor}{\void}
809
810Return the cursor associated with this window.
811
812\wxheading{See also}
813
814\helpref{wxWindow::SetCursor}{wxwindowsetcursor}
8c4b73d1 815
dface61c
JS
816\membersection{wxWindow::GetDropTarget}\label{wxwindowgetdroptarget}
817
818\constfunc{wxDropTarget*}{GetDropTarget}{\void}
819
820Returns the associated drop target, which may be NULL.
821
822\wxheading{See also}
823
c9f00eeb 824\helpref{wxWindow::SetDropTarget}{wxwindowsetdroptarget},
dface61c
JS
825\helpref{Drag and drop overview}{wxdndoverview}
826
8c4b73d1 827
a660d684
KB
828\membersection{wxWindow::GetEventHandler}\label{wxwindowgeteventhandler}
829
830\constfunc{wxEvtHandler*}{GetEventHandler}{\void}
831
832Returns the event handler for this window. By default, the window is its
833own event handler.
834
835\wxheading{See also}
836
837\helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp
838\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
839\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp
840\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp
841\helpref{wxEvtHandler}{wxevthandler}\rtfsp
842
8c4b73d1 843
d80cd92a
VZ
844\membersection{wxWindow::GetExtraStyle}\label{wxwindowgetextrastyle}
845
846\constfunc{long}{GetExtraStyle}{\void}
847
848Returns the extra style bits for the window.
849
8c4b73d1 850
a660d684
KB
851\membersection{wxWindow::GetFont}\label{wxwindowgetfont}
852
c0ed460c 853\constfunc{wxFont\&}{GetFont}{\void}
a660d684 854
c0ed460c 855Returns a reference to the font for this window.
a660d684
KB
856
857\wxheading{See also}
858
859\helpref{wxWindow::SetFont}{wxwindowsetfont}
860
8c4b73d1 861
a660d684
KB
862\membersection{wxWindow::GetForegroundColour}\label{wxwindowgetforegroundcolour}
863
864\func{virtual wxColour}{GetForegroundColour}{\void}
865
866Returns the foreground colour of the window.
867
868\wxheading{Remarks}
869
870The interpretation of foreground colour is open to interpretation according
871to the window class; it may be the text colour or other colour, or it may not
872be used at all.
873
874\wxheading{See also}
875
876\helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp
877\helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp
878\helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour}
879
8c4b73d1 880
a660d684
KB
881\membersection{wxWindow::GetGrandParent}
882
883\constfunc{wxWindow*}{GetGrandParent}{\void}
884
885Returns the grandparent of a window, or NULL if there isn't one.
886
8c4b73d1 887
4e28924c 888\membersection{wxWindow::GetHandle}\label{wxwindowgethandle}
a660d684
KB
889
890\constfunc{void*}{GetHandle}{\void}
891
892Returns the platform-specific handle of the physical window. Cast it to an appropriate
6453876e 893handle, such as {\bf HWND} for Windows, {\bf Widget} for Motif or {\bf GtkWidget} for GTK.
a660d684 894
b32c6ff0
RD
895\pythonnote{This method will return an integer in wxPython.}
896
7975104d
MB
897\perlnote{This method will return an integer in wxPerl.}
898
8c4b73d1 899
4e28924c
JS
900\membersection{wxWindow::GetHelpText}\label{wxwindowgethelptext}
901
902\constfunc{virtual wxString}{GetHelpText}{\void}
903
904Gets the help text to be used as context-sensitive help for this window.
905
906Note that the text is actually stored by the current \helpref{wxHelpProvider}{wxhelpprovider} implementation,
907and not in the window object itself.
908
909\wxheading{See also}
910
911\helpref{SetHelpText}{wxwindowsethelptext}, \helpref{wxHelpProvider}{wxhelpprovider}
912
8c4b73d1 913
a660d684
KB
914\membersection{wxWindow::GetId}\label{wxwindowgetid}
915
916\constfunc{int}{GetId}{\void}
917
918Returns the identifier of the window.
919
920\wxheading{Remarks}
921
6453876e
RR
922Each window has an integer identifier. If the application has not provided one
923(or the default Id -1) an unique identifier with a negative value will be generated.
a660d684 924
a660d684
KB
925\wxheading{See also}
926
b2cf617c 927\helpref{wxWindow::SetId}{wxwindowsetid},\rtfsp
5b6aa0ff 928\helpref{Window identifiers}{windowids}
a660d684 929
8c4b73d1 930
9c824f29
JS
931\membersection{wxWindow::GetLabel}
932
933\constfunc{virtual wxString }{GetLabel}{\void}
934
935Generic way of getting a label from any window, for
936identification purposes.
937
938\wxheading{Remarks}
939
940The interpretation of this function differs from class to class.
941For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
942the button text. This function can be useful for meta-programs (such as testing
943tools or special-needs access programs) which need to identify windows
944by name.
945
8c4b73d1 946
a660d684
KB
947\membersection{wxWindow::GetName}\label{wxwindowgetname}
948
6453876e 949\constfunc{virtual wxString }{GetName}{\void}
a660d684
KB
950
951Returns the window's name.
952
953\wxheading{Remarks}
954
955This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
956name in the window constructor or via \helpref{wxWindow::SetName}{wxwindowsetname}.
957
958\wxheading{See also}
959
960\helpref{wxWindow::SetName}{wxwindowsetname}
961
8c4b73d1 962
a660d684
KB
963\membersection{wxWindow::GetParent}
964
965\constfunc{virtual wxWindow*}{GetParent}{\void}
966
967Returns the parent of the window, or NULL if there is no parent.
968
8c4b73d1 969
15770d1a
JS
970\membersection{wxWindow::GetPosition}\label{wxwindowgetposition}
971
972\constfunc{virtual void}{GetPosition}{\param{int* }{x}, \param{int* }{y}}
973
974\constfunc{wxPoint}{GetPosition}{\void}
975
d0706067
VZ
976This gets the position of the window in pixels, relative to the parent window
977for the child windows or relative to the display origin for the top level
978windows.
15770d1a
JS
979
980\wxheading{Parameters}
981
982\docparam{x}{Receives the x position of the window.}
983
984\docparam{y}{Receives the y position of the window.}
985
986\pythonnote{In place of a single overloaded method name, wxPython
987implements the following methods:\par
988\indented{2cm}{\begin{twocollist}
989\twocolitem{{\bf GetPosition()}}{Returns a wxPoint}
990\twocolitem{{\bf GetPositionTuple()}}{Returns a tuple (x, y)}
991\end{twocollist}}
992}
993
5873607e
VZ
994\perlnote{In wxPerl there are two methods instead of a single overloaded
995method:\par
996\indented{2cm}{\begin{twocollist}
997\twocolitem{{\bf GetPosition()}}{Returns a Wx::Point}
998\twocolitem{{\bf GetPositionXY()}}{Returns a 2-element list
999 {\tt ( x, y )}}
1000\end{twocollist}
1001}}
1002
8c4b73d1 1003
a974387a
JS
1004\membersection{wxWindow::GetRect}\label{wxwindowgetrect}
1005
1006\constfunc{virtual wxRect}{GetRect}{\void}
1007
1008Returns the size and position of the window as a \helpref{wxRect}{wxrect} object.
1009
8c4b73d1 1010
a660d684
KB
1011\membersection{wxWindow::GetScrollThumb}\label{wxwindowgetscrollthumb}
1012
eaaa6a06 1013\func{virtual int}{GetScrollThumb}{\param{int }{orientation}}
a660d684
KB
1014
1015Returns the built-in scrollbar thumb size.
1016
1017\wxheading{See also}
1018
1019\helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar}
1020
8c4b73d1 1021
a660d684
KB
1022\membersection{wxWindow::GetScrollPos}\label{wxwindowgetscrollpos}
1023
eaaa6a06 1024\func{virtual int}{GetScrollPos}{\param{int }{orientation}}
a660d684
KB
1025
1026Returns the built-in scrollbar position.
1027
1028\wxheading{See also}
1029
1030See \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar}
1031
8c4b73d1 1032
a660d684
KB
1033\membersection{wxWindow::GetScrollRange}\label{wxwindowgetscrollrange}
1034
eaaa6a06 1035\func{virtual int}{GetScrollRange}{\param{int }{orientation}}
a660d684
KB
1036
1037Returns the built-in scrollbar range.
1038
1039\wxheading{See also}
1040
1041\helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar}
1042
8c4b73d1 1043
a974387a 1044\membersection{wxWindow::GetSize}\label{wxwindowgetsize}
a660d684 1045
c66c3af1 1046\constfunc{void}{GetSize}{\param{int* }{width}, \param{int* }{height}}
a660d684 1047
c66c3af1 1048\constfunc{wxSize}{GetSize}{\void}
a974387a 1049
8ddffcda
GD
1050This gets the size of the entire window in pixels,
1051including title bar, border, scrollbars, etc.
a660d684
KB
1052
1053\wxheading{Parameters}
1054
1055\docparam{width}{Receives the window width.}
1056
1057\docparam{height}{Receives the window height.}
1058
06d20283
RD
1059\pythonnote{In place of a single overloaded method name, wxPython
1060implements the following methods:\par
1061\indented{2cm}{\begin{twocollist}
c9110876
VS
1062\twocolitem{{\bf GetSize()}}{Returns a wxSize}
1063\twocolitem{{\bf GetSizeTuple()}}{Returns a 2-tuple (width, height)}
06d20283
RD
1064\end{twocollist}}
1065}
1066
5873607e
VZ
1067\perlnote{In wxPerl there are two methods instead of a single overloaded
1068method:\par
1069\indented{2cm}{\begin{twocollist}
1070\twocolitem{{\bf GetSize()}}{Returns a Wx::Size}
1071\twocolitem{{\bf GetSizeWH()}}{Returns a 2-element list
1072 {\tt ( width, height )}}
1073\end{twocollist}
1074}}
1075
8ddffcda
GD
1076\wxheading{See also}
1077
566d84a7
RL
1078\helpref{GetClientSize}{wxwindowgetclientsize},\rtfsp
1079\helpref{GetVirtualSize}{wxwindowgetvirtualsize}
8ddffcda 1080
8c4b73d1 1081
e6973167
VZ
1082\membersection{wxWindow::GetSizer}\label{wxwindowgetsizer}
1083
772c017b 1084\constfunc{wxSizer *}{GetSizer}{\void}
e6973167 1085
be90c029 1086Return the sizer associated with the window by a previous call to
e6973167 1087\helpref{SetSizer()}{wxwindowsetsizer} or {\tt NULL}.
a660d684 1088
8c4b73d1 1089
be90c029
RD
1090\membersection{wxWindow::GetTextExtent}\label{wxwindowgettextextent}
1091
a660d684
KB
1092\constfunc{virtual void}{GetTextExtent}{\param{const wxString\& }{string}, \param{int* }{x}, \param{int* }{y},
1093 \param{int* }{descent = NULL}, \param{int* }{externalLeading = NULL},
cc81d32f 1094 \param{const wxFont* }{font = NULL}, \param{bool}{ use16 = {\tt false}}}
a660d684
KB
1095
1096Gets the dimensions of the string as it would be drawn on the
1097window with the currently selected font.
1098
1099\wxheading{Parameters}
1100
1101\docparam{string}{String whose extent is to be measured.}
1102
1103\docparam{x}{Return value for width.}
1104
1105\docparam{y}{Return value for height.}
1106
1107\docparam{descent}{Return value for descent (optional).}
1108
1109\docparam{externalLeading}{Return value for external leading (optional).}
1110
1111\docparam{font}{Font to use instead of the current window font (optional).}
1112
cc81d32f 1113\docparam{use16}{If {\tt true}, {\it string} contains 16-bit characters. The default is {\tt false}.}
a660d684 1114
06d20283
RD
1115
1116\pythonnote{In place of a single overloaded method name, wxPython
1117implements the following methods:\par
1118\indented{2cm}{\begin{twocollist}
c9110876
VS
1119\twocolitem{{\bf GetTextExtent(string)}}{Returns a 2-tuple, (width, height)}
1120\twocolitem{{\bf GetFullTextExtent(string, font=NULL)}}{Returns a
06d20283
RD
11214-tuple, (width, height, descent, externalLeading) }
1122\end{twocollist}}
1123}
1124
5873607e
VZ
1125\perlnote{In wxPerl this method takes only the {\tt string} and optionally
1126 {\tt font} parameters, and returns a 4-element list
1127 {\tt ( x, y, descent, externalLeading )}.}
06d20283 1128
8c4b73d1 1129
a660d684
KB
1130\membersection{wxWindow::GetTitle}\label{wxwindowgettitle}
1131
1132\func{virtual wxString}{GetTitle}{\void}
1133
1134Gets the window's title. Applicable only to frames and dialogs.
1135
1136\wxheading{See also}
1137
1138\helpref{wxWindow::SetTitle}{wxwindowsettitle}
1139
8c4b73d1 1140
8161ba08
JS
1141\membersection{wxWindow::GetToolTip}\label{wxwindowgettooltip}
1142
1143\constfunc{wxToolTip*}{GetToolTip}{\void}
1144
1145Get the associated tooltip or NULL if none.
1146
8c4b73d1 1147
76c5df24
JS
1148\membersection{wxWindow::GetUpdateRegion}\label{wxwindowgetupdateregion}
1149
1150\constfunc{virtual wxRegion}{GetUpdateRegion}{\void}
1151
1152Returns the region specifying which parts of the window have been damaged. Should
f4fcc291 1153only be called within an \helpref{wxPaintEvent}{wxpaintevent} handler.
76c5df24
JS
1154
1155\wxheading{See also}
1156
9866d9c2
VZ
1157\helpref{wxRegion}{wxregion},\rtfsp
1158\helpref{wxRegionIterator}{wxregioniterator}
76c5df24 1159
8c4b73d1 1160
aeab10d0
JS
1161\membersection{wxWindow::GetValidator}\label{wxwindowgetvalidator}
1162
1163\constfunc{wxValidator*}{GetValidator}{\void}
1164
1165Returns a pointer to the current validator for the window, or NULL if there is none.
1166
8c4b73d1 1167
566d84a7
RL
1168\membersection{wxWindow::GetVirtualSize}\label{wxwindowgetvirtualsize}
1169
1170\constfunc{void}{GetVirtualSize}{\param{int* }{width}, \param{int* }{height}}
1171
1172\constfunc{wxSize}{GetVirtualSize}{\void}
1173
1174This gets the virtual size of the window in pixels.
1175
1176\wxheading{Parameters}
1177
1178\docparam{width}{Receives the window virtual width.}
1179
1180\docparam{height}{Receives the window virtual height.}
1181
1182\helpref{GetSize}{wxwindowgetsize},\rtfsp
1183\helpref{GetClientSize}{wxwindowgetclientsize}
1184
8c4b73d1 1185
d80cd92a 1186\membersection{wxWindow::GetWindowStyleFlag}\label{wxwindowgetwindowstyleflag}
a660d684
KB
1187
1188\constfunc{long}{GetWindowStyleFlag}{\void}
1189
d80cd92a
VZ
1190Gets the window style that was passed to the constructor or {\bf Create}
1191method. {\bf GetWindowStyle()} is another name for the same function.
a660d684 1192
8c4b73d1 1193
a5e84126
JS
1194\membersection{wxWindow::HasCapture}\label{wxwindowhascapture}
1195
1196\constfunc{virtual bool}{HasCapture}{\void}
1197
cc81d32f 1198Returns true if this window has the current mouse capture.
a5e84126
JS
1199
1200\wxheading{See also}
1201
1202\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},
1203\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},
1204\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}
1205
8c4b73d1 1206
bc5879ef
VZ
1207\membersection{wxWindow::Hide}\label{wxwindowhide}
1208
1209\func{bool}{Hide}{\void}
1210
cc81d32f 1211Equivalent to calling \helpref{Show}{wxwindowshow}({\tt false}).
bc5879ef 1212
8c4b73d1 1213
a660d684
KB
1214\membersection{wxWindow::InitDialog}\label{wxwindowinitdialog}
1215
1216\func{void}{InitDialog}{\void}
1217
9866d9c2
VZ
1218Sends an {\tt wxEVT\_INIT\_DIALOG} event, whose handler usually transfers data
1219to the dialog via validators.
a660d684 1220
8c4b73d1 1221
a660d684
KB
1222\membersection{wxWindow::IsEnabled}\label{wxwindowisenabled}
1223
1224\constfunc{virtual bool}{IsEnabled}{\void}
1225
cc81d32f 1226Returns {\tt true} if the window is enabled for input, {\tt false} otherwise.
a660d684
KB
1227
1228\wxheading{See also}
1229
1230\helpref{wxWindow::Enable}{wxwindowenable}
1231
8c4b73d1 1232
aa4b42f0 1233\membersection{wxWindow::IsExposed}\label{wxwindowisexposed}
ad9edf45
RR
1234
1235\constfunc{bool}{IsExposed}{\param{int }{x}, \param{int }{y}}
1236
605d715d 1237\constfunc{bool}{IsExposed}{\param{wxPoint }{\&pt}}
515da557 1238
ad9edf45
RR
1239\constfunc{bool}{IsExposed}{\param{int }{x}, \param{int }{y}, \param{int }{w}, \param{int }{h}}
1240
605d715d 1241\constfunc{bool}{IsExposed}{\param{wxRect }{\&rect}}
515da557 1242
cc81d32f 1243Returns {\tt true} if the given point or rectangle area has been exposed since the
ad9edf45 1244last repaint. Call this in an paint event handler to optimize redrawing by
4130b487 1245only redrawing those areas, which have been exposed.
ad9edf45 1246
3e02f5ed
RD
1247\pythonnote{In place of a single overloaded method name, wxPython
1248implements the following methods:\par
1249\indented{2cm}{\begin{twocollist}
d3e78bab 1250\twocolitem{{\bf IsExposed(x,y, w=0,h=0)}}{}
3e02f5ed
RD
1251\twocolitem{{\bf IsExposedPoint(pt)}}{}
1252\twocolitem{{\bf IsExposedRect(rect)}}{}
8771a323 1253\end{twocollist}}}
3e02f5ed 1254
8c4b73d1 1255
a660d684
KB
1256\membersection{wxWindow::IsRetained}\label{wxwindowisretained}
1257
1258\constfunc{virtual bool}{IsRetained}{\void}
1259
cc81d32f 1260Returns {\tt true} if the window is retained, {\tt false} otherwise.
a660d684
KB
1261
1262\wxheading{Remarks}
1263
1264Retained windows are only available on X platforms.
1265
8c4b73d1 1266
a660d684
KB
1267\membersection{wxWindow::IsShown}\label{wxwindowisshown}
1268
1269\constfunc{virtual bool}{IsShown}{\void}
1270
cc81d32f 1271Returns {\tt true} if the window is shown, {\tt false} if it has been hidden.
a660d684 1272
8c4b73d1 1273
34636400
VZ
1274\membersection{wxWindow::IsTopLevel}\label{wxwindowistoplevel}
1275
1276\constfunc{bool}{IsTopLevel}{\void}
1277
cc81d32f 1278Returns {\tt true} if the given window is a top-level one. Currently all frames and
34636400
VZ
1279dialogs are considered to be top-level windows (even if they have a parent
1280window).
1281
8c4b73d1 1282
a660d684
KB
1283\membersection{wxWindow::Layout}\label{wxwindowlayout}
1284
1285\func{void}{Layout}{\void}
1286
515da557
RR
1287Invokes the constraint-based layout algorithm or the sizer-based algorithm
1288for this window.
6453876e 1289
aab49a0b
JS
1290See \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout}: when auto
1291layout is on, this function gets called automatically when the window is resized.
a660d684 1292
8c4b73d1 1293
75bff3be
VZ
1294\membersection{wxWindow::LineDown}\label{wxwindowlinedown}
1295
1296This is just a wrapper for \helpref{ScrollLines()}{wxwindowscrolllines}$(1)$.
1297
8c4b73d1 1298
75bff3be
VZ
1299\membersection{wxWindow::LineUp}\label{wxwindowlineup}
1300
1301This is just a wrapper for \helpref{ScrollLines()}{wxwindowscrolllines}$(-1)$.
1302
8c4b73d1 1303
a660d684
KB
1304\membersection{wxWindow::Lower}\label{wxwindowlower}
1305
1306\func{void}{Lower}{\void}
1307
1308Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
1309or frame).
1310
8c4b73d1 1311
a660d684
KB
1312\membersection{wxWindow::MakeModal}\label{wxwindowmakemodal}
1313
8a293590 1314\func{virtual void}{MakeModal}{\param{bool }{flag}}
a660d684
KB
1315
1316Disables all other windows in the application so that
d3e78bab 1317the user can only interact with this window.
a660d684
KB
1318
1319\wxheading{Parameters}
1320
cc81d32f
VS
1321\docparam{flag}{If {\tt true}, this call disables all other windows in the application so that
1322the user can only interact with this window. If {\tt false}, the effect is reversed.}
a660d684 1323
8c4b73d1 1324
a660d684
KB
1325\membersection{wxWindow::Move}\label{wxwindowmove}
1326
eaaa6a06 1327\func{void}{Move}{\param{int}{ x}, \param{int}{ y}}
a660d684 1328
a974387a
JS
1329\func{void}{Move}{\param{const wxPoint\&}{ pt}}
1330
a660d684
KB
1331Moves the window to the given position.
1332
1333\wxheading{Parameters}
1334
1335\docparam{x}{Required x position.}
1336
1337\docparam{y}{Required y position.}
1338
a974387a
JS
1339\docparam{pt}{\helpref{wxPoint}{wxpoint} object representing the position.}
1340
a660d684
KB
1341\wxheading{Remarks}
1342
1343Implementations of SetSize can also implicitly implement the
1344wxWindow::Move function, which is defined in the base wxWindow class
1345as the call:
1346
1347\begin{verbatim}
1348 SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING);
1349\end{verbatim}
1350
1351\wxheading{See also}
1352
1353\helpref{wxWindow::SetSize}{wxwindowsetsize}
1354
06d20283
RD
1355\pythonnote{In place of a single overloaded method name, wxPython
1356implements the following methods:\par
1357\indented{2cm}{\begin{twocollist}
c9110876
VS
1358\twocolitem{{\bf Move(point)}}{Accepts a wxPoint}
1359\twocolitem{{\bf MoveXY(x, y)}}{Accepts a pair of integers}
06d20283
RD
1360\end{twocollist}}
1361}
1362
9866d9c2
VZ
1363%% VZ: wxWindow::OnXXX() functions should not be documented but I'm leaving
1364%% the old docs here in case we want to move any still needed bits to
1365%% the right location (i.e. probably the corresponding events docs)
1366%%
1367%% \membersection{wxWindow::OnActivate}\label{wxwindowonactivate}
1368%%
1369%% \func{void}{OnActivate}{\param{wxActivateEvent\&}{ event}}
1370%%
1371%% Called when a window is activated or deactivated.
1372%%
1373%% \wxheading{Parameters}
1374%%
1375%% \docparam{event}{Object containing activation information.}
1376%%
1377%% \wxheading{Remarks}
1378%%
cc81d32f
VS
1379%% If the window is being activated, \helpref{wxActivateEvent::GetActive}{wxactivateeventgetactive} returns {\tt true},
1380%% otherwise it returns {\tt false} (it is being deactivated).
9866d9c2
VZ
1381%%
1382%% \wxheading{See also}
1383%%
1384%% \helpref{wxActivateEvent}{wxactivateevent},\rtfsp
1385%% \helpref{Event handling overview}{eventhandlingoverview}
1386%%
1387%% \membersection{wxWindow::OnChar}\label{wxwindowonchar}
1388%%
1389%% \func{void}{OnChar}{\param{wxKeyEvent\&}{ event}}
1390%%
1391%% Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
1392%%
1393%% \wxheading{Parameters}
1394%%
1395%% \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for
1396%% details about this class.}
1397%%
1398%% \wxheading{Remarks}
1399%%
1400%% This member function is called in response to a keypress. To intercept this event,
1401%% use the EVT\_CHAR macro in an event table definition. Your {\bf OnChar} handler may call this
1402%% default function to achieve default keypress functionality.
1403%%
1404%% Note that the ASCII values do not have explicit key codes: they are passed as ASCII
1405%% values.
1406%%
1407%% Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
1408%% keypresses, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or
1409%% \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup}.
1410%%
1411%% Most, but not all, windows allow keypresses to be intercepted.
1412%%
1413%% {\bf Tip:} be sure to call {\tt event.Skip()} for events that you don't process in this function,
1414%% otherwise menu shortcuts may cease to work under Windows.
1415%%
1416%% \wxheading{See also}
1417%%
1418%% \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown}, \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup},\rtfsp
1419%% \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp
1420%% \helpref{Event handling overview}{eventhandlingoverview}
1421%%
1422%% \membersection{wxWindow::OnCharHook}\label{wxwindowoncharhook}
1423%%
1424%% \func{void}{OnCharHook}{\param{wxKeyEvent\&}{ event}}
1425%%
1426%% This member is called to allow the window to intercept keyboard events
1427%% before they are processed by child windows.
1428%%
1429%% \wxheading{Parameters}
1430%%
1431%% \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for
1432%% details about this class.}
1433%%
1434%% \wxheading{Remarks}
1435%%
1436%% This member function is called in response to a keypress, if the window is active. To intercept this event,
1437%% use the EVT\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
1438%% keypress, call \helpref{wxEvent::Skip}{wxeventskip} to allow default processing.
1439%%
1440%% An example of using this function is in the implementation of escape-character processing for wxDialog,
1441%% where pressing ESC dismisses the dialog by {\bf OnCharHook} 'forging' a cancel button press event.
1442%%
1443%% Note that the ASCII values do not have explicit key codes: they are passed as ASCII
1444%% values.
1445%%
1446%% This function is only relevant to top-level windows (frames and dialogs), and under
1447%% Windows only. Under GTK the normal EVT\_CHAR\_ event has the functionality, i.e.
1448%% you can intercepts it and if you don't call \helpref{wxEvent::Skip}{wxeventskip}
1449%% the window won't get the event.
1450%%
1451%% \wxheading{See also}
1452%%
1453%% \helpref{wxKeyEvent}{wxkeyevent},\rtfsp
1454%% \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp
1455%% %% GD: OnXXX functions are not documented
1456%% %%\helpref{wxApp::OnCharHook}{wxapponcharhook},\rtfsp
1457%% \helpref{Event handling overview}{eventhandlingoverview}
1458%%
1459%% \membersection{wxWindow::OnCommand}\label{wxwindowoncommand}
1460%%
1461%% \func{virtual void}{OnCommand}{\param{wxEvtHandler\& }{object}, \param{wxCommandEvent\& }{event}}
1462%%
1463%% This virtual member function is called if the control does not handle the command event.
1464%%
1465%% \wxheading{Parameters}
1466%%
1467%% \docparam{object}{Object receiving the command event.}
1468%%
1469%% \docparam{event}{Command event}
1470%%
1471%% \wxheading{Remarks}
1472%%
1473%% This virtual function is provided mainly for backward compatibility. You can also intercept commands
1474%% from child controls by using an event table, with identifiers or identifier ranges to identify
1475%% the control(s) in question.
1476%%
1477%% \wxheading{See also}
1478%%
1479%% \helpref{wxCommandEvent}{wxcommandevent},\rtfsp
1480%% \helpref{Event handling overview}{eventhandlingoverview}
1481%%
1482%% \membersection{wxWindow::OnClose}\label{wxwindowonclose}
1483%%
1484%% \func{virtual bool}{OnClose}{\void}
1485%%
1486%% Called when the user has tried to close a a frame
1487%% or dialog box using the window manager (X) or system menu (Windows).
1488%%
1489%% {\bf Note:} This is an obsolete function.
2edb0bde 1490%% It is superseded by the \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow} event
9866d9c2
VZ
1491%% handler.
1492%%
1493%% \wxheading{Return value}
1494%%
cc81d32f 1495%% If {\tt true} is returned by OnClose, the window will be deleted by the system, otherwise the
9866d9c2
VZ
1496%% attempt will be ignored. Do not delete the window from within this handler, although
1497%% you may delete other windows.
1498%%
1499%% \wxheading{See also}
1500%%
1501%% \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp
1502%% \helpref{wxWindow::Close}{wxwindowclose},\rtfsp
1503%% \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
1504%% \helpref{wxCloseEvent}{wxcloseevent}
1505%%
9866d9c2
VZ
1506%% \membersection{wxWindow::OnKeyDown}\label{wxwindowonkeydown}
1507%%
1508%% \func{void}{OnKeyDown}{\param{wxKeyEvent\&}{ event}}
1509%%
1510%% Called when the user has pressed a key, before it is translated into an ASCII value using other
1511%% modifier keys that might be pressed at the same time.
1512%%
1513%% \wxheading{Parameters}
1514%%
1515%% \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for
1516%% details about this class.}
1517%%
1518%% \wxheading{Remarks}
1519%%
1520%% This member function is called in response to a key down event. To intercept this event,
1521%% use the EVT\_KEY\_DOWN macro in an event table definition. Your {\bf OnKeyDown} handler may call this
1522%% default function to achieve default keypress functionality.
1523%%
1524%% Note that not all keypresses can be intercepted this way. If you wish to intercept special
1525%% keys, such as shift, control, and function keys, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or
1526%% \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup}.
1527%%
1528%% Most, but not all, windows allow keypresses to be intercepted.
1529%%
1530%% {\bf Tip:} be sure to call {\tt event.Skip()} for events that you don't process in this function,
1531%% otherwise menu shortcuts may cease to work under Windows.
1532%%
1533%% \wxheading{See also}
1534%%
1535%% \helpref{wxWindow::OnChar}{wxwindowonchar}, \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup},\rtfsp
1536%% \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp
1537%% \helpref{Event handling overview}{eventhandlingoverview}
1538%%
1539%% \membersection{wxWindow::OnKeyUp}\label{wxwindowonkeyup}
1540%%
1541%% \func{void}{OnKeyUp}{\param{wxKeyEvent\&}{ event}}
1542%%
1543%% Called when the user has released a key.
1544%%
1545%% \wxheading{Parameters}
1546%%
1547%% \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for
1548%% details about this class.}
1549%%
1550%% \wxheading{Remarks}
1551%%
1552%% This member function is called in response to a key up event. To intercept this event,
1553%% use the EVT\_KEY\_UP macro in an event table definition. Your {\bf OnKeyUp} handler may call this
1554%% default function to achieve default keypress functionality.
1555%%
1556%% Note that not all keypresses can be intercepted this way. If you wish to intercept special
1557%% keys, such as shift, control, and function keys, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or
1558%% \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup}.
1559%%
1560%% Most, but not all, windows allow key up events to be intercepted.
1561%%
1562%% \wxheading{See also}
1563%%
1564%% \helpref{wxWindow::OnChar}{wxwindowonchar}, \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown},\rtfsp
1565%% \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp
1566%% \helpref{Event handling overview}{eventhandlingoverview}
1567%%
9866d9c2
VZ
1568%% \membersection{wxWindow::OnInitDialog}\label{wxwindowoninitdialog}
1569%%
1570%% \func{void}{OnInitDialog}{\param{wxInitDialogEvent\&}{ event}}
1571%%
1572%% Default handler for the wxEVT\_INIT\_DIALOG event. Calls \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow}.
1573%%
1574%% \wxheading{Parameters}
1575%%
1576%% \docparam{event}{Dialog initialisation event.}
1577%%
1578%% \wxheading{Remarks}
1579%%
1580%% Gives the window the default behaviour of transferring data to child controls via
1581%% the validator that each control has.
1582%%
1583%% \wxheading{See also}
1584%%
1585%% \helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow}
1586%%
1587%% \membersection{wxWindow::OnMenuCommand}\label{wxwindowonmenucommand}
1588%%
1589%% \func{void}{OnMenuCommand}{\param{wxCommandEvent\& }{event}}
1590%%
1591%% Called when a menu command is received from a menu bar.
1592%%
1593%% \wxheading{Parameters}
1594%%
1595%% \docparam{event}{The menu command event. For more information, see \helpref{wxCommandEvent}{wxcommandevent}.}
1596%%
1597%% \wxheading{Remarks}
1598%%
1599%% A function with this name doesn't actually exist; you can choose any member function to receive
1600%% menu command events, using the EVT\_COMMAND macro for individual commands or EVT\_COMMAND\_RANGE for
1601%% a range of commands.
1602%%
1603%% \wxheading{See also}
1604%%
1605%% \helpref{wxCommandEvent}{wxcommandevent},\rtfsp
1606%% \helpref{wxWindow::OnMenuHighlight}{wxwindowonmenuhighlight},\rtfsp
1607%% \helpref{Event handling overview}{eventhandlingoverview}
1608%%
1609%% \membersection{wxWindow::OnMenuHighlight}\label{wxwindowonmenuhighlight}
1610%%
1611%% \func{void}{OnMenuHighlight}{\param{wxMenuEvent\& }{event}}
1612%%
1613%% Called when a menu select is received from a menu bar: that is, the
1614%% mouse cursor is over a menu item, but the left mouse button has not been
1615%% pressed.
1616%%
1617%% \wxheading{Parameters}
1618%%
1619%% \docparam{event}{The menu highlight event. For more information, see \helpref{wxMenuEvent}{wxmenuevent}.}
1620%%
1621%% \wxheading{Remarks}
1622%%
1623%% You can choose any member function to receive
1624%% menu select events, using the EVT\_MENU\_HIGHLIGHT macro for individual menu items or EVT\_MENU\_HIGHLIGHT\_ALL macro
1625%% for all menu items.
1626%%
1627%% The default implementation for \helpref{wxFrame::OnMenuHighlight}{wxframeonmenuhighlight} displays help
1628%% text in the first field of the status bar.
1629%%
1630%% This function was known as {\bf OnMenuSelect} in earlier versions of wxWindows, but this was confusing
1631%% since a selection is normally a left-click action.
1632%%
1633%% \wxheading{See also}
1634%%
1635%% \helpref{wxMenuEvent}{wxmenuevent},\rtfsp
1636%% \helpref{wxWindow::OnMenuCommand}{wxwindowonmenucommand},\rtfsp
1637%% \helpref{Event handling overview}{eventhandlingoverview}
1638%%
1639%%
1640%% \membersection{wxWindow::OnMouseEvent}\label{wxwindowonmouseevent}
1641%%
1642%% \func{void}{OnMouseEvent}{\param{wxMouseEvent\&}{ event}}
1643%%
1644%% Called when the user has initiated an event with the
1645%% mouse.
1646%%
1647%% \wxheading{Parameters}
1648%%
1649%% \docparam{event}{The mouse event. See \helpref{wxMouseEvent}{wxmouseevent} for
1650%% more details.}
1651%%
1652%% \wxheading{Remarks}
1653%%
1654%% Most, but not all, windows respond to this event.
1655%%
1656%% To intercept this event, use the EVT\_MOUSE\_EVENTS macro in an event table definition, or individual
1657%% mouse event macros such as EVT\_LEFT\_DOWN.
1658%%
1659%% \wxheading{See also}
1660%%
1661%% \helpref{wxMouseEvent}{wxmouseevent},\rtfsp
1662%% \helpref{Event handling overview}{eventhandlingoverview}
1663%%
1664%% \membersection{wxWindow::OnMove}\label{wxwindowonmove}
1665%%
1666%% \func{void}{OnMove}{\param{wxMoveEvent\& }{event}}
1667%%
1668%% Called when a window is moved.
1669%%
1670%% \wxheading{Parameters}
1671%%
1672%% \docparam{event}{The move event. For more information, see \helpref{wxMoveEvent}{wxmoveevent}.}
1673%%
1674%% \wxheading{Remarks}
1675%%
1676%% Use the EVT\_MOVE macro to intercept move events.
1677%%
1678%% \wxheading{Remarks}
1679%%
1680%% Not currently implemented.
1681%%
1682%% \wxheading{See also}
1683%%
1684%% \helpref{wxMoveEvent}{wxmoveevent},\rtfsp
1685%% \helpref{wxFrame::OnSize}{wxframeonsize},\rtfsp
1686%% \helpref{Event handling overview}{eventhandlingoverview}
1687%%
1688%% \membersection{wxWindow::OnPaint}\label{wxwindowonpaint}
1689%%
1690%% \func{void}{OnPaint}{\param{wxPaintEvent\& }{event}}
1691%%
1692%% Sent to the event handler when the window must be refreshed.
1693%%
1694%% \wxheading{Parameters}
1695%%
1696%% \docparam{event}{Paint event. For more information, see \helpref{wxPaintEvent}{wxpaintevent}.}
1697%%
1698%% \wxheading{Remarks}
1699%%
1700%% Use the EVT\_PAINT macro in an event table definition to intercept paint events.
1701%%
1702%% Note that In a paint event handler, the application must {\it always} create a \helpref{wxPaintDC}{wxpaintdc} object,
1703%% even if you do not use it. Otherwise, under MS Windows, refreshing for this and other windows will go wrong.
1704%%
1705%% For example:
1706%%
1707%% \small{%
1708%% \begin{verbatim}
1709%% void MyWindow::OnPaint(wxPaintEvent\& event)
1710%% {
1711%% wxPaintDC dc(this);
1712%%
1713%% DrawMyDocument(dc);
1714%% }
1715%% \end{verbatim}
1716%% }%
1717%%
1718%% You can optimize painting by retrieving the rectangles
1719%% that have been damaged and only repainting these. The rectangles are in
1720%% terms of the client area, and are unscrolled, so you will need to do
1721%% some calculations using the current view position to obtain logical,
1722%% scrolled units.
1723%%
1724%% Here is an example of using the \helpref{wxRegionIterator}{wxregioniterator} class:
1725%%
1726%% {\small%
1727%% \begin{verbatim}
1728%% // Called when window needs to be repainted.
1729%% void MyWindow::OnPaint(wxPaintEvent\& event)
1730%% {
1731%% wxPaintDC dc(this);
1732%%
1733%% // Find Out where the window is scrolled to
1734%% int vbX,vbY; // Top left corner of client
1735%% GetViewStart(&vbX,&vbY);
1736%%
1737%% int vX,vY,vW,vH; // Dimensions of client area in pixels
1738%% wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1739%%
1740%% while (upd)
1741%% {
1742%% vX = upd.GetX();
1743%% vY = upd.GetY();
1744%% vW = upd.GetW();
1745%% vH = upd.GetH();
1746%%
1747%% // Alternatively we can do this:
1748%% // wxRect rect;
1749%% // upd.GetRect(&rect);
1750%%
1751%% // Repaint this rectangle
1752%% ...some code...
1753%%
1754%% upd ++ ;
1755%% }
1756%% }
1757%% \end{verbatim}
1758%% }%
1759%%
1760%% \wxheading{See also}
1761%%
1762%% \helpref{wxPaintEvent}{wxpaintevent},\rtfsp
1763%% \helpref{wxPaintDC}{wxpaintdc},\rtfsp
1764%% \helpref{Event handling overview}{eventhandlingoverview}
1765%%
1766%% \membersection{wxWindow::OnScroll}\label{wxwindowonscroll}
1767%%
1768%% \func{void}{OnScroll}{\param{wxScrollWinEvent\& }{event}}
1769%%
1770%% Called when a scroll window event is received from one of the window's built-in scrollbars.
1771%%
1772%% \wxheading{Parameters}
1773%%
1774%% \docparam{event}{Command event. Retrieve the new scroll position by
1775%% calling \helpref{wxScrollEvent::GetPosition}{wxscrolleventgetposition}, and the
1776%% scrollbar orientation by calling \helpref{wxScrollEvent::GetOrientation}{wxscrolleventgetorientation}.}
1777%%
1778%% \wxheading{Remarks}
1779%%
1780%% Note that it is not possible to distinguish between horizontal and vertical scrollbars
1781%% until the function is executing (you can't have one function for vertical, another
1782%% for horizontal events).
1783%%
1784%% \wxheading{See also}
1785%%
1786%% \helpref{wxScrollWinEvent}{wxscrollwinevent},\rtfsp
1787%% \helpref{Event handling overview}{eventhandlingoverview}
1788%%
1789%% \membersection{wxWindow::OnSetFocus}\label{wxwindowonsetfocus}
1790%%
1791%% \func{void}{OnSetFocus}{\param{wxFocusEvent\& }{event}}
1792%%
1793%% Called when a window's focus is being set.
1794%%
1795%% \wxheading{Parameters}
1796%%
1797%% \docparam{event}{The focus event. For more information, see \helpref{wxFocusEvent}{wxfocusevent}.}
1798%%
1799%% \wxheading{Remarks}
1800%%
1801%% To intercept this event, use the macro EVT\_SET\_FOCUS in an event table definition.
1802%%
1803%% Most, but not all, windows respond to this event.
1804%%
1805%% \wxheading{See also}
1806%%
1807%% \helpref{wxFocusEvent}{wxfocusevent}, \helpref{wxWindow::OnKillFocus}{wxwindowonkillfocus},\rtfsp
1808%% \helpref{Event handling overview}{eventhandlingoverview}
1809%%
1810%% \membersection{wxWindow::OnSize}\label{wxwindowonsize}
1811%%
1812%% \func{void}{OnSize}{\param{wxSizeEvent\& }{event}}
1813%%
1814%% Called when the window has been resized. This is not a virtual function; you should
1815%% provide your own non-virtual OnSize function and direct size events to it using EVT\_SIZE
1816%% in an event table definition.
1817%%
1818%% \wxheading{Parameters}
1819%%
1820%% \docparam{event}{Size event. For more information, see \helpref{wxSizeEvent}{wxsizeevent}.}
1821%%
1822%% \wxheading{Remarks}
1823%%
1824%% You may wish to use this for frames to resize their child windows as appropriate.
1825%%
1826%% Note that the size passed is of
1827%% the whole window: call \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize} for the area which may be
1828%% used by the application.
1829%%
1830%% When a window is resized, usually only a small part of the window is damaged and you
1831%% may only need to repaint that area. However, if your drawing depends on the size of the window,
1832%% you may need to clear the DC explicitly and repaint the whole window. In which case, you
1833%% may need to call \helpref{wxWindow::Refresh}{wxwindowrefresh} to invalidate the entire window.
1834%%
1835%% \wxheading{See also}
1836%%
1837%% \helpref{wxSizeEvent}{wxsizeevent},\rtfsp
1838%% \helpref{Event handling overview}{eventhandlingoverview}
1839%%
1840%% \membersection{wxWindow::OnSysColourChanged}\label{wxwindowonsyscolourchanged}
1841%%
1842%% \func{void}{OnSysColourChanged}{\param{wxOnSysColourChangedEvent\& }{event}}
1843%%
1844%% Called when the user has changed the system colours. Windows only.
1845%%
1846%% \wxheading{Parameters}
1847%%
1848%% \docparam{event}{System colour change event. For more information, see \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent}.}
1849%%
1850%% \wxheading{See also}
1851%%
1852%% \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent},\rtfsp
1853%% \helpref{Event handling overview}{eventhandlingoverview}
a660d684 1854
8c4b73d1 1855
e39af974
JS
1856\membersection{wxWindow::OnInternalIdle}\label{wxwindowoninternalidle}
1857
1858\func{virtual void}{OnInternalIdle}{\void}
1859
1860This virtual function is normally only used internally, but
1861sometimes an application may need it to implement functionality
1862that should not be disabled by an application defining an OnIdle
1863handler in a derived class.
1864
1865This function may be used to do delayed painting, for example,
1866and most implementations call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui}
1867in order to send update events to the window in idle time.
1868
8c4b73d1 1869
75bff3be
VZ
1870\membersection{wxWindow::PageDown}\label{wxwindowpagedown}
1871
1872This is just a wrapper for \helpref{ScrollPages()}{wxwindowscrollpages}$(1)$.
1873
8c4b73d1 1874
75bff3be
VZ
1875\membersection{wxWindow::PageUp}\label{wxwindowpageup}
1876
1877This is just a wrapper for \helpref{ScrollPages()}{wxwindowscrollpages}$(-1)$.
1878
8c4b73d1 1879
a660d684
KB
1880\membersection{wxWindow::PopEventHandler}\label{wxwindowpopeventhandler}
1881
cc81d32f 1882\constfunc{wxEvtHandler*}{PopEventHandler}{\param{bool }{deleteHandler = {\tt false}}}
a660d684
KB
1883
1884Removes and returns the top-most event handler on the event handler stack.
1885
1886\wxheading{Parameters}
1887
cc81d32f
VS
1888\docparam{deleteHandler}{If this is {\tt true}, the handler will be deleted after it is removed. The
1889default value is {\tt false}.}
a660d684
KB
1890
1891\wxheading{See also}
1892
1893\helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp
1894\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp
1895\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
1896\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp
1897\helpref{wxEvtHandler}{wxevthandler}\rtfsp
1898
8c4b73d1 1899
a660d684
KB
1900\membersection{wxWindow::PopupMenu}\label{wxwindowpopupmenu}
1901
605d715d 1902\func{bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{const wxPoint\& }{pos}}
a1665b22
VZ
1903
1904\func{bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}}
a660d684
KB
1905
1906Pops up the given menu at the specified coordinates, relative to this
1907window, and returns control when the user has dismissed the menu. If a
a1665b22
VZ
1908menu item is selected, the corresponding menu event is generated and will be
1909processed as usually.
a660d684
KB
1910
1911\wxheading{Parameters}
1912
1913\docparam{menu}{Menu to pop up.}
1914
a1665b22
VZ
1915\docparam{pos}{The position where the menu will appear.}
1916
a660d684
KB
1917\docparam{x}{Required x position for the menu to appear.}
1918
1919\docparam{y}{Required y position for the menu to appear.}
1920
a660d684
KB
1921\wxheading{See also}
1922
631f1bfe
JS
1923\helpref{wxMenu}{wxmenu}
1924
1925\wxheading{Remarks}
1926
1927Just before the menu is popped up, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called
2259e007
RR
1928to ensure that the menu items are in the correct state. The menu does not get deleted
1929by the window.
a660d684 1930
dfa13ec8
RD
1931\pythonnote{In place of a single overloaded method name, wxPython
1932implements the following methods:\par
1933\indented{2cm}{\begin{twocollist}
c9110876
VS
1934\twocolitem{{\bf PopupMenu(menu, point)}}{Specifies position with a wxPoint}
1935\twocolitem{{\bf PopupMenuXY(menu, x, y)}}{Specifies position with two integers (x, y)}
dfa13ec8
RD
1936\end{twocollist}}
1937}
1938
8c4b73d1 1939
a660d684
KB
1940\membersection{wxWindow::PushEventHandler}\label{wxwindowpusheventhandler}
1941
1942\func{void}{PushEventHandler}{\param{wxEvtHandler* }{handler}}
1943
1944Pushes this event handler onto the event stack for the window.
1945
1946\wxheading{Parameters}
1947
1948\docparam{handler}{Specifies the handler to be pushed.}
1949
1950\wxheading{Remarks}
1951
1952An event handler is an object that is capable of processing the events
1953sent to a window. By default, the window is its own event handler, but
1954an application may wish to substitute another, for example to allow
1955central implementation of event-handling for a variety of different
1956window classes.
1957
1958\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} allows
1959an application to set up a chain of event handlers, where an event not handled by one event handler is
1960handed to the next one in the chain. Use \helpref{wxWindow::PopEventHandler}{wxwindowpopeventhandler} to
1961remove the event handler.
1962
1963\wxheading{See also}
1964
1965\helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp
1966\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp
1967\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp
1968\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp
1969\helpref{wxEvtHandler}{wxevthandler}
1970
8c4b73d1 1971
a660d684
KB
1972\membersection{wxWindow::Raise}\label{wxwindowraise}
1973
1974\func{void}{Raise}{\void}
1975
1976Raises the window to the top of the window hierarchy if it is a managed window (dialog
1977or frame).
1978
8c4b73d1 1979
a660d684
KB
1980\membersection{wxWindow::Refresh}\label{wxwindowrefresh}
1981
cc81d32f 1982\func{virtual void}{Refresh}{\param{bool}{ eraseBackground = {\tt true}}, \param{const wxRect* }{rect
a660d684
KB
1983= NULL}}
1984
d3e78bab 1985Causes an event to be generated to repaint the
a660d684
KB
1986window.
1987
1988\wxheading{Parameters}
1989
cc81d32f 1990\docparam{eraseBackground}{If {\tt true}, the background will be
a660d684
KB
1991erased.}
1992
1993\docparam{rect}{If non-NULL, only the given rectangle will
1994be treated as damaged.}
1995
2b5f62a0
VZ
1996\wxheading{See also}
1997
1998\helpref{wxWindow::RefreshRect}{wxwindowrefreshrect}
1999
8c4b73d1 2000
2b5f62a0
VZ
2001\membersection{wxWindow::RefreshRect}\label{wxwindowrefreshrect}
2002
8c4b73d1 2003\func{void}{Refresh}{\param{const wxRect\& }{rect}}
2b5f62a0
VZ
2004
2005Redraws the contents of the given rectangle: the area inside it will be
2006repainted.
2007
2008This is the same as \helpref{Refresh}{wxwindowrefresh} but has a nicer syntax.
2009
8c4b73d1 2010
5048c832
JS
2011\membersection{wxWindow::RegisterHotKey}\label{wxwindowregisterhotkey}
2012
2013\func{bool}{RegisterHotKey}{\param{int}{ hotkeyId}, \param{int}{ modifiers}, \param{int}{ virtualKeyCode}}
2014
2015Registers a system wide hotkey. Every time the user presses the hotkey registered here, this window
2016will receive a hotkey event. It will receive the event even if the application is in the background
2017and does not have the input focus because the user is working with some other application.
2018
2019\wxheading{Parameters}
2020
2021\docparam{hotkeyId}{Numeric identifier of the hotkey. For applications this must be between 0 and 0xBFFF. If
2022this function is called from a shared DLL, it must be a system wide unique identifier between 0xC000 and 0xFFFF.
2023This is a MSW specific detail.}
2024
2025\docparam{modifiers}{A bitwise combination of {\tt wxMOD\_SHIFT}, {\tt wxMOD\_CONTROL}, {\tt wxMOD\_ALT}
2026or {\tt wxMOD\_WIN} specifying the modifier keys that have to be pressed along with the key.}
2027
2028\docparam{virtualKeyCode}{The virtual key code of the hotkey.}
2029
2030\wxheading{Return value}
2031
2032{\tt true} if the hotkey was registered successfully. {\tt false} if some other application already registered a
2033hotkey with this modifier/virtualKeyCode combination.
2034
2035\wxheading{Remarks}
2036
2037Use EVT\_HOTKEY(hotkeyId, fnc) in the event table to capture the event.
2038This function is currently only implemented under MSW.
2039
2040\wxheading{See also}
2041
2042\helpref{wxWindow::UnregisterHotKey}{wxwindowunregisterhotkey}
2043
8c4b73d1 2044
a660d684
KB
2045\membersection{wxWindow::ReleaseMouse}\label{wxwindowreleasemouse}
2046
2047\func{virtual void}{ReleaseMouse}{\void}
2048
2049Releases mouse input captured with \helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}.
2050
2051\wxheading{See also}
2052
a5e84126
JS
2053\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},
2054\helpref{wxWindow::HasCapture}{wxwindowhascapture},
2055\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},
2056\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}
a660d684 2057
8c4b73d1 2058
a660d684
KB
2059\membersection{wxWindow::RemoveChild}\label{wxwindowremovechild}
2060
2061\func{virtual void}{RemoveChild}{\param{wxWindow* }{child}}
2062
2063Removes a child window. This is called automatically by window deletion
2064functions so should not be required by the application programmer.
2065
afbdbdb4
VZ
2066Notice that this function is mostly internal to wxWindows and shouldn't be
2067called by the user code.
2068
a660d684
KB
2069\wxheading{Parameters}
2070
2071\docparam{child}{Child window to remove.}
2072
8c4b73d1 2073
741ed114 2074\membersection{wxWindow::RemoveEventHandler}\label{wxwindowremoveeventhandler}
2e36d5cf
VZ
2075
2076\func{bool}{RemoveEventHandler}{\param{wxEvtHandler *}{handler}}
2077
2078Find the given {\it handler} in the windows event handler chain and remove (but
2079not delete) it from it.
2080
2081\wxheading{Parameters}
2082
2083\docparam{handler}{The event handler to remove, must be non {\tt NULL} and
2084must be present in this windows event handlers chain}
2085
2086\wxheading{Return value}
2087
cc81d32f 2088Returns {\tt true} if it was found and {\tt false} otherwise (this also results
2e36d5cf
VZ
2089in an assert failure so this function should only be called when the
2090handler is supposed to be there).
2091
2092\wxheading{See also}
2093
2094\helpref{PushEventHandler}{wxwindowpusheventhandler},\rtfsp
2095\helpref{PopEventHandler}{wxwindowpopeventhandler}
2096
8c4b73d1 2097
2259e007
RR
2098\membersection{wxWindow::Reparent}\label{wxwindowreparent}
2099
2100\func{virtual bool}{Reparent}{\param{wxWindow* }{newParent}}
2101
2102Reparents the window, i.e the window will be removed from its
18ac8d69 2103current parent window (e.g. a non-standard toolbar in a wxFrame)
103aab26 2104and then re-inserted into another. Available on Windows and GTK.
2259e007
RR
2105
2106\wxheading{Parameters}
2107
2108\docparam{newParent}{New parent.}
2109
8c4b73d1 2110
a974387a 2111\membersection{wxWindow::ScreenToClient}\label{wxwindowscreentoclient}
a660d684
KB
2112
2113\constfunc{virtual void}{ScreenToClient}{\param{int* }{x}, \param{int* }{y}}
2114
a974387a
JS
2115\constfunc{virtual wxPoint}{ScreenToClient}{\param{const wxPoint\& }{pt}}
2116
a660d684
KB
2117Converts from screen to client window coordinates.
2118
2119\wxheading{Parameters}
2120
2121\docparam{x}{Stores the screen x coordinate and receives the client x coordinate.}
2122
2123\docparam{y}{Stores the screen x coordinate and receives the client x coordinate.}
2124
a974387a
JS
2125\docparam{pt}{The screen position for the second form of the function.}
2126
06d20283
RD
2127\pythonnote{In place of a single overloaded method name, wxPython
2128implements the following methods:\par
2129\indented{2cm}{\begin{twocollist}
c9110876
VS
2130\twocolitem{{\bf ScreenToClient(point)}}{Accepts and returns a wxPoint}
2131\twocolitem{{\bf ScreenToClientXY(x, y)}}{Returns a 2-tuple, (x, y)}
06d20283
RD
2132\end{twocollist}}
2133}
2134
8c4b73d1 2135
70e81893
VZ
2136\membersection{wxWindow::ScrollLines}\label{wxwindowscrolllines}
2137
9cd6d737 2138\func{virtual bool}{ScrollLines}{\param{int }{lines}}
70e81893
VZ
2139
2140Scrolls the window by the given number of lines down (if {\it lines} is
2141positive) or up.
2142
9cd6d737
VZ
2143\wxheading{Return value}
2144
cc81d32f 2145Returns {\tt true} if the window was scrolled, {\tt false} if it was already
9cd6d737
VZ
2146on top/bottom and nothing was done.
2147
2148\wxheading{Remarks}
2149
2150This function is currently only implemented under MSW and wxTextCtrl under
2151wxGTK (it also works for wxScrolledWindow derived classes under all
2152platforms).
70e81893
VZ
2153
2154\wxheading{See also}
2155
2156\helpref{ScrollPages}{wxwindowscrollpages}
2157
8c4b73d1 2158
70e81893
VZ
2159\membersection{wxWindow::ScrollPages}\label{wxwindowscrollpages}
2160
9cd6d737 2161\func{virtual bool}{ScrollPages}{\param{int }{pages}}
70e81893
VZ
2162
2163Scrolls the window by the given number of pages down (if {\it pages} is
2164positive) or up.
2165
9cd6d737
VZ
2166\wxheading{Return value}
2167
cc81d32f 2168Returns {\tt true} if the window was scrolled, {\tt false} if it was already
9cd6d737
VZ
2169on top/bottom and nothing was done.
2170
2171\wxheading{Remarks}
2172
2173This function is currently only implemented under MSW and wxTextCtrl under
2174wxGTK (it also works for wxScrolledWindow derived classes under all
2175platforms).
70e81893
VZ
2176
2177\wxheading{See also}
2178
2179\helpref{ScrollLines}{wxwindowscrolllines}
06d20283 2180
8c4b73d1 2181
a660d684
KB
2182\membersection{wxWindow::ScrollWindow}\label{wxwindowscrollwindow}
2183
eaaa6a06 2184\func{virtual void}{ScrollWindow}{\param{int }{dx}, \param{int }{dy}, \param{const wxRect*}{ rect = NULL}}
a660d684 2185
6453876e 2186Physically scrolls the pixels in the window and move child windows accordingly.
a660d684
KB
2187
2188\wxheading{Parameters}
2189
2190\docparam{dx}{Amount to scroll horizontally.}
2191
2192\docparam{dy}{Amount to scroll vertically.}
2193
2194\docparam{rect}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
2195pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
f6bcfd97 2196can optimize painting by checking for the invalidated region. This parameter is ignored under GTK.}
a660d684
KB
2197
2198\wxheading{Remarks}
2199
a660d684 2200Use this function to optimise your scrolling implementations, to minimise the area that must be
6453876e 2201redrawn. Note that it is rarely required to call this function from a user program.
a660d684 2202
8c4b73d1 2203
3972fb49
JS
2204\membersection{wxWindow::SetAcceleratorTable}\label{wxwindowsetacceleratortable}
2205
2206\func{virtual void}{SetAcceleratorTable}{\param{const wxAcceleratorTable\&}{ accel}}
2207
2208Sets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxacceleratortable}.
2209
8c4b73d1 2210
2dab56e9
JS
2211\membersection{wxWindow::SetAccessible}\label{wxwindowsetaccessible}
2212
2213\func{void}{SetAccessible}{\param{wxAccessibile*}{ accessible}}
2214
2215Sets the accessible for this window. Any existing accessible for this window
2216will be deleted first, if not identical to {\it accessible}.
2217
2218See also \helpref{wxAccessible}{wxaccessible}.
2219
8c4b73d1 2220
a660d684
KB
2221\membersection{wxWindow::SetAutoLayout}\label{wxwindowsetautolayout}
2222
8a293590 2223\func{void}{SetAutoLayout}{\param{bool}{ autoLayout}}
a660d684
KB
2224
2225Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will
e5251d4f
VZ
2226be called automatically when the window is resized. It is called implicitly by
2227\helpref{wxWindow::SetSizer}{wxwindowsetsizer} but if you use
2228\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} you should call it
2229manually or otherwise the window layout won't be correctly updated when its
2230size changes.
a660d684
KB
2231
2232\wxheading{Parameters}
2233
cc81d32f 2234\docparam{autoLayout}{Set this to {\tt true} if you wish the Layout function to be called
a660d684
KB
2235from within wxWindow::OnSize functions.}
2236
2237\wxheading{See also}
2238
2239\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints}
2240
8c4b73d1 2241
a660d684
KB
2242\membersection{wxWindow::SetBackgroundColour}\label{wxwindowsetbackgroundcolour}
2243
2244\func{virtual void}{SetBackgroundColour}{\param{const wxColour\& }{colour}}
2245
2246Sets the background colour of the window.
2247
2248\wxheading{Parameters}
2249
2250\docparam{colour}{The colour to be used as the background colour.}
2251
2252\wxheading{Remarks}
2253
2254The background colour is usually painted by the default\rtfsp
f4fcc291 2255\helpref{wxEraseEvent}{wxeraseevent} event handler function
6453876e 2256under Windows and automatically under GTK.
a660d684 2257
5b6aa0ff 2258Note that setting the background colour does not cause an immediate refresh, so you
684761db 2259may wish to call \helpref{wxWindow::ClearBackground}{wxwindowclearbackground} or \helpref{wxWindow::Refresh}{wxwindowrefresh} after
5b6aa0ff
JS
2260calling this function.
2261
684761db
JS
2262Use this function with care under GTK+ as the new appearance of the window might
2263not look equally well when used with "Themes", i.e GTK+'s ability to change its
103aab26 2264look as the user wishes with run-time loadable modules.
6453876e 2265
a660d684
KB
2266\wxheading{See also}
2267
2268\helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour},\rtfsp
2269\helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp
2270\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp
684761db 2271\helpref{wxWindow::ClearBackground}{wxwindowclearbackground},\rtfsp
5b6aa0ff 2272\helpref{wxWindow::Refresh}{wxwindowrefresh},\rtfsp
f4fcc291 2273\helpref{wxEraseEvent}{wxeraseevent}
a660d684 2274
8c4b73d1 2275
f6bcfd97
BP
2276\membersection{wxWindow::SetCaret}\label{wxwindowsetcaret}
2277
2278\constfunc{void}{SetCaret}{\param{wxCaret *}{caret}}
2279
2280Sets the \helpref{caret}{wxcaret} associated with the window.
2281
8c4b73d1 2282
dbdb39b2
JS
2283\membersection{wxWindow::SetClientSize}\label{wxwindowsetclientsize}
2284
2285\func{virtual void}{SetClientSize}{\param{int}{ width}, \param{int}{ height}}
2286
2287\func{virtual void}{SetClientSize}{\param{const wxSize\&}{ size}}
2288
2289This sets the size of the window client area in pixels. Using this function to size a window
2290tends to be more device-independent than \helpref{wxWindow::SetSize}{wxwindowsetsize}, since the application need not
2291worry about what dimensions the border or title bar have when trying to fit the window
2292around panel items, for example.
2293
2294\wxheading{Parameters}
2295
2296\docparam{width}{The required client area width.}
2297
2298\docparam{height}{The required client area height.}
2299
2300\docparam{size}{The required client size.}
2301
06d20283
RD
2302\pythonnote{In place of a single overloaded method name, wxPython
2303implements the following methods:\par
2304\indented{2cm}{\begin{twocollist}
c9110876
VS
2305\twocolitem{{\bf SetClientSize(size)}}{Accepts a wxSize}
2306\twocolitem{{\bf SetClientSizeWH(width, height)}}{}
06d20283
RD
2307\end{twocollist}}
2308}
2309
8c4b73d1 2310
be90c029
RD
2311\membersection{wxWindow::SetContainingSizer}\label{wxwindowsetcontainingsizer}
2312
2313\func{void}{SetContainingSizer}{\param{wxSizer* }{sizer}}
2314
2315This normally does not need to be called by user code. It is called
2316when a window is added to a sizer, and is used so the window can
2317remove itself from the sizer when it is destroyed.
2318
8c4b73d1 2319
dbdb39b2
JS
2320\membersection{wxWindow::SetCursor}\label{wxwindowsetcursor}
2321
2322\func{virtual void}{SetCursor}{\param{const wxCursor\&}{cursor}}
2323
8a9c2246
VZ
2324% VZ: the docs are correct, if the code doesn't behave like this, it must be
2325% changed
2326Sets the window's cursor. Notice that the window cursor also sets it for the
2327children of the window implicitly.
2328
2329The {\it cursor} may be {\tt wxNullCursor} in which case the window cursor will
2330be reset back to default.
dbdb39b2
JS
2331
2332\wxheading{Parameters}
2333
2334\docparam{cursor}{Specifies the cursor that the window should normally display.}
2335
dbdb39b2
JS
2336\wxheading{See also}
2337
2338\helpref{::wxSetCursor}{wxsetcursor}, \helpref{wxCursor}{wxcursor}
2339
8c4b73d1 2340
a660d684
KB
2341\membersection{wxWindow::SetConstraints}\label{wxwindowsetconstraints}
2342
2343\func{void}{SetConstraints}{\param{wxLayoutConstraints* }{constraints}}
2344
2345Sets the window to have the given layout constraints. The window
2346will then own the object, and will take care of its deletion.
2347If an existing layout constraints object is already owned by the
2348window, it will be deleted.
2349
2350\wxheading{Parameters}
2351
2352\docparam{constraints}{The constraints to set. Pass NULL to disassociate and delete the window's
2353constraints.}
2354
2355\wxheading{Remarks}
2356
2357You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use
2cdac558 2358the constraints automatically in OnSize; otherwise, you must override OnSize and call Layout()
515da557
RR
2359explicitly. When setting both a wxLayoutConstraints and a \helpref{wxSizer}{wxsizer}, only the
2360sizer will have effect.
a660d684 2361
8c4b73d1 2362
dface61c
JS
2363\membersection{wxWindow::SetDropTarget}\label{wxwindowsetdroptarget}
2364
2365\func{void}{SetDropTarget}{\param{wxDropTarget*}{ target}}
2366
2367Associates a drop target with this window.
2368
2369If the window already has a drop target, it is deleted.
2370
2371\wxheading{See also}
2372
c9f00eeb 2373\helpref{wxWindow::GetDropTarget}{wxwindowgetdroptarget},
dface61c
JS
2374\helpref{Drag and drop overview}{wxdndoverview}
2375
8c4b73d1 2376
f6bcfd97
BP
2377\membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler}
2378
2379\func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}}
2380
2381Sets the event handler for this window.
2382
2383\wxheading{Parameters}
2384
2385\docparam{handler}{Specifies the handler to be set.}
2386
2387\wxheading{Remarks}
2388
2389An event handler is an object that is capable of processing the events
2390sent to a window. By default, the window is its own event handler, but
2391an application may wish to substitute another, for example to allow
2392central implementation of event-handling for a variety of different
2393window classes.
2394
2395It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since
2396this sets up a chain of event handlers, where an event not handled by one event handler is
2397handed to the next one in the chain.
2398
2399\wxheading{See also}
2400
2401\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp
2402\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
2403\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp
2404\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp
2405\helpref{wxEvtHandler}{wxevthandler}
2406
8c4b73d1 2407
d80cd92a
VZ
2408\membersection{wxWindow::SetExtraStyle}\label{wxwindowsetextrastyle}
2409
2410\func{void}{SetExtraStyle}{\param{long }{exStyle}}
2411
2412Sets the extra style bits for the window. The currently defined extra style
2413bits are:
2414
2415\twocolwidtha{5cm}%
2416\begin{twocollist}\itemsep=0pt
2417\twocolitem{\windowstyle{wxWS\_EX\_VALIDATE\_RECURSIVELY}}{TransferDataTo/FromWindow()
2418and Validate() methods will recursively descend into all children of the
2419window if it has this style flag set.}
e4b713a2 2420\twocolitem{\windowstyle{wxWS\_EX\_BLOCK\_EVENTS}}{Normally, the command
2edb0bde 2421events are propagated upwards to the window parent recursively until a handler
e4b713a2
VZ
2422for them is found. Using this style allows to prevent them from being
2423propagated beyond this window. Notice that wxDialog has this style on by
be90c029 2424default for the reasons explained in the
e4b713a2 2425\helpref{event processing overview}{eventprocessing}.}
39cc7a0b
VZ
2426\twocolitem{\windowstyle{wxWS\_EX\_TRANSIENT}}{This can be used to prevent a
2427window from being used as an implicit parent for the dialogs which were
2428created without a parent. It is useful for the windows which can disappear at
2edb0bde 2429any moment as creating children of such windows results in fatal problems.}
335c9e32
VZ
2430\twocolitem{\windowstyle{wxFRAME\_EX\_CONTEXTHELP}}{Under Windows, puts a query button on the
2431caption. When pressed, Windows will go into a context-sensitive help mode and wxWindows will send
2432a wxEVT\_HELP event if the user clicked on an application window.
2433This style cannot be used together with wxMAXIMIZE\_BOX or wxMINIMIZE\_BOX, so
be90c029 2434you should use the style of
7af3ca16 2435{\tt wxDEFAULT\_FRAME\_STYLE \& \textasciitilde(wxMINIMIZE\_BOX | wxMAXIMIZE\_BOX)} for the
335c9e32
VZ
2436frames having this style (the dialogs don't have minimize nor maximize box by
2437default)}
d3e78bab
JS
2438\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_IDLE}}{This window should always process idle events, even
2439if the mode set by \helpref{wxIdleEvent::SetMode}{wxidleeventsetmode} is wxIDLE\_PROCESS\_SPECIFIED.}
2440\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_UI\_UPDATES}}{This window should always process UI update events,
2441even if the mode set by \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} is wxUPDATE\_UI\_PROCESS\_SPECIFIED.}
d80cd92a
VZ
2442\end{twocollist}
2443
8c4b73d1 2444
a660d684
KB
2445\membersection{wxWindow::SetFocus}\label{wxwindowsetfocus}
2446
2447\func{virtual void}{SetFocus}{\void}
2448
2449This sets the window to receive keyboard input.
2450
d577d610
VZ
2451\wxheading{See also}
2452
2453\helpref{wxFocusEvent}{wxfocusevent}
2454
8c4b73d1 2455
d577d610
VZ
2456\membersection{wxWindow::SetFocusFromKbd}\label{wxwindowsetfocusfromkbd}
2457
2458\func{virtual void}{SetFocusFromKbd}{\void}
2459
2460This function is called by wxWindows keyboard navigation code when the user
2461gives the focus to this window from keyboard (e.g. using {\tt TAB} key).
2462By default this method simply calls \helpref{SetFocus}{wxwindowsetfocus} but
2463can be overridden to do something in addition to this in the derived classes.
2464
8c4b73d1 2465
a660d684
KB
2466\membersection{wxWindow::SetFont}\label{wxwindowsetfont}
2467
2468\func{void}{SetFont}{\param{const wxFont\& }{font}}
2469
2470Sets the font for this window.
2471
2472\wxheading{Parameters}
2473
2474\docparam{font}{Font to associate with this window.}
2475
2476\wxheading{See also}
2477
2478\helpref{wxWindow::GetFont}{wxwindowgetfont}
2479
8c4b73d1 2480
a660d684
KB
2481\membersection{wxWindow::SetForegroundColour}\label{wxwindowsetforegroundcolour}
2482
2483\func{virtual void}{SetForegroundColour}{\param{const wxColour\& }{colour}}
2484
2485Sets the foreground colour of the window.
2486
2487\wxheading{Parameters}
2488
2489\docparam{colour}{The colour to be used as the foreground colour.}
2490
2491\wxheading{Remarks}
2492
2493The interpretation of foreground colour is open to interpretation according
2494to the window class; it may be the text colour or other colour, or it may not
2495be used at all.
2496
6453876e 2497Note that when using this functions under GTK, you will disable the so called "themes",
2edb0bde 2498i.e. the user chosen appearance of windows and controls, including the themes of
6453876e
RR
2499their parent windows.
2500
a660d684
KB
2501\wxheading{See also}
2502
2503\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp
2504\helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp
2505\helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour}
2506
8c4b73d1 2507
4e28924c
JS
2508\membersection{wxWindow::SetHelpText}\label{wxwindowsethelptext}
2509
2510\func{virtual void}{SetHelpText}{\param{const wxString\& }{helpText}}
2511
2512Sets the help text to be used as context-sensitive help for this window.
2513
2514Note that the text is actually stored by the current \helpref{wxHelpProvider}{wxhelpprovider} implementation,
2515and not in the window object itself.
2516
2517\wxheading{See also}
2518
2519\helpref{GetHelpText}{wxwindowgethelptext}, \helpref{wxHelpProvider}{wxhelpprovider}
2520
8c4b73d1 2521
a660d684
KB
2522\membersection{wxWindow::SetId}\label{wxwindowsetid}
2523
2524\func{void}{SetId}{\param{int}{ id}}
2525
2526Sets the identifier of the window.
2527
2528\wxheading{Remarks}
2529
2530Each window has an integer identifier. If the application has not provided one,
2531an identifier will be generated. Normally, the identifier should be provided
2532on creation and should not be modified subsequently.
2533
a660d684
KB
2534\wxheading{See also}
2535
5b6aa0ff
JS
2536\helpref{wxWindow::GetId}{wxwindowgetid},\rtfsp
2537\helpref{Window identifiers}{windowids}
a660d684 2538
8c4b73d1 2539
a660d684
KB
2540\membersection{wxWindow::SetName}\label{wxwindowsetname}
2541
2542\func{virtual void}{SetName}{\param{const wxString\& }{name}}
2543
2544Sets the window's name.
2545
2546\wxheading{Parameters}
2547
2548\docparam{name}{A name to set for the window.}
2549
2550\wxheading{See also}
2551
2552\helpref{wxWindow::GetName}{wxwindowgetname}
2553
8c4b73d1 2554
dbdb39b2
JS
2555\membersection{wxWindow::SetPalette}\label{wxwindowsetpalette}
2556
2557\func{virtual void}{SetPalette}{\param{wxPalette* }{palette}}
2558
2559Obsolete - use \helpref{wxDC::SetPalette}{wxdcsetpalette} instead.
2560
8c4b73d1 2561
a660d684
KB
2562\membersection{wxWindow::SetScrollbar}\label{wxwindowsetscrollbar}
2563
eaaa6a06
JS
2564\func{virtual void}{SetScrollbar}{\param{int }{orientation}, \param{int }{position},\rtfsp
2565\param{int }{thumbSize}, \param{int }{range},\rtfsp
cc81d32f 2566\param{bool }{refresh = {\tt true}}}
a660d684
KB
2567
2568Sets the scrollbar properties of a built-in scrollbar.
2569
2570\wxheading{Parameters}
2571
2572\docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.}
2573
2574\docparam{position}{The position of the scrollbar in scroll units.}
2575
2576\docparam{thumbSize}{The size of the thumb, or visible portion of the scrollbar, in scroll units.}
2577
2578\docparam{range}{The maximum position of the scrollbar.}
2579
cc81d32f 2580\docparam{refresh}{{\tt true} to redraw the scrollbar, {\tt false} otherwise.}
a660d684
KB
2581
2582\wxheading{Remarks}
2583
2584Let's say you wish to display 50 lines of text, using the same font.
2585The window is sized so that you can only see 16 lines at a time.
2586
2587You would use:
2588
2589{\small%
2590\begin{verbatim}
2591 SetScrollbar(wxVERTICAL, 0, 16, 50);
2592\end{verbatim}
2593}
2594
2595Note that with the window at this size, the thumb position can never go
2596above 50 minus 16, or 34.
2597
2598You can determine how many lines are currently visible by dividing the current view
2599size by the character height in pixels.
2600
2601When defining your own scrollbar behaviour, you will always need to recalculate
2602the scrollbar settings when the window size changes. You could therefore put your
2603scrollbar calculations and SetScrollbar
2604call into a function named AdjustScrollbars, which can be called initially and also
f4fcc291 2605from your \helpref{wxSizeEvent}{wxsizeevent} handler function.
a660d684
KB
2606
2607\wxheading{See also}
2608
2609\helpref{Scrolling overview}{scrollingoverview},\rtfsp
2610\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
2611
2612\begin{comment}
8c4b73d1 2613
a660d684
KB
2614\membersection{wxWindow::SetScrollPage}\label{wxwindowsetscrollpage}
2615
cc81d32f 2616\func{virtual void}{SetScrollPage}{\param{int }{orientation}, \param{int }{pageSize}, \param{bool }{refresh = {\tt true}}}
a660d684
KB
2617
2618Sets the page size of one of the built-in scrollbars.
2619
2620\wxheading{Parameters}
2621
2622\docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.}
2623
2624\docparam{pageSize}{Page size in scroll units.}
2625
cc81d32f 2626\docparam{refresh}{{\tt true} to redraw the scrollbar, {\tt false} otherwise.}
a660d684
KB
2627
2628\wxheading{Remarks}
2629
2630The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
2631click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
2632page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
2633value has to be adjusted when the window is resized, since the page size will have changed.
2634
2635In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
2636the thumb changes size to reflect the page size relative to the length of the document. When the
2637document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
2638will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
2639disappear.
2640
2641Currently, this function should be called before SetPageRange, because of a quirk in the Windows
2642handling of pages and ranges.
2643
2644\wxheading{See also}
2645
2646\helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp
a660d684 2647\helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp
f7bd2698 2648\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp
a660d684
KB
2649\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
2650\end{comment}
2651
8c4b73d1 2652
a660d684
KB
2653\membersection{wxWindow::SetScrollPos}\label{wxwindowsetscrollpos}
2654
cc81d32f 2655\func{virtual void}{SetScrollPos}{\param{int }{orientation}, \param{int }{pos}, \param{bool }{refresh = {\tt true}}}
a660d684
KB
2656
2657Sets the position of one of the built-in scrollbars.
2658
2659\wxheading{Parameters}
2660
2661\docparam{orientation}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.}
2662
2663\docparam{pos}{Position in scroll units.}
2664
cc81d32f 2665\docparam{refresh}{{\tt true} to redraw the scrollbar, {\tt false} otherwise.}
a660d684
KB
2666
2667\wxheading{Remarks}
2668
2669This function does not directly affect the contents of the window: it is up to the
2670application to take note of scrollbar attributes and redraw contents accordingly.
2671
2672\wxheading{See also}
2673
2674\helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar},\rtfsp
2675\helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp
f7bd2698 2676\helpref{wxWindow::GetScrollThumb}{wxwindowgetscrollthumb},\rtfsp
a660d684
KB
2677\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
2678
2679\begin{comment}
8c4b73d1 2680
a660d684
KB
2681\membersection{wxWindow::SetScrollRange}\label{wxwindowsetscrollrange}
2682
cc81d32f 2683\func{virtual void}{SetScrollRange}{\param{int }{orientation}, \param{int }{range}, \param{bool }{refresh = {\tt true}}}
a660d684
KB
2684
2685Sets the range of one of the built-in scrollbars.
2686
2687\wxheading{Parameters}
2688
2689\docparam{orientation}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.}
2690
2691\docparam{range}{Scroll range.}
2692
cc81d32f 2693\docparam{refresh}{{\tt true} to redraw the scrollbar, {\tt false} otherwise.}
a660d684
KB
2694
2695\wxheading{Remarks}
2696
2697The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
fe604ccd
JS
2698object length of the scrollbar. If you are implementing a scrolling window, for example, you
2699would adjust the scroll range when the window is resized, by subtracting the window view size from the
2700total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
a660d684
KB
2701and usually the scrollbar will be automatically hidden.
2702
2703\wxheading{See also}
2704
2705\helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp
2706\helpref{wxWindow::SetScrollPage}{wxwindowsetscrollpage},\rtfsp
2707\helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp
f7bd2698 2708\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp
a660d684
KB
2709\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
2710\end{comment}
2711
8c4b73d1 2712
a660d684
KB
2713\membersection{wxWindow::SetSize}\label{wxwindowsetsize}
2714
eaaa6a06
JS
2715\func{virtual void}{SetSize}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height},
2716 \param{int}{ sizeFlags = wxSIZE\_AUTO}}
a660d684 2717
a974387a
JS
2718\func{virtual void}{SetSize}{\param{const wxRect\&}{ rect}}
2719
a660d684
KB
2720Sets the size and position of the window in pixels.
2721
eaaa6a06 2722\func{virtual void}{SetSize}{\param{int}{ width}, \param{int}{ height}}
a660d684 2723
a974387a
JS
2724\func{virtual void}{SetSize}{\param{const wxSize\&}{ size}}
2725
a660d684
KB
2726Sets the size of the window in pixels.
2727
2728\wxheading{Parameters}
2729
2730\docparam{x}{Required x position in pixels, or -1 to indicate that the existing
2731value should be used.}
2732
2733\docparam{y}{Required y position in pixels, or -1 to indicate that the existing
2734value should be used.}
2735
2736\docparam{width}{Required width in pixels, or -1 to indicate that the existing
2737value should be used.}
2738
2739\docparam{height}{Required height position in pixels, or -1 to indicate that the existing
2740value should be used.}
2741
a974387a
JS
2742\docparam{size}{\helpref{wxSize}{wxsize} object for setting the size.}
2743
2744\docparam{rect}{\helpref{wxRect}{wxrect} object for setting the position and size.}
2745
a660d684
KB
2746\docparam{sizeFlags}{Indicates the interpretation of other parameters. It is a bit list of the following:
2747
2748{\bf wxSIZE\_AUTO\_WIDTH}: a -1 width value is taken to indicate
2749a wxWindows-supplied default width.\\
2750{\bf wxSIZE\_AUTO\_HEIGHT}: a -1 height value is taken to indicate
2751a wxWindows-supplied default width.\\
2752{\bf wxSIZE\_AUTO}: -1 size values are taken to indicate
2753a wxWindows-supplied default size.\\
2754{\bf wxSIZE\_USE\_EXISTING}: existing dimensions should be used
2755if -1 values are supplied.\\
2756{\bf wxSIZE\_ALLOW\_MINUS\_ONE}: allow dimensions of -1 and less to be interpreted
2757as real dimensions, not default values.
2758}
2759
2760\wxheading{Remarks}
2761
2762The second form is a convenience for calling the first form with default
2763x and y parameters, and must be used with non-default width and height values.
2764
2765The first form sets the position and optionally size, of the window.
2766Parameters may be -1 to indicate either that a default should be supplied
2767by wxWindows, or that the current value of the dimension should be used.
2768
2769\wxheading{See also}
2770
2771\helpref{wxWindow::Move}{wxwindowmove}
2772
06d20283
RD
2773\pythonnote{In place of a single overloaded method name, wxPython
2774implements the following methods:\par
2775\indented{2cm}{\begin{twocollist}
c9110876
VS
2776\twocolitem{{\bf SetDimensions(x, y, width, height, sizeFlags=wxSIZE\_AUTO)}}{}
2777\twocolitem{{\bf SetSize(size)}}{}
2778\twocolitem{{\bf SetPosition(point)}}{}
06d20283
RD
2779\end{twocollist}}
2780}
2781
8c4b73d1 2782
a660d684
KB
2783\membersection{wxWindow::SetSizeHints}\label{wxwindowsetsizehints}
2784
eaaa6a06
JS
2785\func{virtual void}{SetSizeHints}{\param{int}{ minW=-1}, \param{int}{ minH=-1}, \param{int}{ maxW=-1}, \param{int}{ maxH=-1},
2786 \param{int}{ incW=-1}, \param{int}{ incH=-1}}
a660d684
KB
2787
2788Allows specification of minimum and maximum window sizes, and window size increments.
2789If a pair of values is not set (or set to -1), the default values will be used.
2790
2791\wxheading{Parameters}
2792
2793\docparam{minW}{Specifies the minimum width allowable.}
2794
2795\docparam{minH}{Specifies the minimum height allowable.}
2796
2797\docparam{maxW}{Specifies the maximum width allowable.}
2798
2799\docparam{maxH}{Specifies the maximum height allowable.}
2800
2801\docparam{incW}{Specifies the increment for sizing the width (Motif/Xt only).}
2802
2803\docparam{incH}{Specifies the increment for sizing the height (Motif/Xt only).}
2804
2805\wxheading{Remarks}
2806
2807If this function is called, the user will not be able to size the window outside the
2808given bounds.
2809
2810The resizing increments are only significant under Motif or Xt.
2811
8c4b73d1 2812
515da557
RR
2813\membersection{wxWindow::SetSizer}\label{wxwindowsetsizer}
2814
cc81d32f 2815\func{void}{SetSizer}{\param{wxSizer* }{sizer}, \param{bool }{deleteOld=true}}
515da557
RR
2816
2817Sets the window to have the given layout sizer. The window
2818will then own the object, and will take care of its deletion.
2819If an existing layout constraints object is already owned by the
cc81d32f 2820window, it will be deleted if the deleteOld parameter is true.
515da557 2821
e5251d4f 2822Note that this function will also call
cc81d32f
VS
2823\helpref{SetAutoLayout}{wxwindowsetautolayout} implicitly with {\tt true}
2824parameter if the {\it sizer}\/ is non-NULL and {\tt false} otherwise.
e5251d4f 2825
515da557
RR
2826\wxheading{Parameters}
2827
3aa5d532
RL
2828\docparam{sizer}{The sizer to set. Pass NULL to disassociate and conditionally delete
2829the window's sizer. See below.}
2830
cc81d32f
VS
2831\docparam{deleteOld}{If true (the default), this will delete any prexisting sizer.
2832Pass false if you wish to handle deleting the old sizer yourself.}
515da557
RR
2833
2834\wxheading{Remarks}
2835
566d84a7
RL
2836SetSizer now enables and disables Layout automatically, but prior to wxWindows 2.3.3
2837the following applied:
2838
515da557 2839You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use
2cdac558
RD
2840the sizer automatically in OnSize; otherwise, you must override OnSize and call Layout()
2841explicitly. When setting both a wxSizer and a \helpref{wxLayoutConstraints}{wxlayoutconstraints},
515da557
RR
2842only the sizer will have effect.
2843
8c4b73d1 2844
566d84a7
RL
2845\membersection{wxWindow::SetSizerAndFit}\label{wxwindowsetsizerandfit}
2846
cc81d32f 2847\func{void}{SetSizerAndFit}{\param{wxSizer* }{sizer}, \param{bool }{deleteOld=true}}
566d84a7
RL
2848
2849The same as \helpref{SetSizer}{wxwindowsetsizer}, except it also sets the size hints
2850for the window based on the sizer's minimum size.
2851
8c4b73d1 2852
a660d684
KB
2853\membersection{wxWindow::SetTitle}\label{wxwindowsettitle}
2854
2855\func{virtual void}{SetTitle}{\param{const wxString\& }{title}}
2856
2857Sets the window's title. Applicable only to frames and dialogs.
2858
2859\wxheading{Parameters}
2860
2861\docparam{title}{The window's title.}
2862
2863\wxheading{See also}
2864
2865\helpref{wxWindow::GetTitle}{wxwindowgettitle}
2866
8c4b73d1 2867
f89a1397
RR
2868\membersection{wxWindow::SetThemeEnabled}\label{wxwindowsetthemeenabled}
2869
2870\func{virtual void}{SetThemeEnabled}{\param{bool }{enable}}
2871
2872This function tells a window if it should use the system's "theme" code
2873to draw the windows' background instead if its own background drawing
2874code. This does not always have any effect since the underlying platform
2875obviously needs to support the notion of themes in user defined windows.
2876One such platform is GTK+ where windows can have (very colourful) backgrounds
2877defined by a user's selected theme.
2878
cc81d32f 2879Dialogs, notebook pages and the status bar have this flag set to true
f89a1397
RR
2880by default so that the default look and feel is simulated best.
2881
8c4b73d1 2882
f6bcfd97
BP
2883\membersection{wxWindow::SetToolTip}\label{wxwindowsettooltip}
2884
2885\func{void}{SetToolTip}{\param{const wxString\& }{tip}}
2886
2887\func{void}{SetToolTip}{\param{wxToolTip* }{tip}}
2888
c9f00eeb 2889Attach a tooltip to the window.
f6bcfd97 2890
c9f00eeb 2891See also: \helpref{GetToolTip}{wxwindowgettooltip},
8161ba08 2892 \helpref{wxToolTip}{wxtooltip}
f6bcfd97 2893
8c4b73d1 2894
aa4b42f0
VZ
2895\membersection{wxWindow::SetValidator}\label{wxwindowsetvalidator}
2896
2897\func{virtual void}{SetValidator}{\param{const wxValidator\&}{ validator}}
2898
2899Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to
2900create a new validator of this type.
2901
8c4b73d1 2902
566d84a7
RL
2903\membersection{wxWindow::SetVirtualSize}\label{wxwindowsetvirtualsize}
2904
2905\func{void}{SetVirtualSize}{\param{int}{ width}, \param{int}{ height}}
2906
2907\func{void}{SetVirtualSize}{\param{const wxSize\&}{ size}}
2908
2909Sets the virtual size of the window in pixels.
2910
8c4b73d1 2911
566d84a7
RL
2912\membersection{wxWindow::SetVirtualSizeHints}\label{wxwindowsetvirtualsizehints}
2913
2914\func{virtual void}{SetVirtualSizeHints}{\param{int}{ minW},\param{int}{ minH}, \param{int}{ maxW=-1}, \param{int}{ maxH=-1}}
2915
2916Allows specification of minimum and maximum virtual window sizes.
2917If a pair of values is not set (or set to -1), the default values
2918will be used.
2919
2920\wxheading{Parameters}
2921
2922\docparam{minW}{Specifies the minimum width allowable.}
2923
2924\docparam{minH}{Specifies the minimum height allowable.}
2925
2926\docparam{maxW}{Specifies the maximum width allowable.}
2927
2928\docparam{maxH}{Specifies the maximum height allowable.}
2929
2930\wxheading{Remarks}
2931
2932If this function is called, the user will not be able to size the virtual area
2933of the window outside the given bounds.
f6bcfd97 2934
8c4b73d1 2935
d80cd92a
VZ
2936\membersection{wxWindow::SetWindowStyle}\label{wxwindowsetwindowstyle}
2937
2938\func{void}{SetWindowStyle}{\param{long}{ style}}
2939
2940Identical to \helpref{SetWindowStyleFlag}{wxwindowsetwindowstyleflag}.
2941
8c4b73d1 2942
d80cd92a
VZ
2943\membersection{wxWindow::SetWindowStyleFlag}\label{wxwindowsetwindowstyleflag}
2944
2945\func{virtual void}{SetWindowStyleFlag}{\param{long}{ style}}
2946
2947Sets the style of the window. Please note that some styles cannot be changed
2948after the window creation and that \helpref{Refresh()}{wxwindowrefresh} might
2949be called after changing the others for the change to take place immediately.
2950
b2cf617c 2951See \helpref{Window styles}{windowstyles} for more information about flags.
d80cd92a
VZ
2952
2953\wxheading{See also}
2954
2955\helpref{GetWindowStyleFlag}{wxwindowgetwindowstyleflag}
2956
8c4b73d1 2957
aeab10d0 2958\membersection{wxWindow::Show}\label{wxwindowshow}
a660d684 2959
cc81d32f 2960\func{virtual bool}{Show}{\param{bool}{ show = {\tt true}}}
a660d684 2961
be90c029 2962Shows or hides the window. You may need to call \helpref{Raise}{wxwindowraise}
b59893f3
VZ
2963for a top level window if you want to bring it to top, although this is not
2964needed if Show() is called immediately after the frame creation.
a660d684
KB
2965
2966\wxheading{Parameters}
2967
cc81d32f 2968\docparam{show}{If {\tt true} displays the window. Otherwise, hides it.}
bc5879ef
VZ
2969
2970\wxheading{Return value}
2971
cc81d32f 2972{\tt true} if the window has been shown or hidden or {\tt false} if nothing was
bc5879ef 2973done because it already was in the requested state.
a660d684
KB
2974
2975\wxheading{See also}
2976
2977\helpref{wxWindow::IsShown}{wxwindowisshown}
2978
8c4b73d1 2979
0cc7251e
VZ
2980\membersection{wxWindow::Thaw}\label{wxwindowthaw}
2981
2982\func{virtual void}{Thaw}{\void}
2983
be90c029 2984Reenables window updating after a previous call to
0cc7251e
VZ
2985\helpref{Freeze}{wxwindowfreeze}.
2986
8c4b73d1 2987
a660d684
KB
2988\membersection{wxWindow::TransferDataFromWindow}\label{wxwindowtransferdatafromwindow}
2989
2990\func{virtual bool}{TransferDataFromWindow}{\void}
2991
2992Transfers values from child controls to data areas specified by their validators. Returns
cc81d32f 2993{\tt false} if a transfer failed.
a660d684 2994
d80cd92a
VZ
2995If the window has {\tt wxWS\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
2996the method will also call TransferDataFromWindow() of all child windows.
2997
a660d684
KB
2998\wxheading{See also}
2999
3000\helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow},\rtfsp
3001\helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate}
3002
8c4b73d1 3003
a660d684
KB
3004\membersection{wxWindow::TransferDataToWindow}\label{wxwindowtransferdatatowindow}
3005
3006\func{virtual bool}{TransferDataToWindow}{\void}
3007
3008Transfers values to child controls from data areas specified by their validators.
3009
d80cd92a
VZ
3010If the window has {\tt wxWS\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
3011the method will also call TransferDataToWindow() of all child windows.
3012
a660d684
KB
3013\wxheading{Return value}
3014
cc81d32f 3015Returns {\tt false} if a transfer failed.
a660d684
KB
3016
3017\wxheading{See also}
3018
3019\helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp
3020\helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate}
3021
8c4b73d1 3022
5048c832
JS
3023\membersection{wxWindow::UnregisterHotKey}\label{wxwindowunregisterhotkey}
3024
3025\func{bool}{UnregisterHotKey}{\param{int}{ hotkeyId}}
3026
3027Unregisters a system wide hotkey.
3028
3029\wxheading{Parameters}
3030
3031\docparam{hotkeyId}{Numeric identifier of the hotkey. Must be the same id that was passed to RegisterHotKey.}
3032
3033\wxheading{Return value}
3034
3035{\tt true} if the hotkey was unregistered successfully, {\tt false} if the id was invalid.
3036
3037\wxheading{Remarks}
3038
3039This function is currently only implemented under MSW.
3040
3041\wxheading{See also}
3042
3043\helpref{wxWindow::RegisterHotKey}{wxwindowregisterhotkey}
3044
8c4b73d1 3045
2b5f62a0
VZ
3046\membersection{wxWindow::Update}\label{wxwindowupdate}
3047
3048\func{virtual void}{Update}{\void}
3049
3050Calling this method immediately repaints the invalidated area of the window
3051while this would usually only happen when the flow of control returns to the
3052event loop. Notice that this function doesn't refresh the window and does
3053nothing if the window hadn't been already repainted. Use
3054\helpref{Refresh}{wxwindowrefresh} first if you want to immediately redraw the
3055window unconditionally.
3056
8c4b73d1 3057
e39af974
JS
3058\membersection{wxWindow::UpdateWindowUI}\label{wxwindowupdatewindowui}
3059
c0d26c0f 3060\func{virtual void}{UpdateWindowUI}{\param{long}{ flags = wxUPDATE\_UI\_NONE}}
e39af974
JS
3061
3062This function sends \helpref{wxUpdateUIEvents}{wxupdateuievent} to
3063the window. The particular implementation depends on the window; for
3064example a wxToolBar will send an update UI event for each toolbar button,
3065and a wxFrame will send an update UI event for each menubar menu item.
3066You can call this function from your application to ensure that your
3067UI is up-to-date at this point (as far as your wxUpdateUIEvent handlers
3068are concerned). This may be necessary if you have called
3069\helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} or
3070\helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval} to
3071limit the overhead that wxWindows incurs by sending update UI events in idle time.
3072
3073{\it flags} should be a bitlist of one or more of the following values.
3074
3075\begin{verbatim}
3076enum wxUpdateUI
3077{
3078 wxUPDATE_UI_NONE = 0x0000, // No particular value
3079 wxUPDATE_UI_RECURSE = 0x0001, // Call the function for descendants
3080 wxUPDATE_UI_FROMIDLE = 0x0002 // Invoked from On(Internal)Idle
3081};
3082\end{verbatim}
3083
3084If you are calling this function from an OnInternalIdle or OnIdle
3085function, make sure you pass the wxUPDATE\_UI\_FROMIDLE flag, since
3086this tells the window to only update the UI elements that need
3087to be updated in idle time. Some windows update their elements
3088only when necessary, for example when a menu is about to be shown.
3089The following is an example of how to call UpdateWindowUI from
3090an idle function.
3091
3092\begin{verbatim}
3093void MyWindow::OnInternalIdle()
3094{
3095 if (wxUpdateUIEvent::CanUpdate(this))
3096 UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
3097}
3098\end{verbatim}
3099
3100\wxheading{See also}
3101
3102\helpref{wxUpdateUIEvent}{wxupdateuievent},
3103\helpref{wxWindow::DoUpdateWindowUI}{wxwindowdoupdatewindowui},
3104\helpref{wxWindow::OnInternalIdle}{wxwindowoninternalidle}
3105
8c4b73d1 3106
a660d684
KB
3107\membersection{wxWindow::Validate}\label{wxwindowvalidate}
3108
3109\func{virtual bool}{Validate}{\void}
3110
3111Validates the current values of the child controls using their validators.
3112
d80cd92a
VZ
3113If the window has {\tt wxWS\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
3114the method will also call Validate() of all child windows.
3115
a660d684
KB
3116\wxheading{Return value}
3117
cc81d32f 3118Returns {\tt false} if any of the validations failed.
a660d684
KB
3119
3120\wxheading{See also}
3121
3122\helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp
3123\helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp
3124\helpref{wxValidator}{wxvalidator}
3125
8c4b73d1 3126
a660d684
KB
3127\membersection{wxWindow::WarpPointer}\label{wxwindowwarppointer}
3128
3129\func{void}{WarpPointer}{\param{int}{ x}, \param{int}{ y}}
3130
3131Moves the pointer to the given position on the window.
3132
6faf4b5f
VZ
3133{\bf NB: } This function is not supported under Mac because Apple Human
3134Interface Guidelines forbid moving the mouse cursor programmatically.
3135
a660d684
KB
3136\wxheading{Parameters}
3137
3138\docparam{x}{The new x position for the cursor.}
3139
3140\docparam{y}{The new y position for the cursor.}
3141