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