1 \section{\class{wxWindow
}}\label{wxwindow
}
3 wxWindow is the base class for all windows. Any
4 children of the window will be deleted automatically by the destructor
5 before the window itself is deleted.
7 \wxheading{Derived from
}
9 \helpref{wxEvtHandler
}{wxevthandler
}\\
10 \helpref{wxObject
}{wxobject
}
12 \wxheading{Window styles
}
14 The following styles can apply to all windows, although they will not always make sense for a particular
18 \begin{twocollist
}\itemsep=
0pt
19 \twocolitem{\windowstyle{wxSIMPLE
\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
21 \twocolitem{\windowstyle{wxDOUBLE
\_BORDER}}{Displays a double border. Windows only.
}
22 \twocolitem{\windowstyle{wxSUNKEN
\_BORDER}}{Displays a sunken border.
}
23 \twocolitem{\windowstyle{wxRAISED
\_BORDER}}{Displays a sunken border.
}
24 \twocolitem{\windowstyle{wxSTATIC
\_BORDER}}{Displays a border suitable for a static control.
}
25 \twocolitem{\windowstyle{wxTRANSPARENT
\_WINDOW}}{The window is transparent, that is, it will not receive paint
26 events. Windows only.
}
27 \twocolitem{\windowstyle{wxNO
\_3D}}{Prevents the children of this window taking on
3D styles, even though
28 the application-wide policy is for
3D controls. Windows only.
}
29 \twocolitem{\windowstyle{wxTAB
\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.
}
30 \twocolitem{\windowstyle{wxVSCROLL
}}{Use this style to enable a vertical scrollbar.
}
31 \twocolitem{\windowstyle{wxHSCROLL
}}{Use this style to enable a horizontal scrollbar.
}
32 \twocolitem{\windowstyle{wxCLIP
\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
33 repainted, then children being painted over them. Windows-only.
}
36 See also
\helpref{window styles overview
}{windowstyles
}.
40 \helpref{Event handling overview
}{eventhandlingoverview
}
42 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxWindow::wxWindow
}
46 \func{}{wxWindow
}{\void}
50 \func{}{wxWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
51 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
52 \param{const wxSize\&
}{size = wxDefaultSize
},
53 \param{long
}{style =
0},
54 \param{const wxString\&
}{name = wxPanelNameStr
}}
56 Constructs a window, which can be a child of a frame, dialog or any other non-control window.
58 \wxheading{Parameters
}
60 \docparam{parent
}{Pointer to a parent window.
}
62 \docparam{id
}{Window identifier. If -
1, will automatically create an identifier.
}
64 \docparam{pos
}{Window position. wxDefaultPosition is (-
1, -
1) which indicates that wxWindows
65 should generate a default position for the window. If using the wxWindow class directly, supply
68 \docparam{size
}{Window size. wxDefaultSize is (-
1, -
1) which indicates that wxWindows
69 should generate a default size for the window.
}
71 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
73 \docparam{name
}{Window name.
}
75 \membersection{wxWindow::
\destruct{wxWindow
}}
77 \func{}{\destruct{wxWindow
}}{\void}
79 Destructor. Deletes all subwindows, then deletes itself. Instead of using
80 the
{\bf delete
} operator explicitly, you should normally
81 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
82 can delete a window only when it is safe to do so, in idle time.
86 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
87 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
88 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
89 \helpref{wxCloseEvent
}{wxcloseevent
}
91 \membersection{wxWindow::AddChild
}
93 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
95 Adds a child window. This is called automatically by window creation
96 functions so should not be required by the application programmer.
98 \wxheading{Parameters
}
100 \docparam{child
}{Child window to add.
}
102 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
104 \func{virtual void
}{CaptureMouse
}{\void}
106 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
111 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
113 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
115 \func{void
}{Center
}{\param{int
}{ direction
}}
117 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
119 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
121 \func{virtual void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
125 \wxheading{Parameters
}
127 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
132 The actual behaviour depends on the derived window. For a frame or dialog box,
133 centring is relative to the whole display. For a panel item, centring is
134 relative to the panel.
138 \helpref{wxWindow::Center
}{wxwindowcenter
}
140 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
142 \func{void
}{Clear
}{\void}
144 Clears the window by filling it with the current background colour.
146 \membersection{wxWindow::ClientToScreen
}
148 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
150 Converts to screen coordinates from coordinates relative to this window.
152 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
153 a screen coordinate will be passed out.
}
155 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
156 a screen coordinate will be passed out.
}
158 \membersection{wxWindow::Close
}\label{wxwindowclose
}
160 \func{virtual bool
}{Close
}{\param{const bool
}{ force = FALSE
}}
162 The purpose of this call is to provide a safer way of destroying a window than using
163 the
{\it delete
} operator.
165 \wxheading{Parameters
}
167 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
168 of this window, TRUE if it cannot.
}
172 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
173 choose whether to destroy the window.
175 The close handler should check whether the window is being deleted forcibly,
176 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
177 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
179 Applies to managed windows (wxFrame and wxDialog classes) only.
183 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
184 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
185 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
186 \helpref{wxCloseEvent
}{wxcloseevent
}
188 \membersection{wxWindow::ConvertDialogToPixels
}\label{wxwindowconvertdialogtopixels
}
190 \func{wxPoint
}{ConvertDialogToPixels
}{\param{const wxPoint\&
}{ pt
}}
192 \func{wxSize
}{ConvertDialogToPixels
}{\param{const wxSize\&
}{ sz
}}
194 Converts a point or size from dialog units to pixels.
196 For the x dimension, the dialog units are multiplied by the average character width
197 and then divided by
4.
199 For the y dimension, the dialog units are multiplied by the average character height
200 and then divided by
8.
204 Dialog units are used for maintaining a dialog's proportions even if the font changes.
205 Dialogs created using Dialog Editor optionally use dialog units.
207 You can also use these functions programmatically. A convenience macro is defined:
211 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
217 \helpref{wxWindow::ConvertPixelsToDialog
}{wxwindowconvertpixelstodialog
}
219 \membersection{wxWindow::ConvertPixelsToDialog
}\label{wxwindowconvertpixelstodialog
}
221 \func{wxPoint
}{ConvertPixelsToDialog
}{\param{const wxPoint\&
}{ pt
}}
223 \func{wxSize
}{ConvertPixelsToDialog
}{\param{const wxSize\&
}{ sz
}}
225 Converts a point or size from pixels to dialog units.
227 For the x dimension, the pixels are multiplied by
4 and then divided by the average
230 For the y dimension, the pixels are multipled by
8 and then divided by the average
235 Dialog units are used for maintaining a dialog's proportions even if the font changes.
236 Dialogs created using Dialog Editor optionally use dialog units.
240 \helpref{wxWindow::ConvertDialogToPixels
}{wxwindowconvertdialogtopixels
}
242 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
244 \func{virtual bool
}{Destroy
}{\void}
246 Destroys the window safely. Use this function instead of the delete operator, since
247 different window classes can be destroyed differently. Frames and dialogs
248 are not destroyed immediately when this function is called - they are added
249 to a list of windows to be deleted on idle time, when all the window's events
250 have been processed. This prevents problems with events being sent to non-existant
253 \wxheading{Return value
}
255 TRUE if the window has either been successfully deleted, or it has been added
256 to the list of windows pending real deletion.
258 \membersection{wxWindow::DestroyChildren
}
260 \func{virtual void
}{DestroyChildren
}{\void}
262 Destroys all children of a window. Called automatically by the destructor.
264 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
266 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
268 Enables or disables elibility for drop file events (OnDropFiles).
270 \wxheading{Parameters
}
272 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
273 will not accept drop file events.
}
281 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
283 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
285 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
287 Enable or disable the window for user input.
289 \wxheading{Parameters
}
291 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
295 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
297 \membersection{wxWindow::FakePopupMenu
}\label{wxwindowfakepopupmenu
}
299 \func{virtual bool
}{FakePopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
301 A replacement for wxWindow::PopupMenu for cases where the PopupMenu implementation
302 does not work correctly, in particular on Motif platforms.
304 \wxheading{Parameters
}
306 \docparam{menu
}{Menu to pop up.
}
308 \docparam{x
}{Required x position for the menu to appear.
}
310 \docparam{y
}{Required y position for the menu to appear.
}
314 This is a cut-down version of PopupMenu using a dialog and listbox; pull-right menus
319 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::PopupMenu
}{wxwindowpopupmenu
}
321 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
323 \func{static wxWindow*
}{FindFocus
}{\void}
325 Finds the window or control which currently has the keyboard focus.
329 Note that this is a static function, so it can be called without needing a wxWindow pointer.
333 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
335 \membersection{wxWindow::FindWindow
}\label{wxwindowfindwindow
}
337 \func{wxWindow*
}{FindWindow
}{\param{long
}{ id
}}
339 Find a child of this window, by identifier.
341 \func{wxWindow*
}{FindWindow
}{\param{const wxString\&
}{ name
}}
343 Find a child of this window, by name.
345 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
347 \func{virtual void
}{Fit
}{\void}
349 Sizes the window so that it fits around its subwindows.
351 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
353 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
355 Returns the background colour of the window.
359 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
360 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
361 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
362 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
364 \membersection{wxWindow::GetCharHeight
}
366 \constfunc{virtual int
}{GetCharHeight
}{\void}
368 Returns the character height for this window.
370 \membersection{wxWindow::GetCharWidth
}
372 \constfunc{virtual int
}{GetCharWidth
}{\void}
374 Returns the average character width for this window.
376 \membersection{wxWindow::GetChildren
}
378 \func{wxList*
}{GetChildren
}{\void}
380 Returns a pointer to the list of the window's children.
382 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
384 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
386 This gets the size of the window `client area' in pixels. The client area is the
387 area which may be drawn on by the programmer, excluding title bar, border etc.
389 \wxheading{Parameters
}
391 \docparam{width
}{Receives the client width in pixels.
}
393 \docparam{height
}{Receives the client height in pixels.
}
395 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
397 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
399 Returns a pointer to the window's layout constraints, or NULL if there are none.
401 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
403 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
405 Returns a pointer to the button which is the default for this window, or NULL.
407 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
409 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
411 Returns the event handler for this window. By default, the window is its
416 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
417 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
418 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
419 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
420 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
422 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
424 \constfunc{wxFont*
}{GetFont
}{\void}
426 Returns a pointer to the font for this window.
430 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
432 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
434 \func{virtual wxColour
}{GetForegroundColour
}{\void}
436 Returns the foreground colour of the window.
440 The interpretation of foreground colour is open to interpretation according
441 to the window class; it may be the text colour or other colour, or it may not
446 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
447 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
448 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
450 \membersection{wxWindow::GetGrandParent
}
452 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
454 Returns the grandparent of a window, or NULL if there isn't one.
456 \membersection{wxWindow::GetHandle
}
458 \constfunc{void*
}{GetHandle
}{\void}
460 Returns the platform-specific handle of the physical window. Cast it to an appropriate
461 handle, such as
{\bf HWND
} for Windows or
{\bf Widget
} for Motif.
463 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
465 \constfunc{int
}{GetId
}{\void}
467 Returns the identifier of the window.
471 Each window has an integer identifier. If the application has not provided one,
472 an identifier will be generated.
474 TODO: perhaps there should be a default identifier for each class, rather
475 choosing one, which could clash with other ones.
479 \helpref{wxWindow::SetId
}{wxwindowsetid
}
481 \membersection{wxWindow::GetPosition
}
483 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
485 This gets the position of the window in pixels, relative to the parent window or
486 if no parent, relative to the whole display.
488 \wxheading{Parameters
}
490 \docparam{x
}{Receives the x position of the window.
}
492 \docparam{y
}{Receives the y position of the window.
}
494 \membersection{wxWindow::GetLabel
}
496 \constfunc{virtual wxString\&
}{GetLabel
}{\void}
498 Generic way of getting a label from any window, for
499 identification purposes.
503 The interpretation of this function differs from class to class.
504 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
505 the button text. This function can be useful for meta-programs (such as testing
506 tools or special-needs access programs) which need to identify windows
509 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
511 \constfunc{virtual wxString\&
}{GetName
}{\void}
513 Returns the window's name.
517 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
518 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
522 \helpref{wxWindow::SetName
}{wxwindowsetname
}
524 \membersection{wxWindow::GetParent
}
526 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
528 Returns the parent of the window, or NULL if there is no parent.
530 \membersection{wxWindow::GetReturnCode
}\label{wxwindowgetreturncode
}
532 \func{int
}{GetReturnCode
}{\void}
534 Gets the return code for this window.
538 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
539 a code to the application.
543 \helpref{wxWindow::SetReturnCode
}{wxwindowsetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
544 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
546 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
548 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
550 Returns the built-in scrollbar thumb size.
554 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
556 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
558 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
560 Returns the built-in scrollbar position.
564 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
566 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
568 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
570 Returns the built-in scrollbar range.
574 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
576 \membersection{wxWindow::GetSize
}
578 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
580 This gets the size of the entire window in pixels.
582 \wxheading{Parameters
}
584 \docparam{width
}{Receives the window width.
}
586 \docparam{height
}{Receives the window height.
}
588 \membersection{wxWindow::GetTextExtent
}
590 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
591 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
592 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
594 Gets the dimensions of the string as it would be drawn on the
595 window with the currently selected font.
597 \wxheading{Parameters
}
599 \docparam{string
}{String whose extent is to be measured.
}
601 \docparam{x
}{Return value for width.
}
603 \docparam{y
}{Return value for height.
}
605 \docparam{descent
}{Return value for descent (optional).
}
607 \docparam{externalLeading
}{Return value for external leading (optional).
}
609 \docparam{font
}{Font to use instead of the current window font (optional).
}
611 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
613 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
615 \func{virtual wxString
}{GetTitle
}{\void}
617 Gets the window's title. Applicable only to frames and dialogs.
621 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
623 \membersection{wxWindow::GetWindowStyleFlag
}
625 \constfunc{long
}{GetWindowStyleFlag
}{\void}
627 Gets the window style that was passed to the consructor or
{\bf Create
} member.
629 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
631 \func{void
}{InitDialog
}{\void}
633 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
634 in turn transfers data to the dialog via validators.
638 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
640 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
642 \constfunc{virtual bool
}{IsEnabled
}{\void}
644 Returns TRUE if the window is enabled for input, FALSE otherwise.
648 \helpref{wxWindow::Enable
}{wxwindowenable
}
650 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
652 \constfunc{virtual bool
}{IsRetained
}{\void}
654 Returns TRUE if the window is retained, FALSE otherwise.
658 Retained windows are only available on X platforms.
660 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
662 \constfunc{virtual bool
}{IsShown
}{\void}
664 Returns TRUE if the window is shown, FALSE if it has been hidden.
666 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
668 \func{void
}{Layout
}{\void}
670 Invokes the constraint-based layout algorithm for this window. It is called
671 automatically by the default
{\bf wxWindow::OnSize
} member.
673 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
675 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
676 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
678 Loads a panel or dialog from a resource file.
680 \wxheading{Parameters
}
682 \docparam{parent
}{Parent window.
}
684 \docparam{resourceName
}{The name of the resource to load.
}
686 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
687 default resource table will be used.
}
689 \wxheading{Return value
}
691 TRUE if the operation succeeded, otherwise FALSE.
701 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
703 \func{void
}{Lower
}{\void}
705 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
708 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
710 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
712 Disables all other windows in the application so that
713 the user can only interact with this window.
715 \wxheading{Parameters
}
717 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
718 the user can only interact with this window. If FALSE, the effect is reversed.
}
720 \membersection{wxWindow::Move
}\label{wxwindowmove
}
722 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
724 Moves the window to the given position.
726 \wxheading{Parameters
}
728 \docparam{x
}{Required x position.
}
730 \docparam{y
}{Required y position.
}
734 Implementations of SetSize can also implicitly implement the
735 wxWindow::Move function, which is defined in the base wxWindow class
739 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
744 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
746 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
748 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
750 Called when a window is activated or deactivated.
752 \wxheading{Parameters
}
754 \docparam{event
}{Object containing activation information.
}
758 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
759 otherwise it returns FALSE (it is being deactivated).
763 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
764 \helpref{Event handling overview
}{eventhandlingoverview
}
766 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
768 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
770 Called when the user has pressed a key.
772 \wxheading{Parameters
}
774 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
775 details about this class.
}
779 This member function is called in response to a keypress. To intercept this event,
780 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
781 default function to achieve default keypress functionality.
783 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
786 Most, but not all, windows allow keypresses to be intercepted.
790 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
791 \helpref{Event handling overview
}{eventhandlingoverview
}
793 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
795 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
797 This member is called to allow the window to intercept keyboard events
798 before they are processed by child windows.
800 \wxheading{Parameters
}
802 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
803 details about this class.
}
807 This member function is called in response to a keypress, if the window is active. To intercept this event,
808 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
809 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
811 An example of using this function is in the implementation of escape-character processing for wxDialog,
812 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
814 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
817 This function is only relevant to top-level windows (frames and dialogs), and under
822 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
823 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
824 \helpref{Event handling overview
}{eventhandlingoverview
}
826 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
828 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
830 This virtual member function is called if the control does not handle the command event.
832 \wxheading{Parameters
}
834 \docparam{object
}{Object receiving the command event.
}
836 \docparam{event
}{Command event
}
840 This virtual function is provided mainly for backward compatibility. You can also intercept commands
841 from child controls by using an event table, with identifiers or identifier ranges to identify
842 the control(s) in question.
846 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
847 \helpref{Event handling overview
}{eventhandlingoverview
}
849 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
851 \func{virtual bool
}{OnClose
}{\void}
853 Called when the user has tried to close a a frame
854 or dialog box using the window manager (X) or system menu (Windows).
856 {\bf Note:
} This is an obsolete function retained for backward compatibility.
857 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
860 \wxheading{Return value
}
862 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
863 attempt will be ignored. Do not delete the window from within this handler, although
864 you may delete other windows.
868 Derive your own class to handle this message. The default handler returns TRUE.
872 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
873 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
874 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
875 \helpref{wxCloseEvent
}{wxcloseevent
}
877 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
879 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
881 This is an event handler function called when the user has tried to close a a frame
882 or dialog box using the window manager (X) or system menu (Windows). It is
883 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
884 that the application can also invoke the handler programmatically.
886 Use the EVT
\_CLOSE event table macro to handle close events.
888 You should check whether the application is forcing the deletion of the window
889 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
890 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
891 If not, it is up to you whether you respond by destroying the window.
893 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
894 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
895 it is not possible to skip window deletion.)
897 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
898 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
899 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
903 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
904 for backward compatibility with earlier versions of wxWindows. The
905 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
906 destroying the window if it returns TRUE or if the close is being forced.
910 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
911 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
912 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
913 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
914 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
915 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
916 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
918 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
920 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
922 Called when files have been dragged from the file manager to the window.
924 \wxheading{Parameters
}
926 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
930 The window must have previously been enabled for dropping by calling
931 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
933 This event is only generated under Windows.
935 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
939 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
940 \helpref{Event handling overview
}{eventhandlingoverview
}
942 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
944 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
946 Called when the background of the window needs to be erased.
948 \wxheading{Parameters
}
950 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
954 This event is only generated under Windows.
956 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
960 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
962 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
964 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
966 Called when a window's focus is being killed.
968 \wxheading{Parameters
}
970 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
974 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
976 Most, but not all, windows respond to this event.
980 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
981 \helpref{Event handling overview
}{eventhandlingoverview
}
983 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
985 \func{void
}{Onidle
}{\param{wxIdleEvent\&
}{event
}}
987 Provide this member function for any processing which needs to be done
988 when the application is idle.
992 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
994 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
996 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
998 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1000 \wxheading{Parameters
}
1002 \docparam{event
}{Dialog initialisation event.
}
1006 Gives the window the default behaviour of transferring data to child controls via
1007 the validator that each control has.
1009 \wxheading{See also
}
1011 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1013 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1015 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1017 Called when a menu command is received from a menu bar.
1019 \wxheading{Parameters
}
1021 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1025 A function with this name doesn't actually exist; you can choose any member function to receive
1026 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1027 a range of commands.
1029 \wxheading{See also
}
1031 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1032 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1033 \helpref{Event handling overview
}{eventhandlingoverview
}
1035 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1037 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1039 Called when a menu select is received from a menu bar: that is, the
1040 mouse cursor is over a menu item, but the left mouse button has not been
1043 \wxheading{Parameters
}
1045 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1049 You can choose any member function to receive
1050 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1053 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1054 text in the first field of the status bar.
1056 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1057 since a selection is normally a left-click action.
1059 \wxheading{See also
}
1061 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1062 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1063 \helpref{Event handling overview
}{eventhandlingoverview
}
1066 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1068 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1070 Called when the user has initiated an event with the
1073 \wxheading{Parameters
}
1075 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1080 Most, but not all, windows respond to this event.
1082 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1083 mouse event macros such as EVT
\_LEFT\_DOWN.
1085 \wxheading{See also
}
1087 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1088 \helpref{Event handling overview
}{eventhandlingoverview
}
1090 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1092 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1094 Called when a window is moved.
1096 \wxheading{Parameters
}
1098 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1102 Use the EVT
\_MOVE macro to intercept move events.
1106 Not currently implemented.
1108 \wxheading{See also
}
1110 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1111 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1112 \helpref{Event handling overview
}{eventhandlingoverview
}
1114 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1116 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1118 Sent to the event handler when the window must be refreshed.
1120 \wxheading{Parameters
}
1122 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1126 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1128 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1134 void MyWindow::OnPaint(wxPaintEvent& event)
1143 You can optimize painting by retrieving the rectangles
1144 that have been damaged and only repainting these. The rectangles are in
1145 terms of the client area, and are unscrolled, so you will need to do
1146 some calculations using the current view position to obtain logical,
1149 Here is an example of using the
\helpref{wxUpdateIterator
}{wxupdateiterator
} class:
1153 // Called when window needs to be repainted.
1154 void MyWindow::OnPaint(wxPaintEvent& event)
1158 // Find Out where the window is scrolled to
1159 int vbX,vbY; // Top left corner of client
1160 ViewStart(&vbX,&vbY);
1162 int vX,vY,vW,vH; // Dimensions of client area in pixels
1163 wxUpdateIterator upd(this); // get the update rect list
1172 // Alternatively we can do this:
1174 // upd.GetRect(&rect);
1176 // Repaint this rectangle
1185 \wxheading{See also
}
1187 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1188 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1189 \helpref{Event handling overview
}{eventhandlingoverview
}
1191 \func{void
}{OnScroll
}{\param{wxScrollEvent\&
}{event
}}
1193 Called when a scroll event is received from one of the window's built-in scrollbars.
1195 \wxheading{Parameters
}
1197 \docparam{event
}{Command event. Retrieve the new scroll position by
1198 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1199 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1203 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1204 until the function is executing (you can't have one function for vertical, another
1205 for horizontal events).
1207 \wxheading{See also
}
1209 \helpref{wxScrollEvent
}{wxscrollevent
},
\rtfsp
1210 \helpref{Event handling overview
}{eventhandlingoverview
}
1212 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1214 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1216 Called when a window's focus is being set.
1218 \wxheading{Parameters
}
1220 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1224 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1226 Most, but not all, windows respond to this event.
1228 \wxheading{See also
}
1230 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1231 \helpref{Event handling overview
}{eventhandlingoverview
}
1233 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1235 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1237 Called when the window has been resized.
1239 \wxheading{Parameters
}
1241 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1245 You may wish to use this for frames to resize their child windows as appropriate.
1247 Note that the size passed is of
1248 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1249 used by the application.
1251 \wxheading{See also
}
1253 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1254 \helpref{Event handling overview
}{eventhandlingoverview
}
1256 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1258 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1260 Called when the user has changed the system colours.
1262 \wxheading{Parameters
}
1264 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1266 \wxheading{See also
}
1268 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1269 \helpref{Event handling overview
}{eventhandlingoverview
}
1271 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1273 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1275 Removes and returns the top-most event handler on the event handler stack.
1277 \wxheading{Parameters
}
1279 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1280 default value is FALSE.
}
1282 \wxheading{See also
}
1284 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1285 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1286 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1287 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1288 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1290 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1292 \func{virtual bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1294 Pops up the given menu at the specified coordinates, relative to this
1295 window, and returns control when the user has dismissed the menu. If a
1296 menu item is selected, the callback defined for the menu is called with
1297 wxMenu and wxCommandEvent reference arguments. The callback should access
1298 the commandInt member of the event to check the selected menu identifier.
1300 \wxheading{Parameters
}
1302 \docparam{menu
}{Menu to pop up.
}
1304 \docparam{x
}{Required x position for the menu to appear.
}
1306 \docparam{y
}{Required y position for the menu to appear.
}
1308 \wxheading{See also
}
1310 \helpref{wxMenu
}{wxmenu
},
\helpref{wxWindow::FakePopupMenu
}{wxwindowfakepopupmenu
}
1312 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1314 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1316 Pushes this event handler onto the event stack for the window.
1318 \wxheading{Parameters
}
1320 \docparam{handler
}{Specifies the handler to be pushed.
}
1324 An event handler is an object that is capable of processing the events
1325 sent to a window. By default, the window is its own event handler, but
1326 an application may wish to substitute another, for example to allow
1327 central implementation of event-handling for a variety of different
1330 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1331 an application to set up a chain of event handlers, where an event not handled by one event handler is
1332 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1333 remove the event handler.
1335 \wxheading{See also
}
1337 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1338 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1339 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1340 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1341 \helpref{wxEvtHandler
}{wxevthandler
}
1343 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1345 \func{void
}{Raise
}{\void}
1347 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1350 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1352 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1355 Causes a message or event to be generated to repaint the
1358 \wxheading{Parameters
}
1360 \docparam{eraseBackground
}{If TRUE, the background will be
1363 \docparam{rect
}{If non-NULL, only the given rectangle will
1364 be treated as damaged.
}
1366 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1368 \func{virtual void
}{ReleaseMouse
}{\void}
1370 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1372 \wxheading{See also
}
1374 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1376 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1378 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1380 Removes a child window. This is called automatically by window deletion
1381 functions so should not be required by the application programmer.
1383 \wxheading{Parameters
}
1385 \docparam{child
}{Child window to remove.
}
1387 \membersection{wxWindow::ScreenToClient
}
1389 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1391 Converts from screen to client window coordinates.
1393 \wxheading{Parameters
}
1395 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1397 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1399 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1401 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1403 Physically scrolls the pixels in the window.
1405 \wxheading{Parameters
}
1407 \docparam{dx
}{Amount to scroll horizontally.
}
1409 \docparam{dy
}{Amount to scroll vertically.
}
1411 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1412 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1413 can optimise painting by checking for the invalidated region.
}
1417 Available only under Windows.
1419 Use this function to optimise your scrolling implementations, to minimise the area that must be
1422 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1424 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1426 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1428 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1430 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1432 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1433 be called automatically when the window is resized.
1435 \wxheading{Parameters
}
1437 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1438 from within wxWindow::OnSize functions.
}
1440 \wxheading{See also
}
1442 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1444 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1446 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1448 Sets the background colour of the window.
1450 \wxheading{Parameters
}
1452 \docparam{colour
}{The colour to be used as the background colour.
}
1456 The background colour is usually painted by the default
\rtfsp
1457 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function.
1459 \wxheading{See also
}
1461 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1462 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1463 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1464 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1466 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1468 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1470 Sets the window to have the given layout constraints. The window
1471 will then own the object, and will take care of its deletion.
1472 If an existing layout constraints object is already owned by the
1473 window, it will be deleted.
1475 \wxheading{Parameters
}
1477 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1482 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1483 the constraints automatically in OnSize; otherwise, you must
1484 override OnSize and call Layout explicitly.
1486 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1488 \func{virtual void
}{SetFocus
}{\void}
1490 This sets the window to receive keyboard input.
1492 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1494 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1496 Sets the font for this window.
1498 \wxheading{Parameters
}
1500 \docparam{font
}{Font to associate with this window.
}
1502 \wxheading{See also
}
1504 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1506 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1508 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1510 Sets the foreground colour of the window.
1512 \wxheading{Parameters
}
1514 \docparam{colour
}{The colour to be used as the foreground colour.
}
1518 The interpretation of foreground colour is open to interpretation according
1519 to the window class; it may be the text colour or other colour, or it may not
1522 \wxheading{See also
}
1524 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1525 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1526 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1528 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1530 \func{void
}{SetId
}{\param{int
}{ id
}}
1532 Sets the identifier of the window.
1536 Each window has an integer identifier. If the application has not provided one,
1537 an identifier will be generated. Normally, the identifier should be provided
1538 on creation and should not be modified subsequently.
1540 TODO: perhaps there should be a default identifier for each class, rather
1541 choosing one, which could clash with other ones.
1543 \wxheading{See also
}
1545 \helpref{wxWindow::GetId
}{wxwindowgetid
}
1548 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1550 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1552 Sets the window's name.
1554 \wxheading{Parameters
}
1556 \docparam{name
}{A name to set for the window.
}
1558 \wxheading{See also
}
1560 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1562 \membersection{wxWindow::SetReturnCode
}\label{wxwindowsetreturncode
}
1564 \func{void
}{SetReturnCode
}{\param{int
}{retCode
}}
1566 Sets the return code for this window.
1568 \wxheading{Parameters
}
1570 \docparam{retCode
}{The integer return code, usually a control identifier.
}
1574 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
1575 a code to the application. The function
\helpref{wxDialog::EndModal
}{wxdialogendmodal
} calls
{\bf SetReturnCode
}.
1577 \wxheading{See also
}
1579 \helpref{wxWindow::GetReturnCode
}{wxwindowgetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
1580 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
1582 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1584 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1585 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1586 \param{const bool
}{refresh = TRUE
}}
1588 Sets the scrollbar properties of a built-in scrollbar.
1590 \wxheading{Parameters
}
1592 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1594 \docparam{position
}{The position of the scrollbar in scroll units.
}
1596 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1598 \docparam{range
}{The maximum position of the scrollbar.
}
1600 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1604 Let's say you wish to display
50 lines of text, using the same font.
1605 The window is sized so that you can only see
16 lines at a time.
1611 SetScrollbar(wxVERTICAL,
0,
16,
50);
1615 Note that with the window at this size, the thumb position can never go
1616 above
50 minus
16, or
34.
1618 You can determine how many lines are currently visible by dividing the current view
1619 size by the character height in pixels.
1621 When defining your own scrollbar behaviour, you will always need to recalculate
1622 the scrollbar settings when the window size changes. You could therefore put your
1623 scrollbar calculations and SetScrollbar
1624 call into a function named AdjustScrollbars, which can be called initially and also
1625 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1627 \wxheading{See also
}
1629 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1630 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1633 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1635 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1637 Sets the page size of one of the built-in scrollbars.
1639 \wxheading{Parameters
}
1641 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1643 \docparam{pageSize
}{Page size in scroll units.
}
1645 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1649 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1650 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1651 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1652 value has to be adjusted when the window is resized, since the page size will have changed.
1654 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1655 the thumb changes size to reflect the page size relative to the length of the
document. When the
1656 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1657 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1660 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1661 handling of pages and ranges.
1663 \wxheading{See also
}
1665 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1666 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1667 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1668 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1671 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1673 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1675 Sets the position of one of the built-in scrollbars.
1677 \wxheading{Parameters
}
1679 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1681 \docparam{pos
}{Position in scroll units.
}
1683 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1687 This function does not directly affect the contents of the window: it is up to the
1688 application to take note of scrollbar attributes and redraw contents accordingly.
1690 \wxheading{See also
}
1692 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1693 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1694 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
1695 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1698 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1700 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1702 Sets the range of one of the built-in scrollbars.
1704 \wxheading{Parameters
}
1706 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1708 \docparam{range
}{Scroll range.
}
1710 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1714 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1715 object length of the scrollbar. If you are implementing a scrolling window, for example, you
1716 would adjust the scroll range when the window is resized, by subtracting the window view size from the
1717 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
1718 and usually the scrollbar will be automatically hidden.
1720 \wxheading{See also
}
1722 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1723 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1724 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1725 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1726 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1729 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
1731 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
1732 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
1734 Sets the size and position of the window in pixels.
1736 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1738 Sets the size of the window in pixels.
1740 \wxheading{Parameters
}
1742 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
1743 value should be used.
}
1745 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
1746 value should be used.
}
1748 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
1749 value should be used.
}
1751 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
1752 value should be used.
}
1754 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
1756 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
1757 a wxWindows-supplied default width.\\
1758 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
1759 a wxWindows-supplied default width.\\
1760 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
1761 a wxWindows-supplied default size.\\
1762 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
1763 if -
1 values are supplied.\\
1764 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
1765 as real dimensions, not default values.
1770 The second form is a convenience for calling the first form with default
1771 x and y parameters, and must be used with non-default width and height values.
1773 The first form sets the position and optionally size, of the window.
1774 Parameters may be -
1 to indicate either that a default should be supplied
1775 by wxWindows, or that the current value of the dimension should be used.
1777 \wxheading{See also
}
1779 \helpref{wxWindow::Move
}{wxwindowmove
}
1781 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
1783 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
1784 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
1786 Allows specification of minimum and maximum window sizes, and window size increments.
1787 If a pair of values is not set (or set to -
1), the default values will be used.
1789 \wxheading{Parameters
}
1791 \docparam{minW
}{Specifies the minimum width allowable.
}
1793 \docparam{minH
}{Specifies the minimum height allowable.
}
1795 \docparam{maxW
}{Specifies the maximum width allowable.
}
1797 \docparam{maxH
}{Specifies the maximum height allowable.
}
1799 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
1801 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
1805 If this function is called, the user will not be able to size the window outside the
1808 The resizing increments are only significant under Motif or Xt.
1810 \membersection{wxWindow::SetClientSize
}
1812 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1814 This sets the size of the window client area in pixels. Using this function to size a window
1815 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1816 worry about what dimensions the border or title bar have when trying to fit the window
1817 around panel items, for example.
1819 \wxheading{Parameters
}
1821 \docparam{width
}{The required client area width.
}
1823 \docparam{height
}{The required client area height.
}
1825 \membersection{wxWindow::SetPalette
}
1827 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1829 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1831 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1833 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1835 Sets the window's cursor.
1837 \wxheading{Parameters
}
1839 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1843 Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1844 function if you want the cursor to change immediately, because under Windows,
1845 wxWindows only sets the global cursor when it detects mouse movement.
1847 \wxheading{See also
}
1849 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1851 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1853 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1855 Sets the event handler for this window.
1857 \wxheading{Parameters
}
1859 \docparam{handler
}{Specifies the handler to be set.
}
1863 An event handler is an object that is capable of processing the events
1864 sent to a window. By default, the window is its own event handler, but
1865 an application may wish to substitute another, for example to allow
1866 central implementation of event-handling for a variety of different
1869 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1870 this sets up a chain of event handlers, where an event not handled by one event handler is
1871 handed to the next one in the chain.
1873 \wxheading{See also
}
1875 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1876 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1877 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1878 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1879 \helpref{wxEvtHandler
}{wxevthandler
}
1881 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
1883 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
1885 Sets the window's title. Applicable only to frames and dialogs.
1887 \wxheading{Parameters
}
1889 \docparam{title
}{The window's title.
}
1891 \wxheading{See also
}
1893 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
1895 \membersection{wxWindow::Show
}
1897 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
1899 Shows or hides the window.
1901 \wxheading{Parameters
}
1903 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
1906 \wxheading{See also
}
1908 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
1910 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
1912 \func{virtual bool
}{TransferDataFromWindow
}{\void}
1914 Transfers values from child controls to data areas specified by their validators. Returns
1915 FALSE if a transfer failed.
1917 \wxheading{See also
}
1919 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
1920 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1922 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
1924 \func{virtual bool
}{TransferDataToWindow
}{\void}
1926 Transfers values to child controls from data areas specified by their validators.
1928 \wxheading{Return value
}
1930 Returns FALSE if a transfer failed.
1932 \wxheading{See also
}
1934 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1935 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
1937 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
1939 \func{virtual bool
}{Validate
}{\void}
1941 Validates the current values of the child controls using their validators.
1943 \wxheading{Return value
}
1945 Returns FALSE if any of the validations failed.
1947 \wxheading{See also
}
1949 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1950 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
1951 \helpref{wxValidator
}{wxvalidator
}
1953 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
1955 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
1957 Moves the pointer to the given position on the window.
1959 \wxheading{Parameters
}
1961 \docparam{x
}{The new x position for the cursor.
}
1963 \docparam{y
}{The new y position for the cursor.
}