X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/75504144d2ee5ce2bc62d186f04b2d445c2048c5..323d36e452c48f1e48ffe48312004d5e224634ca:/interface/wx/window.h diff --git a/interface/wx/window.h b/interface/wx/window.h index 0335e85abe..ac715f76f7 100644 --- a/interface/wx/window.h +++ b/interface/wx/window.h @@ -3,7 +3,7 @@ // Purpose: interface of wxWindow // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -235,8 +235,6 @@ enum wxWindowVariant 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)} @@ -1423,8 +1421,14 @@ public: //@{ /** - 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(); @@ -1627,6 +1631,8 @@ public: @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 @@ -1644,32 +1650,32 @@ public: @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(), @@ -1840,6 +1846,19 @@ public: */ 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. @@ -2099,6 +2118,12 @@ public: /** 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. @@ -2208,6 +2233,11 @@ public: 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. @@ -2345,6 +2375,10 @@ public: 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 @@ -2352,7 +2386,8 @@ public: @since 2.9.0 */ - int GetPopupMenuSelectionFromUser(wxMenu& menu, const wxPoint& pos); + int GetPopupMenuSelectionFromUser(wxMenu& menu, + const wxPoint& pos = wxDefaultPosition); /** @overload @@ -3147,6 +3182,8 @@ public: 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); @@ -3160,6 +3197,8 @@ public: 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); @@ -3176,6 +3215,8 @@ public: 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);