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.
}
34 See also
\helpref{window styles overview
}{windowstyles
}.
38 \helpref{Event handling overview
}{eventhandlingoverview
}
40 \latexignore{\rtfignore{\wxheading{Members
}}}
42 \membersection{wxWindow::wxWindow
}
44 \func{}{wxWindow
}{\void}
48 \func{}{wxWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
49 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
50 \param{const wxSize\&
}{size = wxDefaultSize
},
51 \param{long
}{style =
0},
52 \param{const wxString\&
}{name = wxPanelNameStr
}}
54 Constructs a window, which can be a child of a frame, dialog or any other non-control window.
56 \wxheading{Parameters
}
58 \docparam{parent
}{Pointer to a parent window.
}
60 \docparam{id
}{Window identifier. If -
1, will automatically create an identifier.
}
62 \docparam{pos
}{Window position. wxDefaultPosition is (-
1, -
1) which indicates that wxWindows
63 should generate a default position for the window. If using the wxWindow class directly, supply
66 \docparam{size
}{Window size. wxDefaultSize is (-
1, -
1) which indicates that wxWindows
67 should generate a default size for the window.
}
69 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
71 \docparam{name
}{Window name.
}
73 \membersection{wxWindow::
\destruct{wxWindow
}}
75 \func{}{\destruct{wxWindow
}}{\void}
77 Destructor. Deletes all subwindows, then deletes itself. Instead of using
78 the
{\bf delete
} operator explicitly, you should normally
79 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
80 can delete a window only when it is safe to do so, in idle time.
84 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
85 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
86 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
87 \helpref{wxCloseEvent
}{wxcloseevent
}
89 \membersection{wxWindow::AddChild
}
91 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
93 Adds a child window. This is called automatically by window creation
94 functions so should not be required by the application programmer.
96 \wxheading{Parameters
}
98 \docparam{child
}{Child window to add.
}
100 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
102 \func{virtual void
}{CaptureMouse
}{\void}
104 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
109 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
111 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
113 \func{void
}{Center
}{\param{int
}{ direction
}}
115 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
117 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
119 \func{virtual void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
123 \wxheading{Parameters
}
125 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
130 The actual behaviour depends on the derived window. For a frame or dialog box,
131 centring is relative to the whole display. For a panel item, centring is
132 relative to the panel.
136 \helpref{wxWindow::Center
}{wxwindowcenter
}
138 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
140 \func{void
}{Clear
}{\void}
142 Clears the window by filling it with the current background colour.
144 \membersection{wxWindow::ClientToScreen
}
146 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
148 Converts to screen coordinates from coordinates relative to this window.
150 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
151 a screen coordinate will be passed out.
}
153 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
154 a screen coordinate will be passed out.
}
156 \membersection{wxWindow::Close
}\label{wxwindowclose
}
158 \func{virtual bool
}{Close
}{\param{const bool
}{ force = FALSE
}}
160 The purpose of this call is to provide a safer way of destroying a window than using
161 the
{\it delete
} operator.
163 \wxheading{Parameters
}
165 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
166 of this window, TRUE if it cannot.
}
170 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
171 choose whether to destroy the window.
173 The close handler should check whether the window is being deleted forcibly,
174 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
175 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
177 Applies to managed windows (wxFrame and wxDialog classes) only.
181 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
182 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
183 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
184 \helpref{wxCloseEvent
}{wxcloseevent
}
186 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
188 \func{virtual bool
}{Destroy
}{\void}
190 Destroys the window safely. Use this function instead of the delete operator, since
191 different window classes can be destroyed differently. Frames and dialogs
192 are not destroyed immediately when this function is called - they are added
193 to a list of windows to be deleted on idle time, when all the window's events
194 have been processed. This prevents problems with events being sent to non-existant
197 \wxheading{Return value
}
199 TRUE if the window has either been successfully deleted, or it has been added
200 to the list of windows pending real deletion.
202 \membersection{wxWindow::DestroyChildren
}
204 \func{virtual void
}{DestroyChildren
}{\void}
206 Destroys all children of a window. Called automatically by the destructor.
208 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
210 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
212 Enables or disables elibility for drop file events (OnDropFiles).
214 \wxheading{Parameters
}
216 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
217 will not accept drop file events.
}
225 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
227 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
229 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
231 Enable or disable the window for user input.
233 \wxheading{Parameters
}
235 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
239 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
241 \membersection{wxWindow::FakePopupMenu
}\label{wxwindowfakepopupmenu
}
243 \func{virtual bool
}{FakePopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
245 A replacement for wxWindow::PopupMenu for cases where the PopupMenu implementation
246 does not work correctly, in particular on Motif platforms.
248 \wxheading{Parameters
}
250 \docparam{menu
}{Menu to pop up.
}
252 \docparam{x
}{Required x position for the menu to appear.
}
254 \docparam{y
}{Required y position for the menu to appear.
}
258 This is a cut-down version of PopupMenu using a dialog and listbox; pull-right menus
263 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::PopupMenu
}{wxwindowpopupmenu
}
265 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
267 \func{static wxWindow*
}{FindFocus
}{\void}
269 Finds the window or control which currently has the keyboard focus.
273 Note that this is a static function, so it can be called without needing a wxWindow pointer.
277 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
279 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
281 \func{virtual void
}{Fit
}{\void}
283 Sizes the window so that it fits around its subwindows.
285 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
287 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
289 Returns the background colour of the window.
293 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
294 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
295 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
296 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
298 \membersection{wxWindow::GetCharHeight
}
300 \constfunc{virtual int
}{GetCharHeight
}{\void}
302 Returns the character height for this window.
304 \membersection{wxWindow::GetCharWidth
}
306 \constfunc{virtual int
}{GetCharWidth
}{\void}
308 Returns the average character width for this window.
310 \membersection{wxWindow::GetChildren
}
312 \func{wxList*
}{GetChildren
}{\void}
314 Returns a pointer to the list of the window's children.
316 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
318 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
320 This gets the size of the window `client area' in pixels. The client area is the
321 area which may be drawn on by the programmer, excluding title bar, border etc.
323 \wxheading{Parameters
}
325 \docparam{width
}{Receives the client width in pixels.
}
327 \docparam{height
}{Receives the client height in pixels.
}
329 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
331 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
333 Returns a pointer to the window's layout constraints, or NULL if there are none.
335 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
337 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
339 Returns a pointer to the button which is the default for this window, or NULL.
341 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
343 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
345 Returns the event handler for this window. By default, the window is its
350 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
351 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
352 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
353 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
354 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
356 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
358 \constfunc{wxFont*
}{GetFont
}{\void}
360 Returns a pointer to the font for this window.
364 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
366 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
368 \func{virtual wxColour
}{GetForegroundColour
}{\void}
370 Returns the foreground colour of the window.
374 The interpretation of foreground colour is open to interpretation according
375 to the window class; it may be the text colour or other colour, or it may not
380 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
381 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
382 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
384 \membersection{wxWindow::GetGrandParent
}
386 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
388 Returns the grandparent of a window, or NULL if there isn't one.
390 \membersection{wxWindow::GetHandle
}
392 \constfunc{void*
}{GetHandle
}{\void}
394 Returns the platform-specific handle of the physical window. Cast it to an appropriate
395 handle, such as
{\bf HWND
} for Windows or
{\bf Widget
} for Motif.
397 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
399 \constfunc{int
}{GetId
}{\void}
401 Returns the identifier of the window.
405 Each window has an integer identifier. If the application has not provided one,
406 an identifier will be generated.
408 TODO: perhaps there should be a default identifier for each class, rather
409 choosing one, which could clash with other ones.
413 \helpref{wxWindow::SetId
}{wxwindowsetid
}
415 \membersection{wxWindow::GetPosition
}
417 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
419 This gets the position of the window in pixels, relative to the parent window or
420 if no parent, relative to the whole display.
422 \wxheading{Parameters
}
424 \docparam{x
}{Receives the x position of the window.
}
426 \docparam{y
}{Receives the y position of the window.
}
428 \membersection{wxWindow::GetLabel
}
430 \constfunc{virtual wxString\&
}{GetLabel
}{\void}
432 Generic way of getting a label from any window, for
433 identification purposes.
437 The interpretation of this function differs from class to class.
438 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
439 the button text. This function can be useful for meta-programs (such as testing
440 tools or special-needs access programs) which need to identify windows
443 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
445 \constfunc{virtual wxString\&
}{GetName
}{\void}
447 Returns the window's name.
451 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
452 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
456 \helpref{wxWindow::SetName
}{wxwindowsetname
}
458 \membersection{wxWindow::GetParent
}
460 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
462 Returns the parent of the window, or NULL if there is no parent.
464 \membersection{wxWindow::GetReturnCode
}\label{wxwindowgetreturncode
}
466 \func{int
}{GetReturnCode
}{\void}
468 Gets the return code for this window.
472 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
473 a code to the application.
477 \helpref{wxWindow::SetReturnCode
}{wxwindowsetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
478 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
480 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
482 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
484 Returns the built-in scrollbar thumb size.
488 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
490 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
492 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
494 Returns the built-in scrollbar position.
498 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
500 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
502 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
504 Returns the built-in scrollbar range.
508 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
510 \membersection{wxWindow::GetSize
}
512 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
514 This gets the size of the entire window in pixels.
516 \wxheading{Parameters
}
518 \docparam{width
}{Receives the window width.
}
520 \docparam{height
}{Receives the window height.
}
522 \membersection{wxWindow::GetTextExtent
}
524 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
525 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
526 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
528 Gets the dimensions of the string as it would be drawn on the
529 window with the currently selected font.
531 \wxheading{Parameters
}
533 \docparam{string
}{String whose extent is to be measured.
}
535 \docparam{x
}{Return value for width.
}
537 \docparam{y
}{Return value for height.
}
539 \docparam{descent
}{Return value for descent (optional).
}
541 \docparam{externalLeading
}{Return value for external leading (optional).
}
543 \docparam{font
}{Font to use instead of the current window font (optional).
}
545 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
547 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
549 \func{virtual wxString
}{GetTitle
}{\void}
551 Gets the window's title. Applicable only to frames and dialogs.
555 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
557 \membersection{wxWindow::GetWindowStyleFlag
}
559 \constfunc{long
}{GetWindowStyleFlag
}{\void}
561 Gets the window style that was passed to the consructor or
{\bf Create
} member.
563 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
565 \func{void
}{InitDialog
}{\void}
567 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
568 in turn transfers data to the dialog via validators.
572 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
574 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
576 \constfunc{virtual bool
}{IsEnabled
}{\void}
578 Returns TRUE if the window is enabled for input, FALSE otherwise.
582 \helpref{wxWindow::Enable
}{wxwindowenable
}
584 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
586 \constfunc{virtual bool
}{IsRetained
}{\void}
588 Returns TRUE if the window is retained, FALSE otherwise.
592 Retained windows are only available on X platforms.
594 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
596 \constfunc{virtual bool
}{IsShown
}{\void}
598 Returns TRUE if the window is shown, FALSE if it has been hidden.
600 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
602 \func{void
}{Layout
}{\void}
604 Invokes the constraint-based layout algorithm for this window. It is called
605 automatically by the default
{\bf wxWindow::OnSize
} member.
607 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
609 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
610 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
612 Loads a panel or dialog from a resource file.
614 \wxheading{Parameters
}
616 \docparam{parent
}{Parent window.
}
618 \docparam{resourceName
}{The name of the resource to load.
}
620 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
621 default resource table will be used.
}
623 \wxheading{Return value
}
625 TRUE if the operation succeeded, otherwise FALSE.
635 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
637 \func{void
}{Lower
}{\void}
639 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
642 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
644 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
646 Disables all other windows in the application so that
647 the user can only interact with this window.
649 \wxheading{Parameters
}
651 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
652 the user can only interact with this window. If FALSE, the effect is reversed.
}
654 \membersection{wxWindow::Move
}\label{wxwindowmove
}
656 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
658 Moves the window to the given position.
660 \wxheading{Parameters
}
662 \docparam{x
}{Required x position.
}
664 \docparam{y
}{Required y position.
}
668 Implementations of SetSize can also implicitly implement the
669 wxWindow::Move function, which is defined in the base wxWindow class
673 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
678 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
680 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
682 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
684 Called when a window is activated or deactivated.
686 \wxheading{Parameters
}
688 \docparam{event
}{Object containing activation information.
}
692 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
693 otherwise it returns FALSE (it is being deactivated).
697 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
698 \helpref{Event handling overview
}{eventhandlingoverview
}
700 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
702 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
704 Called when the user has pressed a key.
706 \wxheading{Parameters
}
708 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
709 details about this class.
}
713 This member function is called in response to a keypress. To intercept this event,
714 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
715 default function to achieve default keypress functionality.
717 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
720 Most, but not all, windows allow keypresses to be intercepted.
724 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
725 \helpref{Event handling overview
}{eventhandlingoverview
}
727 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
729 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
731 This member is called to allow the window to intercept keyboard events
732 before they are processed by child windows.
734 \wxheading{Parameters
}
736 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
737 details about this class.
}
741 This member function is called in response to a keypress, if the window is active. To intercept this event,
742 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
743 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
745 An example of using this function is in the implementation of escape-character processing for wxDialog,
746 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
748 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
751 This function is only relevant to top-level windows (frames and dialogs), and under
756 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
757 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
758 \helpref{Event handling overview
}{eventhandlingoverview
}
760 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
762 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
764 This virtual member function is called if the control does not handle the command event.
766 \wxheading{Parameters
}
768 \docparam{object
}{Object receiving the command event.
}
770 \docparam{event
}{Command event
}
774 This virtual function is provided mainly for backward compatibility. You can also intercept commands
775 from child controls by using an event table, with identifiers or identifier ranges to identify
776 the control(s) in question.
780 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
781 \helpref{Event handling overview
}{eventhandlingoverview
}
783 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
785 \func{virtual bool
}{OnClose
}{\void}
787 Called when the user has tried to close a a frame
788 or dialog box using the window manager (X) or system menu (Windows).
790 {\bf Note:
} This is an obsolete function retained for backward compatibility.
791 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
794 \wxheading{Return value
}
796 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
797 attempt will be ignored. Do not delete the window from within this handler, although
798 you may delete other windows.
802 Derive your own class to handle this message. The default handler returns FALSE.
806 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
807 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
808 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
809 \helpref{wxCloseEvent
}{wxcloseevent
}
811 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
813 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
815 This is an event handler function called when the user has tried to close a a frame
816 or dialog box using the window manager (X) or system menu (Windows). It is
817 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
818 that the application can also invoke the handler programmatically.
820 Use the EVT
\_CLOSE event table macro to handle close events.
822 You should check whether the application is forcing the deletion of the window
823 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
824 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
825 If not, it is up to you whether you respond by destroying the window.
829 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
830 for backward compatibility with earlier versions of wxWindows. The
831 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
832 destroying the window if it returns TRUE or if the close is being forced.
836 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
837 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
838 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
839 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
840 \helpref{wxCloseEvent
}{wxcloseevent
}
842 \membersection{wxWindow::OnDefaultAction
}\label{wxwindowondefaultaction
}
844 \func{virtual void
}{OnDefaultAction
}{\param{wxControl*
}{control
}}
846 Called when the user initiates the default action for a panel or
847 dialog box, for example by double clicking on a listbox.
849 \wxheading{Parameters
}
851 \docparam{control
}{The control which caused the default action.
}
855 TODO: eliminate this?? Or keep it for backward compatibility?
857 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
859 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
861 Called when files have been dragged from the file manager to the window.
863 \wxheading{Parameters
}
865 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
869 The window must have previously been enabled for dropping by calling
870 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
872 This event is only generated under Windows.
874 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
878 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
879 \helpref{Event handling overview
}{eventhandlingoverview
}
881 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
883 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
885 Called when the background of the window needs to be erased.
887 \wxheading{Parameters
}
889 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
893 This event is only generated under Windows.
895 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
899 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
901 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
903 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
905 Called when a window's focus is being killed.
907 \wxheading{Parameters
}
909 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
913 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
915 Most, but not all, windows respond to this event.
919 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
920 \helpref{Event handling overview
}{eventhandlingoverview
}
922 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
924 \func{void
}{Onidle
}{\param{wxIdleEvent\&
}{event
}}
926 Provide this member function for any processing which needs to be done
927 when the application is idle.
931 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
933 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
935 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
937 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
939 \wxheading{Parameters
}
941 \docparam{event
}{Dialog initialisation event.
}
945 Gives the window the default behaviour of transferring data to child controls via
946 the validator that each control has.
950 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
952 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
954 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
956 Called when a menu command is received from a menu bar.
958 \wxheading{Parameters
}
960 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
964 A function with this name doesn't actually exist; you can choose any member function to receive
965 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
970 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
971 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
972 \helpref{Event handling overview
}{eventhandlingoverview
}
974 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
976 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
978 Called when a menu select is received from a menu bar: that is, the
979 mouse cursor is over a menu item, but the left mouse button has not been
982 \wxheading{Parameters
}
984 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
988 You can choose any member function to receive
989 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
992 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
993 text in the first field of the status bar.
995 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
996 since a selection is normally a left-click action.
1000 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1001 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1002 \helpref{Event handling overview
}{eventhandlingoverview
}
1005 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1007 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1009 Called when the user has initiated an event with the
1012 \wxheading{Parameters
}
1014 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1019 Most, but not all, windows respond to this event.
1021 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1022 mouse event macros such as EVT
\_LEFT\_DOWN.
1024 \wxheading{See also
}
1026 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1027 \helpref{Event handling overview
}{eventhandlingoverview
}
1029 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1031 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1033 Called when a window is moved.
1035 \wxheading{Parameters
}
1037 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1041 Use the EVT
\_MOVE macro to intercept move events.
1045 Not currently implemented.
1047 \wxheading{See also
}
1049 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1050 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1051 \helpref{Event handling overview
}{eventhandlingoverview
}
1053 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1055 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1057 Sent to the event handler when the window must be refreshed.
1059 \wxheading{Parameters
}
1061 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1065 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1067 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1073 void MyWindow::OnPaint(wxPaintEvent& event)
1082 You can optimize painting by retrieving the rectangles
1083 that have been damaged and only repainting these. The rectangles are in
1084 terms of the client area, and are unscrolled, so you will need to do
1085 some calculations using the current view position to obtain logical,
1088 Here is an example of using the
\helpref{wxUpdateIterator
}{wxupdateiterator
} class:
1092 // Called when window needs to be repainted.
1093 void MyWindow::OnPaint(wxPaintEvent& event)
1097 // Find Out where the window is scrolled to
1098 int vbX,vbY; // Top left corner of client
1099 ViewStart(&vbX,&vbY);
1101 int vX,vY,vW,vH; // Dimensions of client area in pixels
1102 wxUpdateIterator upd(this); // get the update rect list
1111 // Alternatively we can do this:
1113 // upd.GetRect(&rect);
1115 // Repaint this rectangle
1124 \wxheading{See also
}
1126 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1127 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1128 \helpref{Event handling overview
}{eventhandlingoverview
}
1130 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1132 \func{void
}{OnScroll
}{\param{wxScrollEvent\&
}{event
}}
1134 Called when a scroll event is received from one of the window's built-in scrollbars.
1136 \wxheading{Parameters
}
1138 \docparam{event
}{Command event. Retrieve the new scroll position by
1139 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1140 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1144 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1145 until the function is executing (you can't have one function for vertical, another
1146 for horizontal events).
1148 \wxheading{See also
}
1150 \helpref{wxScrollEvent
}{wxscrollevent
},
\rtfsp
1151 \helpref{Event handling overview
}{eventhandlingoverview
}
1153 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1155 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1157 Called when a window's focus is being set.
1159 \wxheading{Parameters
}
1161 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1165 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1167 Most, but not all, windows respond to this event.
1169 \wxheading{See also
}
1171 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1172 \helpref{Event handling overview
}{eventhandlingoverview
}
1174 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1176 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1178 Called when the window has been resized.
1180 \wxheading{Parameters
}
1182 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1186 You may wish to use this for frames to resize their child windows as appropriate.
1188 Note that the size passed is of
1189 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1190 used by the application.
1192 \wxheading{See also
}
1194 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1195 \helpref{Event handling overview
}{eventhandlingoverview
}
1197 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1199 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1201 Called when the user has changed the system colours.
1203 \wxheading{Parameters
}
1205 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1207 \wxheading{See also
}
1209 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1210 \helpref{Event handling overview
}{eventhandlingoverview
}
1212 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1214 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1216 Removes and returns the top-most event handler on the event handler stack.
1218 \wxheading{Parameters
}
1220 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1221 default value is FALSE.
}
1223 \wxheading{See also
}
1225 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1226 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1227 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1228 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1229 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1231 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1233 \func{virtual bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1235 Pops up the given menu at the specified coordinates, relative to this
1236 window, and returns control when the user has dismissed the menu. If a
1237 menu item is selected, the callback defined for the menu is called with
1238 wxMenu and wxCommandEvent reference arguments. The callback should access
1239 the commandInt member of the event to check the selected menu identifier.
1241 \wxheading{Parameters
}
1243 \docparam{menu
}{Menu to pop up.
}
1245 \docparam{x
}{Required x position for the menu to appear.
}
1247 \docparam{y
}{Required y position for the menu to appear.
}
1249 \wxheading{See also
}
1251 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::FakePopupMenu
}{wxwindowfakepopupmenu
}
1253 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1255 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1257 Pushes this event handler onto the event stack for the window.
1259 \wxheading{Parameters
}
1261 \docparam{handler
}{Specifies the handler to be pushed.
}
1265 An event handler is an object that is capable of processing the events
1266 sent to a window. By default, the window is its own event handler, but
1267 an application may wish to substitute another, for example to allow
1268 central implementation of event-handling for a variety of different
1271 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1272 an application to set up a chain of event handlers, where an event not handled by one event handler is
1273 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1274 remove the event handler.
1276 \wxheading{See also
}
1278 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1279 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1280 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1281 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1282 \helpref{wxEvtHandler
}{wxevthandler
}
1284 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1286 \func{void
}{Raise
}{\void}
1288 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1291 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1293 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1296 Causes a message or event to be generated to repaint the
1299 \wxheading{Parameters
}
1301 \docparam{eraseBackground
}{If TRUE, the background will be
1304 \docparam{rect
}{If non-NULL, only the given rectangle will
1305 be treated as damaged.
}
1307 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1309 \func{virtual void
}{ReleaseMouse
}{\void}
1311 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1313 \wxheading{See also
}
1315 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1317 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1319 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1321 Removes a child window. This is called automatically by window deletion
1322 functions so should not be required by the application programmer.
1324 \wxheading{Parameters
}
1326 \docparam{child
}{Child window to remove.
}
1328 \membersection{wxWindow::ScreenToClient
}
1330 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1332 Converts from screen to client window coordinates.
1334 \wxheading{Parameters
}
1336 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1338 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1340 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1342 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1344 Physically scrolls the pixels in the window.
1346 \wxheading{Parameters
}
1348 \docparam{dx
}{Amount to scroll horizontally.
}
1350 \docparam{dy
}{Amount to scroll vertically.
}
1352 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1353 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1354 can optimise painting by checking for the invalidated region.
}
1358 Available only under Windows.
1360 Use this function to optimise your scrolling implementations, to minimise the area that must be
1363 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1365 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1367 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1368 be called automatically when the window is resized.
1370 \wxheading{Parameters
}
1372 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1373 from within wxWindow::OnSize functions.
}
1375 \wxheading{See also
}
1377 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1379 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1381 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1383 Sets the background colour of the window.
1385 \wxheading{Parameters
}
1387 \docparam{colour
}{The colour to be used as the background colour.
}
1391 The background colour is usually painted by the default
\rtfsp
1392 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function.
1394 \wxheading{See also
}
1396 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1397 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1398 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1399 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1401 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1403 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1405 Sets the window to have the given layout constraints. The window
1406 will then own the object, and will take care of its deletion.
1407 If an existing layout constraints object is already owned by the
1408 window, it will be deleted.
1410 \wxheading{Parameters
}
1412 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1417 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1418 the constraints automatically in OnSize; otherwise, you must
1419 override OnSize and call Layout explicitly.
1421 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1423 \func{virtual void
}{SetFocus
}{\void}
1425 This sets the window to receive keyboard input.
1427 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1429 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1431 Sets the font for this window.
1433 \wxheading{Parameters
}
1435 \docparam{font
}{Font to associate with this window.
}
1437 \wxheading{See also
}
1439 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1441 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1443 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1445 Sets the foreground colour of the window.
1447 \wxheading{Parameters
}
1449 \docparam{colour
}{The colour to be used as the foreground colour.
}
1453 The interpretation of foreground colour is open to interpretation according
1454 to the window class; it may be the text colour or other colour, or it may not
1457 \wxheading{See also
}
1459 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1460 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1461 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1463 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1465 \func{void
}{SetId
}{\param{int
}{ id
}}
1467 Sets the identifier of the window.
1471 Each window has an integer identifier. If the application has not provided one,
1472 an identifier will be generated. Normally, the identifier should be provided
1473 on creation and should not be modified subsequently.
1475 TODO: perhaps there should be a default identifier for each class, rather
1476 choosing one, which could clash with other ones.
1478 \wxheading{See also
}
1480 \helpref{wxWindow::GetId
}{wxwindowgetid
}
1483 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1485 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1487 Sets the window's name.
1489 \wxheading{Parameters
}
1491 \docparam{name
}{A name to set for the window.
}
1493 \wxheading{See also
}
1495 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1497 \membersection{wxWindow::SetReturnCode
}\label{wxwindowsetreturncode
}
1499 \func{void
}{SetReturnCode
}{\param{int
}{retCode
}}
1501 Sets the return code for this window.
1503 \wxheading{Parameters
}
1505 \docparam{retCode
}{The integer return code, usually a control identifier.
}
1509 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
1510 a code to the application. The function
\helpref{wxDialog::EndModal
}{wxdialogendmodal
} calls
{\bf SetReturnCode
}.
1512 \wxheading{See also
}
1514 \helpref{wxWindow::GetReturnCode
}{wxwindowgetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
1515 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
1517 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1519 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1520 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1521 \param{const bool
}{refresh = TRUE
}}
1523 Sets the scrollbar properties of a built-in scrollbar.
1525 \wxheading{Parameters
}
1527 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1529 \docparam{position
}{The position of the scrollbar in scroll units.
}
1531 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1533 \docparam{range
}{The maximum position of the scrollbar.
}
1535 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1539 Let's say you wish to display
50 lines of text, using the same font.
1540 The window is sized so that you can only see
16 lines at a time.
1546 SetScrollbar(wxVERTICAL,
0,
16,
50);
1550 Note that with the window at this size, the thumb position can never go
1551 above
50 minus
16, or
34.
1553 You can determine how many lines are currently visible by dividing the current view
1554 size by the character height in pixels.
1556 When defining your own scrollbar behaviour, you will always need to recalculate
1557 the scrollbar settings when the window size changes. You could therefore put your
1558 scrollbar calculations and SetScrollbar
1559 call into a function named AdjustScrollbars, which can be called initially and also
1560 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1562 \wxheading{See also
}
1564 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1565 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1568 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1570 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1572 Sets the page size of one of the built-in scrollbars.
1574 \wxheading{Parameters
}
1576 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1578 \docparam{pageSize
}{Page size in scroll units.
}
1580 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1584 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1585 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1586 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1587 value has to be adjusted when the window is resized, since the page size will have changed.
1589 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1590 the thumb changes size to reflect the page size relative to the length of the
document. When the
1591 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1592 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1595 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1596 handling of pages and ranges.
1598 \wxheading{See also
}
1600 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1601 \helpref{wxWindow::SetScrollRange
}{wxwindowsetscrollpage
},
\rtfsp
1602 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1603 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1604 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollrange
},
\rtfsp
1605 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1608 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1610 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1612 Sets the position of one of the built-in scrollbars.
1614 \wxheading{Parameters
}
1616 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1618 \docparam{pos
}{Position in scroll units.
}
1620 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1624 This function does not directly affect the contents of the window: it is up to the
1625 application to take note of scrollbar attributes and redraw contents accordingly.
1627 \wxheading{See also
}
1629 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1630 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1631 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1632 \helpref{wxWindow::GetScrollThumb
}{wxwindowsetscrollthumb
},
\rtfsp
1633 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1636 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1638 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1640 Sets the range of one of the built-in scrollbars.
1642 \wxheading{Parameters
}
1644 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1646 \docparam{range
}{Scroll range.
}
1648 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1652 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1653 object length of the scrollbar. If you are implementing a scrolling window, for example, you
1654 would adjust the scroll range when the window is resized, by subtracting the window view size from the
1655 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
1656 and usually the scrollbar will be automatically hidden.
1658 \wxheading{See also
}
1660 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1661 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1662 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1663 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1664 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollrange
},
\rtfsp
1665 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1668 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
1670 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
1671 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
1673 Sets the size and position of the window in pixels.
1675 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1677 Sets the size of the window in pixels.
1679 \wxheading{Parameters
}
1681 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
1682 value should be used.
}
1684 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
1685 value should be used.
}
1687 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
1688 value should be used.
}
1690 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
1691 value should be used.
}
1693 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
1695 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
1696 a wxWindows-supplied default width.\\
1697 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
1698 a wxWindows-supplied default width.\\
1699 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
1700 a wxWindows-supplied default size.\\
1701 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
1702 if -
1 values are supplied.\\
1703 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
1704 as real dimensions, not default values.
1709 The second form is a convenience for calling the first form with default
1710 x and y parameters, and must be used with non-default width and height values.
1712 The first form sets the position and optionally size, of the window.
1713 Parameters may be -
1 to indicate either that a default should be supplied
1714 by wxWindows, or that the current value of the dimension should be used.
1716 \wxheading{See also
}
1718 \helpref{wxWindow::Move
}{wxwindowmove
}
1720 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
1722 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
1723 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
1725 Allows specification of minimum and maximum window sizes, and window size increments.
1726 If a pair of values is not set (or set to -
1), the default values will be used.
1728 \wxheading{Parameters
}
1730 \docparam{minW
}{Specifies the minimum width allowable.
}
1732 \docparam{minH
}{Specifies the minimum height allowable.
}
1734 \docparam{maxW
}{Specifies the maximum width allowable.
}
1736 \docparam{maxH
}{Specifies the maximum height allowable.
}
1738 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
1740 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
1744 If this function is called, the user will not be able to size the window outside the
1747 The resizing increments are only significant under Motif or Xt.
1749 \membersection{wxWindow::SetClientSize
}
1751 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1753 This sets the size of the window client area in pixels. Using this function to size a window
1754 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1755 worry about what dimensions the border or title bar have when trying to fit the window
1756 around panel items, for example.
1758 \wxheading{Parameters
}
1760 \docparam{width
}{The required client area width.
}
1762 \docparam{height
}{The required client area height.
}
1764 \membersection{wxWindow::SetPalette
}
1766 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1768 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1770 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1772 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1774 Sets the window's cursor.
1776 \wxheading{Parameters
}
1778 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1782 Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1783 function if you want the cursor to change immediately, because under Windows,
1784 wxWindows only sets the global cursor when it detects mouse movement.
1786 \wxheading{See also
}
1788 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1790 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1792 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1794 Sets the event handler for this window.
1796 \wxheading{Parameters
}
1798 \docparam{handler
}{Specifies the handler to be set.
}
1802 An event handler is an object that is capable of processing the events
1803 sent to a window. By default, the window is its own event handler, but
1804 an application may wish to substitute another, for example to allow
1805 central implementation of event-handling for a variety of different
1808 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1809 this sets up a chain of event handlers, where an event not handled by one event handler is
1810 handed to the next one in the chain.
1812 \wxheading{See also
}
1814 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1815 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1816 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1817 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1818 \helpref{wxEvtHandler
}{wxevthandler
}
1820 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
1822 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
1824 Sets the window's title. Applicable only to frames and dialogs.
1826 \wxheading{Parameters
}
1828 \docparam{title
}{The window's title.
}
1830 \wxheading{See also
}
1832 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
1834 \membersection{wxWindow::Show
}
1836 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
1838 Shows or hides the window.
1840 \wxheading{Parameters
}
1842 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
1845 \wxheading{See also
}
1847 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
1849 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
1851 \func{virtual bool
}{TransferDataFromWindow
}{\void}
1853 Transfers values from child controls to data areas specified by their validators. Returns
1854 FALSE if a transfer failed.
1856 \wxheading{See also
}
1858 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
1859 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1861 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
1863 \func{virtual bool
}{TransferDataToWindow
}{\void}
1865 Transfers values to child controls from data areas specified by their validators.
1867 \wxheading{Return value
}
1869 Returns FALSE if a transfer failed.
1871 \wxheading{See also
}
1873 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1874 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1876 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
1878 \func{virtual bool
}{Validate
}{\void}
1880 Validates the current values of the child controls using their validators.
1882 \wxheading{Return value
}
1884 Returns FALSE if any of the validations failed.
1886 \wxheading{See also
}
1888 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1889 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1890 \helpref{wxValidator
}{wxvalidator
}
1892 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
1894 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
1896 Moves the pointer to the given position on the window.
1898 \wxheading{Parameters
}
1900 \docparam{x
}{The new x position for the cursor.
}
1902 \docparam{y
}{The new y position for the cursor.
}