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