X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce7fe42e848cc0c9058dae906c3a7bded50681e6..9e9574fe45b176ee74bba8fad7574cf9906145d1:/interface/wx/event.h?ds=inline diff --git a/interface/wx/event.h b/interface/wx/event.h index f56d4b2435..618d95a8ab 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -3,7 +3,6 @@ // Purpose: interface of wxEvtHandler, wxEventBlocker and many // wxEvent-derived classes // Author: wxWidgets team -// RCS-ID: $Id$ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -525,7 +524,9 @@ public: @param x1 The (optional) first parameter to pass to the method. @param x2 The (optional) second parameter to pass to the method. - Note that currently only up to 2 arguments can be passed. + Note that currently only up to 2 arguments can be passed. For more + complicated needs, you can use the CallAfter(const T& fn) overload + that can call any functor. @note This method is not available with Visual C++ before version 8 (Visual Studio 2005) as earlier versions of the compiler don't @@ -536,6 +537,39 @@ public: template void CallAfter(void (T::*method)(T1, ...), T1 x1, ...); + /** + Asynchronously call the given functor. + + Calling this function on an object schedules an asynchronous call to + the functor specified as CallAfter() argument at a (slightly) later + time. This is useful when processing some events as certain actions + typically can't be performed inside their handlers, e.g. you shouldn't + show a modal dialog from a mouse click event handler as this would + break the mouse capture state -- but you can call a function showing + this message dialog after the current event handler completes. + + Notice that it is safe to use CallAfter() from other, non-GUI, + threads, but that the method will be always called in the main, GUI, + thread context. + + This overload is particularly useful in combination with C++11 lambdas: + @code + wxGetApp().CallAfter([]{ + wxBell(); + }); + @endcode + + @param functor The functor to call. + + @note This method is not available with Visual C++ before version 8 + (Visual Studio 2005) as earlier versions of the compiler don't + have the required support for C++ templates to implement it. + + @since 2.9.6 + */ + template + void CallAfter(const T& functor); + /** Processes an event, searching event tables and calling zero or more suitable event handler function(s). @@ -2725,10 +2759,26 @@ public: /** Returns the configured number of lines (or whatever) to be scrolled per - wheel action. Defaults to three. + wheel action. + + Default value under most platforms is three. + + @see GetColumnsPerAction() */ int GetLinesPerAction() const; + /** + Returns the configured number of columns (or whatever) to be scrolled per + wheel action. + + Default value under most platforms is three. + + @see GetLinesPerAction() + + @since 2.9.5 + */ + int GetColumnsPerAction() const; + /** Returns the logical mouse position in pixels (i.e.\ translated according to the translation set for the DC, which usually indicates that the window has been @@ -3420,7 +3470,7 @@ public: wxHelpEvent::Origin origin = Origin_Unknown); /** - Returns the origin of the help event which is one of the ::wxHelpEventOrigin + Returns the origin of the help event which is one of the wxHelpEvent::Origin values. The application may handle events generated using the keyboard or mouse @@ -3836,7 +3886,8 @@ public: /** Sets the flags for this event. - The @a flags can be a combination of the ::wxNavigationKeyEventFlags values. + The @a flags can be a combination of the + wxNavigationKeyEvent::wxNavigationKeyEventFlags values. */ void SetFlags(long flags);