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::Destroy
}\label{wxwindowdestroy
}
190 \func{virtual bool
}{Destroy
}{\void}
192 Destroys the window safely. Use this function instead of the delete operator, since
193 different window classes can be destroyed differently. Frames and dialogs
194 are not destroyed immediately when this function is called - they are added
195 to a list of windows to be deleted on idle time, when all the window's events
196 have been processed. This prevents problems with events being sent to non-existant
199 \wxheading{Return value
}
201 TRUE if the window has either been successfully deleted, or it has been added
202 to the list of windows pending real deletion.
204 \membersection{wxWindow::DestroyChildren
}
206 \func{virtual void
}{DestroyChildren
}{\void}
208 Destroys all children of a window. Called automatically by the destructor.
210 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
212 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
214 Enables or disables elibility for drop file events (OnDropFiles).
216 \wxheading{Parameters
}
218 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
219 will not accept drop file events.
}
227 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
229 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
231 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
233 Enable or disable the window for user input.
235 \wxheading{Parameters
}
237 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
241 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
243 \membersection{wxWindow::FakePopupMenu
}\label{wxwindowfakepopupmenu
}
245 \func{virtual bool
}{FakePopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
247 A replacement for wxWindow::PopupMenu for cases where the PopupMenu implementation
248 does not work correctly, in particular on Motif platforms.
250 \wxheading{Parameters
}
252 \docparam{menu
}{Menu to pop up.
}
254 \docparam{x
}{Required x position for the menu to appear.
}
256 \docparam{y
}{Required y position for the menu to appear.
}
260 This is a cut-down version of PopupMenu using a dialog and listbox; pull-right menus
265 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::PopupMenu
}{wxwindowpopupmenu
}
267 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
269 \func{static wxWindow*
}{FindFocus
}{\void}
271 Finds the window or control which currently has the keyboard focus.
275 Note that this is a static function, so it can be called without needing a wxWindow pointer.
279 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
281 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
283 \func{virtual void
}{Fit
}{\void}
285 Sizes the window so that it fits around its subwindows.
287 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
289 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
291 Returns the background colour of the window.
295 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
296 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
297 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
298 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
300 \membersection{wxWindow::GetCharHeight
}
302 \constfunc{virtual int
}{GetCharHeight
}{\void}
304 Returns the character height for this window.
306 \membersection{wxWindow::GetCharWidth
}
308 \constfunc{virtual int
}{GetCharWidth
}{\void}
310 Returns the average character width for this window.
312 \membersection{wxWindow::GetChildren
}
314 \func{wxList*
}{GetChildren
}{\void}
316 Returns a pointer to the list of the window's children.
318 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
320 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
322 This gets the size of the window `client area' in pixels. The client area is the
323 area which may be drawn on by the programmer, excluding title bar, border etc.
325 \wxheading{Parameters
}
327 \docparam{width
}{Receives the client width in pixels.
}
329 \docparam{height
}{Receives the client height in pixels.
}
331 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
333 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
335 Returns a pointer to the window's layout constraints, or NULL if there are none.
337 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
339 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
341 Returns a pointer to the button which is the default for this window, or NULL.
343 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
345 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
347 Returns the event handler for this window. By default, the window is its
352 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
353 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
354 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
355 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
356 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
358 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
360 \constfunc{wxFont*
}{GetFont
}{\void}
362 Returns a pointer to the font for this window.
366 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
368 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
370 \func{virtual wxColour
}{GetForegroundColour
}{\void}
372 Returns the foreground colour of the window.
376 The interpretation of foreground colour is open to interpretation according
377 to the window class; it may be the text colour or other colour, or it may not
382 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
383 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
384 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
386 \membersection{wxWindow::GetGrandParent
}
388 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
390 Returns the grandparent of a window, or NULL if there isn't one.
392 \membersection{wxWindow::GetHandle
}
394 \constfunc{void*
}{GetHandle
}{\void}
396 Returns the platform-specific handle of the physical window. Cast it to an appropriate
397 handle, such as
{\bf HWND
} for Windows or
{\bf Widget
} for Motif.
399 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
401 \constfunc{int
}{GetId
}{\void}
403 Returns the identifier of the window.
407 Each window has an integer identifier. If the application has not provided one,
408 an identifier will be generated.
410 TODO: perhaps there should be a default identifier for each class, rather
411 choosing one, which could clash with other ones.
415 \helpref{wxWindow::SetId
}{wxwindowsetid
}
417 \membersection{wxWindow::GetPosition
}
419 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
421 This gets the position of the window in pixels, relative to the parent window or
422 if no parent, relative to the whole display.
424 \wxheading{Parameters
}
426 \docparam{x
}{Receives the x position of the window.
}
428 \docparam{y
}{Receives the y position of the window.
}
430 \membersection{wxWindow::GetLabel
}
432 \constfunc{virtual wxString\&
}{GetLabel
}{\void}
434 Generic way of getting a label from any window, for
435 identification purposes.
439 The interpretation of this function differs from class to class.
440 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
441 the button text. This function can be useful for meta-programs (such as testing
442 tools or special-needs access programs) which need to identify windows
445 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
447 \constfunc{virtual wxString\&
}{GetName
}{\void}
449 Returns the window's name.
453 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
454 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
458 \helpref{wxWindow::SetName
}{wxwindowsetname
}
460 \membersection{wxWindow::GetParent
}
462 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
464 Returns the parent of the window, or NULL if there is no parent.
466 \membersection{wxWindow::GetReturnCode
}\label{wxwindowgetreturncode
}
468 \func{int
}{GetReturnCode
}{\void}
470 Gets the return code for this window.
474 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
475 a code to the application.
479 \helpref{wxWindow::SetReturnCode
}{wxwindowsetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
480 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
482 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
484 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
486 Returns the built-in scrollbar thumb size.
490 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
492 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
494 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
496 Returns the built-in scrollbar position.
500 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
502 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
504 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
506 Returns the built-in scrollbar range.
510 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
512 \membersection{wxWindow::GetSize
}
514 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
516 This gets the size of the entire window in pixels.
518 \wxheading{Parameters
}
520 \docparam{width
}{Receives the window width.
}
522 \docparam{height
}{Receives the window height.
}
524 \membersection{wxWindow::GetTextExtent
}
526 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
527 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
528 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
530 Gets the dimensions of the string as it would be drawn on the
531 window with the currently selected font.
533 \wxheading{Parameters
}
535 \docparam{string
}{String whose extent is to be measured.
}
537 \docparam{x
}{Return value for width.
}
539 \docparam{y
}{Return value for height.
}
541 \docparam{descent
}{Return value for descent (optional).
}
543 \docparam{externalLeading
}{Return value for external leading (optional).
}
545 \docparam{font
}{Font to use instead of the current window font (optional).
}
547 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
549 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
551 \func{virtual wxString
}{GetTitle
}{\void}
553 Gets the window's title. Applicable only to frames and dialogs.
557 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
559 \membersection{wxWindow::GetWindowStyleFlag
}
561 \constfunc{long
}{GetWindowStyleFlag
}{\void}
563 Gets the window style that was passed to the consructor or
{\bf Create
} member.
565 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
567 \func{void
}{InitDialog
}{\void}
569 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
570 in turn transfers data to the dialog via validators.
574 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
576 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
578 \constfunc{virtual bool
}{IsEnabled
}{\void}
580 Returns TRUE if the window is enabled for input, FALSE otherwise.
584 \helpref{wxWindow::Enable
}{wxwindowenable
}
586 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
588 \constfunc{virtual bool
}{IsRetained
}{\void}
590 Returns TRUE if the window is retained, FALSE otherwise.
594 Retained windows are only available on X platforms.
596 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
598 \constfunc{virtual bool
}{IsShown
}{\void}
600 Returns TRUE if the window is shown, FALSE if it has been hidden.
602 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
604 \func{void
}{Layout
}{\void}
606 Invokes the constraint-based layout algorithm for this window. It is called
607 automatically by the default
{\bf wxWindow::OnSize
} member.
609 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
611 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
612 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
614 Loads a panel or dialog from a resource file.
616 \wxheading{Parameters
}
618 \docparam{parent
}{Parent window.
}
620 \docparam{resourceName
}{The name of the resource to load.
}
622 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
623 default resource table will be used.
}
625 \wxheading{Return value
}
627 TRUE if the operation succeeded, otherwise FALSE.
637 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
639 \func{void
}{Lower
}{\void}
641 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
644 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
646 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
648 Disables all other windows in the application so that
649 the user can only interact with this window.
651 \wxheading{Parameters
}
653 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
654 the user can only interact with this window. If FALSE, the effect is reversed.
}
656 \membersection{wxWindow::Move
}\label{wxwindowmove
}
658 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
660 Moves the window to the given position.
662 \wxheading{Parameters
}
664 \docparam{x
}{Required x position.
}
666 \docparam{y
}{Required y position.
}
670 Implementations of SetSize can also implicitly implement the
671 wxWindow::Move function, which is defined in the base wxWindow class
675 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
680 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
682 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
684 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
686 Called when a window is activated or deactivated.
688 \wxheading{Parameters
}
690 \docparam{event
}{Object containing activation information.
}
694 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
695 otherwise it returns FALSE (it is being deactivated).
699 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
700 \helpref{Event handling overview
}{eventhandlingoverview
}
702 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
704 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
706 Called when the user has pressed a key.
708 \wxheading{Parameters
}
710 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
711 details about this class.
}
715 This member function is called in response to a keypress. To intercept this event,
716 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
717 default function to achieve default keypress functionality.
719 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
722 Most, but not all, windows allow keypresses to be intercepted.
726 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
727 \helpref{Event handling overview
}{eventhandlingoverview
}
729 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
731 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
733 This member is called to allow the window to intercept keyboard events
734 before they are processed by child windows.
736 \wxheading{Parameters
}
738 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
739 details about this class.
}
743 This member function is called in response to a keypress, if the window is active. To intercept this event,
744 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
745 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
747 An example of using this function is in the implementation of escape-character processing for wxDialog,
748 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
750 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
753 This function is only relevant to top-level windows (frames and dialogs), and under
758 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
759 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
760 \helpref{Event handling overview
}{eventhandlingoverview
}
762 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
764 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
766 This virtual member function is called if the control does not handle the command event.
768 \wxheading{Parameters
}
770 \docparam{object
}{Object receiving the command event.
}
772 \docparam{event
}{Command event
}
776 This virtual function is provided mainly for backward compatibility. You can also intercept commands
777 from child controls by using an event table, with identifiers or identifier ranges to identify
778 the control(s) in question.
782 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
783 \helpref{Event handling overview
}{eventhandlingoverview
}
785 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
787 \func{virtual bool
}{OnClose
}{\void}
789 Called when the user has tried to close a a frame
790 or dialog box using the window manager (X) or system menu (Windows).
792 {\bf Note:
} This is an obsolete function retained for backward compatibility.
793 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
796 \wxheading{Return value
}
798 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
799 attempt will be ignored. Do not delete the window from within this handler, although
800 you may delete other windows.
804 Derive your own class to handle this message. The default handler returns FALSE.
808 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
809 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
810 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
811 \helpref{wxCloseEvent
}{wxcloseevent
}
813 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
815 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
817 This is an event handler function called when the user has tried to close a a frame
818 or dialog box using the window manager (X) or system menu (Windows). It is
819 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
820 that the application can also invoke the handler programmatically.
822 Use the EVT
\_CLOSE event table macro to handle close events.
824 You should check whether the application is forcing the deletion of the window
825 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
826 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
827 If not, it is up to you whether you respond by destroying the window.
831 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
832 for backward compatibility with earlier versions of wxWindows. The
833 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
834 destroying the window if it returns TRUE or if the close is being forced.
838 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
839 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
840 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
841 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
842 \helpref{wxCloseEvent
}{wxcloseevent
}
844 \membersection{wxWindow::OnDefaultAction
}\label{wxwindowondefaultaction
}
846 \func{virtual void
}{OnDefaultAction
}{\param{wxControl*
}{control
}}
848 Called when the user initiates the default action for a panel or
849 dialog box, for example by double clicking on a listbox.
851 \wxheading{Parameters
}
853 \docparam{control
}{The control which caused the default action.
}
857 TODO: eliminate this?? Or keep it for backward compatibility?
859 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
861 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
863 Called when files have been dragged from the file manager to the window.
865 \wxheading{Parameters
}
867 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
871 The window must have previously been enabled for dropping by calling
872 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
874 This event is only generated under Windows.
876 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
880 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
881 \helpref{Event handling overview
}{eventhandlingoverview
}
883 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
885 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
887 Called when the background of the window needs to be erased.
889 \wxheading{Parameters
}
891 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
895 This event is only generated under Windows.
897 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
901 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
903 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
905 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
907 Called when a window's focus is being killed.
909 \wxheading{Parameters
}
911 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
915 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
917 Most, but not all, windows respond to this event.
921 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
922 \helpref{Event handling overview
}{eventhandlingoverview
}
924 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
926 \func{void
}{Onidle
}{\param{wxIdleEvent\&
}{event
}}
928 Provide this member function for any processing which needs to be done
929 when the application is idle.
933 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
935 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
937 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
939 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
941 \wxheading{Parameters
}
943 \docparam{event
}{Dialog initialisation event.
}
947 Gives the window the default behaviour of transferring data to child controls via
948 the validator that each control has.
952 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
954 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
956 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
958 Called when a menu command is received from a menu bar.
960 \wxheading{Parameters
}
962 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
966 A function with this name doesn't actually exist; you can choose any member function to receive
967 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
972 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
973 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
974 \helpref{Event handling overview
}{eventhandlingoverview
}
976 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
978 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
980 Called when a menu select is received from a menu bar: that is, the
981 mouse cursor is over a menu item, but the left mouse button has not been
984 \wxheading{Parameters
}
986 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
990 You can choose any member function to receive
991 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
994 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
995 text in the first field of the status bar.
997 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
998 since a selection is normally a left-click action.
1000 \wxheading{See also
}
1002 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1003 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1004 \helpref{Event handling overview
}{eventhandlingoverview
}
1007 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1009 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1011 Called when the user has initiated an event with the
1014 \wxheading{Parameters
}
1016 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1021 Most, but not all, windows respond to this event.
1023 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1024 mouse event macros such as EVT
\_LEFT\_DOWN.
1026 \wxheading{See also
}
1028 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1029 \helpref{Event handling overview
}{eventhandlingoverview
}
1031 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1033 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1035 Called when a window is moved.
1037 \wxheading{Parameters
}
1039 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1043 Use the EVT
\_MOVE macro to intercept move events.
1047 Not currently implemented.
1049 \wxheading{See also
}
1051 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1052 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1053 \helpref{Event handling overview
}{eventhandlingoverview
}
1055 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1057 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1059 Sent to the event handler when the window must be refreshed.
1061 \wxheading{Parameters
}
1063 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1067 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1069 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1075 void MyWindow::OnPaint(wxPaintEvent& event)
1084 You can optimize painting by retrieving the rectangles
1085 that have been damaged and only repainting these. The rectangles are in
1086 terms of the client area, and are unscrolled, so you will need to do
1087 some calculations using the current view position to obtain logical,
1090 Here is an example of using the
\helpref{wxUpdateIterator
}{wxupdateiterator
} class:
1094 // Called when window needs to be repainted.
1095 void MyWindow::OnPaint(wxPaintEvent& event)
1099 // Find Out where the window is scrolled to
1100 int vbX,vbY; // Top left corner of client
1101 ViewStart(&vbX,&vbY);
1103 int vX,vY,vW,vH; // Dimensions of client area in pixels
1104 wxUpdateIterator upd(this); // get the update rect list
1113 // Alternatively we can do this:
1115 // upd.GetRect(&rect);
1117 // Repaint this rectangle
1126 \wxheading{See also
}
1128 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1129 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1130 \helpref{Event handling overview
}{eventhandlingoverview
}
1132 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1134 \func{void
}{OnScroll
}{\param{wxScrollEvent\&
}{event
}}
1136 Called when a scroll event is received from one of the window's built-in scrollbars.
1138 \wxheading{Parameters
}
1140 \docparam{event
}{Command event. Retrieve the new scroll position by
1141 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1142 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1146 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1147 until the function is executing (you can't have one function for vertical, another
1148 for horizontal events).
1150 \wxheading{See also
}
1152 \helpref{wxScrollEvent
}{wxscrollevent
},
\rtfsp
1153 \helpref{Event handling overview
}{eventhandlingoverview
}
1155 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1157 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1159 Called when a window's focus is being set.
1161 \wxheading{Parameters
}
1163 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1167 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1169 Most, but not all, windows respond to this event.
1171 \wxheading{See also
}
1173 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1174 \helpref{Event handling overview
}{eventhandlingoverview
}
1176 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1178 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1180 Called when the window has been resized.
1182 \wxheading{Parameters
}
1184 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1188 You may wish to use this for frames to resize their child windows as appropriate.
1190 Note that the size passed is of
1191 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1192 used by the application.
1194 \wxheading{See also
}
1196 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1197 \helpref{Event handling overview
}{eventhandlingoverview
}
1199 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1201 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1203 Called when the user has changed the system colours.
1205 \wxheading{Parameters
}
1207 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1209 \wxheading{See also
}
1211 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1212 \helpref{Event handling overview
}{eventhandlingoverview
}
1214 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1216 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1218 Removes and returns the top-most event handler on the event handler stack.
1220 \wxheading{Parameters
}
1222 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1223 default value is FALSE.
}
1225 \wxheading{See also
}
1227 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1228 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1229 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1230 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1231 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1233 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1235 \func{virtual bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1237 Pops up the given menu at the specified coordinates, relative to this
1238 window, and returns control when the user has dismissed the menu. If a
1239 menu item is selected, the callback defined for the menu is called with
1240 wxMenu and wxCommandEvent reference arguments. The callback should access
1241 the commandInt member of the event to check the selected menu identifier.
1243 \wxheading{Parameters
}
1245 \docparam{menu
}{Menu to pop up.
}
1247 \docparam{x
}{Required x position for the menu to appear.
}
1249 \docparam{y
}{Required y position for the menu to appear.
}
1251 \wxheading{See also
}
1253 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::FakePopupMenu
}{wxwindowfakepopupmenu
}
1255 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1257 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1259 Pushes this event handler onto the event stack for the window.
1261 \wxheading{Parameters
}
1263 \docparam{handler
}{Specifies the handler to be pushed.
}
1267 An event handler is an object that is capable of processing the events
1268 sent to a window. By default, the window is its own event handler, but
1269 an application may wish to substitute another, for example to allow
1270 central implementation of event-handling for a variety of different
1273 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1274 an application to set up a chain of event handlers, where an event not handled by one event handler is
1275 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1276 remove the event handler.
1278 \wxheading{See also
}
1280 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1281 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1282 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1283 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1284 \helpref{wxEvtHandler
}{wxevthandler
}
1286 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1288 \func{void
}{Raise
}{\void}
1290 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1293 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1295 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1298 Causes a message or event to be generated to repaint the
1301 \wxheading{Parameters
}
1303 \docparam{eraseBackground
}{If TRUE, the background will be
1306 \docparam{rect
}{If non-NULL, only the given rectangle will
1307 be treated as damaged.
}
1309 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1311 \func{virtual void
}{ReleaseMouse
}{\void}
1313 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1315 \wxheading{See also
}
1317 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1319 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1321 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1323 Removes a child window. This is called automatically by window deletion
1324 functions so should not be required by the application programmer.
1326 \wxheading{Parameters
}
1328 \docparam{child
}{Child window to remove.
}
1330 \membersection{wxWindow::ScreenToClient
}
1332 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1334 Converts from screen to client window coordinates.
1336 \wxheading{Parameters
}
1338 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1340 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1342 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1344 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1346 Physically scrolls the pixels in the window.
1348 \wxheading{Parameters
}
1350 \docparam{dx
}{Amount to scroll horizontally.
}
1352 \docparam{dy
}{Amount to scroll vertically.
}
1354 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1355 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1356 can optimise painting by checking for the invalidated region.
}
1360 Available only under Windows.
1362 Use this function to optimise your scrolling implementations, to minimise the area that must be
1365 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1367 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1369 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1370 be called automatically when the window is resized.
1372 \wxheading{Parameters
}
1374 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1375 from within wxWindow::OnSize functions.
}
1377 \wxheading{See also
}
1379 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1381 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1383 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1385 Sets the background colour of the window.
1387 \wxheading{Parameters
}
1389 \docparam{colour
}{The colour to be used as the background colour.
}
1393 The background colour is usually painted by the default
\rtfsp
1394 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function.
1396 \wxheading{See also
}
1398 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1399 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1400 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1401 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1403 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1405 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1407 Sets the window to have the given layout constraints. The window
1408 will then own the object, and will take care of its deletion.
1409 If an existing layout constraints object is already owned by the
1410 window, it will be deleted.
1412 \wxheading{Parameters
}
1414 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1419 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1420 the constraints automatically in OnSize; otherwise, you must
1421 override OnSize and call Layout explicitly.
1423 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1425 \func{virtual void
}{SetFocus
}{\void}
1427 This sets the window to receive keyboard input.
1429 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1431 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1433 Sets the font for this window.
1435 \wxheading{Parameters
}
1437 \docparam{font
}{Font to associate with this window.
}
1439 \wxheading{See also
}
1441 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1443 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1445 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1447 Sets the foreground colour of the window.
1449 \wxheading{Parameters
}
1451 \docparam{colour
}{The colour to be used as the foreground colour.
}
1455 The interpretation of foreground colour is open to interpretation according
1456 to the window class; it may be the text colour or other colour, or it may not
1459 \wxheading{See also
}
1461 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1462 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1463 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1465 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1467 \func{void
}{SetId
}{\param{int
}{ id
}}
1469 Sets the identifier of the window.
1473 Each window has an integer identifier. If the application has not provided one,
1474 an identifier will be generated. Normally, the identifier should be provided
1475 on creation and should not be modified subsequently.
1477 TODO: perhaps there should be a default identifier for each class, rather
1478 choosing one, which could clash with other ones.
1480 \wxheading{See also
}
1482 \helpref{wxWindow::GetId
}{wxwindowgetid
}
1485 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1487 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1489 Sets the window's name.
1491 \wxheading{Parameters
}
1493 \docparam{name
}{A name to set for the window.
}
1495 \wxheading{See also
}
1497 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1499 \membersection{wxWindow::SetReturnCode
}\label{wxwindowsetreturncode
}
1501 \func{void
}{SetReturnCode
}{\param{int
}{retCode
}}
1503 Sets the return code for this window.
1505 \wxheading{Parameters
}
1507 \docparam{retCode
}{The integer return code, usually a control identifier.
}
1511 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
1512 a code to the application. The function
\helpref{wxDialog::EndModal
}{wxdialogendmodal
} calls
{\bf SetReturnCode
}.
1514 \wxheading{See also
}
1516 \helpref{wxWindow::GetReturnCode
}{wxwindowgetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
1517 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
1519 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1521 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1522 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1523 \param{const bool
}{refresh = TRUE
}}
1525 Sets the scrollbar properties of a built-in scrollbar.
1527 \wxheading{Parameters
}
1529 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1531 \docparam{position
}{The position of the scrollbar in scroll units.
}
1533 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1535 \docparam{range
}{The maximum position of the scrollbar.
}
1537 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1541 Let's say you wish to display
50 lines of text, using the same font.
1542 The window is sized so that you can only see
16 lines at a time.
1548 SetScrollbar(wxVERTICAL,
0,
16,
50);
1552 Note that with the window at this size, the thumb position can never go
1553 above
50 minus
16, or
34.
1555 You can determine how many lines are currently visible by dividing the current view
1556 size by the character height in pixels.
1558 When defining your own scrollbar behaviour, you will always need to recalculate
1559 the scrollbar settings when the window size changes. You could therefore put your
1560 scrollbar calculations and SetScrollbar
1561 call into a function named AdjustScrollbars, which can be called initially and also
1562 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1564 \wxheading{See also
}
1566 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1567 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1570 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1572 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1574 Sets the page size of one of the built-in scrollbars.
1576 \wxheading{Parameters
}
1578 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1580 \docparam{pageSize
}{Page size in scroll units.
}
1582 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1586 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1587 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1588 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1589 value has to be adjusted when the window is resized, since the page size will have changed.
1591 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1592 the thumb changes size to reflect the page size relative to the length of the
document. When the
1593 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1594 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1597 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1598 handling of pages and ranges.
1600 \wxheading{See also
}
1602 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1603 \helpref{wxWindow::SetScrollRange
}{wxwindowsetscrollpage
},
\rtfsp
1604 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1605 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1606 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollrange
},
\rtfsp
1607 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1610 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1612 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1614 Sets the position of one of the built-in scrollbars.
1616 \wxheading{Parameters
}
1618 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1620 \docparam{pos
}{Position in scroll units.
}
1622 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1626 This function does not directly affect the contents of the window: it is up to the
1627 application to take note of scrollbar attributes and redraw contents accordingly.
1629 \wxheading{See also
}
1631 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1632 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1633 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1634 \helpref{wxWindow::GetScrollThumb
}{wxwindowsetscrollthumb
},
\rtfsp
1635 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1638 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1640 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1642 Sets the range of one of the built-in scrollbars.
1644 \wxheading{Parameters
}
1646 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1648 \docparam{range
}{Scroll range.
}
1650 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1654 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1655 object length of the scrollbar. If you are implementing a scrolling window, for example, you
1656 would adjust the scroll range when the window is resized, by subtracting the window view size from the
1657 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
1658 and usually the scrollbar will be automatically hidden.
1660 \wxheading{See also
}
1662 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1663 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1664 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1665 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1666 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollrange
},
\rtfsp
1667 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1670 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
1672 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
1673 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
1675 Sets the size and position of the window in pixels.
1677 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1679 Sets the size of the window in pixels.
1681 \wxheading{Parameters
}
1683 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
1684 value should be used.
}
1686 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
1687 value should be used.
}
1689 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
1690 value should be used.
}
1692 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
1693 value should be used.
}
1695 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
1697 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
1698 a wxWindows-supplied default width.\\
1699 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
1700 a wxWindows-supplied default width.\\
1701 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
1702 a wxWindows-supplied default size.\\
1703 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
1704 if -
1 values are supplied.\\
1705 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
1706 as real dimensions, not default values.
1711 The second form is a convenience for calling the first form with default
1712 x and y parameters, and must be used with non-default width and height values.
1714 The first form sets the position and optionally size, of the window.
1715 Parameters may be -
1 to indicate either that a default should be supplied
1716 by wxWindows, or that the current value of the dimension should be used.
1718 \wxheading{See also
}
1720 \helpref{wxWindow::Move
}{wxwindowmove
}
1722 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
1724 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
1725 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
1727 Allows specification of minimum and maximum window sizes, and window size increments.
1728 If a pair of values is not set (or set to -
1), the default values will be used.
1730 \wxheading{Parameters
}
1732 \docparam{minW
}{Specifies the minimum width allowable.
}
1734 \docparam{minH
}{Specifies the minimum height allowable.
}
1736 \docparam{maxW
}{Specifies the maximum width allowable.
}
1738 \docparam{maxH
}{Specifies the maximum height allowable.
}
1740 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
1742 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
1746 If this function is called, the user will not be able to size the window outside the
1749 The resizing increments are only significant under Motif or Xt.
1751 \membersection{wxWindow::SetClientSize
}
1753 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1755 This sets the size of the window client area in pixels. Using this function to size a window
1756 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1757 worry about what dimensions the border or title bar have when trying to fit the window
1758 around panel items, for example.
1760 \wxheading{Parameters
}
1762 \docparam{width
}{The required client area width.
}
1764 \docparam{height
}{The required client area height.
}
1766 \membersection{wxWindow::SetPalette
}
1768 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1770 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1772 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1774 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1776 Sets the window's cursor.
1778 \wxheading{Parameters
}
1780 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1784 Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1785 function if you want the cursor to change immediately, because under Windows,
1786 wxWindows only sets the global cursor when it detects mouse movement.
1788 \wxheading{See also
}
1790 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1792 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1794 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1796 Sets the event handler for this window.
1798 \wxheading{Parameters
}
1800 \docparam{handler
}{Specifies the handler to be set.
}
1804 An event handler is an object that is capable of processing the events
1805 sent to a window. By default, the window is its own event handler, but
1806 an application may wish to substitute another, for example to allow
1807 central implementation of event-handling for a variety of different
1810 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1811 this sets up a chain of event handlers, where an event not handled by one event handler is
1812 handed to the next one in the chain.
1814 \wxheading{See also
}
1816 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1817 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1818 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1819 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1820 \helpref{wxEvtHandler
}{wxevthandler
}
1822 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
1824 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
1826 Sets the window's title. Applicable only to frames and dialogs.
1828 \wxheading{Parameters
}
1830 \docparam{title
}{The window's title.
}
1832 \wxheading{See also
}
1834 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
1836 \membersection{wxWindow::Show
}
1838 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
1840 Shows or hides the window.
1842 \wxheading{Parameters
}
1844 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
1847 \wxheading{See also
}
1849 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
1851 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
1853 \func{virtual bool
}{TransferDataFromWindow
}{\void}
1855 Transfers values from child controls to data areas specified by their validators. Returns
1856 FALSE if a transfer failed.
1858 \wxheading{See also
}
1860 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
1861 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1863 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
1865 \func{virtual bool
}{TransferDataToWindow
}{\void}
1867 Transfers values to child controls from data areas specified by their validators.
1869 \wxheading{Return value
}
1871 Returns FALSE if a transfer failed.
1873 \wxheading{See also
}
1875 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1876 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1878 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
1880 \func{virtual bool
}{Validate
}{\void}
1882 Validates the current values of the child controls using their validators.
1884 \wxheading{Return value
}
1886 Returns FALSE if any of the validations failed.
1888 \wxheading{See also
}
1890 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1891 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1892 \helpref{wxValidator
}{wxvalidator
}
1894 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
1896 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
1898 Moves the pointer to the given position on the window.
1900 \wxheading{Parameters
}
1902 \docparam{x
}{The new x position for the cursor.
}
1904 \docparam{y
}{The new y position for the cursor.
}