// Purpose: interface of wxWindow
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
Process scroll events. See wxScrollWinEvent.
@event{EVT_SET_CURSOR(func)}
Process a @c wxEVT_SET_CURSOR event. See wxSetCursorEvent.
- @event{EVT_SHOW(func)}
- Process a @c wxEVT_SHOW event. See wxShowEvent.
@event{EVT_SIZE(func)}
Process a @c wxEVT_SIZE event. See wxSizeEvent.
@event{EVT_SYS_COLOUR_CHANGED(func)}
wxPanel), the size returned by this function will be the same as the size
the window would have had after calling Fit().
- Note that when you write your own widget you need to overload the
+ Note that when you write your own widget you need to override the
DoGetBestSize() function instead of this (non-virtual!) function.
@see CacheBestSize(), @ref overview_windowsizing
@see @ref overview_windowsizing
*/
- virtual void SetClientSize(int width, int height);
+ void SetClientSize(int width, int height);
/**
@overload
*/
- virtual void SetClientSize(const wxSize& size);
+ void SetClientSize(const wxSize& size);
/**
This normally does not need to be called by user code.
@see Move(), @ref overview_windowsizing
*/
- virtual void SetSize(const wxRect& rect);
+ void SetSize(const wxRect& rect);
/**
@overload
*/
- virtual void SetSize(const wxSize& size);
+ void SetSize(const wxSize& size);
/**
@overload
*/
- virtual void SetSize(int width, int height);
+ void SetSize(int width, int height);
/**
Use of this function for windows which are not toplevel windows
//@{
/**
- Clears the window by filling it with the current background colour. Does not
- cause an erase background event to be generated.
+ Clears the window by filling it with the current background colour.
+
+ Does not cause an erase background event to be generated.
+
+ Notice that this uses wxClientDC to draw on the window and the results
+ of doing it while also drawing on wxPaintDC for this window are
+ undefined. Hence this method shouldn't be used from EVT_PAINT handlers,
+ just use wxDC::Clear() on the wxPaintDC you already use there instead.
*/
virtual void ClearBackground();
@param colour
The colour to be used as the background colour; pass
wxNullColour to reset to the default colour.
+ Note that you may want to use wxSystemSettings::GetColour() to retrieve
+ a suitable colour to use rather than setting an hard-coded one.
@remarks The background colour is usually painted by the default
wxEraseEvent event handler function under Windows and
@see GetBackgroundColour(), SetForegroundColour(),
GetForegroundColour(), ClearBackground(),
- Refresh(), wxEraseEvent
+ Refresh(), wxEraseEvent, wxSystemSettings
*/
virtual bool SetBackgroundColour(const wxColour& colour);
/**
Sets the background style of the window.
- The default background style is wxBG_STYLE_ERASE which indicates that
- the window background may be erased in EVT_ERASE_BACKGROUND handler.
+ The default background style is @c wxBG_STYLE_ERASE which indicates that
+ the window background may be erased in @c EVT_ERASE_BACKGROUND handler.
This is a safe, compatibility default; however you may want to change it
- to wxBG_STYLE_SYSTEM if you don't define any erase background event
+ to @c wxBG_STYLE_SYSTEM if you don't define any erase background event
handlers at all, to avoid unnecessary generation of erase background
events and always let system erase the background. And you should
- change the background style to wxBG_STYLE_PAINT if you define an
- EVT_PAINT handler which completely overwrites the window background as
- in this case erasing it previously, either in EVT_ERASE_BACKGROUND
+ change the background style to @c wxBG_STYLE_PAINT if you define an
+ @c EVT_PAINT handler which completely overwrites the window background as
+ in this case erasing it previously, either in @c EVT_ERASE_BACKGROUND
handler or in the system default handler, would result in flicker as
the background pixels will be repainted twice every time the window is
redrawn. Do ensure that the background is entirely erased by your
- EVT_PAINT handler in this case however as otherwise garbage may be left
+ @c EVT_PAINT handler in this case however as otherwise garbage may be left
on screen.
Notice that in previous versions of wxWidgets a common way to work
around the above mentioned flickering problem was to define an empty
- EVT_ERASE_BACKGROUND handler. Setting background style to
- wxBG_STYLE_PAINT is a simpler and more efficient solution to the same
+ @c EVT_ERASE_BACKGROUND handler. Setting background style to
+ @c wxBG_STYLE_PAINT is a simpler and more efficient solution to the same
problem.
@see SetBackgroundColour(), GetForegroundColour(),
*/
bool ProcessWindowEvent(wxEvent& event);
+ /**
+ Wrapper for wxEvtHandler::ProcessEventLocally().
+
+ This method is similar to ProcessWindowEvent() but can be used to
+ search for the event handler only in this window and any event handlers
+ pushed on top of it. Unlike ProcessWindowEvent() it won't propagate the
+ event upwards. But it will use the validator and event handlers
+ associated with this window, if any.
+
+ @since 2.9.1
+ */
+ bool ProcessWindowEventLocally(wxEvent& event);
+
/**
Removes and returns the top-most event handler on the event handler stack.
/**
Raises the window to the top of the window hierarchy (Z-order).
+ Notice that this function only requests the window manager to raise
+ this window to the top of Z-order. Depending on its configuration, the
+ window manager may raise the window, not do it at all or indicate that
+ a window requested to be raised in some other way, e.g. by flashing its
+ icon if it is minimized.
+
@remarks
This function only works for wxTopLevelWindow-derived classes.
for a top level window if you want to bring it to top, although this is not
needed if Show() is called immediately after the frame creation.
+ Notice that the default state of newly created top level windows is hidden
+ (to allow you to create their contents without flicker) unlike for
+ all the other, not derived from wxTopLevelWindow, windows that
+ are by default created in the shown state.
+
@param show
If @true displays the window. Otherwise, hides it.
The parameter @a menu is the menu to show.
The parameter @a pos (or the parameters @a x and @a y) is the
position at which to show the menu in client coordinates.
+ It is recommended to not explicitly specify coordinates when
+ calling this method in response to mouse click, because some of
+ the ports (namely, wxGTK) can do a better job of positioning
+ the menu in that case.
@return
The selected menu item id or @c wxID_NONE if none selected or an
@since 2.9.0
*/
- int GetPopupMenuSelectionFromUser(wxMenu& menu, const wxPoint& pos);
+ int GetPopupMenuSelectionFromUser(wxMenu& menu,
+ const wxPoint& pos = wxDefaultPosition);
/**
@overload
The search is recursive in both cases.
@see FindWindow()
+
+ @return Window with the given @a id or @NULL if not found.
*/
static wxWindow* FindWindowById(long id, const wxWindow* parent = 0);
The search is recursive in both cases.
@see FindWindow()
+
+ @return Window with the given @a label or @NULL if not found.
*/
static wxWindow* FindWindowByLabel(const wxString& label,
const wxWindow* parent = 0);
FindWindowByLabel() is called.
@see FindWindow()
+
+ @return Window with the given @a name or @NULL if not found.
*/
static wxWindow* FindWindowByName(const wxString& name,
const wxWindow* parent = 0);