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