]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/window.tex
Version 0.4 of wxPython for MSW.
[wxWidgets.git] / docs / latex / wx / window.tex
CommitLineData
a660d684
KB
1\section{\class{wxWindow}}\label{wxwindow}
2
3wxWindow is the base class for all windows. Any
4children of the window will be deleted automatically by the destructor
5before the window itself is deleted.
6
7\wxheading{Derived from}
8
9\helpref{wxEvtHandler}{wxevthandler}\\
10\helpref{wxObject}{wxobject}
11
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.}
884360bc
JS
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.}
a660d684
KB
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
eaaa6a06 50\func{}{wxWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},
a660d684
KB
51 \param{const wxPoint\& }{pos = wxDefaultPosition},
52 \param{const wxSize\& }{size = wxDefaultSize},
eaaa6a06 53 \param{long }{style = 0},
a660d684
KB
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
eaaa6a06 115\func{void}{Center}{\param{int}{ direction}}
a660d684
KB
116
117A synonym for \helpref{Centre}{wxwindowcentre}.
118
119\membersection{wxWindow::Centre}\label{wxwindowcentre}
120
eaaa6a06 121\func{virtual void}{Centre}{\param{int}{ direction = wxHORIZONTAL}}
a660d684
KB
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
eaaa6a06 245\func{virtual bool}{FakePopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}}
a660d684
KB
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
eaaa6a06 484\func{virtual int}{GetScrollThumb}{\param{int }{orientation}}
a660d684
KB
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
eaaa6a06 494\func{virtual int}{GetScrollPos}{\param{int }{orientation}}
a660d684
KB
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
eaaa6a06 504\func{virtual int}{GetScrollRange}{\param{int }{orientation}}
a660d684
KB
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
eaaa6a06 658\func{void}{Move}{\param{int}{ x}, \param{int}{ y}}
a660d684
KB
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
a660d684
KB
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
eaaa6a06 1220\func{virtual bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}}
a660d684
KB
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
a660d684
KB
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
eaaa6a06 1329\func{virtual void}{ScrollWindow}{\param{int }{dx}, \param{int }{dy}, \param{const wxRect*}{ rect = NULL}}
a660d684
KB
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
3972fb49
JS
1350\membersection{wxWindow::SetAcceleratorTable}\label{wxwindowsetacceleratortable}
1351
1352\func{virtual void}{SetAcceleratorTable}{\param{const wxAcceleratorTable\&}{ accel}}
1353
1354Sets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxacceleratortable}.
1355
a660d684
KB
1356\membersection{wxWindow::SetAutoLayout}\label{wxwindowsetautolayout}
1357
1358\func{void}{SetAutoLayout}{\param{const bool}{ autoLayout}}
1359
1360Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will
1361be called automatically when the window is resized.
1362
1363\wxheading{Parameters}
1364
1365\docparam{autoLayout}{Set this to TRUE if you wish the Layout function to be called
1366from within wxWindow::OnSize functions.}
1367
1368\wxheading{See also}
1369
1370\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints}
1371
1372\membersection{wxWindow::SetBackgroundColour}\label{wxwindowsetbackgroundcolour}
1373
1374\func{virtual void}{SetBackgroundColour}{\param{const wxColour\& }{colour}}
1375
1376Sets the background colour of the window.
1377
1378\wxheading{Parameters}
1379
1380\docparam{colour}{The colour to be used as the background colour.}
1381
1382\wxheading{Remarks}
1383
1384The background colour is usually painted by the default\rtfsp
1385\helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground} event handler function.
1386
1387\wxheading{See also}
1388
1389\helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour},\rtfsp
1390\helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp
1391\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp
1392\helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground}
1393
1394\membersection{wxWindow::SetConstraints}\label{wxwindowsetconstraints}
1395
1396\func{void}{SetConstraints}{\param{wxLayoutConstraints* }{constraints}}
1397
1398Sets the window to have the given layout constraints. The window
1399will then own the object, and will take care of its deletion.
1400If an existing layout constraints object is already owned by the
1401window, it will be deleted.
1402
1403\wxheading{Parameters}
1404
1405\docparam{constraints}{The constraints to set. Pass NULL to disassociate and delete the window's
1406constraints.}
1407
1408\wxheading{Remarks}
1409
1410You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use
1411the constraints automatically in OnSize; otherwise, you must
1412override OnSize and call Layout explicitly.
1413
a660d684
KB
1414\membersection{wxWindow::SetFocus}\label{wxwindowsetfocus}
1415
1416\func{virtual void}{SetFocus}{\void}
1417
1418This sets the window to receive keyboard input.
1419
1420\membersection{wxWindow::SetFont}\label{wxwindowsetfont}
1421
1422\func{void}{SetFont}{\param{const wxFont\& }{font}}
1423
1424Sets the font for this window.
1425
1426\wxheading{Parameters}
1427
1428\docparam{font}{Font to associate with this window.}
1429
1430\wxheading{See also}
1431
1432\helpref{wxWindow::GetFont}{wxwindowgetfont}
1433
1434\membersection{wxWindow::SetForegroundColour}\label{wxwindowsetforegroundcolour}
1435
1436\func{virtual void}{SetForegroundColour}{\param{const wxColour\& }{colour}}
1437
1438Sets the foreground colour of the window.
1439
1440\wxheading{Parameters}
1441
1442\docparam{colour}{The colour to be used as the foreground colour.}
1443
1444\wxheading{Remarks}
1445
1446The interpretation of foreground colour is open to interpretation according
1447to the window class; it may be the text colour or other colour, or it may not
1448be used at all.
1449
1450\wxheading{See also}
1451
1452\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp
1453\helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp
1454\helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour}
1455
1456\membersection{wxWindow::SetId}\label{wxwindowsetid}
1457
1458\func{void}{SetId}{\param{int}{ id}}
1459
1460Sets the identifier of the window.
1461
1462\wxheading{Remarks}
1463
1464Each window has an integer identifier. If the application has not provided one,
1465an identifier will be generated. Normally, the identifier should be provided
1466on creation and should not be modified subsequently.
1467
1468TODO: perhaps there should be a default identifier for each class, rather
1469choosing one, which could clash with other ones.
1470
1471\wxheading{See also}
1472
1473\helpref{wxWindow::GetId}{wxwindowgetid}
1474
1475
1476\membersection{wxWindow::SetName}\label{wxwindowsetname}
1477
1478\func{virtual void}{SetName}{\param{const wxString\& }{name}}
1479
1480Sets the window's name.
1481
1482\wxheading{Parameters}
1483
1484\docparam{name}{A name to set for the window.}
1485
1486\wxheading{See also}
1487
1488\helpref{wxWindow::GetName}{wxwindowgetname}
1489
1490\membersection{wxWindow::SetReturnCode}\label{wxwindowsetreturncode}
1491
1492\func{void}{SetReturnCode}{\param{int }{retCode}}
1493
1494Sets the return code for this window.
1495
1496\wxheading{Parameters}
1497
1498\docparam{retCode}{The integer return code, usually a control identifier.}
1499
1500\wxheading{Remarks}
1501
1502A return code is normally associated with a modal dialog, where \helpref{wxDialog::ShowModal}{wxdialogshowmodal} returns
1503a code to the application. The function \helpref{wxDialog::EndModal}{wxdialogendmodal} calls {\bf SetReturnCode}.
1504
1505\wxheading{See also}
1506
1507\helpref{wxWindow::GetReturnCode}{wxwindowgetreturncode}, \helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp
1508\helpref{wxDialog::EndModal}{wxdialogendmodal}
1509
1510\membersection{wxWindow::SetScrollbar}\label{wxwindowsetscrollbar}
1511
eaaa6a06
JS
1512\func{virtual void}{SetScrollbar}{\param{int }{orientation}, \param{int }{position},\rtfsp
1513\param{int }{thumbSize}, \param{int }{range},\rtfsp
a660d684
KB
1514\param{const bool }{refresh = TRUE}}
1515
1516Sets the scrollbar properties of a built-in scrollbar.
1517
1518\wxheading{Parameters}
1519
1520\docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.}
1521
1522\docparam{position}{The position of the scrollbar in scroll units.}
1523
1524\docparam{thumbSize}{The size of the thumb, or visible portion of the scrollbar, in scroll units.}
1525
1526\docparam{range}{The maximum position of the scrollbar.}
1527
1528\docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.}
1529
1530\wxheading{Remarks}
1531
1532Let's say you wish to display 50 lines of text, using the same font.
1533The window is sized so that you can only see 16 lines at a time.
1534
1535You would use:
1536
1537{\small%
1538\begin{verbatim}
1539 SetScrollbar(wxVERTICAL, 0, 16, 50);
1540\end{verbatim}
1541}
1542
1543Note that with the window at this size, the thumb position can never go
1544above 50 minus 16, or 34.
1545
1546You can determine how many lines are currently visible by dividing the current view
1547size by the character height in pixels.
1548
1549When defining your own scrollbar behaviour, you will always need to recalculate
1550the scrollbar settings when the window size changes. You could therefore put your
1551scrollbar calculations and SetScrollbar
1552call into a function named AdjustScrollbars, which can be called initially and also
1553from your \helpref{wxWindow::OnSize}{wxwindowonsize} event handler function.
1554
1555\wxheading{See also}
1556
1557\helpref{Scrolling overview}{scrollingoverview},\rtfsp
1558\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
1559
1560\begin{comment}
1561\membersection{wxWindow::SetScrollPage}\label{wxwindowsetscrollpage}
1562
eaaa6a06 1563\func{virtual void}{SetScrollPage}{\param{int }{orientation}, \param{int }{pageSize}, \param{const bool }{refresh = TRUE}}
a660d684
KB
1564
1565Sets the page size of one of the built-in scrollbars.
1566
1567\wxheading{Parameters}
1568
1569\docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.}
1570
1571\docparam{pageSize}{Page size in scroll units.}
1572
1573\docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.}
1574
1575\wxheading{Remarks}
1576
1577The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1578click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1579page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1580value has to be adjusted when the window is resized, since the page size will have changed.
1581
1582In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1583the thumb changes size to reflect the page size relative to the length of the document. When the
1584document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1585will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1586disappear.
1587
1588Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1589handling of pages and ranges.
1590
1591\wxheading{See also}
1592
1593\helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp
a660d684 1594\helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp
f7bd2698 1595\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp
a660d684
KB
1596\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
1597\end{comment}
1598
1599\membersection{wxWindow::SetScrollPos}\label{wxwindowsetscrollpos}
1600
eaaa6a06 1601\func{virtual void}{SetScrollPos}{\param{int }{orientation}, \param{int }{pos}, \param{const bool }{refresh = TRUE}}
a660d684
KB
1602
1603Sets the position of one of the built-in scrollbars.
1604
1605\wxheading{Parameters}
1606
1607\docparam{orientation}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.}
1608
1609\docparam{pos}{Position in scroll units.}
1610
1611\docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.}
1612
1613\wxheading{Remarks}
1614
1615This function does not directly affect the contents of the window: it is up to the
1616application to take note of scrollbar attributes and redraw contents accordingly.
1617
1618\wxheading{See also}
1619
1620\helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar},\rtfsp
1621\helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp
f7bd2698 1622\helpref{wxWindow::GetScrollThumb}{wxwindowgetscrollthumb},\rtfsp
a660d684
KB
1623\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
1624
1625\begin{comment}
1626\membersection{wxWindow::SetScrollRange}\label{wxwindowsetscrollrange}
1627
eaaa6a06 1628\func{virtual void}{SetScrollRange}{\param{int }{orientation}, \param{int }{range}, \param{const bool }{refresh = TRUE}}
a660d684
KB
1629
1630Sets the range of one of the built-in scrollbars.
1631
1632\wxheading{Parameters}
1633
1634\docparam{orientation}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.}
1635
1636\docparam{range}{Scroll range.}
1637
1638\docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.}
1639
1640\wxheading{Remarks}
1641
1642The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
fe604ccd
JS
1643object length of the scrollbar. If you are implementing a scrolling window, for example, you
1644would adjust the scroll range when the window is resized, by subtracting the window view size from the
1645total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
a660d684
KB
1646and usually the scrollbar will be automatically hidden.
1647
1648\wxheading{See also}
1649
1650\helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp
1651\helpref{wxWindow::SetScrollPage}{wxwindowsetscrollpage},\rtfsp
1652\helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp
f7bd2698 1653\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp
a660d684
KB
1654\helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow}
1655\end{comment}
1656
1657\membersection{wxWindow::SetSize}\label{wxwindowsetsize}
1658
eaaa6a06
JS
1659\func{virtual void}{SetSize}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height},
1660 \param{int}{ sizeFlags = wxSIZE\_AUTO}}
a660d684
KB
1661
1662Sets the size and position of the window in pixels.
1663
eaaa6a06 1664\func{virtual void}{SetSize}{\param{int}{ width}, \param{int}{ height}}
a660d684
KB
1665
1666Sets the size of the window in pixels.
1667
1668\wxheading{Parameters}
1669
1670\docparam{x}{Required x position in pixels, or -1 to indicate that the existing
1671value should be used.}
1672
1673\docparam{y}{Required y position in pixels, or -1 to indicate that the existing
1674value should be used.}
1675
1676\docparam{width}{Required width in pixels, or -1 to indicate that the existing
1677value should be used.}
1678
1679\docparam{height}{Required height position in pixels, or -1 to indicate that the existing
1680value should be used.}
1681
1682\docparam{sizeFlags}{Indicates the interpretation of other parameters. It is a bit list of the following:
1683
1684{\bf wxSIZE\_AUTO\_WIDTH}: a -1 width value is taken to indicate
1685a wxWindows-supplied default width.\\
1686{\bf wxSIZE\_AUTO\_HEIGHT}: a -1 height value is taken to indicate
1687a wxWindows-supplied default width.\\
1688{\bf wxSIZE\_AUTO}: -1 size values are taken to indicate
1689a wxWindows-supplied default size.\\
1690{\bf wxSIZE\_USE\_EXISTING}: existing dimensions should be used
1691if -1 values are supplied.\\
1692{\bf wxSIZE\_ALLOW\_MINUS\_ONE}: allow dimensions of -1 and less to be interpreted
1693as real dimensions, not default values.
1694}
1695
1696\wxheading{Remarks}
1697
1698The second form is a convenience for calling the first form with default
1699x and y parameters, and must be used with non-default width and height values.
1700
1701The first form sets the position and optionally size, of the window.
1702Parameters may be -1 to indicate either that a default should be supplied
1703by wxWindows, or that the current value of the dimension should be used.
1704
1705\wxheading{See also}
1706
1707\helpref{wxWindow::Move}{wxwindowmove}
1708
1709\membersection{wxWindow::SetSizeHints}\label{wxwindowsetsizehints}
1710
eaaa6a06
JS
1711\func{virtual void}{SetSizeHints}{\param{int}{ minW=-1}, \param{int}{ minH=-1}, \param{int}{ maxW=-1}, \param{int}{ maxH=-1},
1712 \param{int}{ incW=-1}, \param{int}{ incH=-1}}
a660d684
KB
1713
1714Allows specification of minimum and maximum window sizes, and window size increments.
1715If a pair of values is not set (or set to -1), the default values will be used.
1716
1717\wxheading{Parameters}
1718
1719\docparam{minW}{Specifies the minimum width allowable.}
1720
1721\docparam{minH}{Specifies the minimum height allowable.}
1722
1723\docparam{maxW}{Specifies the maximum width allowable.}
1724
1725\docparam{maxH}{Specifies the maximum height allowable.}
1726
1727\docparam{incW}{Specifies the increment for sizing the width (Motif/Xt only).}
1728
1729\docparam{incH}{Specifies the increment for sizing the height (Motif/Xt only).}
1730
1731\wxheading{Remarks}
1732
1733If this function is called, the user will not be able to size the window outside the
1734given bounds.
1735
1736The resizing increments are only significant under Motif or Xt.
1737
1738\membersection{wxWindow::SetClientSize}
1739
eaaa6a06 1740\func{virtual void}{SetClientSize}{\param{int}{ width}, \param{int}{ height}}
a660d684
KB
1741
1742This sets the size of the window client area in pixels. Using this function to size a window
1743tends to be more device-independent than \helpref{wxWindow::SetSize}{wxwindowsetsize}, since the application need not
1744worry about what dimensions the border or title bar have when trying to fit the window
1745around panel items, for example.
1746
1747\wxheading{Parameters}
1748
1749\docparam{width}{The required client area width.}
1750
1751\docparam{height}{The required client area height.}
1752
1753\membersection{wxWindow::SetPalette}
1754
1755\func{virtual void}{SetPalette}{\param{wxPalette* }{palette}}
1756
1757Obsolete - use \helpref{wxDC::SetPalette}{wxdcsetpalette} instead.
1758
1759\membersection{wxWindow::SetCursor}\label{wxwindowsetcursor}
1760
1761\func{virtual void}{SetCursor}{\param{const wxCursor\&}{cursor}}
1762
1763Sets the window's cursor.
1764
1765\wxheading{Parameters}
1766
1767\docparam{cursor}{Specifies the cursor that the window should normally display.}
1768
1769\wxheading{Remarks}
1770
1771Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1772function if you want the cursor to change immediately, because under Windows,
1773wxWindows only sets the global cursor when it detects mouse movement.
1774
1775\wxheading{See also}
1776
1777\helpref{::wxSetCursor}{wxsetcursor}, \helpref{wxCursor}{wxcursor}
1778
1779\membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler}
1780
1781\func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}}
1782
1783Sets the event handler for this window.
1784
1785\wxheading{Parameters}
1786
1787\docparam{handler}{Specifies the handler to be set.}
1788
1789\wxheading{Remarks}
1790
1791An event handler is an object that is capable of processing the events
1792sent to a window. By default, the window is its own event handler, but
1793an application may wish to substitute another, for example to allow
1794central implementation of event-handling for a variety of different
1795window classes.
1796
1797It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since
1798this sets up a chain of event handlers, where an event not handled by one event handler is
1799handed to the next one in the chain.
1800
1801\wxheading{See also}
1802
1803\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp
1804\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
1805\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp
1806\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp
1807\helpref{wxEvtHandler}{wxevthandler}
1808
1809\membersection{wxWindow::SetTitle}\label{wxwindowsettitle}
1810
1811\func{virtual void}{SetTitle}{\param{const wxString\& }{title}}
1812
1813Sets the window's title. Applicable only to frames and dialogs.
1814
1815\wxheading{Parameters}
1816
1817\docparam{title}{The window's title.}
1818
1819\wxheading{See also}
1820
1821\helpref{wxWindow::GetTitle}{wxwindowgettitle}
1822
1823\membersection{wxWindow::Show}
1824
1825\func{virtual bool}{Show}{\param{const bool}{ show}}
1826
1827Shows or hides the window.
1828
1829\wxheading{Parameters}
1830
1831\docparam{show}{If TRUE, displays the window and brings it to the front. Otherwise,
1832hides the window.}
1833
1834\wxheading{See also}
1835
1836\helpref{wxWindow::IsShown}{wxwindowisshown}
1837
1838\membersection{wxWindow::TransferDataFromWindow}\label{wxwindowtransferdatafromwindow}
1839
1840\func{virtual bool}{TransferDataFromWindow}{\void}
1841
1842Transfers values from child controls to data areas specified by their validators. Returns
1843FALSE if a transfer failed.
1844
1845\wxheading{See also}
1846
1847\helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow},\rtfsp
1848\helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate}
1849
1850\membersection{wxWindow::TransferDataToWindow}\label{wxwindowtransferdatatowindow}
1851
1852\func{virtual bool}{TransferDataToWindow}{\void}
1853
1854Transfers values to child controls from data areas specified by their validators.
1855
1856\wxheading{Return value}
1857
1858Returns FALSE if a transfer failed.
1859
1860\wxheading{See also}
1861
1862\helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp
1863\helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate}
1864
1865\membersection{wxWindow::Validate}\label{wxwindowvalidate}
1866
1867\func{virtual bool}{Validate}{\void}
1868
1869Validates the current values of the child controls using their validators.
1870
1871\wxheading{Return value}
1872
1873Returns FALSE if any of the validations failed.
1874
1875\wxheading{See also}
1876
1877\helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp
1878\helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp
1879\helpref{wxValidator}{wxvalidator}
1880
1881\membersection{wxWindow::WarpPointer}\label{wxwindowwarppointer}
1882
1883\func{void}{WarpPointer}{\param{int}{ x}, \param{int}{ y}}
1884
1885Moves the pointer to the given position on the window.
1886
1887\wxheading{Parameters}
1888
1889\docparam{x}{The new x position for the cursor.}
1890
1891\docparam{y}{The new y position for the cursor.}
1892