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