1 \section{\class{wxWindow
}}\label{wxwindow
}
3 wxWindow is the base class for all windows. Any
4 children of the window will be deleted automatically by the destructor
5 before the window itself is deleted.
7 \wxheading{Derived from
}
9 \helpref{wxEvtHandler
}{wxevthandler
}\\
10 \helpref{wxObject
}{wxobject
}
12 \wxheading{Window styles
}
14 The following styles can apply to all windows, although they will not always make sense for a particular
18 \begin{twocollist
}\itemsep=
0pt
19 \twocolitem{\windowstyle{wxSIMPLE
\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
21 \twocolitem{\windowstyle{wxDOUBLE
\_BORDER}}{Displays a double border. Windows only.
}
22 \twocolitem{\windowstyle{wxSUNKEN
\_BORDER}}{Displays a sunken border.
}
23 \twocolitem{\windowstyle{wxRAISED
\_BORDER}}{Displays a sunken border.
}
24 \twocolitem{\windowstyle{wxSTATIC
\_BORDER}}{Displays a border suitable for a static control.
}
25 \twocolitem{\windowstyle{wxTRANSPARENT
\_WINDOW}}{The window is transparent, that is, it will not receive paint
26 events. Windows only.
}
27 \twocolitem{\windowstyle{wxNO
\_3D}}{Prevents the children of this window taking on
3D styles, even though
28 the application-wide policy is for
3D controls. Windows only.
}
29 \twocolitem{\windowstyle{wxTAB
\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.
}
30 \twocolitem{\windowstyle{wxVSCROLL
}}{Use this style to enable a vertical scrollbar.
}
31 \twocolitem{\windowstyle{wxHSCROLL
}}{Use this style to enable a horizontal scrollbar.
}
32 \twocolitem{\windowstyle{wxCLIP
\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
33 repainted, then children being painted over them. Windows-only.
}
36 See also
\helpref{window styles overview
}{windowstyles
}.
40 \helpref{Event handling overview
}{eventhandlingoverview
}
42 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxWindow::wxWindow
}
46 \func{}{wxWindow
}{\void}
50 \func{}{wxWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
51 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
52 \param{const wxSize\&
}{size = wxDefaultSize
},
53 \param{long
}{style =
0},
54 \param{const wxString\&
}{name = wxPanelNameStr
}}
56 Constructs a window, which can be a child of a frame, dialog or any other non-control window.
58 \wxheading{Parameters
}
60 \docparam{parent
}{Pointer to a parent window.
}
62 \docparam{id
}{Window identifier. If -
1, will automatically create an identifier.
}
64 \docparam{pos
}{Window position. wxDefaultPosition is (-
1, -
1) which indicates that wxWindows
65 should generate a default position for the window. If using the wxWindow class directly, supply
68 \docparam{size
}{Window size. wxDefaultSize is (-
1, -
1) which indicates that wxWindows
69 should generate a default size for the window.
}
71 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
73 \docparam{name
}{Window name.
}
75 \membersection{wxWindow::
\destruct{wxWindow
}}
77 \func{}{\destruct{wxWindow
}}{\void}
79 Destructor. Deletes all subwindows, then deletes itself. Instead of using
80 the
{\bf delete
} operator explicitly, you should normally
81 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
82 can delete a window only when it is safe to do so, in idle time.
86 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
87 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
88 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
89 \helpref{wxCloseEvent
}{wxcloseevent
}
91 \membersection{wxWindow::AddChild
}
93 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
95 Adds a child window. This is called automatically by window creation
96 functions so should not be required by the application programmer.
98 \wxheading{Parameters
}
100 \docparam{child
}{Child window to add.
}
102 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
104 \func{virtual void
}{CaptureMouse
}{\void}
106 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
111 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
113 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
115 \func{void
}{Center
}{\param{int
}{ direction
}}
117 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
119 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
121 \func{virtual void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
125 \wxheading{Parameters
}
127 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
132 The actual behaviour depends on the derived window. For a frame or dialog box,
133 centring is relative to the whole display. For a panel item, centring is
134 relative to the panel.
138 \helpref{wxWindow::Center
}{wxwindowcenter
}
140 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
142 \func{void
}{Clear
}{\void}
144 Clears the window by filling it with the current background colour.
146 \membersection{wxWindow::ClientToScreen
}
148 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
150 Converts to screen coordinates from coordinates relative to this window.
152 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
153 a screen coordinate will be passed out.
}
155 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
156 a screen coordinate will be passed out.
}
158 \membersection{wxWindow::Close
}\label{wxwindowclose
}
160 \func{virtual bool
}{Close
}{\param{const bool
}{ force = FALSE
}}
162 The purpose of this call is to provide a safer way of destroying a window than using
163 the
{\it delete
} operator.
165 \wxheading{Parameters
}
167 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
168 of this window, TRUE if it cannot.
}
172 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
173 choose whether to destroy the window.
175 The close handler should check whether the window is being deleted forcibly,
176 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
177 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
179 Applies to managed windows (wxFrame and wxDialog classes) only.
183 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
184 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
185 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
186 \helpref{wxCloseEvent
}{wxcloseevent
}
188 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
190 \func{virtual bool
}{Destroy
}{\void}
192 Destroys the window safely. Use this function instead of the delete operator, since
193 different window classes can be destroyed differently. Frames and dialogs
194 are not destroyed immediately when this function is called - they are added
195 to a list of windows to be deleted on idle time, when all the window's events
196 have been processed. This prevents problems with events being sent to non-existant
199 \wxheading{Return value
}
201 TRUE if the window has either been successfully deleted, or it has been added
202 to the list of windows pending real deletion.
204 \membersection{wxWindow::DestroyChildren
}
206 \func{virtual void
}{DestroyChildren
}{\void}
208 Destroys all children of a window. Called automatically by the destructor.
210 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
212 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
214 Enables or disables elibility for drop file events (OnDropFiles).
216 \wxheading{Parameters
}
218 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
219 will not accept drop file events.
}
227 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
229 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
231 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
233 Enable or disable the window for user input.
235 \wxheading{Parameters
}
237 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
241 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
243 \membersection{wxWindow::FakePopupMenu
}\label{wxwindowfakepopupmenu
}
245 \func{virtual bool
}{FakePopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
247 A replacement for wxWindow::PopupMenu for cases where the PopupMenu implementation
248 does not work correctly, in particular on Motif platforms.
250 \wxheading{Parameters
}
252 \docparam{menu
}{Menu to pop up.
}
254 \docparam{x
}{Required x position for the menu to appear.
}
256 \docparam{y
}{Required y position for the menu to appear.
}
260 This is a cut-down version of PopupMenu using a dialog and listbox; pull-right menus
265 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::PopupMenu
}{wxwindowpopupmenu
}
267 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
269 \func{static wxWindow*
}{FindFocus
}{\void}
271 Finds the window or control which currently has the keyboard focus.
275 Note that this is a static function, so it can be called without needing a wxWindow pointer.
279 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
281 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
283 \func{virtual void
}{Fit
}{\void}
285 Sizes the window so that it fits around its subwindows.
287 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
289 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
291 Returns the background colour of the window.
295 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
296 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
297 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
298 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
300 \membersection{wxWindow::GetCharHeight
}
302 \constfunc{virtual int
}{GetCharHeight
}{\void}
304 Returns the character height for this window.
306 \membersection{wxWindow::GetCharWidth
}
308 \constfunc{virtual int
}{GetCharWidth
}{\void}
310 Returns the average character width for this window.
312 \membersection{wxWindow::GetChildren
}
314 \func{wxList*
}{GetChildren
}{\void}
316 Returns a pointer to the list of the window's children.
318 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
320 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
322 This gets the size of the window `client area' in pixels. The client area is the
323 area which may be drawn on by the programmer, excluding title bar, border etc.
325 \wxheading{Parameters
}
327 \docparam{width
}{Receives the client width in pixels.
}
329 \docparam{height
}{Receives the client height in pixels.
}
331 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
333 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
335 Returns a pointer to the window's layout constraints, or NULL if there are none.
337 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
339 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
341 Returns a pointer to the button which is the default for this window, or NULL.
343 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
345 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
347 Returns the event handler for this window. By default, the window is its
352 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
353 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
354 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
355 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
356 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
358 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
360 \constfunc{wxFont*
}{GetFont
}{\void}
362 Returns a pointer to the font for this window.
366 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
368 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
370 \func{virtual wxColour
}{GetForegroundColour
}{\void}
372 Returns the foreground colour of the window.
376 The interpretation of foreground colour is open to interpretation according
377 to the window class; it may be the text colour or other colour, or it may not
382 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
383 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
384 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
386 \membersection{wxWindow::GetGrandParent
}
388 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
390 Returns the grandparent of a window, or NULL if there isn't one.
392 \membersection{wxWindow::GetHandle
}
394 \constfunc{void*
}{GetHandle
}{\void}
396 Returns the platform-specific handle of the physical window. Cast it to an appropriate
397 handle, such as
{\bf HWND
} for Windows or
{\bf Widget
} for Motif.
399 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
401 \constfunc{int
}{GetId
}{\void}
403 Returns the identifier of the window.
407 Each window has an integer identifier. If the application has not provided one,
408 an identifier will be generated.
410 TODO: perhaps there should be a default identifier for each class, rather
411 choosing one, which could clash with other ones.
415 \helpref{wxWindow::SetId
}{wxwindowsetid
}
417 \membersection{wxWindow::GetPosition
}
419 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
421 This gets the position of the window in pixels, relative to the parent window or
422 if no parent, relative to the whole display.
424 \wxheading{Parameters
}
426 \docparam{x
}{Receives the x position of the window.
}
428 \docparam{y
}{Receives the y position of the window.
}
430 \membersection{wxWindow::GetLabel
}
432 \constfunc{virtual wxString\&
}{GetLabel
}{\void}
434 Generic way of getting a label from any window, for
435 identification purposes.
439 The interpretation of this function differs from class to class.
440 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
441 the button text. This function can be useful for meta-programs (such as testing
442 tools or special-needs access programs) which need to identify windows
445 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
447 \constfunc{virtual wxString\&
}{GetName
}{\void}
449 Returns the window's name.
453 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
454 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
458 \helpref{wxWindow::SetName
}{wxwindowsetname
}
460 \membersection{wxWindow::GetParent
}
462 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
464 Returns the parent of the window, or NULL if there is no parent.
466 \membersection{wxWindow::GetReturnCode
}\label{wxwindowgetreturncode
}
468 \func{int
}{GetReturnCode
}{\void}
470 Gets the return code for this window.
474 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
475 a code to the application.
479 \helpref{wxWindow::SetReturnCode
}{wxwindowsetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
480 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
482 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
484 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
486 Returns the built-in scrollbar thumb size.
490 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
492 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
494 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
496 Returns the built-in scrollbar position.
500 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
502 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
504 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
506 Returns the built-in scrollbar range.
510 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
512 \membersection{wxWindow::GetSize
}
514 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
516 This gets the size of the entire window in pixels.
518 \wxheading{Parameters
}
520 \docparam{width
}{Receives the window width.
}
522 \docparam{height
}{Receives the window height.
}
524 \membersection{wxWindow::GetTextExtent
}
526 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
527 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
528 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
530 Gets the dimensions of the string as it would be drawn on the
531 window with the currently selected font.
533 \wxheading{Parameters
}
535 \docparam{string
}{String whose extent is to be measured.
}
537 \docparam{x
}{Return value for width.
}
539 \docparam{y
}{Return value for height.
}
541 \docparam{descent
}{Return value for descent (optional).
}
543 \docparam{externalLeading
}{Return value for external leading (optional).
}
545 \docparam{font
}{Font to use instead of the current window font (optional).
}
547 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
549 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
551 \func{virtual wxString
}{GetTitle
}{\void}
553 Gets the window's title. Applicable only to frames and dialogs.
557 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
559 \membersection{wxWindow::GetWindowStyleFlag
}
561 \constfunc{long
}{GetWindowStyleFlag
}{\void}
563 Gets the window style that was passed to the consructor or
{\bf Create
} member.
565 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
567 \func{void
}{InitDialog
}{\void}
569 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
570 in turn transfers data to the dialog via validators.
574 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
576 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
578 \constfunc{virtual bool
}{IsEnabled
}{\void}
580 Returns TRUE if the window is enabled for input, FALSE otherwise.
584 \helpref{wxWindow::Enable
}{wxwindowenable
}
586 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
588 \constfunc{virtual bool
}{IsRetained
}{\void}
590 Returns TRUE if the window is retained, FALSE otherwise.
594 Retained windows are only available on X platforms.
596 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
598 \constfunc{virtual bool
}{IsShown
}{\void}
600 Returns TRUE if the window is shown, FALSE if it has been hidden.
602 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
604 \func{void
}{Layout
}{\void}
606 Invokes the constraint-based layout algorithm for this window. It is called
607 automatically by the default
{\bf wxWindow::OnSize
} member.
609 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
611 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
612 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
614 Loads a panel or dialog from a resource file.
616 \wxheading{Parameters
}
618 \docparam{parent
}{Parent window.
}
620 \docparam{resourceName
}{The name of the resource to load.
}
622 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
623 default resource table will be used.
}
625 \wxheading{Return value
}
627 TRUE if the operation succeeded, otherwise FALSE.
637 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
639 \func{void
}{Lower
}{\void}
641 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
644 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
646 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
648 Disables all other windows in the application so that
649 the user can only interact with this window.
651 \wxheading{Parameters
}
653 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
654 the user can only interact with this window. If FALSE, the effect is reversed.
}
656 \membersection{wxWindow::Move
}\label{wxwindowmove
}
658 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
660 Moves the window to the given position.
662 \wxheading{Parameters
}
664 \docparam{x
}{Required x position.
}
666 \docparam{y
}{Required y position.
}
670 Implementations of SetSize can also implicitly implement the
671 wxWindow::Move function, which is defined in the base wxWindow class
675 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
680 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
682 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
684 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
686 Called when a window is activated or deactivated.
688 \wxheading{Parameters
}
690 \docparam{event
}{Object containing activation information.
}
694 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
695 otherwise it returns FALSE (it is being deactivated).
699 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
700 \helpref{Event handling overview
}{eventhandlingoverview
}
702 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
704 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
706 Called when the user has pressed a key.
708 \wxheading{Parameters
}
710 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
711 details about this class.
}
715 This member function is called in response to a keypress. To intercept this event,
716 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
717 default function to achieve default keypress functionality.
719 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
722 Most, but not all, windows allow keypresses to be intercepted.
726 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
727 \helpref{Event handling overview
}{eventhandlingoverview
}
729 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
731 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
733 This member is called to allow the window to intercept keyboard events
734 before they are processed by child windows.
736 \wxheading{Parameters
}
738 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
739 details about this class.
}
743 This member function is called in response to a keypress, if the window is active. To intercept this event,
744 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
745 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
747 An example of using this function is in the implementation of escape-character processing for wxDialog,
748 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
750 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
753 This function is only relevant to top-level windows (frames and dialogs), and under
758 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
759 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
760 \helpref{Event handling overview
}{eventhandlingoverview
}
762 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
764 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
766 This virtual member function is called if the control does not handle the command event.
768 \wxheading{Parameters
}
770 \docparam{object
}{Object receiving the command event.
}
772 \docparam{event
}{Command event
}
776 This virtual function is provided mainly for backward compatibility. You can also intercept commands
777 from child controls by using an event table, with identifiers or identifier ranges to identify
778 the control(s) in question.
782 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
783 \helpref{Event handling overview
}{eventhandlingoverview
}
785 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
787 \func{virtual bool
}{OnClose
}{\void}
789 Called when the user has tried to close a a frame
790 or dialog box using the window manager (X) or system menu (Windows).
792 {\bf Note:
} This is an obsolete function retained for backward compatibility.
793 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
796 \wxheading{Return value
}
798 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
799 attempt will be ignored. Do not delete the window from within this handler, although
800 you may delete other windows.
804 Derive your own class to handle this message. The default handler returns FALSE.
808 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
809 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
810 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
811 \helpref{wxCloseEvent
}{wxcloseevent
}
813 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
815 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
817 This is an event handler function called when the user has tried to close a a frame
818 or dialog box using the window manager (X) or system menu (Windows). It is
819 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
820 that the application can also invoke the handler programmatically.
822 Use the EVT
\_CLOSE event table macro to handle close events.
824 You should check whether the application is forcing the deletion of the window
825 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
826 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
827 If not, it is up to you whether you respond by destroying the window.
831 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
832 for backward compatibility with earlier versions of wxWindows. The
833 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
834 destroying the window if it returns TRUE or if the close is being forced.
838 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
839 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
840 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
841 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
842 \helpref{wxCloseEvent
}{wxcloseevent
}
844 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
846 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
848 Called when files have been dragged from the file manager to the window.
850 \wxheading{Parameters
}
852 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
856 The window must have previously been enabled for dropping by calling
857 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
859 This event is only generated under Windows.
861 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
865 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
866 \helpref{Event handling overview
}{eventhandlingoverview
}
868 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
870 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
872 Called when the background of the window needs to be erased.
874 \wxheading{Parameters
}
876 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
880 This event is only generated under Windows.
882 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
886 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
888 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
890 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
892 Called when a window's focus is being killed.
894 \wxheading{Parameters
}
896 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
900 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
902 Most, but not all, windows respond to this event.
906 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
907 \helpref{Event handling overview
}{eventhandlingoverview
}
909 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
911 \func{void
}{Onidle
}{\param{wxIdleEvent\&
}{event
}}
913 Provide this member function for any processing which needs to be done
914 when the application is idle.
918 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
920 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
922 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
924 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
926 \wxheading{Parameters
}
928 \docparam{event
}{Dialog initialisation event.
}
932 Gives the window the default behaviour of transferring data to child controls via
933 the validator that each control has.
937 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
939 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
941 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
943 Called when a menu command is received from a menu bar.
945 \wxheading{Parameters
}
947 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
951 A function with this name doesn't actually exist; you can choose any member function to receive
952 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
957 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
958 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
959 \helpref{Event handling overview
}{eventhandlingoverview
}
961 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
963 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
965 Called when a menu select is received from a menu bar: that is, the
966 mouse cursor is over a menu item, but the left mouse button has not been
969 \wxheading{Parameters
}
971 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
975 You can choose any member function to receive
976 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
979 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
980 text in the first field of the status bar.
982 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
983 since a selection is normally a left-click action.
987 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
988 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
989 \helpref{Event handling overview
}{eventhandlingoverview
}
992 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
994 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
996 Called when the user has initiated an event with the
999 \wxheading{Parameters
}
1001 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1006 Most, but not all, windows respond to this event.
1008 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1009 mouse event macros such as EVT
\_LEFT\_DOWN.
1011 \wxheading{See also
}
1013 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1014 \helpref{Event handling overview
}{eventhandlingoverview
}
1016 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1018 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1020 Called when a window is moved.
1022 \wxheading{Parameters
}
1024 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1028 Use the EVT
\_MOVE macro to intercept move events.
1032 Not currently implemented.
1034 \wxheading{See also
}
1036 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1037 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1038 \helpref{Event handling overview
}{eventhandlingoverview
}
1040 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1042 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1044 Sent to the event handler when the window must be refreshed.
1046 \wxheading{Parameters
}
1048 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1052 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1054 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1060 void MyWindow::OnPaint(wxPaintEvent& event)
1069 You can optimize painting by retrieving the rectangles
1070 that have been damaged and only repainting these. The rectangles are in
1071 terms of the client area, and are unscrolled, so you will need to do
1072 some calculations using the current view position to obtain logical,
1075 Here is an example of using the
\helpref{wxUpdateIterator
}{wxupdateiterator
} class:
1079 // Called when window needs to be repainted.
1080 void MyWindow::OnPaint(wxPaintEvent& event)
1084 // Find Out where the window is scrolled to
1085 int vbX,vbY; // Top left corner of client
1086 ViewStart(&vbX,&vbY);
1088 int vX,vY,vW,vH; // Dimensions of client area in pixels
1089 wxUpdateIterator upd(this); // get the update rect list
1098 // Alternatively we can do this:
1100 // upd.GetRect(&rect);
1102 // Repaint this rectangle
1111 \wxheading{See also
}
1113 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1114 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1115 \helpref{Event handling overview
}{eventhandlingoverview
}
1117 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1119 \func{void
}{OnScroll
}{\param{wxScrollEvent\&
}{event
}}
1121 Called when a scroll event is received from one of the window's built-in scrollbars.
1123 \wxheading{Parameters
}
1125 \docparam{event
}{Command event. Retrieve the new scroll position by
1126 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1127 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1131 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1132 until the function is executing (you can't have one function for vertical, another
1133 for horizontal events).
1135 \wxheading{See also
}
1137 \helpref{wxScrollEvent
}{wxscrollevent
},
\rtfsp
1138 \helpref{Event handling overview
}{eventhandlingoverview
}
1140 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1142 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1144 Called when a window's focus is being set.
1146 \wxheading{Parameters
}
1148 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1152 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1154 Most, but not all, windows respond to this event.
1156 \wxheading{See also
}
1158 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1159 \helpref{Event handling overview
}{eventhandlingoverview
}
1161 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1163 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1165 Called when the window has been resized.
1167 \wxheading{Parameters
}
1169 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1173 You may wish to use this for frames to resize their child windows as appropriate.
1175 Note that the size passed is of
1176 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1177 used by the application.
1179 \wxheading{See also
}
1181 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1182 \helpref{Event handling overview
}{eventhandlingoverview
}
1184 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1186 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1188 Called when the user has changed the system colours.
1190 \wxheading{Parameters
}
1192 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1194 \wxheading{See also
}
1196 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1197 \helpref{Event handling overview
}{eventhandlingoverview
}
1199 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1201 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1203 Removes and returns the top-most event handler on the event handler stack.
1205 \wxheading{Parameters
}
1207 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1208 default value is FALSE.
}
1210 \wxheading{See also
}
1212 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1213 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1214 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1215 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1216 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1218 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1220 \func{virtual bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1222 Pops up the given menu at the specified coordinates, relative to this
1223 window, and returns control when the user has dismissed the menu. If a
1224 menu item is selected, the callback defined for the menu is called with
1225 wxMenu and wxCommandEvent reference arguments. The callback should access
1226 the commandInt member of the event to check the selected menu identifier.
1228 \wxheading{Parameters
}
1230 \docparam{menu
}{Menu to pop up.
}
1232 \docparam{x
}{Required x position for the menu to appear.
}
1234 \docparam{y
}{Required y position for the menu to appear.
}
1236 \wxheading{See also
}
1238 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::FakePopupMenu
}{wxwindowfakepopupmenu
}
1240 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1242 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1244 Pushes this event handler onto the event stack for the window.
1246 \wxheading{Parameters
}
1248 \docparam{handler
}{Specifies the handler to be pushed.
}
1252 An event handler is an object that is capable of processing the events
1253 sent to a window. By default, the window is its own event handler, but
1254 an application may wish to substitute another, for example to allow
1255 central implementation of event-handling for a variety of different
1258 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1259 an application to set up a chain of event handlers, where an event not handled by one event handler is
1260 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1261 remove the event handler.
1263 \wxheading{See also
}
1265 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1266 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1267 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1268 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1269 \helpref{wxEvtHandler
}{wxevthandler
}
1271 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1273 \func{void
}{Raise
}{\void}
1275 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1278 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1280 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1283 Causes a message or event to be generated to repaint the
1286 \wxheading{Parameters
}
1288 \docparam{eraseBackground
}{If TRUE, the background will be
1291 \docparam{rect
}{If non-NULL, only the given rectangle will
1292 be treated as damaged.
}
1294 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1296 \func{virtual void
}{ReleaseMouse
}{\void}
1298 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1300 \wxheading{See also
}
1302 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1304 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1306 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1308 Removes a child window. This is called automatically by window deletion
1309 functions so should not be required by the application programmer.
1311 \wxheading{Parameters
}
1313 \docparam{child
}{Child window to remove.
}
1315 \membersection{wxWindow::ScreenToClient
}
1317 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1319 Converts from screen to client window coordinates.
1321 \wxheading{Parameters
}
1323 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1325 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1327 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1329 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1331 Physically scrolls the pixels in the window.
1333 \wxheading{Parameters
}
1335 \docparam{dx
}{Amount to scroll horizontally.
}
1337 \docparam{dy
}{Amount to scroll vertically.
}
1339 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1340 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1341 can optimise painting by checking for the invalidated region.
}
1345 Available only under Windows.
1347 Use this function to optimise your scrolling implementations, to minimise the area that must be
1350 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1352 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1354 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1355 be called automatically when the window is resized.
1357 \wxheading{Parameters
}
1359 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1360 from within wxWindow::OnSize functions.
}
1362 \wxheading{See also
}
1364 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1366 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1368 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1370 Sets the background colour of the window.
1372 \wxheading{Parameters
}
1374 \docparam{colour
}{The colour to be used as the background colour.
}
1378 The background colour is usually painted by the default
\rtfsp
1379 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function.
1381 \wxheading{See also
}
1383 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1384 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1385 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1386 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1388 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1390 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1392 Sets the window to have the given layout constraints. The window
1393 will then own the object, and will take care of its deletion.
1394 If an existing layout constraints object is already owned by the
1395 window, it will be deleted.
1397 \wxheading{Parameters
}
1399 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1404 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1405 the constraints automatically in OnSize; otherwise, you must
1406 override OnSize and call Layout explicitly.
1408 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1410 \func{virtual void
}{SetFocus
}{\void}
1412 This sets the window to receive keyboard input.
1414 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1416 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1418 Sets the font for this window.
1420 \wxheading{Parameters
}
1422 \docparam{font
}{Font to associate with this window.
}
1424 \wxheading{See also
}
1426 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1428 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1430 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1432 Sets the foreground colour of the window.
1434 \wxheading{Parameters
}
1436 \docparam{colour
}{The colour to be used as the foreground colour.
}
1440 The interpretation of foreground colour is open to interpretation according
1441 to the window class; it may be the text colour or other colour, or it may not
1444 \wxheading{See also
}
1446 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1447 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1448 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1450 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1452 \func{void
}{SetId
}{\param{int
}{ id
}}
1454 Sets the identifier of the window.
1458 Each window has an integer identifier. If the application has not provided one,
1459 an identifier will be generated. Normally, the identifier should be provided
1460 on creation and should not be modified subsequently.
1462 TODO: perhaps there should be a default identifier for each class, rather
1463 choosing one, which could clash with other ones.
1465 \wxheading{See also
}
1467 \helpref{wxWindow::GetId
}{wxwindowgetid
}
1470 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1472 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1474 Sets the window's name.
1476 \wxheading{Parameters
}
1478 \docparam{name
}{A name to set for the window.
}
1480 \wxheading{See also
}
1482 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1484 \membersection{wxWindow::SetReturnCode
}\label{wxwindowsetreturncode
}
1486 \func{void
}{SetReturnCode
}{\param{int
}{retCode
}}
1488 Sets the return code for this window.
1490 \wxheading{Parameters
}
1492 \docparam{retCode
}{The integer return code, usually a control identifier.
}
1496 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
1497 a code to the application. The function
\helpref{wxDialog::EndModal
}{wxdialogendmodal
} calls
{\bf SetReturnCode
}.
1499 \wxheading{See also
}
1501 \helpref{wxWindow::GetReturnCode
}{wxwindowgetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
1502 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
1504 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1506 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1507 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1508 \param{const bool
}{refresh = TRUE
}}
1510 Sets the scrollbar properties of a built-in scrollbar.
1512 \wxheading{Parameters
}
1514 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1516 \docparam{position
}{The position of the scrollbar in scroll units.
}
1518 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1520 \docparam{range
}{The maximum position of the scrollbar.
}
1522 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1526 Let's say you wish to display
50 lines of text, using the same font.
1527 The window is sized so that you can only see
16 lines at a time.
1533 SetScrollbar(wxVERTICAL,
0,
16,
50);
1537 Note that with the window at this size, the thumb position can never go
1538 above
50 minus
16, or
34.
1540 You can determine how many lines are currently visible by dividing the current view
1541 size by the character height in pixels.
1543 When defining your own scrollbar behaviour, you will always need to recalculate
1544 the scrollbar settings when the window size changes. You could therefore put your
1545 scrollbar calculations and SetScrollbar
1546 call into a function named AdjustScrollbars, which can be called initially and also
1547 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1549 \wxheading{See also
}
1551 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1552 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1555 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1557 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1559 Sets the page size of one of the built-in scrollbars.
1561 \wxheading{Parameters
}
1563 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1565 \docparam{pageSize
}{Page size in scroll units.
}
1567 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1571 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1572 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1573 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1574 value has to be adjusted when the window is resized, since the page size will have changed.
1576 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1577 the thumb changes size to reflect the page size relative to the length of the
document. When the
1578 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1579 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1582 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1583 handling of pages and ranges.
1585 \wxheading{See also
}
1587 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1588 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1589 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1590 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1593 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1595 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1597 Sets the position of one of the built-in scrollbars.
1599 \wxheading{Parameters
}
1601 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1603 \docparam{pos
}{Position in scroll units.
}
1605 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1609 This function does not directly affect the contents of the window: it is up to the
1610 application to take note of scrollbar attributes and redraw contents accordingly.
1612 \wxheading{See also
}
1614 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1615 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1616 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
1617 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1620 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1622 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1624 Sets the range of one of the built-in scrollbars.
1626 \wxheading{Parameters
}
1628 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1630 \docparam{range
}{Scroll range.
}
1632 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1636 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1637 object length of the scrollbar. If you are implementing a scrolling window, for example, you
1638 would adjust the scroll range when the window is resized, by subtracting the window view size from the
1639 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
1640 and usually the scrollbar will be automatically hidden.
1642 \wxheading{See also
}
1644 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1645 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1646 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1647 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1648 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1651 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
1653 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
1654 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
1656 Sets the size and position of the window in pixels.
1658 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1660 Sets the size of the window in pixels.
1662 \wxheading{Parameters
}
1664 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
1665 value should be used.
}
1667 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
1668 value should be used.
}
1670 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
1671 value should be used.
}
1673 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
1674 value should be used.
}
1676 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
1678 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
1679 a wxWindows-supplied default width.\\
1680 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
1681 a wxWindows-supplied default width.\\
1682 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
1683 a wxWindows-supplied default size.\\
1684 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
1685 if -
1 values are supplied.\\
1686 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
1687 as real dimensions, not default values.
1692 The second form is a convenience for calling the first form with default
1693 x and y parameters, and must be used with non-default width and height values.
1695 The first form sets the position and optionally size, of the window.
1696 Parameters may be -
1 to indicate either that a default should be supplied
1697 by wxWindows, or that the current value of the dimension should be used.
1699 \wxheading{See also
}
1701 \helpref{wxWindow::Move
}{wxwindowmove
}
1703 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
1705 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
1706 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
1708 Allows specification of minimum and maximum window sizes, and window size increments.
1709 If a pair of values is not set (or set to -
1), the default values will be used.
1711 \wxheading{Parameters
}
1713 \docparam{minW
}{Specifies the minimum width allowable.
}
1715 \docparam{minH
}{Specifies the minimum height allowable.
}
1717 \docparam{maxW
}{Specifies the maximum width allowable.
}
1719 \docparam{maxH
}{Specifies the maximum height allowable.
}
1721 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
1723 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
1727 If this function is called, the user will not be able to size the window outside the
1730 The resizing increments are only significant under Motif or Xt.
1732 \membersection{wxWindow::SetClientSize
}
1734 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1736 This sets the size of the window client area in pixels. Using this function to size a window
1737 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1738 worry about what dimensions the border or title bar have when trying to fit the window
1739 around panel items, for example.
1741 \wxheading{Parameters
}
1743 \docparam{width
}{The required client area width.
}
1745 \docparam{height
}{The required client area height.
}
1747 \membersection{wxWindow::SetPalette
}
1749 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1751 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1753 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1755 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1757 Sets the window's cursor.
1759 \wxheading{Parameters
}
1761 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1765 Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1766 function if you want the cursor to change immediately, because under Windows,
1767 wxWindows only sets the global cursor when it detects mouse movement.
1769 \wxheading{See also
}
1771 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1773 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1775 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1777 Sets the event handler for this window.
1779 \wxheading{Parameters
}
1781 \docparam{handler
}{Specifies the handler to be set.
}
1785 An event handler is an object that is capable of processing the events
1786 sent to a window. By default, the window is its own event handler, but
1787 an application may wish to substitute another, for example to allow
1788 central implementation of event-handling for a variety of different
1791 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1792 this sets up a chain of event handlers, where an event not handled by one event handler is
1793 handed to the next one in the chain.
1795 \wxheading{See also
}
1797 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1798 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1799 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1800 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1801 \helpref{wxEvtHandler
}{wxevthandler
}
1803 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
1805 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
1807 Sets the window's title. Applicable only to frames and dialogs.
1809 \wxheading{Parameters
}
1811 \docparam{title
}{The window's title.
}
1813 \wxheading{See also
}
1815 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
1817 \membersection{wxWindow::Show
}
1819 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
1821 Shows or hides the window.
1823 \wxheading{Parameters
}
1825 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
1828 \wxheading{See also
}
1830 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
1832 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
1834 \func{virtual bool
}{TransferDataFromWindow
}{\void}
1836 Transfers values from child controls to data areas specified by their validators. Returns
1837 FALSE if a transfer failed.
1839 \wxheading{See also
}
1841 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
1842 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1844 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
1846 \func{virtual bool
}{TransferDataToWindow
}{\void}
1848 Transfers values to child controls from data areas specified by their validators.
1850 \wxheading{Return value
}
1852 Returns FALSE if a transfer failed.
1854 \wxheading{See also
}
1856 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1857 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1859 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
1861 \func{virtual bool
}{Validate
}{\void}
1863 Validates the current values of the child controls using their validators.
1865 \wxheading{Return value
}
1867 Returns FALSE if any of the validations failed.
1869 \wxheading{See also
}
1871 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1872 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1873 \helpref{wxValidator
}{wxvalidator
}
1875 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
1877 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
1879 Moves the pointer to the given position on the window.
1881 \wxheading{Parameters
}
1883 \docparam{x
}{The new x position for the cursor.
}
1885 \docparam{y
}{The new y position for the cursor.
}