1 \section{\class{wxWindow
}}\label{wxwindow
}
3 wxWindow is the base class for all windows. Any
4 children of the window will be deleted automatically by the destructor
5 before the window itself is deleted.
7 \wxheading{Derived from
}
9 \helpref{wxEvtHandler
}{wxevthandler
}\\
10 \helpref{wxObject
}{wxobject
}
12 \wxheading{Window styles
}
14 The following styles can apply to all windows, although they will not always make sense for a particular
18 \begin{twocollist
}\itemsep=
0pt
19 \twocolitem{\windowstyle{wxSIMPLE
\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
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
26 events. Windows only.
}
27 \twocolitem{\windowstyle{wxNO
\_3D}}{Prevents the children of this window taking on
3D styles, even though
28 the application-wide policy is for
3D controls. Windows only.
}
29 \twocolitem{\windowstyle{wxTAB
\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.
}
30 \twocolitem{\windowstyle{wxVSCROLL
}}{Use this style to enable a vertical scrollbar.
}
31 \twocolitem{\windowstyle{wxHSCROLL
}}{Use this style to enable a horizontal scrollbar.
}
32 \twocolitem{\windowstyle{wxCLIP
\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
33 repainted, then children being painted over them. Windows-only.
}
36 See also
\helpref{window styles overview
}{windowstyles
}.
40 \helpref{Event handling overview
}{eventhandlingoverview
}
42 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxWindow::wxWindow
}
46 \func{}{wxWindow
}{\void}
50 \func{}{wxWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
51 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
52 \param{const wxSize\&
}{size = wxDefaultSize
},
53 \param{long
}{style =
0},
54 \param{const wxString\&
}{name = wxPanelNameStr
}}
56 Constructs a window, which can be a child of a frame, dialog or any other non-control window.
58 \wxheading{Parameters
}
60 \docparam{parent
}{Pointer to a parent window.
}
62 \docparam{id
}{Window identifier. If -
1, will automatically create an identifier.
}
64 \docparam{pos
}{Window position. wxDefaultPosition is (-
1, -
1) which indicates that wxWindows
65 should generate a default position for the window. If using the wxWindow class directly, supply
68 \docparam{size
}{Window size. wxDefaultSize is (-
1, -
1) which indicates that wxWindows
69 should generate a default size for the window.
}
71 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
73 \docparam{name
}{Window name.
}
75 \membersection{wxWindow::
\destruct{wxWindow
}}
77 \func{}{\destruct{wxWindow
}}{\void}
79 Destructor. Deletes all subwindows, then deletes itself. Instead of using
80 the
{\bf delete
} operator explicitly, you should normally
81 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
82 can delete a window only when it is safe to do so, in idle time.
86 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
87 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
88 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
89 \helpref{wxCloseEvent
}{wxcloseevent
}
91 \membersection{wxWindow::AddChild
}
93 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
95 Adds a child window. This is called automatically by window creation
96 functions so should not be required by the application programmer.
98 \wxheading{Parameters
}
100 \docparam{child
}{Child window to add.
}
102 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
104 \func{virtual void
}{CaptureMouse
}{\void}
106 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
111 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
113 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
115 \func{void
}{Center
}{\param{int
}{ direction
}}
117 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
119 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
121 \func{virtual void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
125 \wxheading{Parameters
}
127 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
132 The actual behaviour depends on the derived window. For a frame or dialog box,
133 centring is relative to the whole display. For a panel item, centring is
134 relative to the panel.
138 \helpref{wxWindow::Center
}{wxwindowcenter
}
140 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
142 \func{void
}{Clear
}{\void}
144 Clears the window by filling it with the current background colour.
146 \membersection{wxWindow::ClientToScreen
}
148 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
150 Converts to screen coordinates from coordinates relative to this window.
152 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
153 a screen coordinate will be passed out.
}
155 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
156 a screen coordinate will be passed out.
}
158 \membersection{wxWindow::Close
}\label{wxwindowclose
}
160 \func{virtual bool
}{Close
}{\param{const bool
}{ force = FALSE
}}
162 The purpose of this call is to provide a safer way of destroying a window than using
163 the
{\it delete
} operator.
165 \wxheading{Parameters
}
167 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
168 of this window, TRUE if it cannot.
}
172 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
173 choose whether to destroy the window.
175 The close handler should check whether the window is being deleted forcibly,
176 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
177 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
179 Applies to managed windows (wxFrame and wxDialog classes) only.
183 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
184 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
185 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
186 \helpref{wxCloseEvent
}{wxcloseevent
}
188 \membersection{wxWindow::ConvertDialogToPixels
}\label{wxwindowconvertdialogtopixels
}
190 \func{wxPoint
}{ConvertDialogToPixels
}{\param{const wxPoint\&
}{ pt
}}
192 \func{wxSize
}{ConvertDialogToPixels
}{\param{const wxSize\&
}{ sz
}}
194 Converts a point or size from dialog units to pixels.
196 For the x dimension, the dialog units are multiplied by the average character width
197 and then divided by
4.
199 For the y dimension, the dialog units are multiplied by the average character height
200 and then divided by
8.
204 Dialog units are used for maintaining a dialog's proportions even if the font changes.
205 Dialogs created using Dialog Editor optionally use dialog units.
207 You can also use these functions programmatically. A convenience macro is defined:
211 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
217 \helpref{wxWindow::ConvertPixelsToDialog
}{wxwindowconvertpixelstodialog
}
219 \membersection{wxWindow::ConvertPixelsToDialog
}\label{wxwindowconvertpixelstodialog
}
221 \func{wxPoint
}{ConvertPixelsToDialog
}{\param{const wxPoint\&
}{ pt
}}
223 \func{wxSize
}{ConvertPixelsToDialog
}{\param{const wxSize\&
}{ sz
}}
225 Converts a point or size from pixels to dialog units.
227 For the x dimension, the pixels are multiplied by
4 and then divided by the average
230 For the y dimension, the pixels are multipled by
8 and then divided by the average
235 Dialog units are used for maintaining a dialog's proportions even if the font changes.
236 Dialogs created using Dialog Editor optionally use dialog units.
240 \helpref{wxWindow::ConvertDialogToPixels
}{wxwindowconvertdialogtopixels
}
242 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
244 \func{virtual bool
}{Destroy
}{\void}
246 Destroys the window safely. Use this function instead of the delete operator, since
247 different window classes can be destroyed differently. Frames and dialogs
248 are not destroyed immediately when this function is called - they are added
249 to a list of windows to be deleted on idle time, when all the window's events
250 have been processed. This prevents problems with events being sent to non-existant
253 \wxheading{Return value
}
255 TRUE if the window has either been successfully deleted, or it has been added
256 to the list of windows pending real deletion.
258 \membersection{wxWindow::DestroyChildren
}
260 \func{virtual void
}{DestroyChildren
}{\void}
262 Destroys all children of a window. Called automatically by the destructor.
264 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
266 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
268 Enables or disables elibility for drop file events (OnDropFiles).
270 \wxheading{Parameters
}
272 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
273 will not accept drop file events.
}
281 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
283 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
285 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
287 Enable or disable the window for user input.
289 \wxheading{Parameters
}
291 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
295 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
297 \membersection{wxWindow::FakePopupMenu
}\label{wxwindowfakepopupmenu
}
299 \func{virtual bool
}{FakePopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
301 A replacement for wxWindow::PopupMenu for cases where the PopupMenu implementation
302 does not work correctly, in particular on Motif platforms.
304 \wxheading{Parameters
}
306 \docparam{menu
}{Menu to pop up.
}
308 \docparam{x
}{Required x position for the menu to appear.
}
310 \docparam{y
}{Required y position for the menu to appear.
}
314 This is a cut-down version of PopupMenu using a dialog and listbox; pull-right menus
319 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::PopupMenu
}{wxwindowpopupmenu
}
321 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
323 \func{static wxWindow*
}{FindFocus
}{\void}
325 Finds the window or control which currently has the keyboard focus.
329 Note that this is a static function, so it can be called without needing a wxWindow pointer.
333 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
335 \membersection{wxWindow::FindWindow
}\label{wxwindowfindwindow
}
337 \func{wxWindow*
}{FindWindow
}{\param{long
}{ id
}}
339 Find a child of this window, by identifier.
341 \func{wxWindow*
}{FindWindow
}{\param{const wxString\&
}{ name
}}
343 Find a child of this window, by name.
345 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
347 \func{virtual void
}{Fit
}{\void}
349 Sizes the window so that it fits around its subwindows.
351 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
353 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
355 Returns the background colour of the window.
359 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
360 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
361 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
362 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
364 \membersection{wxWindow::GetCharHeight
}
366 \constfunc{virtual int
}{GetCharHeight
}{\void}
368 Returns the character height for this window.
370 \membersection{wxWindow::GetCharWidth
}
372 \constfunc{virtual int
}{GetCharWidth
}{\void}
374 Returns the average character width for this window.
376 \membersection{wxWindow::GetChildren
}
378 \func{wxList*
}{GetChildren
}{\void}
380 Returns a pointer to the list of the window's children.
382 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
384 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
386 This gets the size of the window `client area' in pixels. The client area is the
387 area which may be drawn on by the programmer, excluding title bar, border etc.
389 \wxheading{Parameters
}
391 \docparam{width
}{Receives the client width in pixels.
}
393 \docparam{height
}{Receives the client height in pixels.
}
395 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
397 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
399 Returns a pointer to the window's layout constraints, or NULL if there are none.
401 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
403 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
405 Returns a pointer to the button which is the default for this window, or NULL.
407 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
409 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
411 Returns the event handler for this window. By default, the window is its
416 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
417 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
418 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
419 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
420 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
422 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
424 \constfunc{wxFont*
}{GetFont
}{\void}
426 Returns a pointer to the font for this window.
430 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
432 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
434 \func{virtual wxColour
}{GetForegroundColour
}{\void}
436 Returns the foreground colour of the window.
440 The interpretation of foreground colour is open to interpretation according
441 to the window class; it may be the text colour or other colour, or it may not
446 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
447 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
448 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
450 \membersection{wxWindow::GetGrandParent
}
452 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
454 Returns the grandparent of a window, or NULL if there isn't one.
456 \membersection{wxWindow::GetHandle
}
458 \constfunc{void*
}{GetHandle
}{\void}
460 Returns the platform-specific handle of the physical window. Cast it to an appropriate
461 handle, such as
{\bf HWND
} for Windows or
{\bf Widget
} for Motif.
463 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
465 \constfunc{int
}{GetId
}{\void}
467 Returns the identifier of the window.
471 Each window has an integer identifier. If the application has not provided one,
472 an identifier will be generated.
474 TODO: perhaps there should be a default identifier for each class, rather
475 choosing one, which could clash with other ones.
479 \helpref{wxWindow::SetId
}{wxwindowsetid
}
481 \membersection{wxWindow::GetPosition
}
483 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
485 This gets the position of the window in pixels, relative to the parent window or
486 if no parent, relative to the whole display.
488 \wxheading{Parameters
}
490 \docparam{x
}{Receives the x position of the window.
}
492 \docparam{y
}{Receives the y position of the window.
}
494 \membersection{wxWindow::GetLabel
}
496 \constfunc{virtual wxString\&
}{GetLabel
}{\void}
498 Generic way of getting a label from any window, for
499 identification purposes.
503 The interpretation of this function differs from class to class.
504 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
505 the button text. This function can be useful for meta-programs (such as testing
506 tools or special-needs access programs) which need to identify windows
509 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
511 \constfunc{virtual wxString\&
}{GetName
}{\void}
513 Returns the window's name.
517 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
518 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
522 \helpref{wxWindow::SetName
}{wxwindowsetname
}
524 \membersection{wxWindow::GetParent
}
526 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
528 Returns the parent of the window, or NULL if there is no parent.
530 \membersection{wxWindow::GetReturnCode
}\label{wxwindowgetreturncode
}
532 \func{int
}{GetReturnCode
}{\void}
534 Gets the return code for this window.
538 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
539 a code to the application.
543 \helpref{wxWindow::SetReturnCode
}{wxwindowsetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
544 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
546 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
548 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
550 Returns the built-in scrollbar thumb size.
554 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
556 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
558 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
560 Returns the built-in scrollbar position.
564 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
566 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
568 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
570 Returns the built-in scrollbar range.
574 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
576 \membersection{wxWindow::GetSize
}
578 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
580 This gets the size of the entire window in pixels.
582 \wxheading{Parameters
}
584 \docparam{width
}{Receives the window width.
}
586 \docparam{height
}{Receives the window height.
}
588 \membersection{wxWindow::GetTextExtent
}
590 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
591 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
592 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
594 Gets the dimensions of the string as it would be drawn on the
595 window with the currently selected font.
597 \wxheading{Parameters
}
599 \docparam{string
}{String whose extent is to be measured.
}
601 \docparam{x
}{Return value for width.
}
603 \docparam{y
}{Return value for height.
}
605 \docparam{descent
}{Return value for descent (optional).
}
607 \docparam{externalLeading
}{Return value for external leading (optional).
}
609 \docparam{font
}{Font to use instead of the current window font (optional).
}
611 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
613 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
615 \func{virtual wxString
}{GetTitle
}{\void}
617 Gets the window's title. Applicable only to frames and dialogs.
621 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
623 \membersection{wxWindow::GetUpdateRegion
}\label{wxwindowgetupdateregion
}
625 \constfunc{virtual wxRegion
}{GetUpdateRegion
}{\void}
627 Returns the region specifying which parts of the window have been damaged. Should
628 only be called within an
\helpref{OnPaint
}{wxwindowonpaint
} event handler.
632 \helpref{wxRegion
}{wxregion
},
\helpref{wxRegionIterator
}{wxregioniterator
},
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
634 \membersection{wxWindow::GetWindowStyleFlag
}
636 \constfunc{long
}{GetWindowStyleFlag
}{\void}
638 Gets the window style that was passed to the consructor or
{\bf Create
} member.
640 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
642 \func{void
}{InitDialog
}{\void}
644 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
645 in turn transfers data to the dialog via validators.
649 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
651 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
653 \constfunc{virtual bool
}{IsEnabled
}{\void}
655 Returns TRUE if the window is enabled for input, FALSE otherwise.
659 \helpref{wxWindow::Enable
}{wxwindowenable
}
661 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
663 \constfunc{virtual bool
}{IsRetained
}{\void}
665 Returns TRUE if the window is retained, FALSE otherwise.
669 Retained windows are only available on X platforms.
671 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
673 \constfunc{virtual bool
}{IsShown
}{\void}
675 Returns TRUE if the window is shown, FALSE if it has been hidden.
677 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
679 \func{void
}{Layout
}{\void}
681 Invokes the constraint-based layout algorithm for this window. It is called
682 automatically by the default
{\bf wxWindow::OnSize
} member.
684 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
686 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
687 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
689 Loads a panel or dialog from a resource file.
691 \wxheading{Parameters
}
693 \docparam{parent
}{Parent window.
}
695 \docparam{resourceName
}{The name of the resource to load.
}
697 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
698 default resource table will be used.
}
700 \wxheading{Return value
}
702 TRUE if the operation succeeded, otherwise FALSE.
712 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
714 \func{void
}{Lower
}{\void}
716 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
719 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
721 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
723 Disables all other windows in the application so that
724 the user can only interact with this window.
726 \wxheading{Parameters
}
728 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
729 the user can only interact with this window. If FALSE, the effect is reversed.
}
731 \membersection{wxWindow::Move
}\label{wxwindowmove
}
733 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
735 Moves the window to the given position.
737 \wxheading{Parameters
}
739 \docparam{x
}{Required x position.
}
741 \docparam{y
}{Required y position.
}
745 Implementations of SetSize can also implicitly implement the
746 wxWindow::Move function, which is defined in the base wxWindow class
750 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
755 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
757 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
759 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
761 Called when a window is activated or deactivated.
763 \wxheading{Parameters
}
765 \docparam{event
}{Object containing activation information.
}
769 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
770 otherwise it returns FALSE (it is being deactivated).
774 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
775 \helpref{Event handling overview
}{eventhandlingoverview
}
777 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
779 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
781 Called when the user has pressed a key.
783 \wxheading{Parameters
}
785 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
786 details about this class.
}
790 This member function is called in response to a keypress. To intercept this event,
791 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
792 default function to achieve default keypress functionality.
794 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
797 Most, but not all, windows allow keypresses to be intercepted.
801 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
802 \helpref{Event handling overview
}{eventhandlingoverview
}
804 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
806 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
808 This member is called to allow the window to intercept keyboard events
809 before they are processed by child windows.
811 \wxheading{Parameters
}
813 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
814 details about this class.
}
818 This member function is called in response to a keypress, if the window is active. To intercept this event,
819 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
820 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
822 An example of using this function is in the implementation of escape-character processing for wxDialog,
823 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
825 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
828 This function is only relevant to top-level windows (frames and dialogs), and under
833 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
834 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
835 \helpref{Event handling overview
}{eventhandlingoverview
}
837 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
839 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
841 This virtual member function is called if the control does not handle the command event.
843 \wxheading{Parameters
}
845 \docparam{object
}{Object receiving the command event.
}
847 \docparam{event
}{Command event
}
851 This virtual function is provided mainly for backward compatibility. You can also intercept commands
852 from child controls by using an event table, with identifiers or identifier ranges to identify
853 the control(s) in question.
857 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
858 \helpref{Event handling overview
}{eventhandlingoverview
}
860 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
862 \func{virtual bool
}{OnClose
}{\void}
864 Called when the user has tried to close a a frame
865 or dialog box using the window manager (X) or system menu (Windows).
867 {\bf Note:
} This is an obsolete function retained for backward compatibility.
868 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
871 \wxheading{Return value
}
873 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
874 attempt will be ignored. Do not delete the window from within this handler, although
875 you may delete other windows.
879 Derive your own class to handle this message. The default handler returns TRUE.
883 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
884 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
885 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
886 \helpref{wxCloseEvent
}{wxcloseevent
}
888 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
890 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
892 This is an event handler function called when the user has tried to close a a frame
893 or dialog box using the window manager (X) or system menu (Windows). It is
894 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
895 that the application can also invoke the handler programmatically.
897 Use the EVT
\_CLOSE event table macro to handle close events.
899 You should check whether the application is forcing the deletion of the window
900 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
901 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
902 If not, it is up to you whether you respond by destroying the window.
904 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
905 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
906 it is not possible to skip window deletion.)
908 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
909 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
910 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
914 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
915 for backward compatibility with earlier versions of wxWindows. The
916 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
917 destroying the window if it returns TRUE or if the close is being forced.
921 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
922 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
923 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
924 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
925 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
926 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
927 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
929 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
931 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
933 Called when files have been dragged from the file manager to the window.
935 \wxheading{Parameters
}
937 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
941 The window must have previously been enabled for dropping by calling
942 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
944 This event is only generated under Windows.
946 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
950 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
951 \helpref{Event handling overview
}{eventhandlingoverview
}
953 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
955 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
957 Called when the background of the window needs to be erased.
959 \wxheading{Parameters
}
961 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
965 This event is only generated under Windows.
967 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
971 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
973 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
975 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
977 Called when a window's focus is being killed.
979 \wxheading{Parameters
}
981 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
985 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
987 Most, but not all, windows respond to this event.
991 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
992 \helpref{Event handling overview
}{eventhandlingoverview
}
994 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
996 \func{void
}{Onidle
}{\param{wxIdleEvent\&
}{event
}}
998 Provide this member function for any processing which needs to be done
999 when the application is idle.
1001 \wxheading{See also
}
1003 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
1005 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
1007 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
1009 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1011 \wxheading{Parameters
}
1013 \docparam{event
}{Dialog initialisation event.
}
1017 Gives the window the default behaviour of transferring data to child controls via
1018 the validator that each control has.
1020 \wxheading{See also
}
1022 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1024 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1026 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1028 Called when a menu command is received from a menu bar.
1030 \wxheading{Parameters
}
1032 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1036 A function with this name doesn't actually exist; you can choose any member function to receive
1037 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1038 a range of commands.
1040 \wxheading{See also
}
1042 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1043 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1044 \helpref{Event handling overview
}{eventhandlingoverview
}
1046 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1048 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1050 Called when a menu select is received from a menu bar: that is, the
1051 mouse cursor is over a menu item, but the left mouse button has not been
1054 \wxheading{Parameters
}
1056 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1060 You can choose any member function to receive
1061 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1064 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1065 text in the first field of the status bar.
1067 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1068 since a selection is normally a left-click action.
1070 \wxheading{See also
}
1072 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1073 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1074 \helpref{Event handling overview
}{eventhandlingoverview
}
1077 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1079 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1081 Called when the user has initiated an event with the
1084 \wxheading{Parameters
}
1086 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1091 Most, but not all, windows respond to this event.
1093 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1094 mouse event macros such as EVT
\_LEFT\_DOWN.
1096 \wxheading{See also
}
1098 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1099 \helpref{Event handling overview
}{eventhandlingoverview
}
1101 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1103 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1105 Called when a window is moved.
1107 \wxheading{Parameters
}
1109 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1113 Use the EVT
\_MOVE macro to intercept move events.
1117 Not currently implemented.
1119 \wxheading{See also
}
1121 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1122 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1123 \helpref{Event handling overview
}{eventhandlingoverview
}
1125 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1127 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1129 Sent to the event handler when the window must be refreshed.
1131 \wxheading{Parameters
}
1133 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1137 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1139 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1145 void MyWindow::OnPaint(wxPaintEvent& event)
1154 You can optimize painting by retrieving the rectangles
1155 that have been damaged and only repainting these. The rectangles are in
1156 terms of the client area, and are unscrolled, so you will need to do
1157 some calculations using the current view position to obtain logical,
1160 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
1164 // Called when window needs to be repainted.
1165 void MyWindow::OnPaint(wxPaintEvent& event)
1169 // Find Out where the window is scrolled to
1170 int vbX,vbY; // Top left corner of client
1171 ViewStart(&vbX,&vbY);
1173 int vX,vY,vW,vH; // Dimensions of client area in pixels
1174 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1183 // Alternatively we can do this:
1185 // upd.GetRect(&rect);
1187 // Repaint this rectangle
1196 \wxheading{See also
}
1198 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1199 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1200 \helpref{Event handling overview
}{eventhandlingoverview
}
1202 \func{void
}{OnScroll
}{\param{wxScrollEvent\&
}{event
}}
1204 Called when a scroll event is received from one of the window's built-in scrollbars.
1206 \wxheading{Parameters
}
1208 \docparam{event
}{Command event. Retrieve the new scroll position by
1209 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1210 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1214 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1215 until the function is executing (you can't have one function for vertical, another
1216 for horizontal events).
1218 \wxheading{See also
}
1220 \helpref{wxScrollEvent
}{wxscrollevent
},
\rtfsp
1221 \helpref{Event handling overview
}{eventhandlingoverview
}
1223 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1225 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1227 Called when a window's focus is being set.
1229 \wxheading{Parameters
}
1231 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1235 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1237 Most, but not all, windows respond to this event.
1239 \wxheading{See also
}
1241 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1242 \helpref{Event handling overview
}{eventhandlingoverview
}
1244 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1246 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1248 Called when the window has been resized.
1250 \wxheading{Parameters
}
1252 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1256 You may wish to use this for frames to resize their child windows as appropriate.
1258 Note that the size passed is of
1259 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1260 used by the application.
1262 \wxheading{See also
}
1264 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1265 \helpref{Event handling overview
}{eventhandlingoverview
}
1267 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1269 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1271 Called when the user has changed the system colours.
1273 \wxheading{Parameters
}
1275 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1277 \wxheading{See also
}
1279 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1280 \helpref{Event handling overview
}{eventhandlingoverview
}
1282 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1284 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1286 Removes and returns the top-most event handler on the event handler stack.
1288 \wxheading{Parameters
}
1290 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1291 default value is FALSE.
}
1293 \wxheading{See also
}
1295 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1296 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1297 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1298 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1299 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1301 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1303 \func{virtual bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1305 Pops up the given menu at the specified coordinates, relative to this
1306 window, and returns control when the user has dismissed the menu. If a
1307 menu item is selected, the callback defined for the menu is called with
1308 wxMenu and wxCommandEvent reference arguments. The callback should access
1309 the commandInt member of the event to check the selected menu identifier.
1311 \wxheading{Parameters
}
1313 \docparam{menu
}{Menu to pop up.
}
1315 \docparam{x
}{Required x position for the menu to appear.
}
1317 \docparam{y
}{Required y position for the menu to appear.
}
1319 \wxheading{See also
}
1321 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::FakePopupMenu
}{wxwindowfakepopupmenu
}
1323 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1325 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1327 Pushes this event handler onto the event stack for the window.
1329 \wxheading{Parameters
}
1331 \docparam{handler
}{Specifies the handler to be pushed.
}
1335 An event handler is an object that is capable of processing the events
1336 sent to a window. By default, the window is its own event handler, but
1337 an application may wish to substitute another, for example to allow
1338 central implementation of event-handling for a variety of different
1341 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1342 an application to set up a chain of event handlers, where an event not handled by one event handler is
1343 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1344 remove the event handler.
1346 \wxheading{See also
}
1348 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1349 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1350 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1351 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1352 \helpref{wxEvtHandler
}{wxevthandler
}
1354 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1356 \func{void
}{Raise
}{\void}
1358 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1361 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1363 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1366 Causes a message or event to be generated to repaint the
1369 \wxheading{Parameters
}
1371 \docparam{eraseBackground
}{If TRUE, the background will be
1374 \docparam{rect
}{If non-NULL, only the given rectangle will
1375 be treated as damaged.
}
1377 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1379 \func{virtual void
}{ReleaseMouse
}{\void}
1381 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1383 \wxheading{See also
}
1385 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1387 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1389 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1391 Removes a child window. This is called automatically by window deletion
1392 functions so should not be required by the application programmer.
1394 \wxheading{Parameters
}
1396 \docparam{child
}{Child window to remove.
}
1398 \membersection{wxWindow::ScreenToClient
}
1400 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1402 Converts from screen to client window coordinates.
1404 \wxheading{Parameters
}
1406 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1408 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1410 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1412 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1414 Physically scrolls the pixels in the window.
1416 \wxheading{Parameters
}
1418 \docparam{dx
}{Amount to scroll horizontally.
}
1420 \docparam{dy
}{Amount to scroll vertically.
}
1422 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1423 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1424 can optimise painting by checking for the invalidated region.
}
1428 Available only under Windows.
1430 Use this function to optimise your scrolling implementations, to minimise the area that must be
1433 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1435 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1437 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1439 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1441 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1443 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1444 be called automatically when the window is resized.
1446 \wxheading{Parameters
}
1448 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1449 from within wxWindow::OnSize functions.
}
1451 \wxheading{See also
}
1453 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1455 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1457 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1459 Sets the background colour of the window.
1461 \wxheading{Parameters
}
1463 \docparam{colour
}{The colour to be used as the background colour.
}
1467 The background colour is usually painted by the default
\rtfsp
1468 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function.
1470 \wxheading{See also
}
1472 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1473 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1474 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1475 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1477 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1479 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1481 Sets the window to have the given layout constraints. The window
1482 will then own the object, and will take care of its deletion.
1483 If an existing layout constraints object is already owned by the
1484 window, it will be deleted.
1486 \wxheading{Parameters
}
1488 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1493 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1494 the constraints automatically in OnSize; otherwise, you must
1495 override OnSize and call Layout explicitly.
1497 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1499 \func{virtual void
}{SetFocus
}{\void}
1501 This sets the window to receive keyboard input.
1503 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1505 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1507 Sets the font for this window.
1509 \wxheading{Parameters
}
1511 \docparam{font
}{Font to associate with this window.
}
1513 \wxheading{See also
}
1515 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1517 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1519 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1521 Sets the foreground colour of the window.
1523 \wxheading{Parameters
}
1525 \docparam{colour
}{The colour to be used as the foreground colour.
}
1529 The interpretation of foreground colour is open to interpretation according
1530 to the window class; it may be the text colour or other colour, or it may not
1533 \wxheading{See also
}
1535 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1536 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1537 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1539 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1541 \func{void
}{SetId
}{\param{int
}{ id
}}
1543 Sets the identifier of the window.
1547 Each window has an integer identifier. If the application has not provided one,
1548 an identifier will be generated. Normally, the identifier should be provided
1549 on creation and should not be modified subsequently.
1551 TODO: perhaps there should be a default identifier for each class, rather
1552 choosing one, which could clash with other ones.
1554 \wxheading{See also
}
1556 \helpref{wxWindow::GetId
}{wxwindowgetid
}
1559 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1561 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1563 Sets the window's name.
1565 \wxheading{Parameters
}
1567 \docparam{name
}{A name to set for the window.
}
1569 \wxheading{See also
}
1571 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1573 \membersection{wxWindow::SetReturnCode
}\label{wxwindowsetreturncode
}
1575 \func{void
}{SetReturnCode
}{\param{int
}{retCode
}}
1577 Sets the return code for this window.
1579 \wxheading{Parameters
}
1581 \docparam{retCode
}{The integer return code, usually a control identifier.
}
1585 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
1586 a code to the application. The function
\helpref{wxDialog::EndModal
}{wxdialogendmodal
} calls
{\bf SetReturnCode
}.
1588 \wxheading{See also
}
1590 \helpref{wxWindow::GetReturnCode
}{wxwindowgetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
1591 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
1593 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1595 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1596 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1597 \param{const bool
}{refresh = TRUE
}}
1599 Sets the scrollbar properties of a built-in scrollbar.
1601 \wxheading{Parameters
}
1603 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1605 \docparam{position
}{The position of the scrollbar in scroll units.
}
1607 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1609 \docparam{range
}{The maximum position of the scrollbar.
}
1611 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1615 Let's say you wish to display
50 lines of text, using the same font.
1616 The window is sized so that you can only see
16 lines at a time.
1622 SetScrollbar(wxVERTICAL,
0,
16,
50);
1626 Note that with the window at this size, the thumb position can never go
1627 above
50 minus
16, or
34.
1629 You can determine how many lines are currently visible by dividing the current view
1630 size by the character height in pixels.
1632 When defining your own scrollbar behaviour, you will always need to recalculate
1633 the scrollbar settings when the window size changes. You could therefore put your
1634 scrollbar calculations and SetScrollbar
1635 call into a function named AdjustScrollbars, which can be called initially and also
1636 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1638 \wxheading{See also
}
1640 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1641 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1644 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1646 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1648 Sets the page size of one of the built-in scrollbars.
1650 \wxheading{Parameters
}
1652 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1654 \docparam{pageSize
}{Page size in scroll units.
}
1656 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1660 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1661 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1662 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1663 value has to be adjusted when the window is resized, since the page size will have changed.
1665 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1666 the thumb changes size to reflect the page size relative to the length of the
document. When the
1667 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1668 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1671 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1672 handling of pages and ranges.
1674 \wxheading{See also
}
1676 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1677 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1678 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1679 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1682 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1684 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1686 Sets the position of one of the built-in scrollbars.
1688 \wxheading{Parameters
}
1690 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1692 \docparam{pos
}{Position in scroll units.
}
1694 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1698 This function does not directly affect the contents of the window: it is up to the
1699 application to take note of scrollbar attributes and redraw contents accordingly.
1701 \wxheading{See also
}
1703 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1704 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1705 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
1706 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1709 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1711 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1713 Sets the range of one of the built-in scrollbars.
1715 \wxheading{Parameters
}
1717 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1719 \docparam{range
}{Scroll range.
}
1721 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1725 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1726 object length of the scrollbar. If you are implementing a scrolling window, for example, you
1727 would adjust the scroll range when the window is resized, by subtracting the window view size from the
1728 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
1729 and usually the scrollbar will be automatically hidden.
1731 \wxheading{See also
}
1733 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1734 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1735 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1736 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1737 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1740 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
1742 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
1743 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
1745 Sets the size and position of the window in pixels.
1747 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1749 Sets the size of the window in pixels.
1751 \wxheading{Parameters
}
1753 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
1754 value should be used.
}
1756 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
1757 value should be used.
}
1759 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
1760 value should be used.
}
1762 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
1763 value should be used.
}
1765 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
1767 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
1768 a wxWindows-supplied default width.\\
1769 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
1770 a wxWindows-supplied default width.\\
1771 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
1772 a wxWindows-supplied default size.\\
1773 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
1774 if -
1 values are supplied.\\
1775 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
1776 as real dimensions, not default values.
1781 The second form is a convenience for calling the first form with default
1782 x and y parameters, and must be used with non-default width and height values.
1784 The first form sets the position and optionally size, of the window.
1785 Parameters may be -
1 to indicate either that a default should be supplied
1786 by wxWindows, or that the current value of the dimension should be used.
1788 \wxheading{See also
}
1790 \helpref{wxWindow::Move
}{wxwindowmove
}
1792 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
1794 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
1795 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
1797 Allows specification of minimum and maximum window sizes, and window size increments.
1798 If a pair of values is not set (or set to -
1), the default values will be used.
1800 \wxheading{Parameters
}
1802 \docparam{minW
}{Specifies the minimum width allowable.
}
1804 \docparam{minH
}{Specifies the minimum height allowable.
}
1806 \docparam{maxW
}{Specifies the maximum width allowable.
}
1808 \docparam{maxH
}{Specifies the maximum height allowable.
}
1810 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
1812 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
1816 If this function is called, the user will not be able to size the window outside the
1819 The resizing increments are only significant under Motif or Xt.
1821 \membersection{wxWindow::SetClientSize
}
1823 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1825 This sets the size of the window client area in pixels. Using this function to size a window
1826 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1827 worry about what dimensions the border or title bar have when trying to fit the window
1828 around panel items, for example.
1830 \wxheading{Parameters
}
1832 \docparam{width
}{The required client area width.
}
1834 \docparam{height
}{The required client area height.
}
1836 \membersection{wxWindow::SetPalette
}
1838 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1840 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1842 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1844 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1846 Sets the window's cursor.
1848 \wxheading{Parameters
}
1850 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1854 Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1855 function if you want the cursor to change immediately, because under Windows,
1856 wxWindows only sets the global cursor when it detects mouse movement.
1858 \wxheading{See also
}
1860 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1862 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1864 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1866 Sets the event handler for this window.
1868 \wxheading{Parameters
}
1870 \docparam{handler
}{Specifies the handler to be set.
}
1874 An event handler is an object that is capable of processing the events
1875 sent to a window. By default, the window is its own event handler, but
1876 an application may wish to substitute another, for example to allow
1877 central implementation of event-handling for a variety of different
1880 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1881 this sets up a chain of event handlers, where an event not handled by one event handler is
1882 handed to the next one in the chain.
1884 \wxheading{See also
}
1886 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1887 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1888 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1889 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1890 \helpref{wxEvtHandler
}{wxevthandler
}
1892 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
1894 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
1896 Sets the window's title. Applicable only to frames and dialogs.
1898 \wxheading{Parameters
}
1900 \docparam{title
}{The window's title.
}
1902 \wxheading{See also
}
1904 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
1906 \membersection{wxWindow::Show
}
1908 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
1910 Shows or hides the window.
1912 \wxheading{Parameters
}
1914 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
1917 \wxheading{See also
}
1919 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
1921 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
1923 \func{virtual bool
}{TransferDataFromWindow
}{\void}
1925 Transfers values from child controls to data areas specified by their validators. Returns
1926 FALSE if a transfer failed.
1928 \wxheading{See also
}
1930 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
1931 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1933 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
1935 \func{virtual bool
}{TransferDataToWindow
}{\void}
1937 Transfers values to child controls from data areas specified by their validators.
1939 \wxheading{Return value
}
1941 Returns FALSE if a transfer failed.
1943 \wxheading{See also
}
1945 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1946 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1948 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
1950 \func{virtual bool
}{Validate
}{\void}
1952 Validates the current values of the child controls using their validators.
1954 \wxheading{Return value
}
1956 Returns FALSE if any of the validations failed.
1958 \wxheading{See also
}
1960 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1961 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1962 \helpref{wxValidator
}{wxvalidator
}
1964 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
1966 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
1968 Moves the pointer to the given position on the window.
1970 \wxheading{Parameters
}
1972 \docparam{x
}{The new x position for the cursor.
}
1974 \docparam{y
}{The new y position for the cursor.
}