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.
}
1251 Valid only for subwindows (panels, canvases and text windows).
1253 Sometimes this function does not function correctly under Motif, in which case
1254 please use
\helpref{wxWindow::FakePopupMenu
}{wxwindowfakepopupmenu
} instead.
1256 \wxheading{See also
}
1258 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::FakePopupMenu
}{wxwindowfakepopupmenu
}
1260 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1262 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1264 Pushes this event handler onto the event stack for the window.
1266 \wxheading{Parameters
}
1268 \docparam{handler
}{Specifies the handler to be pushed.
}
1272 An event handler is an object that is capable of processing the events
1273 sent to a window. By default, the window is its own event handler, but
1274 an application may wish to substitute another, for example to allow
1275 central implementation of event-handling for a variety of different
1278 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1279 an application to set up a chain of event handlers, where an event not handled by one event handler is
1280 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1281 remove the event handler.
1283 \wxheading{See also
}
1285 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1286 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1287 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1288 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1289 \helpref{wxEvtHandler
}{wxevthandler
}
1291 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1293 \func{void
}{Raise
}{\void}
1295 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1298 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1300 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1303 Causes a message or event to be generated to repaint the
1306 \wxheading{Parameters
}
1308 \docparam{eraseBackground
}{If TRUE, the background will be
1311 \docparam{rect
}{If non-NULL, only the given rectangle will
1312 be treated as damaged.
}
1314 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1316 \func{virtual void
}{ReleaseMouse
}{\void}
1318 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1320 \wxheading{See also
}
1322 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1324 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1326 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1328 Removes a child window. This is called automatically by window deletion
1329 functions so should not be required by the application programmer.
1331 \wxheading{Parameters
}
1333 \docparam{child
}{Child window to remove.
}
1335 \membersection{wxWindow::ScreenToClient
}
1337 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1339 Converts from screen to client window coordinates.
1341 \wxheading{Parameters
}
1343 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1345 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1347 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1349 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1351 Physically scrolls the pixels in the window.
1353 \wxheading{Parameters
}
1355 \docparam{dx
}{Amount to scroll horizontally.
}
1357 \docparam{dy
}{Amount to scroll vertically.
}
1359 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1360 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1361 can optimise painting by checking for the invalidated region.
}
1365 Available only under Windows.
1367 Use this function to optimise your scrolling implementations, to minimise the area that must be
1370 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1372 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1374 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1375 be called automatically when the window is resized.
1377 \wxheading{Parameters
}
1379 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1380 from within wxWindow::OnSize functions.
}
1382 \wxheading{See also
}
1384 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1386 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1388 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1390 Sets the background colour of the window.
1392 \wxheading{Parameters
}
1394 \docparam{colour
}{The colour to be used as the background colour.
}
1398 The background colour is usually painted by the default
\rtfsp
1399 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function.
1401 \wxheading{See also
}
1403 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1404 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1405 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1406 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1408 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1410 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1412 Sets the window to have the given layout constraints. The window
1413 will then own the object, and will take care of its deletion.
1414 If an existing layout constraints object is already owned by the
1415 window, it will be deleted.
1417 \wxheading{Parameters
}
1419 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1424 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1425 the constraints automatically in OnSize; otherwise, you must
1426 override OnSize and call Layout explicitly.
1428 % TODO: double click should always be allowed.
1429 %\membersection{wxWindow::SetDoubleClick}\label{setdoubleclick}
1431 %\func{void}{SetDoubleClick}{\param{bool}{ allowDoubleClick}}
1433 %For canvases, allows double click if {\it allowDoubleClick} is TRUE. The default is FALSE.
1435 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1437 \func{virtual void
}{SetFocus
}{\void}
1439 This sets the window to receive keyboard input.
1441 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1443 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1445 Sets the font for this window.
1447 \wxheading{Parameters
}
1449 \docparam{font
}{Font to associate with this window.
}
1451 \wxheading{See also
}
1453 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1455 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1457 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1459 Sets the foreground colour of the window.
1461 \wxheading{Parameters
}
1463 \docparam{colour
}{The colour to be used as the foreground colour.
}
1467 The interpretation of foreground colour is open to interpretation according
1468 to the window class; it may be the text colour or other colour, or it may not
1471 \wxheading{See also
}
1473 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1474 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1475 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1477 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1479 \func{void
}{SetId
}{\param{int
}{ id
}}
1481 Sets the identifier of the window.
1485 Each window has an integer identifier. If the application has not provided one,
1486 an identifier will be generated. Normally, the identifier should be provided
1487 on creation and should not be modified subsequently.
1489 TODO: perhaps there should be a default identifier for each class, rather
1490 choosing one, which could clash with other ones.
1492 \wxheading{See also
}
1494 \helpref{wxWindow::GetId
}{wxwindowgetid
}
1497 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1499 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1501 Sets the window's name.
1503 \wxheading{Parameters
}
1505 \docparam{name
}{A name to set for the window.
}
1507 \wxheading{See also
}
1509 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1511 \membersection{wxWindow::SetReturnCode
}\label{wxwindowsetreturncode
}
1513 \func{void
}{SetReturnCode
}{\param{int
}{retCode
}}
1515 Sets the return code for this window.
1517 \wxheading{Parameters
}
1519 \docparam{retCode
}{The integer return code, usually a control identifier.
}
1523 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
1524 a code to the application. The function
\helpref{wxDialog::EndModal
}{wxdialogendmodal
} calls
{\bf SetReturnCode
}.
1526 \wxheading{See also
}
1528 \helpref{wxWindow::GetReturnCode
}{wxwindowgetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
1529 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
1531 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1533 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1534 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1535 \param{const bool
}{refresh = TRUE
}}
1537 Sets the scrollbar properties of a built-in scrollbar.
1539 \wxheading{Parameters
}
1541 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1543 \docparam{position
}{The position of the scrollbar in scroll units.
}
1545 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1547 \docparam{range
}{The maximum position of the scrollbar.
}
1549 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1553 Let's say you wish to display
50 lines of text, using the same font.
1554 The window is sized so that you can only see
16 lines at a time.
1560 SetScrollbar(wxVERTICAL,
0,
16,
50);
1564 Note that with the window at this size, the thumb position can never go
1565 above
50 minus
16, or
34.
1567 You can determine how many lines are currently visible by dividing the current view
1568 size by the character height in pixels.
1570 When defining your own scrollbar behaviour, you will always need to recalculate
1571 the scrollbar settings when the window size changes. You could therefore put your
1572 scrollbar calculations and SetScrollbar
1573 call into a function named AdjustScrollbars, which can be called initially and also
1574 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1576 \wxheading{See also
}
1578 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1579 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1582 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1584 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1586 Sets the page size of one of the built-in scrollbars.
1588 \wxheading{Parameters
}
1590 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1592 \docparam{pageSize
}{Page size in scroll units.
}
1594 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1598 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1599 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1600 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1601 value has to be adjusted when the window is resized, since the page size will have changed.
1603 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1604 the thumb changes size to reflect the page size relative to the length of the
document. When the
1605 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1606 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1609 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1610 handling of pages and ranges.
1612 \wxheading{See also
}
1614 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1615 \helpref{wxWindow::SetScrollRange
}{wxwindowsetscrollpage
},
\rtfsp
1616 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1617 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1618 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollrange
},
\rtfsp
1619 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1622 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1624 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1626 Sets the position of one of the built-in scrollbars.
1628 \wxheading{Parameters
}
1630 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1632 \docparam{pos
}{Position in scroll units.
}
1634 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1638 This function does not directly affect the contents of the window: it is up to the
1639 application to take note of scrollbar attributes and redraw contents accordingly.
1641 \wxheading{See also
}
1643 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1644 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1645 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1646 \helpref{wxWindow::GetScrollThumb
}{wxwindowsetscrollthumb
},
\rtfsp
1647 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1650 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1652 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1654 Sets the range of one of the built-in scrollbars.
1656 \wxheading{Parameters
}
1658 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1660 \docparam{range
}{Scroll range.
}
1662 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1666 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1667 object length of the scrollbar. If you are implementing a scrolling canvas, for example, you
1668 would adjust the scroll range when the canvas is resized, by subtracting the canvas view size from the
1669 total virtual canvas size. When the two sizes are the same (all the canvas is visible), the range goes to zero
1670 and usually the scrollbar will be automatically hidden.
1672 \wxheading{See also
}
1674 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1675 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1676 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1677 \helpref{wxWindow::GetScrollRange
}{wxwindowsetscrollrange
},
\rtfsp
1678 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollrange
},
\rtfsp
1679 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1682 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
1684 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
1685 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
1687 Sets the size and position of the window in pixels.
1689 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1691 Sets the size of the window in pixels.
1693 \wxheading{Parameters
}
1695 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
1696 value should be used.
}
1698 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
1699 value should be used.
}
1701 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
1702 value should be used.
}
1704 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
1705 value should be used.
}
1707 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
1709 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
1710 a wxWindows-supplied default width.\\
1711 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
1712 a wxWindows-supplied default width.\\
1713 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
1714 a wxWindows-supplied default size.\\
1715 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
1716 if -
1 values are supplied.\\
1717 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
1718 as real dimensions, not default values.
1723 The second form is a convenience for calling the first form with default
1724 x and y parameters, and must be used with non-default width and height values.
1726 The first form sets the position and optionally size, of the window.
1727 Parameters may be -
1 to indicate either that a default should be supplied
1728 by wxWindows, or that the current value of the dimension should be used.
1730 \wxheading{See also
}
1732 \helpref{wxWindow::Move
}{wxwindowmove
}
1734 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
1736 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
1737 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
1739 Allows specification of minimum and maximum window sizes, and window size increments.
1740 If a pair of values is not set (or set to -
1), the default values will be used.
1742 \wxheading{Parameters
}
1744 \docparam{minW
}{Specifies the minimum width allowable.
}
1746 \docparam{minH
}{Specifies the minimum height allowable.
}
1748 \docparam{maxW
}{Specifies the maximum width allowable.
}
1750 \docparam{maxH
}{Specifies the maximum height allowable.
}
1752 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
1754 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
1758 If this function is called, the user will not be able to size the window outside the
1761 The resizing increments are only significant under Motif or Xt.
1763 \membersection{wxWindow::SetClientSize
}
1765 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1767 This sets the size of the window client area in pixels. Using this function to size a window
1768 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1769 worry about what dimensions the border or title bar have when trying to fit the window
1770 around panel items, for example.
1772 \wxheading{Parameters
}
1774 \docparam{width
}{The required client area width.
}
1776 \docparam{height
}{The required client area height.
}
1778 \membersection{wxWindow::SetPalette
}
1780 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1782 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1784 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1786 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1788 Sets the window's cursor.
1790 \wxheading{Parameters
}
1792 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1796 Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1797 function if you want the cursor to change immediately, because under Windows,
1798 wxWindows only sets the global cursor when it detects mouse movement.
1800 \wxheading{See also
}
1802 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1804 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1806 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1808 Sets the event handler for this window.
1810 \wxheading{Parameters
}
1812 \docparam{handler
}{Specifies the handler to be set.
}
1816 An event handler is an object that is capable of processing the events
1817 sent to a window. By default, the window is its own event handler, but
1818 an application may wish to substitute another, for example to allow
1819 central implementation of event-handling for a variety of different
1822 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1823 this sets up a chain of event handlers, where an event not handled by one event handler is
1824 handed to the next one in the chain.
1826 \wxheading{See also
}
1828 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1829 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1830 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1831 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1832 \helpref{wxEvtHandler
}{wxevthandler
}
1834 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
1836 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
1838 Sets the window's title. Applicable only to frames and dialogs.
1840 \wxheading{Parameters
}
1842 \docparam{title
}{The window's title.
}
1844 \wxheading{See also
}
1846 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
1848 \membersection{wxWindow::Show
}
1850 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
1852 Shows or hides the window.
1854 \wxheading{Parameters
}
1856 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
1859 \wxheading{See also
}
1861 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
1863 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
1865 \func{virtual bool
}{TransferDataFromWindow
}{\void}
1867 Transfers values from child controls to data areas specified by their validators. Returns
1868 FALSE if a transfer failed.
1870 \wxheading{See also
}
1872 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
1873 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1875 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
1877 \func{virtual bool
}{TransferDataToWindow
}{\void}
1879 Transfers values to child controls from data areas specified by their validators.
1881 \wxheading{Return value
}
1883 Returns FALSE if a transfer failed.
1885 \wxheading{See also
}
1887 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1888 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1890 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
1892 \func{virtual bool
}{Validate
}{\void}
1894 Validates the current values of the child controls using their validators.
1896 \wxheading{Return value
}
1898 Returns FALSE if any of the validations failed.
1900 \wxheading{See also
}
1902 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1903 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1904 \helpref{wxValidator
}{wxvalidator
}
1906 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
1908 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
1910 Moves the pointer to the given position on the window.
1912 \wxheading{Parameters
}
1914 \docparam{x
}{The new x position for the cursor.
}
1916 \docparam{y
}{The new y position for the cursor.
}