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{Include files
}
16 \wxheading{Window styles
}
18 The following styles can apply to all windows, although they will not always make sense for a particular
22 \begin{twocollist
}\itemsep=
0pt
23 \twocolitem{\windowstyle{wxSIMPLE
\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
24 for this style. Windows only.
}
25 \twocolitem{\windowstyle{wxDOUBLE
\_BORDER}}{Displays a double border. Windows only.
}
26 \twocolitem{\windowstyle{wxSUNKEN
\_BORDER}}{Displays a sunken border.
}
27 \twocolitem{\windowstyle{wxRAISED
\_BORDER}}{Displays a raised border.
}
28 \twocolitem{\windowstyle{wxSTATIC
\_BORDER}}{Displays a border suitable for a static control. Windows only.
}
29 \twocolitem{\windowstyle{wxTRANSPARENT
\_WINDOW}}{The window is transparent, that is, it will not receive paint
30 events. Windows only.
}
31 \twocolitem{\windowstyle{wxNO
\_3D}}{Prevents the children of this window taking on
3D styles, even though
32 the application-wide policy is for
3D controls. Windows only.
}
33 \twocolitem{\windowstyle{wxTAB
\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.
}
34 \twocolitem{\windowstyle{wxWANTS
\_CHARS}}{Use this to indicate that the window
35 wants to get all char events - even for keys like TAB or ENTER which are
36 usually used for dialog navigation and which wouldn't be generated without
38 \twocolitem{\windowstyle{wxNO
\_FULLREPAINT\_ON\_RESIZE}}{Disables repainting
39 the window completely when its size is changed - you will have to repaint the
40 new window area manually if you use style. Currently only has effect for
42 \twocolitem{\windowstyle{wxVSCROLL
}}{Use this style to enable a vertical scrollbar. (Still used?)
}
43 \twocolitem{\windowstyle{wxHSCROLL
}}{Use this style to enable a horizontal scrollbar. (Still used?)
}
44 \twocolitem{\windowstyle{wxCLIP
\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
45 repainted, then children being painted over them. Windows only.
}
48 See also
\helpref{window styles overview
}{windowstyles
}.
52 \helpref{Event handling overview
}{eventhandlingoverview
}
54 \latexignore{\rtfignore{\wxheading{Members
}}}
56 \membersection{wxWindow::wxWindow
}
58 \func{}{wxWindow
}{\void}
62 \func{}{wxWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
63 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
64 \param{const wxSize\&
}{size = wxDefaultSize
},
65 \param{long
}{style =
0},
66 \param{const wxString\&
}{name = wxPanelNameStr
}}
68 Constructs a window, which can be a child of a frame, dialog or any other non-control window.
70 \wxheading{Parameters
}
72 \docparam{parent
}{Pointer to a parent window.
}
74 \docparam{id
}{Window identifier. If -
1, will automatically create an identifier.
}
76 \docparam{pos
}{Window position. wxDefaultPosition is (-
1, -
1) which indicates that wxWindows
77 should generate a default position for the window. If using the wxWindow class directly, supply
80 \docparam{size
}{Window size. wxDefaultSize is (-
1, -
1) which indicates that wxWindows
81 should generate a default size for the window. If no suitable size can be found, the
82 window will be sized to
20x20 pixels so that the window is visible but obviously not
85 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
87 \docparam{name
}{Window name.
}
89 \membersection{wxWindow::
\destruct{wxWindow
}}
91 \func{}{\destruct{wxWindow
}}{\void}
93 Destructor. Deletes all subwindows, then deletes itself. Instead of using
94 the
{\bf delete
} operator explicitly, you should normally
95 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
96 can delete a window only when it is safe to do so, in idle time.
100 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
101 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
102 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
103 \helpref{wxCloseEvent
}{wxcloseevent
}
105 \membersection{wxWindow::AddChild
}
107 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
109 Adds a child window. This is called automatically by window creation
110 functions so should not be required by the application programmer.
112 \wxheading{Parameters
}
114 \docparam{child
}{Child window to add.
}
116 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
118 \func{virtual void
}{CaptureMouse
}{\void}
120 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
125 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
127 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
129 \func{void
}{Center
}{\param{int
}{ direction
}}
131 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
133 \membersection{wxWindow::CenterOnParent
}\label{wxwindowcenteronparent
}
135 \func{void
}{CenterOnParent
}{\param{int
}{ direction
}}
137 A synonym for
\helpref{CentreOnParent
}{wxwindowcentreonparent
}.
139 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
141 \func{void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
145 \wxheading{Parameters
}
147 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
148 or
{\tt wxBOTH
}. It may also include
{\tt wxCENTRE
\_ON\_SCREEN} flag
149 if you want to center the window on the entire screen and not on its
152 The flag
{\tt wxCENTRE
\_FRAME} is obsolete and should not be used any longer.
156 If the window is a top level one (i.e. doesn't have a parent), it will be
157 centered relative to the screen anyhow.
161 \helpref{wxWindow::Center
}{wxwindowcenter
}
163 \membersection{wxWindow::CentreOnParent
}\label{wxwindowcentreonparent
}
165 \func{void
}{CentreOnParent
}{\param{int
}{ direction = wxHORIZONTAL
}}
169 \wxheading{Parameters
}
171 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
176 This methods provides for a way to center top level windows over their
177 parents instead of the entire screen. If there is no parent or if the
178 window is not a top level window, then behaviour is the same as
179 \helpref{wxWindow::Centre
}{wxwindowcentre
}.
183 \helpref{wxWindow::CenterOnParent
}{wxwindowcenteronparent
}
185 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
187 \func{void
}{Clear
}{\void}
189 Clears the window by filling it with the current background colour. Does not
190 cause an erase background event to be generated.
192 \membersection{wxWindow::ClientToScreen
}
194 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
196 \constfunc{virtual wxPoint
}{ClientToScreen
}{\param{const wxPoint\&
}{ pt
}}
198 Converts to screen coordinates from coordinates relative to this window.
200 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
201 a screen coordinate will be passed out.
}
203 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
204 a screen coordinate will be passed out.
}
206 \docparam{pt
}{The client position for the second form of the function.
}
208 \pythonnote{In place of a single overloaded method name, wxPython
209 implements the following methods:
\par
210 \indented{2cm
}{\begin{twocollist
}
211 \twocolitem{\bf{ClientToScreen(point)
}}{Accepts and returns a wxPoint
}
212 \twocolitem{\bf{ClientToScreenXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
217 \membersection{wxWindow::Close
}\label{wxwindowclose
}
219 \func{virtual bool
}{Close
}{\param{const bool
}{ force = FALSE
}}
221 The purpose of this call is to provide a safer way of destroying a window than using
222 the
{\it delete
} operator.
224 \wxheading{Parameters
}
226 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
227 of this window, TRUE if it cannot.
}
231 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
232 choose whether to destroy the window.
234 The close handler should check whether the window is being deleted forcibly,
235 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
236 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
238 Applies to managed windows (wxFrame and wxDialog classes) only.
240 {\it Note
} that calling Close does not guarantee that the window will be destroyed; but it
241 provides a way to simulate a manual close of a window, which may or may not be implemented by
242 destroying the window. The default implementation of wxDialog::OnCloseWindow does not
243 necessarily delete the dialog, since it will simply simulate an wxID
\_CANCEL event which
244 itself only hides the dialog.
246 To guarantee that the window will be destroyed, call
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} instead.
250 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
251 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
252 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
253 \helpref{wxCloseEvent
}{wxcloseevent
}
255 \membersection{wxWindow::ConvertDialogToPixels
}\label{wxwindowconvertdialogtopixels
}
257 \func{wxPoint
}{ConvertDialogToPixels
}{\param{const wxPoint\&
}{ pt
}}
259 \func{wxSize
}{ConvertDialogToPixels
}{\param{const wxSize\&
}{ sz
}}
261 Converts a point or size from dialog units to pixels.
263 For the x dimension, the dialog units are multiplied by the average character width
264 and then divided by
4.
266 For the y dimension, the dialog units are multiplied by the average character height
267 and then divided by
8.
271 Dialog units are used for maintaining a dialog's proportions even if the font changes.
272 Dialogs created using Dialog Editor optionally use dialog units.
274 You can also use these functions programmatically. A convenience macro is defined:
278 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
284 \helpref{wxWindow::ConvertPixelsToDialog
}{wxwindowconvertpixelstodialog
}
286 \pythonnote{In place of a single overloaded method name, wxPython
287 implements the following methods:
\par
288 \indented{2cm
}{\begin{twocollist
}
289 \twocolitem{\bf{ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
290 \twocolitem{\bf{ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
293 Additionally, the following helper functions are defined:
\par
294 \indented{2cm
}{\begin{twocollist
}
295 \twocolitem{\bf{wxDLG
\_PNT(win, point)
}}{Converts a wxPoint from dialog
297 \twocolitem{\bf{wxDLG
\_SZE(win, size)
}}{Converts a wxSize from dialog
303 \membersection{wxWindow::ConvertPixelsToDialog
}\label{wxwindowconvertpixelstodialog
}
305 \func{wxPoint
}{ConvertPixelsToDialog
}{\param{const wxPoint\&
}{ pt
}}
307 \func{wxSize
}{ConvertPixelsToDialog
}{\param{const wxSize\&
}{ sz
}}
309 Converts a point or size from pixels to dialog units.
311 For the x dimension, the pixels are multiplied by
4 and then divided by the average
314 For the y dimension, the pixels are multipled by
8 and then divided by the average
319 Dialog units are used for maintaining a dialog's proportions even if the font changes.
320 Dialogs created using Dialog Editor optionally use dialog units.
324 \helpref{wxWindow::ConvertDialogToPixels
}{wxwindowconvertdialogtopixels
}
327 \pythonnote{In place of a single overloaded method name, wxPython
328 implements the following methods:
\par
329 \indented{2cm
}{\begin{twocollist
}
330 \twocolitem{\bf{ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
331 \twocolitem{\bf{ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
335 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
337 \func{virtual bool
}{Destroy
}{\void}
339 Destroys the window safely. Use this function instead of the delete operator, since
340 different window classes can be destroyed differently. Frames and dialogs
341 are not destroyed immediately when this function is called - they are added
342 to a list of windows to be deleted on idle time, when all the window's events
343 have been processed. This prevents problems with events being sent to non-existant
346 \wxheading{Return value
}
348 TRUE if the window has either been successfully deleted, or it has been added
349 to the list of windows pending real deletion.
351 \membersection{wxWindow::DestroyChildren
}
353 \func{virtual void
}{DestroyChildren
}{\void}
355 Destroys all children of a window. Called automatically by the destructor.
357 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
359 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
361 Enables or disables elibility for drop file events (OnDropFiles).
363 \wxheading{Parameters
}
365 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
366 will not accept drop file events.
}
374 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
376 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
378 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
380 Enable or disable the window for user input.
382 \wxheading{Parameters
}
384 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
388 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
390 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
392 \func{static wxWindow*
}{FindFocus
}{\void}
394 Finds the window or control which currently has the keyboard focus.
398 Note that this is a static function, so it can be called without needing a wxWindow pointer.
402 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
404 \membersection{wxWindow::FindWindow
}\label{wxwindowfindwindow
}
406 \func{wxWindow*
}{FindWindow
}{\param{long
}{ id
}}
408 Find a child of this window, by identifier.
410 \func{wxWindow*
}{FindWindow
}{\param{const wxString\&
}{ name
}}
412 Find a child of this window, by name.
414 \pythonnote{In place of a single overloaded method name, wxPython
415 implements the following methods:
\par
416 \indented{2cm
}{\begin{twocollist
}
417 \twocolitem{\bf{FindWindowById(id)
}}{Accepts an integer
}
418 \twocolitem{\bf{FindWindowByName(name)
}}{Accepts a string
}
422 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
424 \func{virtual void
}{Fit
}{\void}
426 Sizes the window so that it fits around its subwindows.
428 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
430 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
432 Returns the background colour of the window.
436 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
437 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
438 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
439 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
441 \membersection{wxWindow::GetCharHeight
}
443 \constfunc{virtual int
}{GetCharHeight
}{\void}
445 Returns the character height for this window.
447 \membersection{wxWindow::GetCharWidth
}
449 \constfunc{virtual int
}{GetCharWidth
}{\void}
451 Returns the average character width for this window.
453 \membersection{wxWindow::GetChildren
}
455 \func{wxList\&
}{GetChildren
}{\void}
457 Returns a reference to the list of the window's children.
459 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
461 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
463 \constfunc{virtual wxSize
}{GetClientSize
}{\void}
465 This gets the size of the window `client area' in pixels. The client area is the
466 area which may be drawn on by the programmer, excluding title bar, border etc.
468 \wxheading{Parameters
}
470 \docparam{width
}{Receives the client width in pixels.
}
472 \docparam{height
}{Receives the client height in pixels.
}
474 \pythonnote{In place of a single overloaded method name, wxPython
475 implements the following methods:
\par
476 \indented{2cm
}{\begin{twocollist
}
477 \twocolitem{\bf{wxGetClientSizeTuple()
}}{Returns a
2-tuple of (width, height)
}
478 \twocolitem{\bf{wxGetClientSize()
}}{Returns a wxSize object
}
482 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
484 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
486 Returns a pointer to the window's layout constraints, or NULL if there are none.
488 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
490 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
492 Returns a pointer to the button which is the default for this window, or NULL.
494 \membersection{wxWindow::GetDropTarget
}\label{wxwindowgetdroptarget
}
496 \constfunc{wxDropTarget*
}{GetDropTarget
}{\void}
498 Returns the associated drop target, which may be NULL.
502 \helpref{wxWindow::SetDropTarget
}{wxwindowsetdroptarget
},
503 \helpref{Drag and drop overview
}{wxdndoverview
}
505 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
507 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
509 Returns the event handler for this window. By default, the window is its
514 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
515 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
516 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
517 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
518 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
520 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
522 \constfunc{wxFont\&
}{GetFont
}{\void}
524 Returns a reference to the font for this window.
528 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
530 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
532 \func{virtual wxColour
}{GetForegroundColour
}{\void}
534 Returns the foreground colour of the window.
538 The interpretation of foreground colour is open to interpretation according
539 to the window class; it may be the text colour or other colour, or it may not
544 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
545 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
546 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
548 \membersection{wxWindow::GetGrandParent
}
550 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
552 Returns the grandparent of a window, or NULL if there isn't one.
554 \membersection{wxWindow::GetHandle
}
556 \constfunc{void*
}{GetHandle
}{\void}
558 Returns the platform-specific handle of the physical window. Cast it to an appropriate
559 handle, such as
{\bf HWND
} for Windows,
{\bf Widget
} for Motif or
{\bf GtkWidget
} for GTK.
561 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
563 \constfunc{int
}{GetId
}{\void}
565 Returns the identifier of the window.
569 Each window has an integer identifier. If the application has not provided one
570 (or the default Id -
1) an unique identifier with a negative value will be generated.
574 \helpref{wxWindow::SetId
}{wxwindowsetid
}\rtfsp
575 \helpref{Window identifiers
}{windowids
}
577 \membersection{wxWindow::GetPosition
}
579 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
581 This gets the position of the window in pixels, relative to the parent window or
582 if no parent, relative to the whole display.
584 \wxheading{Parameters
}
586 \docparam{x
}{Receives the x position of the window.
}
588 \docparam{y
}{Receives the y position of the window.
}
590 \pythonnote{In place of a single overloaded method name, wxPython
591 implements the following methods:
\par
592 \indented{2cm
}{\begin{twocollist
}
593 \twocolitem{\bf{GetPosition()
}}{Returns a wxPoint
}
594 \twocolitem{\bf{GetPositionTuple()
}}{Returns a tuple (x, y)
}
598 \membersection{wxWindow::GetLabel
}
600 \constfunc{virtual wxString
}{GetLabel
}{\void}
602 Generic way of getting a label from any window, for
603 identification purposes.
607 The interpretation of this function differs from class to class.
608 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
609 the button text. This function can be useful for meta-programs (such as testing
610 tools or special-needs access programs) which need to identify windows
613 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
615 \constfunc{virtual wxString
}{GetName
}{\void}
617 Returns the window's name.
621 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
622 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
626 \helpref{wxWindow::SetName
}{wxwindowsetname
}
628 \membersection{wxWindow::GetParent
}
630 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
632 Returns the parent of the window, or NULL if there is no parent.
634 \membersection{wxWindow::GetRect
}\label{wxwindowgetrect
}
636 \constfunc{virtual wxRect
}{GetRect
}{\void}
638 Returns the size and position of the window as a
\helpref{wxRect
}{wxrect
} object.
640 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
642 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
644 Returns the built-in scrollbar thumb size.
648 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
650 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
652 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
654 Returns the built-in scrollbar position.
658 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
660 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
662 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
664 Returns the built-in scrollbar range.
668 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
670 \membersection{wxWindow::GetSize
}\label{wxwindowgetsize
}
672 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
674 \constfunc{virtual wxSize
}{GetSize
}{\void}
676 This gets the size of the entire window in pixels.
678 \wxheading{Parameters
}
680 \docparam{width
}{Receives the window width.
}
682 \docparam{height
}{Receives the window height.
}
684 \pythonnote{In place of a single overloaded method name, wxPython
685 implements the following methods:
\par
686 \indented{2cm
}{\begin{twocollist
}
687 \twocolitem{\bf{GetSize()
}}{Returns a wxSize
}
688 \twocolitem{\bf{GetSizeTuple()
}}{Returns a
2-tuple (width, height)
}
692 \membersection{wxWindow::GetTextExtent
}
694 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
695 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
696 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
698 Gets the dimensions of the string as it would be drawn on the
699 window with the currently selected font.
701 \wxheading{Parameters
}
703 \docparam{string
}{String whose extent is to be measured.
}
705 \docparam{x
}{Return value for width.
}
707 \docparam{y
}{Return value for height.
}
709 \docparam{descent
}{Return value for descent (optional).
}
711 \docparam{externalLeading
}{Return value for external leading (optional).
}
713 \docparam{font
}{Font to use instead of the current window font (optional).
}
715 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
718 \pythonnote{In place of a single overloaded method name, wxPython
719 implements the following methods:
\par
720 \indented{2cm
}{\begin{twocollist
}
721 \twocolitem{\bf{GetTextExtent(string)
}}{Returns a
2-tuple, (width, height)
}
722 \twocolitem{\bf{GetFullTextExtent(string, font=NULL)
}}{Returns a
723 4-tuple, (width, height, descent, externalLeading)
}
728 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
730 \func{virtual wxString
}{GetTitle
}{\void}
732 Gets the window's title. Applicable only to frames and dialogs.
736 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
738 \membersection{wxWindow::GetUpdateRegion
}\label{wxwindowgetupdateregion
}
740 \constfunc{virtual wxRegion
}{GetUpdateRegion
}{\void}
742 Returns the region specifying which parts of the window have been damaged. Should
743 only be called within an
\helpref{OnPaint
}{wxwindowonpaint
} event handler.
747 \helpref{wxRegion
}{wxregion
},
\helpref{wxRegionIterator
}{wxregioniterator
},
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
749 \membersection{wxWindow::GetValidator
}\label{wxwindowgetvalidator
}
751 \constfunc{wxValidator*
}{GetValidator
}{\void}
753 Returns a pointer to the current validator for the window, or NULL if there is none.
755 \membersection{wxWindow::GetWindowStyleFlag
}
757 \constfunc{long
}{GetWindowStyleFlag
}{\void}
759 Gets the window style that was passed to the consructor or
{\bf Create
} member.
760 {\bf GetWindowStyle
} is synonymous.
762 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
764 \func{void
}{InitDialog
}{\void}
766 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
767 in turn transfers data to the dialog via validators.
771 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
773 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
775 \constfunc{virtual bool
}{IsEnabled
}{\void}
777 Returns TRUE if the window is enabled for input, FALSE otherwise.
781 \helpref{wxWindow::Enable
}{wxwindowenable
}
783 \membersection{wxWindow:IsExposed
}\label{wxwindowisexposed
}
785 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
}}
787 \constfunc{bool
}{IsExposed
}{\param{wxPoint
}{&pt
}}
789 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
},
\param{int
}{w
},
\param{int
}{h
}}
791 \constfunc{bool
}{IsExposed
}{\param{wxRect
}{&rect
}}
793 Returns TRUE if the given point or rectange area has been exposed since the
794 last repaint. Call this in an paint event handler to optimize redrawing by
795 only redrawing those area, which have been exposed.
797 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
799 \constfunc{virtual bool
}{IsRetained
}{\void}
801 Returns TRUE if the window is retained, FALSE otherwise.
805 Retained windows are only available on X platforms.
807 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
809 \constfunc{virtual bool
}{IsShown
}{\void}
811 Returns TRUE if the window is shown, FALSE if it has been hidden.
813 \membersection{wxWindow::IsTopLevel
}\label{wxwindowistoplevel
}
815 \constfunc{bool
}{IsTopLevel
}{\void}
817 Returns TRUE if the given window is a top-level one. Currently all frames and
818 dialogs are considered to be top-level windows (even if they have a parent
821 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
823 \func{void
}{Layout
}{\void}
825 Invokes the constraint-based layout algorithm or the sizer-based algorithm
828 See
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} on when
829 this function gets called automatically using auto layout.
831 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
833 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
834 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
836 Loads a panel or dialog from a resource file.
838 \wxheading{Parameters
}
840 \docparam{parent
}{Parent window.
}
842 \docparam{resourceName
}{The name of the resource to load.
}
844 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
845 default resource table will be used.
}
847 \wxheading{Return value
}
849 TRUE if the operation succeeded, otherwise FALSE.
851 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
853 \func{void
}{Lower
}{\void}
855 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
858 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
860 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
862 Disables all other windows in the application so that
863 the user can only interact with this window. (This function
864 is not implemented anywhere).
866 \wxheading{Parameters
}
868 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
869 the user can only interact with this window. If FALSE, the effect is reversed.
}
871 \membersection{wxWindow::Move
}\label{wxwindowmove
}
873 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
875 \func{void
}{Move
}{\param{const wxPoint\&
}{ pt
}}
877 Moves the window to the given position.
879 \wxheading{Parameters
}
881 \docparam{x
}{Required x position.
}
883 \docparam{y
}{Required y position.
}
885 \docparam{pt
}{\helpref{wxPoint
}{wxpoint
} object representing the position.
}
889 Implementations of SetSize can also implicitly implement the
890 wxWindow::Move function, which is defined in the base wxWindow class
894 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
899 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
901 \pythonnote{In place of a single overloaded method name, wxPython
902 implements the following methods:
\par
903 \indented{2cm
}{\begin{twocollist
}
904 \twocolitem{\bf{Move(point)
}}{Accepts a wxPoint
}
905 \twocolitem{\bf{MoveXY(x, y)
}}{Accepts a pair of integers
}
909 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
911 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
913 Called when a window is activated or deactivated.
915 \wxheading{Parameters
}
917 \docparam{event
}{Object containing activation information.
}
921 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
922 otherwise it returns FALSE (it is being deactivated).
926 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
927 \helpref{Event handling overview
}{eventhandlingoverview
}
929 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
931 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
933 Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
935 \wxheading{Parameters
}
937 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
938 details about this class.
}
942 This member function is called in response to a keypress. To intercept this event,
943 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
944 default function to achieve default keypress functionality.
946 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
949 Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
950 keypresses, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
951 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
953 Most, but not all, windows allow keypresses to be intercepted.
957 \helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
958 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
959 \helpref{Event handling overview
}{eventhandlingoverview
}
961 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
963 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
965 This member is called to allow the window to intercept keyboard events
966 before they are processed by child windows.
968 \wxheading{Parameters
}
970 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
971 details about this class.
}
975 This member function is called in response to a keypress, if the window is active. To intercept this event,
976 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
977 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
979 An example of using this function is in the implementation of escape-character processing for wxDialog,
980 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
982 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
985 This function is only relevant to top-level windows (frames and dialogs), and under
986 Windows only. Under GTK the normal EVT
\_CHAR\_ event has the functionality, i.e.
987 you can intercepts it and if you don't call
\helpref{wxEvent::Skip
}{wxeventskip
}
988 the window won't get the event.
992 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
993 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
994 \helpref{Event handling overview
}{eventhandlingoverview
}
996 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
998 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
1000 This virtual member function is called if the control does not handle the command event.
1002 \wxheading{Parameters
}
1004 \docparam{object
}{Object receiving the command event.
}
1006 \docparam{event
}{Command event
}
1010 This virtual function is provided mainly for backward compatibility. You can also intercept commands
1011 from child controls by using an event table, with identifiers or identifier ranges to identify
1012 the control(s) in question.
1014 \wxheading{See also
}
1016 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1017 \helpref{Event handling overview
}{eventhandlingoverview
}
1019 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
1021 \func{virtual bool
}{OnClose
}{\void}
1023 Called when the user has tried to close a a frame
1024 or dialog box using the window manager (X) or system menu (Windows).
1026 {\bf Note:
} This is an obsolete function.
1027 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
1030 \wxheading{Return value
}
1032 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
1033 attempt will be ignored. Do not delete the window from within this handler, although
1034 you may delete other windows.
1036 \wxheading{See also
}
1038 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1039 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1040 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
1041 \helpref{wxCloseEvent
}{wxcloseevent
}
1043 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
1045 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
1047 This is an event handler function called when the user has tried to close a a frame
1048 or dialog box using the window manager (X) or system menu (Windows). It is
1049 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
1050 that the application can also invoke the handler programmatically.
1052 Use the EVT
\_CLOSE event table macro to handle close events.
1054 You should check whether the application is forcing the deletion of the window
1055 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
1056 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
1057 If not, it is up to you whether you respond by destroying the window.
1059 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
1060 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
1061 it is not possible to skip window deletion.)
1063 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
1064 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
1065 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
1069 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
1070 for backward compatibility with earlier versions of wxWindows. The
1071 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
1072 destroying the window if it returns TRUE or if the close is being forced.
1074 \wxheading{See also
}
1076 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1077 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1078 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
1079 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
1080 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
1081 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
1082 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
1084 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
1086 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
1088 Called when files have been dragged from the file manager to the window.
1090 \wxheading{Parameters
}
1092 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
1096 The window must have previously been enabled for dropping by calling
1097 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
1099 This event is only generated under Windows.
1101 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
1103 \wxheading{See also
}
1105 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
1106 \helpref{Event handling overview
}{eventhandlingoverview
}
1108 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
1110 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
1112 Called when the background of the window needs to be erased.
1114 \wxheading{Parameters
}
1116 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
1120 This event is only generated under Windows. It is therefore recommended that
1121 you set the text background colour explicitly in order to prevent flicker.
1122 The default background colour under GTK is grey.
1124 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
1126 \wxheading{See also
}
1128 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
1130 \membersection{wxWindow::OnKeyDown
}\label{wxwindowonkeydown
}
1132 \func{void
}{OnKeyDown
}{\param{wxKeyEvent\&
}{ event
}}
1134 Called when the user has pressed a key, before it is translated into an ASCII value using other
1135 modifier keys that might be pressed at the same time.
1137 \wxheading{Parameters
}
1139 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1140 details about this class.
}
1144 This member function is called in response to a key down event. To intercept this event,
1145 use the EVT
\_KEY\_DOWN macro in an event table definition. Your
{\bf OnKeyDown
} handler may call this
1146 default function to achieve default keypress functionality.
1148 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1149 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1150 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1152 Most, but not all, windows allow keypresses to be intercepted.
1154 \wxheading{See also
}
1156 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
1157 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1158 \helpref{Event handling overview
}{eventhandlingoverview
}
1160 \membersection{wxWindow::OnKeyUp
}\label{wxwindowonkeyup
}
1162 \func{void
}{OnKeyUp
}{\param{wxKeyEvent\&
}{ event
}}
1164 Called when the user has released a key.
1166 \wxheading{Parameters
}
1168 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1169 details about this class.
}
1173 This member function is called in response to a key up event. To intercept this event,
1174 use the EVT
\_KEY\_UP macro in an event table definition. Your
{\bf OnKeyUp
} handler may call this
1175 default function to achieve default keypress functionality.
1177 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1178 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1179 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1181 Most, but not all, windows allow key up events to be intercepted.
1183 \wxheading{See also
}
1185 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\rtfsp
1186 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1187 \helpref{Event handling overview
}{eventhandlingoverview
}
1189 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
1191 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
1193 Called when a window's focus is being killed.
1195 \wxheading{Parameters
}
1197 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1201 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
1203 Most, but not all, windows respond to this event.
1205 \wxheading{See also
}
1207 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
1208 \helpref{Event handling overview
}{eventhandlingoverview
}
1210 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
1212 \func{void
}{OnIdle
}{\param{wxIdleEvent\&
}{event
}}
1214 Provide this member function for any processing which needs to be done
1215 when the application is idle.
1217 \wxheading{See also
}
1219 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
1221 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
1223 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
1225 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1227 \wxheading{Parameters
}
1229 \docparam{event
}{Dialog initialisation event.
}
1233 Gives the window the default behaviour of transferring data to child controls via
1234 the validator that each control has.
1236 \wxheading{See also
}
1238 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1240 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1242 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1244 Called when a menu command is received from a menu bar.
1246 \wxheading{Parameters
}
1248 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1252 A function with this name doesn't actually exist; you can choose any member function to receive
1253 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1254 a range of commands.
1256 \wxheading{See also
}
1258 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1259 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1260 \helpref{Event handling overview
}{eventhandlingoverview
}
1262 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1264 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1266 Called when a menu select is received from a menu bar: that is, the
1267 mouse cursor is over a menu item, but the left mouse button has not been
1270 \wxheading{Parameters
}
1272 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1276 You can choose any member function to receive
1277 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1280 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1281 text in the first field of the status bar.
1283 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1284 since a selection is normally a left-click action.
1286 \wxheading{See also
}
1288 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1289 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1290 \helpref{Event handling overview
}{eventhandlingoverview
}
1293 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1295 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1297 Called when the user has initiated an event with the
1300 \wxheading{Parameters
}
1302 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1307 Most, but not all, windows respond to this event.
1309 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1310 mouse event macros such as EVT
\_LEFT\_DOWN.
1312 \wxheading{See also
}
1314 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1315 \helpref{Event handling overview
}{eventhandlingoverview
}
1317 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1319 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1321 Called when a window is moved.
1323 \wxheading{Parameters
}
1325 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1329 Use the EVT
\_MOVE macro to intercept move events.
1333 Not currently implemented.
1335 \wxheading{See also
}
1337 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1338 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1339 \helpref{Event handling overview
}{eventhandlingoverview
}
1341 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1343 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1345 Sent to the event handler when the window must be refreshed.
1347 \wxheading{Parameters
}
1349 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1353 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1355 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1361 void MyWindow::OnPaint(wxPaintEvent& event)
1370 You can optimize painting by retrieving the rectangles
1371 that have been damaged and only repainting these. The rectangles are in
1372 terms of the client area, and are unscrolled, so you will need to do
1373 some calculations using the current view position to obtain logical,
1376 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
1380 // Called when window needs to be repainted.
1381 void MyWindow::OnPaint(wxPaintEvent& event)
1385 // Find Out where the window is scrolled to
1386 int vbX,vbY; // Top left corner of client
1387 ViewStart(&vbX,&vbY);
1389 int vX,vY,vW,vH; // Dimensions of client area in pixels
1390 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1399 // Alternatively we can do this:
1401 // upd.GetRect(&rect);
1403 // Repaint this rectangle
1412 \wxheading{See also
}
1414 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1415 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1416 \helpref{Event handling overview
}{eventhandlingoverview
}
1418 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1420 \func{void
}{OnScroll
}{\param{wxScrollWinEvent\&
}{event
}}
1422 Called when a scroll window event is received from one of the window's built-in scrollbars.
1424 \wxheading{Parameters
}
1426 \docparam{event
}{Command event. Retrieve the new scroll position by
1427 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1428 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1432 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1433 until the function is executing (you can't have one function for vertical, another
1434 for horizontal events).
1436 \wxheading{See also
}
1438 \helpref{wxScrollWinEvent
}{wxscrollwinevent
},
\rtfsp
1439 \helpref{Event handling overview
}{eventhandlingoverview
}
1441 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1443 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1445 Called when a window's focus is being set.
1447 \wxheading{Parameters
}
1449 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1453 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1455 Most, but not all, windows respond to this event.
1457 \wxheading{See also
}
1459 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1460 \helpref{Event handling overview
}{eventhandlingoverview
}
1462 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1464 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1466 Called when the window has been resized.
1468 \wxheading{Parameters
}
1470 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1474 You may wish to use this for frames to resize their child windows as appropriate.
1476 Note that the size passed is of
1477 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1478 used by the application.
1480 \wxheading{See also
}
1482 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1483 \helpref{Event handling overview
}{eventhandlingoverview
}
1485 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1487 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1489 Called when the user has changed the system colours. Windows only.
1491 \wxheading{Parameters
}
1493 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1495 \wxheading{See also
}
1497 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1498 \helpref{Event handling overview
}{eventhandlingoverview
}
1500 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1502 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1504 Removes and returns the top-most event handler on the event handler stack.
1506 \wxheading{Parameters
}
1508 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1509 default value is FALSE.
}
1511 \wxheading{See also
}
1513 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1514 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1515 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1516 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1517 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1519 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1521 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{const wxPoint&
}{pos
}}
1523 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1525 Pops up the given menu at the specified coordinates, relative to this
1526 window, and returns control when the user has dismissed the menu. If a
1527 menu item is selected, the corresponding menu event is generated and will be
1528 processed as usually.
1530 \wxheading{Parameters
}
1532 \docparam{menu
}{Menu to pop up.
}
1534 \docparam{pos
}{The position where the menu will appear.
}
1536 \docparam{x
}{Required x position for the menu to appear.
}
1538 \docparam{y
}{Required y position for the menu to appear.
}
1540 \wxheading{See also
}
1542 \helpref{wxMenu
}{wxmenu
}
1546 Just before the menu is popped up,
\helpref{wxMenu::UpdateUI
}{wxmenuupdateui
} is called
1547 to ensure that the menu items are in the correct state. The menu does not get deleted
1550 \pythonnote{In place of a single overloaded method name, wxPython
1551 implements the following methods:
\par
1552 \indented{2cm
}{\begin{twocollist
}
1553 \twocolitem{\bf{PopupMenu(menu, point)
}}{Specifies position with a wxPoint
}
1554 \twocolitem{\bf{PopupMenuXY(menu, x, y)
}}{Specifies position with two integers (x, y)
}
1558 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1560 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1562 Pushes this event handler onto the event stack for the window.
1564 \wxheading{Parameters
}
1566 \docparam{handler
}{Specifies the handler to be pushed.
}
1570 An event handler is an object that is capable of processing the events
1571 sent to a window. By default, the window is its own event handler, but
1572 an application may wish to substitute another, for example to allow
1573 central implementation of event-handling for a variety of different
1576 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1577 an application to set up a chain of event handlers, where an event not handled by one event handler is
1578 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1579 remove the event handler.
1581 \wxheading{See also
}
1583 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1584 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1585 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1586 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1587 \helpref{wxEvtHandler
}{wxevthandler
}
1589 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1591 \func{void
}{Raise
}{\void}
1593 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1596 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1598 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1601 Causes a message or event to be generated to repaint the
1604 \wxheading{Parameters
}
1606 \docparam{eraseBackground
}{If TRUE, the background will be
1609 \docparam{rect
}{If non-NULL, only the given rectangle will
1610 be treated as damaged.
}
1612 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1614 \func{virtual void
}{ReleaseMouse
}{\void}
1616 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1618 \wxheading{See also
}
1620 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1622 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1624 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1626 Removes a child window. This is called automatically by window deletion
1627 functions so should not be required by the application programmer.
1629 \wxheading{Parameters
}
1631 \docparam{child
}{Child window to remove.
}
1633 \membersection{wxWindow::Reparent
}\label{wxwindowreparent
}
1635 \func{virtual bool
}{Reparent
}{\param{wxWindow*
}{newParent
}}
1637 Reparents the window, i.e the window will be removed from its
1638 current parent window (e.g. a non-standard toolbar in a wxFrame)
1639 and then re-inserted into another (e.g. a wxMiniFrame for a
1640 floating toolbar). Available on Windows and GTK+.
1642 \wxheading{Parameters
}
1644 \docparam{newParent
}{New parent.
}
1646 \membersection{wxWindow::ScreenToClient
}\label{wxwindowscreentoclient
}
1648 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1650 \constfunc{virtual wxPoint
}{ScreenToClient
}{\param{const wxPoint\&
}{pt
}}
1652 Converts from screen to client window coordinates.
1654 \wxheading{Parameters
}
1656 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1658 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1660 \docparam{pt
}{The screen position for the second form of the function.
}
1662 \pythonnote{In place of a single overloaded method name, wxPython
1663 implements the following methods:
\par
1664 \indented{2cm
}{\begin{twocollist
}
1665 \twocolitem{\bf{ScreenToClient(point)
}}{Accepts and returns a wxPoint
}
1666 \twocolitem{\bf{ScreenToClientXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
1671 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1673 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1675 Physically scrolls the pixels in the window and move child windows accordingly.
1677 \wxheading{Parameters
}
1679 \docparam{dx
}{Amount to scroll horizontally.
}
1681 \docparam{dy
}{Amount to scroll vertically.
}
1683 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1684 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1685 can optimise painting by checking for the invalidated region. This paramter is ignored under GTK,
1686 instead the regions to be invalidated are calculated automatically.
}
1690 Use this function to optimise your scrolling implementations, to minimise the area that must be
1691 redrawn. Note that it is rarely required to call this function from a user program.
1693 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1695 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1697 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1699 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1701 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1703 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1704 be called automatically when the window is resized. Use in connection with
1705 \helpref{wxWindow::SetSizer
}{wxwindowsetsizer
} and
1706 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
} for layouting subwindows.
1708 \wxheading{Parameters
}
1710 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1711 from within wxWindow::OnSize functions.
}
1715 Note that this function is actually disabled for wxWindow and only indirectly
1716 takes affect for children of wxDialog, wxFrame, wxNotebook and wxSplitterWindow.
1718 \wxheading{See also
}
1720 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1722 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1724 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1726 Sets the background colour of the window.
1728 \wxheading{Parameters
}
1730 \docparam{colour
}{The colour to be used as the background colour.
}
1734 The background colour is usually painted by the default
\rtfsp
1735 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function
1736 under Windows and automatically under GTK.
1738 Note that setting the background colour does not cause an immediate refresh, so you
1739 may wish to call
\helpref{wxWindow::Clear
}{wxwindowclear
} or
\helpref{wxWindow::Refresh
}{wxwindowrefresh
} after
1740 calling this function.
1742 Note that when using this functions under GTK, you will disable the so called "themes",
1743 i.e. the user chosen apperance of windows and controls, including the themes of
1744 their parent windows.
1746 \wxheading{See also
}
1748 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1749 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1750 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1751 \helpref{wxWindow::Clear
}{wxwindowclear
},
\rtfsp
1752 \helpref{wxWindow::Refresh
}{wxwindowrefresh
},
\rtfsp
1753 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1755 \membersection{wxWindow::SetClientSize
}\label{wxwindowsetclientsize
}
1757 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1759 \func{virtual void
}{SetClientSize
}{\param{const wxSize\&
}{ size
}}
1761 This sets the size of the window client area in pixels. Using this function to size a window
1762 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1763 worry about what dimensions the border or title bar have when trying to fit the window
1764 around panel items, for example.
1766 \wxheading{Parameters
}
1768 \docparam{width
}{The required client area width.
}
1770 \docparam{height
}{The required client area height.
}
1772 \docparam{size
}{The required client size.
}
1774 \pythonnote{In place of a single overloaded method name, wxPython
1775 implements the following methods:
\par
1776 \indented{2cm
}{\begin{twocollist
}
1777 \twocolitem{\bf{SetClientSize(size)
}}{Accepts a wxSize
}
1778 \twocolitem{\bf{SetClientSizeWH(width, height)
}}{}
1782 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1784 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1786 Sets the window's cursor. Notice that setting the cursor for this window does
1787 not set it for its children so you'll need to explicitly call SetCursor() for
1788 them too if you need it.
1790 \wxheading{Parameters
}
1792 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1794 \wxheading{See also
}
1796 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1798 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1800 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1802 Sets the event handler for this window.
1804 \wxheading{Parameters
}
1806 \docparam{handler
}{Specifies the handler to be set.
}
1810 An event handler is an object that is capable of processing the events
1811 sent to a window. By default, the window is its own event handler, but
1812 an application may wish to substitute another, for example to allow
1813 central implementation of event-handling for a variety of different
1816 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1817 this sets up a chain of event handlers, where an event not handled by one event handler is
1818 handed to the next one in the chain.
1820 \wxheading{See also
}
1822 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1823 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1824 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1825 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1826 \helpref{wxEvtHandler
}{wxevthandler
}
1828 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1830 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1832 Sets the window to have the given layout constraints. The window
1833 will then own the object, and will take care of its deletion.
1834 If an existing layout constraints object is already owned by the
1835 window, it will be deleted.
1837 \wxheading{Parameters
}
1839 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1844 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1845 the constraints automatically in OnSize; otherwise, you must override OnSize and call Layout()
1846 explicitly. When setting both a wxLayoutConstraints and a
\helpref{wxSizer
}{wxsizer
}, only the
1847 sizer will have effect.
1849 \membersection{wxWindow::SetDropTarget
}\label{wxwindowsetdroptarget
}
1851 \func{void
}{SetDropTarget
}{\param{wxDropTarget*
}{ target
}}
1853 Associates a drop target with this window.
1855 If the window already has a drop target, it is deleted.
1857 \wxheading{See also
}
1859 \helpref{wxWindow::GetDropTarget
}{wxwindowgetdroptarget
},
1860 \helpref{Drag and drop overview
}{wxdndoverview
}
1862 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1864 \func{virtual void
}{SetFocus
}{\void}
1866 This sets the window to receive keyboard input.
1868 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1870 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1872 Sets the font for this window.
1874 \wxheading{Parameters
}
1876 \docparam{font
}{Font to associate with this window.
}
1878 \wxheading{See also
}
1880 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1882 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1884 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1886 Sets the foreground colour of the window.
1888 \wxheading{Parameters
}
1890 \docparam{colour
}{The colour to be used as the foreground colour.
}
1894 The interpretation of foreground colour is open to interpretation according
1895 to the window class; it may be the text colour or other colour, or it may not
1898 Note that when using this functions under GTK, you will disable the so called "themes",
1899 i.e. the user chosen apperance of windows and controls, including the themes of
1900 their parent windows.
1902 \wxheading{See also
}
1904 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1905 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1906 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1908 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1910 \func{void
}{SetId
}{\param{int
}{ id
}}
1912 Sets the identifier of the window.
1916 Each window has an integer identifier. If the application has not provided one,
1917 an identifier will be generated. Normally, the identifier should be provided
1918 on creation and should not be modified subsequently.
1920 \wxheading{See also
}
1922 \helpref{wxWindow::GetId
}{wxwindowgetid
},
\rtfsp
1923 \helpref{Window identifiers
}{windowids
}
1925 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1927 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1929 Sets the window's name.
1931 \wxheading{Parameters
}
1933 \docparam{name
}{A name to set for the window.
}
1935 \wxheading{See also
}
1937 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1939 \membersection{wxWindow::SetPalette
}\label{wxwindowsetpalette
}
1941 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1943 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1945 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1947 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1948 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1949 \param{const bool
}{refresh = TRUE
}}
1951 Sets the scrollbar properties of a built-in scrollbar.
1953 \wxheading{Parameters
}
1955 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1957 \docparam{position
}{The position of the scrollbar in scroll units.
}
1959 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1961 \docparam{range
}{The maximum position of the scrollbar.
}
1963 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1967 Let's say you wish to display
50 lines of text, using the same font.
1968 The window is sized so that you can only see
16 lines at a time.
1974 SetScrollbar(wxVERTICAL,
0,
16,
50);
1978 Note that with the window at this size, the thumb position can never go
1979 above
50 minus
16, or
34.
1981 You can determine how many lines are currently visible by dividing the current view
1982 size by the character height in pixels.
1984 When defining your own scrollbar behaviour, you will always need to recalculate
1985 the scrollbar settings when the window size changes. You could therefore put your
1986 scrollbar calculations and SetScrollbar
1987 call into a function named AdjustScrollbars, which can be called initially and also
1988 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1990 \wxheading{See also
}
1992 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1993 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1996 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1998 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
2000 Sets the page size of one of the built-in scrollbars.
2002 \wxheading{Parameters
}
2004 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2006 \docparam{pageSize
}{Page size in scroll units.
}
2008 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2012 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
2013 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
2014 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
2015 value has to be adjusted when the window is resized, since the page size will have changed.
2017 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
2018 the thumb changes size to reflect the page size relative to the length of the
document. When the
2019 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
2020 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
2023 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
2024 handling of pages and ranges.
2026 \wxheading{See also
}
2028 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2029 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2030 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2031 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2034 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
2036 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
2038 Sets the position of one of the built-in scrollbars.
2040 \wxheading{Parameters
}
2042 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2044 \docparam{pos
}{Position in scroll units.
}
2046 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2050 This function does not directly affect the contents of the window: it is up to the
2051 application to take note of scrollbar attributes and redraw contents accordingly.
2053 \wxheading{See also
}
2055 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
2056 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2057 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
2058 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2061 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
2063 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
2065 Sets the range of one of the built-in scrollbars.
2067 \wxheading{Parameters
}
2069 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2071 \docparam{range
}{Scroll range.
}
2073 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2077 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
2078 object length of the scrollbar. If you are implementing a scrolling window, for example, you
2079 would adjust the scroll range when the window is resized, by subtracting the window view size from the
2080 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
2081 and usually the scrollbar will be automatically hidden.
2083 \wxheading{See also
}
2085 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2086 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2087 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2088 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2089 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2092 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
2094 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
2095 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
2097 \func{virtual void
}{SetSize
}{\param{const wxRect\&
}{ rect
}}
2099 Sets the size and position of the window in pixels.
2101 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
2103 \func{virtual void
}{SetSize
}{\param{const wxSize\&
}{ size
}}
2105 Sets the size of the window in pixels.
2107 \wxheading{Parameters
}
2109 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
2110 value should be used.
}
2112 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
2113 value should be used.
}
2115 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
2116 value should be used.
}
2118 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
2119 value should be used.
}
2121 \docparam{size
}{\helpref{wxSize
}{wxsize
} object for setting the size.
}
2123 \docparam{rect
}{\helpref{wxRect
}{wxrect
} object for setting the position and size.
}
2125 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
2127 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
2128 a wxWindows-supplied default width.\\
2129 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
2130 a wxWindows-supplied default width.\\
2131 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
2132 a wxWindows-supplied default size.\\
2133 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
2134 if -
1 values are supplied.\\
2135 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
2136 as real dimensions, not default values.
2141 The second form is a convenience for calling the first form with default
2142 x and y parameters, and must be used with non-default width and height values.
2144 The first form sets the position and optionally size, of the window.
2145 Parameters may be -
1 to indicate either that a default should be supplied
2146 by wxWindows, or that the current value of the dimension should be used.
2148 \wxheading{See also
}
2150 \helpref{wxWindow::Move
}{wxwindowmove
}
2152 \pythonnote{In place of a single overloaded method name, wxPython
2153 implements the following methods:
\par
2154 \indented{2cm
}{\begin{twocollist
}
2155 \twocolitem{\bf{SetDimensions(x, y, width, height, sizeFlags=wxSIZE_AUTO)
}}{}
2156 \twocolitem{\bf{SetSize(size)
}}{}
2157 \twocolitem{\bf{SetPosition(point)
}}{}
2161 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
2163 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
2164 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
2166 Allows specification of minimum and maximum window sizes, and window size increments.
2167 If a pair of values is not set (or set to -
1), the default values will be used.
2169 \wxheading{Parameters
}
2171 \docparam{minW
}{Specifies the minimum width allowable.
}
2173 \docparam{minH
}{Specifies the minimum height allowable.
}
2175 \docparam{maxW
}{Specifies the maximum width allowable.
}
2177 \docparam{maxH
}{Specifies the maximum height allowable.
}
2179 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
2181 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
2185 If this function is called, the user will not be able to size the window outside the
2188 The resizing increments are only significant under Motif or Xt.
2190 \membersection{wxWindow::SetSizer
}\label{wxwindowsetsizer
}
2192 \func{void
}{SetSizer
}{\param{wxSizer*
}{sizer
}}
2194 Sets the window to have the given layout sizer. The window
2195 will then own the object, and will take care of its deletion.
2196 If an existing layout constraints object is already owned by the
2197 window, it will be deleted.
2199 \wxheading{Parameters
}
2201 \docparam{sizer
}{The sizer to set. Pass NULL to disassociate and delete the window's
2206 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
2207 the sizer automatically in OnSize; otherwise, you must override OnSize and call Layout()
2208 explicitly. When setting both a wxSizer and a
\helpref{wxLayoutConstraints
}{wxlayoutconstraints
},
2209 only the sizer will have effect.
2211 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
2213 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
2215 Sets the window's title. Applicable only to frames and dialogs.
2217 \wxheading{Parameters
}
2219 \docparam{title
}{The window's title.
}
2221 \wxheading{See also
}
2223 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
2225 \membersection{wxWindow::SetValidator
}\label{wxwindowsetvalidator
}
2227 \func{virtual void
}{SetValidator
}{\param{const wxValidator\&
}{ validator
}}
2229 Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to
2230 create a new validator of this type.
2232 \membersection{wxWindow::Show
}\label{wxwindowshow
}
2234 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
2236 Shows or hides the window.
2238 \wxheading{Parameters
}
2240 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
2243 \wxheading{See also
}
2245 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
2247 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
2249 \func{virtual bool
}{TransferDataFromWindow
}{\void}
2251 Transfers values from child controls to data areas specified by their validators. Returns
2252 FALSE if a transfer failed.
2254 \wxheading{See also
}
2256 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
2257 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2259 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
2261 \func{virtual bool
}{TransferDataToWindow
}{\void}
2263 Transfers values to child controls from data areas specified by their validators.
2265 \wxheading{Return value
}
2267 Returns FALSE if a transfer failed.
2269 \wxheading{See also
}
2271 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2272 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2274 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
2276 \func{virtual bool
}{Validate
}{\void}
2278 Validates the current values of the child controls using their validators.
2280 \wxheading{Return value
}
2282 Returns FALSE if any of the validations failed.
2284 \wxheading{See also
}
2286 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2287 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2288 \helpref{wxValidator
}{wxvalidator
}
2290 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
2292 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
2294 Moves the pointer to the given position on the window.
2296 \wxheading{Parameters
}
2298 \docparam{x
}{The new x position for the cursor.
}
2300 \docparam{y
}{The new y position for the cursor.
}