#include <wx/window.h>

Please note that all children of the window will be deleted automatically by the destructor before the window itself is deleted which means that you don't have to worry about deleting them manually. Please see the window deletion overview for more information.
Also note that in this, and many others, wxWidgets classes some GetXXX() methods may be overloaded (as, for example, wxWindow::GetSize or wxWindow::GetClientSize). In this case, the overloads are non-virtual because having multiple virtual functions with the same name results in a virtual function name hiding at the derived class level (in English, this means that the derived class has to override all overloaded variants if it overrides any of them). To allow overriding them in the derived class, wxWidgets uses a unique protected virtual DoGetXXX() method and all GetXXX() ones are forwarded to it, so overriding the former changes the behaviour of the latter.
Styles:
Public Member Functions | |
| wxWindow () | |
| wxWindow (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr) | |
| virtual | ~wxWindow () |
| virtual bool | AcceptsFocus () const |
| virtual bool | AcceptsFocusFromKeyboard () const |
| virtual bool | AcceptsFocusRecursively () const |
| virtual void | AddChild (wxWindow *child) |
| virtual void | AlwaysShowScrollbars (bool hflag=true, bool vflag=true) |
| void | CacheBestSize (const wxSize &size) const |
| virtual bool | CanSetTransparent () |
| void | CaptureMouse () |
| void | Center (int dir=wxBOTH) |
| void | CenterOnParent (int dir=wxBOTH) |
| void | Centre (int direction=wxBOTH) |
| void | CentreOnParent (int direction=wxBOTH) |
| virtual void | ClearBackground () |
| void | ClientToScreen (int *x, int *y) const |
| wxPoint | ClientToScreen (const wxPoint &pt) const |
| virtual wxSize | ClientToWindowSize (const wxSize &size) const |
| virtual wxSize | WindowToClientSize (const wxSize &size) const |
| bool | Close (bool force=false) |
| virtual bool | Destroy () |
| bool | DestroyChildren () |
| bool | IsBeingDeleted () const |
| bool | Disable () |
| virtual void | DoUpdateWindowUI (wxUpdateUIEvent &event) |
| virtual void | DragAcceptFiles (bool accept) |
| virtual bool | Enable (bool enable=true) |
| wxWindow * | FindWindow (long id) const |
| wxWindow * | FindWindow (const wxString &name) const |
| virtual void | Fit () |
| virtual void | FitInside () |
| void | Freeze () |
| wxAcceleratorTable * | GetAcceleratorTable () |
| wxAccessible * | GetAccessible () |
| wxSize | GetAdjustedBestSize () const |
| wxColour | GetBackgroundColour () const |
| virtual wxBackgroundStyle | GetBackgroundStyle () const |
| wxSize | GetBestSize () const |
| wxCaret * | GetCaret () const |
| virtual int | GetCharHeight () const |
| virtual int | GetCharWidth () const |
| wxLayoutConstraints * | GetConstraints () const |
| wxSizer * | GetContainingSizer () const |
| const wxCursor & | GetCursor () const |
| virtual wxVisualAttributes | GetDefaultAttributes () const |
| virtual wxDropTarget * | GetDropTarget () const |
| wxSize | GetEffectiveMinSize () const |
| wxEvtHandler * | GetEventHandler () const |
| long | GetExtraStyle () const |
| wxFont | GetFont () const |
| wxColour | GetForegroundColour () const |
| wxWindow * | GetGrandParent () const |
| virtual WXWidget | GetHandle () const |
| wxString | GetHelpText () const |
| virtual wxString | GetHelpTextAtPoint (const wxPoint point, wxHelpEvent::Origin origin) const |
| wxWindowID | GetId () const |
| virtual wxString | GetLabel () const |
| virtual wxSize | GetMaxClientSize () const |
| virtual wxSize | GetMaxSize () const |
| virtual wxSize | GetMinClientSize () const |
| virtual wxSize | GetMinSize () const |
| virtual wxString | GetName () const |
| wxWindow * | GetNextSibling () const |
| wxWindow * | GetParent () const |
| int | GetPopupMenuSelectionFromUser (wxMenu &menu, const wxPoint &pos) |
| int | GetPopupMenuSelectionFromUser (wxMenu &menu, int x, int y) |
| void | GetPosition (int *x, int *y) const |
| wxPoint | GetPosition () const |
| wxWindow * | GetPrevSibling () const |
| wxRect | GetRect () const |
| void | GetScreenPosition (int *x, int *y) const |
| wxPoint | GetScreenPosition () const |
| wxRect | GetScreenRect () const |
| virtual int | GetScrollPos (int orientation) const |
| virtual int | GetScrollRange (int orientation) const |
| virtual int | GetScrollThumb (int orientation) const |
| void | GetSize (int *width, int *height) const |
| wxSize | GetSize () const |
| wxSizer * | GetSizer () const |
| virtual void | GetTextExtent (const wxString &string, int *w, int *h, int *descent=NULL, int *externalLeading=NULL, const wxFont *font=NULL) const |
| wxSize | GetTextExtent (const wxString &string) const |
| wxToolTip * | GetToolTip () const |
| const wxRegion & | GetUpdateRegion () const |
| virtual wxValidator * | GetValidator () |
| virtual wxSize | GetWindowBorderSize () const |
| virtual long | GetWindowStyleFlag () const |
| wxWindowVariant | GetWindowVariant () const |
| bool | HandleAsNavigationKey (const wxKeyEvent &event) |
| bool | HandleWindowEvent (wxEvent &event) const |
| virtual bool | HasCapture () const |
| bool | HasExtraStyle (int exFlag) const |
| bool | HasFlag (int flag) const |
| virtual bool | HasFocus () const |
| virtual bool | HasMultiplePages () const |
| bool | HasScrollbar (int orient) const |
| virtual bool | HasTransparentBackground () |
| bool | Hide () |
| virtual bool | HideWithEffect (wxShowEffect effect, unsigned int timeout=0) |
| virtual void | InheritAttributes () |
| virtual void | InitDialog () |
| void | InvalidateBestSize () |
| virtual bool | IsDoubleBuffered () const |
| bool | IsEnabled () const |
| bool | IsFrozen () const |
| virtual bool | IsRetained () const |
| virtual bool | IsScrollbarAlwaysShown (int orient) const |
| virtual bool | IsShown () const |
| virtual bool | IsShownOnScreen () const |
| bool | IsThisEnabled () const |
| virtual bool | IsTopLevel () const |
| virtual bool | Layout () |
| virtual void | Lower () |
| virtual void | MakeModal (bool modal=true) |
| void | Move (int x, int y, int flags=wxSIZE_USE_EXISTING) |
| void | Move (const wxPoint &pt, int flags=wxSIZE_USE_EXISTING) |
| void | MoveAfterInTabOrder (wxWindow *win) |
| void | MoveBeforeInTabOrder (wxWindow *win) |
| bool | Navigate (int flags=IsForward) |
| bool | NavigateIn (int flags=IsForward) |
| virtual void | OnInternalIdle () |
| bool | LineUp () |
| bool | LineDown () |
| bool | PageUp () |
| bool | PageDown () |
| wxEvtHandler * | PopEventHandler (bool deleteHandler=false) |
| void | PostSizeEvent () |
| void | PostSizeEventToParent () |
| void | PushEventHandler (wxEvtHandler *handler) |
| virtual void | Raise () |
| virtual void | Refresh (bool eraseBackground=true, const wxRect *rect=NULL) |
| void | RefreshRect (const wxRect &rect, bool eraseBackground=true) |
| bool | RegisterHotKey (int hotkeyId, int modifiers, int virtualKeyCode) |
| void | ReleaseMouse () |
| virtual void | RemoveChild (wxWindow *child) |
| bool | RemoveEventHandler (wxEvtHandler *handler) |
| virtual bool | Reparent (wxWindow *newParent) |
| virtual void | ScreenToClient (int *x, int *y) const |
| virtual wxPoint | ScreenToClient (const wxPoint &pt) const |
| virtual bool | ScrollLines (int lines) |
| virtual bool | ScrollPages (int pages) |
| virtual void | ScrollWindow (int dx, int dy, const wxRect *rect=NULL) |
| virtual void | SendSizeEvent (int flags=0) |
| void | SendSizeEventToParent (int flags=0) |
| virtual void | SetAcceleratorTable (const wxAcceleratorTable &accel) |
| void | SetAccessible (wxAccessible *accessible) |
| void | SetAutoLayout (bool autoLayout) |
| virtual bool | SetBackgroundColour (const wxColour &colour) |
| virtual bool | SetBackgroundStyle (wxBackgroundStyle style) |
| virtual void | SetCanFocus (bool canFocus) |
| void | SetCaret (wxCaret *caret) |
| void | SetConstraints (wxLayoutConstraints *constraints) |
| void | SetContainingSizer (wxSizer *sizer) |
| virtual bool | SetCursor (const wxCursor &cursor) |
| virtual void | SetDropTarget (wxDropTarget *target) |
| void | SetEventHandler (wxEvtHandler *handler) |
| virtual void | SetExtraStyle (long exStyle) |
| virtual void | SetFocus () |
| virtual void | SetFocusFromKbd () |
| virtual bool | SetFont (const wxFont &font) |
| virtual bool | SetForegroundColour (const wxColour &colour) |
| void | SetHelpText (const wxString &helpText) |
| void | SetId (wxWindowID winid) |
| void | SetInitialSize (const wxSize &size=wxDefaultSize) |
| virtual void | SetLabel (const wxString &label) |
| virtual void | SetMaxClientSize (const wxSize &size) |
| virtual void | SetMaxSize (const wxSize &size) |
| virtual void | SetMinClientSize (const wxSize &size) |
| virtual void | SetMinSize (const wxSize &size) |
| virtual void | SetName (const wxString &name) |
| void | SetOwnBackgroundColour (const wxColour &colour) |
| void | SetOwnFont (const wxFont &font) |
| void | SetOwnForegroundColour (const wxColour &colour) |
| void | SetPalette (const wxPalette &pal) |
| virtual void | SetScrollPos (int orientation, int pos, bool refresh=true) |
| virtual void | SetScrollbar (int orientation, int position, int thumbSize, int range, bool refresh=true) |
| void | SetSize (int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO) |
| void | SetSizer (wxSizer *sizer, bool deleteOld=true) |
| void | SetSizerAndFit (wxSizer *sizer, bool deleteOld=true) |
| virtual void | SetThemeEnabled (bool enable) |
| virtual bool | SetTransparent (wxByte alpha) |
| virtual void | SetValidator (const wxValidator &validator) |
| void | SetWindowStyle (long style) |
| virtual void | SetWindowStyleFlag (long style) |
| void | SetWindowVariant (wxWindowVariant variant) |
| virtual bool | ShouldInheritColours () const |
| virtual bool | Show (bool show=true) |
| virtual bool | ShowWithEffect (wxShowEffect effect, unsigned int timeout=0) |
| void | Thaw () |
| bool | ToggleWindowStyle (int flag) |
| virtual bool | TransferDataFromWindow () |
| virtual bool | TransferDataToWindow () |
| bool | UnregisterHotKey (int hotkeyId) |
| void | UnsetToolTip () |
| virtual void | Update () |
| virtual void | UpdateWindowUI (long flags=wxUPDATE_UI_NONE) |
| virtual bool | Validate () |
| virtual void | WarpPointer (int x, int y) |
| wxPoint | ConvertDialogToPixels (const wxPoint &pt) |
| wxSize | ConvertDialogToPixels (const wxSize &sz) |
| wxPoint | ConvertPixelsToDialog (const wxPoint &pt) |
| wxSize | ConvertPixelsToDialog (const wxSize &sz) |
| wxWindowList & | GetChildren () |
| const wxWindowList & | GetChildren () const |
| void | GetClientSize (int *width, int *height) const |
| wxSize | GetClientSize () const |
| wxSize | GetVirtualSize () const |
| void | GetVirtualSize (int *width, int *height) const |
| bool | IsExposed (int x, int y) const |
| const bool | IsExposed (wxPoint amp;pt) const |
| const bool | IsExposed (int x, int y, int w, int h) const |
| const bool | IsExposed (wxRect amp;rect) const |
| bool | PopupMenu (wxMenu *menu, const wxPoint &pos=wxDefaultPosition) |
| bool | PopupMenu (wxMenu *menu, int x, int y) |
| virtual void | SetClientSize (int width, int height) |
| virtual void | SetClientSize (const wxSize &size) |
| virtual void | SetSize (const wxRect &rect) |
| virtual void | SetSize (const wxSize &size) |
| virtual void | SetSize (int width, int height) |
| void | SetToolTip (const wxString &tip) |
| void | SetToolTip (wxToolTip *tip) |
| void | SetVirtualSize (int width, int height) |
| void | SetVirtualSize (const wxSize &size) |
Static Public Member Functions | |
| static wxWindow * | FindFocus () |
| static wxWindow * | FindWindowById (long id, wxWindow *parent=NULL) |
| static wxWindow * | FindWindowByLabel (const wxString &label, wxWindow *parent=NULL) |
| static wxWindow * | FindWindowByName (const wxString &name, wxWindow *parent=NULL) |
| static wxWindow * | GetCapture () |
| static wxVisualAttributes | GetClassDefaultAttributes (wxWindowVariant variant=wxWINDOW_VARIANT_NORMAL) |
| static wxWindowID | NewControlId (int count=1) |
| static void | UnreserveControlId (wxWindowID id, int count=1) |
Protected Member Functions | |
| virtual wxSize | DoGetBestSize () const |
| virtual void | SetInitialBestSize (const wxSize &size) |
| wxWindow::wxWindow | ( | ) |
Default constructor
| wxWindow::wxWindow | ( | wxWindow * | parent, | |
| wxWindowID | id, | |||
| const wxPoint & | pos = wxDefaultPosition, |
|||
| const wxSize & | size = wxDefaultSize, |
|||
| long | style = 0, |
|||
| const wxString & | name = wxPanelNameStr | |||
| ) |
Constructs a window, which can be a child of a frame, dialog or any other non-control window.
| parent | Pointer to a parent window. | |
| id | Window identifier. If wxID_ANY, will automatically create an identifier. | |
| pos | Window position. wxDefaultPosition indicates that wxWidgets should generate a default position for the window. If using the wxWindow class directly, supply an actual position. | |
| size | Window size. wxDefaultSize indicates that wxWidgets should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized. | |
| style | Window style. For generic window styles, please see wxWindow. | |
| name | Window name. |
| virtual wxWindow::~wxWindow | ( | ) | [virtual] |
Destructor.
Deletes all sub-windows, then deletes itself. Instead of using the delete operator explicitly, you should normally use Destroy() so that wxWidgets can delete a window only when it is safe to do so, in idle time.
| virtual bool wxWindow::AcceptsFocus | ( | ) | const [virtual] |
This method may be overridden in the derived classes to return false to indicate that this control doesn't accept input at all (i.e. behaves like e.g. wxStaticText) and so doesn't need focus.
Reimplemented in wxPanel.
| virtual bool wxWindow::AcceptsFocusFromKeyboard | ( | ) | const [virtual] |
This method may be overridden in the derived classes to return false to indicate that while this control can, in principle, have focus if the user clicks it with the mouse, it shouldn't be included in the TAB traversal chain when using the keyboard.
| virtual bool wxWindow::AcceptsFocusRecursively | ( | ) | const [virtual] |
Overridden to indicate wehter this window or one of its children accepts focus. Usually it's the same as AcceptsFocus() but is overridden for container windows.
| virtual void wxWindow::AddChild | ( | wxWindow * | child | ) | [virtual] |
Adds a child window. This is called automatically by window creation functions so should not be required by the application programmer. Notice that this function is mostly internal to wxWidgets and shouldn't be called by the user code.
| child | Child window to add. |
| virtual void wxWindow::AlwaysShowScrollbars | ( | bool | hflag = true, |
|
| bool | vflag = true | |||
| ) | [virtual] |
Call this function to force one or both scrollbars to be always shown, even if the window is big enough to show its entire contents without scrolling.
| hflag | Whether the horizontal scroll bar should always be visible. | |
| vflag | Whether the vertical scroll bar should always be visible. |
| void wxWindow::CacheBestSize | ( | const wxSize & | size | ) | const |
Sets the cached best size value.
| virtual bool wxWindow::CanSetTransparent | ( | ) | [virtual] |
Returns true if the system supports transparent windows and calling SetTransparent() may succeed. If this function returns false, transparent windows are definitely not supported by the current system.
Reimplemented in wxTopLevelWindow.
| void wxWindow::CaptureMouse | ( | ) |
Directs all mouse input to this window. Call ReleaseMouse() to release the capture.
Note that wxWidgets maintains the stack of windows having captured the mouse and when the mouse is released the capture returns to the window which had had captured it previously and it is only really released if there were no previous window. In particular, this means that you must release the mouse as many times as you capture it, unless the window receives the wxMouseCaptureLostEvent event.
Any application which captures the mouse in the beginning of some operation must handle wxMouseCaptureLostEvent and cancel this operation when it receives the event. The event handler must not recapture mouse.
| void wxWindow::Center | ( | int | dir = wxBOTH |
) |
A synonym for Centre().
| void wxWindow::CenterOnParent | ( | int | dir = wxBOTH |
) |
A synonym for CentreOnParent().
| void wxWindow::Centre | ( | int | direction = wxBOTH |
) |
Centres the window.
| direction | Specifies the direction for the centering. May be wxHORIZONTAL, wxVERTICAL or wxBOTH. It may also include wxCENTRE_ON_SCREEN flag if you want to center the window on the entire screen and not on its parent window. |
| void wxWindow::CentreOnParent | ( | int | direction = wxBOTH |
) |
Centres the window on its parent. This is a more readable synonym for Centre().
| direction | Specifies the direction for the centering. May be wxHORIZONTAL, wxVERTICAL or wxBOTH. |
| virtual void wxWindow::ClearBackground | ( | ) | [virtual] |
Clears the window by filling it with the current background colour. Does not cause an erase background event to be generated.
| void wxWindow::ClientToScreen | ( | int * | x, | |
| int * | y | |||
| ) | const |
Converts to screen coordinates from coordinates relative to this window.
| x | A pointer to a integer value for the x coordinate. Pass the client coordinate in, and a screen coordinate will be passed out. | |
| y | A pointer to a integer value for the y coordinate. Pass the client coordinate in, and a screen coordinate will be passed out. |
Converts to screen coordinates from coordinates relative to this window.
| pt | The client position for the second form of the function. |
Converts client area size size to corresponding window size.
In other words, the returned value is what would GetSize() return if this window had client area of given size. Components with wxDefaultCoord value are left unchanged. Note that the conversion is not always exact, it assumes that non-client area doesn't change and so doesn't take into account things like menu bar (un)wrapping or (dis)appearance of the scrollbars.
Converts window size size to corresponding client area size In other words, the returned value is what would GetClientSize() return if this window had given window size. Components with wxDefaultCoord value are left unchanged.
Note that the conversion is not always exact, it assumes that non-client area doesn't change and so doesn't take into account things like menu bar (un)wrapping or (dis)appearance of the scrollbars.
| bool wxWindow::Close | ( | bool | force = false |
) |
This function simply generates a wxCloseEvent whose handler usually tries to close the window. It doesn't close the window itself, however.
| force | false if the window's close handler should be able to veto the destruction of this window, true if it cannot. |
Converts a point or size from dialog units to pixels.
For the x dimension, the dialog units are multiplied by the average character width and then divided by 4. For the y dimension, the dialog units are multiplied by the average character height and then divided by 8.
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
Converts a point or size from dialog units to pixels.
For the x dimension, the dialog units are multiplied by the average character width and then divided by 4. For the y dimension, the dialog units are multiplied by the average character height and then divided by 8.
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
Converts a point or size from pixels to dialog units.
For the x dimension, the pixels are multiplied by 4 and then divided by the average character width. For the y dimension, the pixels are multiplied by 8 and then divided by the average character height.
Converts a point or size from pixels to dialog units.
For the x dimension, the pixels are multiplied by 4 and then divided by the average character width. For the y dimension, the pixels are multiplied by 8 and then divided by the average character height.
| virtual bool wxWindow::Destroy | ( | ) | [virtual] |
Destroys the window safely. Use this function instead of the delete operator, since different window classes can be destroyed differently. Frames and dialogs are not destroyed immediately when this function is called -- they are added to a list of windows to be deleted on idle time, when all the window's events have been processed. This prevents problems with events being sent to non-existent windows.
| bool wxWindow::DestroyChildren | ( | ) |
Destroys all children of a window. Called automatically by the destructor.
| bool wxWindow::IsBeingDeleted | ( | ) | const |
Returns true if this window is in process of being destroyed.
The top level windows are not deleted immediately but are rather scheduled for later destruction to give them time to process any pending messages, see Destroy() description.
This function returns true if this window, or one of its parent windows, is scheduled for destruction and can be useful to avoid manipulating it as it's usually useless to do something with a window which is on the point of disappearing anyhow.
| bool wxWindow::Disable | ( | ) |
Disables the window. Same as Enable() Enable(false).
| virtual void wxWindow::DoUpdateWindowUI | ( | wxUpdateUIEvent & | event | ) | [virtual] |
Does the window-specific updating after processing the update event. This function is called by UpdateWindowUI() in order to check return values in the wxUpdateUIEvent and act appropriately. For example, to allow frame and dialog title updating, wxWidgets implements this function as follows:
// do the window-specific processing after processing the update event void wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event) { if ( event.GetSetEnabled() ) Enable(event.GetEnabled()); if ( event.GetSetText() ) { if ( event.GetText() != GetTitle() ) SetTitle(event.GetText()); } }
| virtual void wxWindow::DragAcceptFiles | ( | bool | accept | ) | [virtual] |
Enables or disables eligibility for drop file events (OnDropFiles).
| accept | If true, the window is eligible for drop file events. If false, the window will not accept drop file events. |
| virtual bool wxWindow::Enable | ( | bool | enable = true |
) | [virtual] |
Enable or disable the window for user input. Note that when a parent window is disabled, all of its children are disabled as well and they are reenabled again when the parent is.
| enable | If true, enables the window for input. If false, disables the window. |
| static wxWindow* wxWindow::FindFocus | ( | ) | [static] |
Finds the window or control which currently has the keyboard focus.
| wxWindow* wxWindow::FindWindow | ( | long | id | ) | const |
Find a child of this window, by id. May return this if it matches itself.
Find a child of this window, by name. May return this if it matches itself.
Find the first window with the given id.
If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases.
| static wxWindow* wxWindow::FindWindowByLabel | ( | const wxString & | label, | |
| wxWindow * | parent = NULL | |||
| ) | [static] |
Find a window by its label.
Depending on the type of window, the label may be a window title or panel item label. If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases.
| static wxWindow* wxWindow::FindWindowByName | ( | const wxString & | name, | |
| wxWindow * | parent = NULL | |||
| ) | [static] |
Find a window by its name (as given in a window constructor or Create function call).
If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
The search is recursive in both cases. If no window with such name is found, FindWindowByLabel() is called.
| virtual void wxWindow::Fit |