X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f06832c1b6caae13c0bddf8f3a8aeb1114f4392b..5b88a837ba75928cd3835a6b97ae2bf5ad983a6e:/interface/wx/utils.h?ds=inline diff --git a/interface/wx/utils.h b/interface/wx/utils.h index 2e49aaf7bd..534b610ea6 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -78,7 +78,7 @@ public: /** Constructs a busy cursor object, calling wxBeginBusyCursor(). */ - wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR); + wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR); /** Destroys the busy cursor object, calling wxEndBusyCursor(). @@ -88,92 +88,12 @@ public: -/** - @class wxMouseState - - Represents the mouse state. - - The methods of this class generally mirror the corresponding methods of - wxMouseEvent. - - This class is implemented entirely in @, meaning no extra - library needs to be linked to use this class. - - @category{misc} - - @see wxGetMouseState() - */ -class wxMouseState -{ -public: - /** - Default constructor. - */ - wxMouseState(); - - /** - Returns X coordinate of the physical mouse event position. - */ - wxCoord GetX() const; - /** - Returns Y coordinate of the physical mouse event position. - */ - wxCoord GetY() const; - /** - Returns the physical mouse position. - */ - wxPoint GetPosition() const; - - /** - Returns @true if the left mouse button changed to down. - */ - bool LeftDown() const; - /** - Returns @true if the middle mouse button changed to down. - */ - bool MiddleDown() const; - /** - Returns @true if the right mouse button changed to down. - */ - bool RightDown() const; - /** - Returns @true if the first extra button mouse button changed to down. - */ - bool Aux1Down() const; - /** - Returns @true if the second extra button mouse button changed to down. - */ - bool Aux2Down() const; - - /** - Returns @true if the control key is down. - */ - bool ControlDown() const; - /** - Returns @true if the shift key is down. - */ - bool ShiftDown() const; - /** - Returns @true if the alt key is down. - */ - bool AltDown() const; - /** - Returns @true if the meta key is down. - */ - bool MetaDown() const; - /** - Same as MetaDown() under Mac systems, ControlDown() for the others. - */ - bool CmdDown() const; -}; - - // ============================================================================ // Global functions/macros // ============================================================================ -/** @ingroup group_funcmacro_dialog */ +/** @addtogroup group_funcmacro_dialog */ //@{ /** @@ -234,7 +154,7 @@ void wxInfoMessageBox(wxWindow parent = NULL); -/** @ingroup group_funcmacro_env */ +/** @addtogroup group_funcmacro_env */ //@{ /** @@ -285,7 +205,7 @@ bool wxUnsetEnv(const wxString& var); -/** @ingroup group_funcmacro_misc */ +/** @addtogroup group_funcmacro_misc */ //@{ /** @@ -429,9 +349,11 @@ void wxRegisterId(long id); Returns @true if the application was successfully launched. + @see wxLaunchDefaultBrowser(), wxExecute() + @header{wx/utils.h} */ -bool wxLaunchDefaultApplication(const wxString& document, int flags = 0) +bool wxLaunchDefaultApplication(const wxString& document, int flags = 0); /** Opens the @a url in user's default browser. @@ -444,9 +366,15 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags = 0) a busy cursor is shown while the browser is being launched (using wxBusyCursor). - The @a url may also be a local file path (with or without the "file://" - prefix), if it doesn't correspond to an existing file and the URL has no - scheme "http://" is prepended to it by default. + The parameter @a url is interpreted as follows: + - if it has a valid scheme (e.g. @c "file:", @c "http:" or @c "mailto:") + it is passed to the appropriate browser configured in the user system. + - if it has no valid scheme (e.g. it's a local file path without the @c "file:" + prefix), then ::wxFileExists and ::wxDirExists are used to test if it's a + local file/directory; if it is, then the browser is called with the + @a url parameter eventually prefixed by @c "file:". + - if it has no valid scheme and it's not a local file/directory, then @c "http:" + is prepended and the browser is called. Returns @true if the application was successfully launched. @@ -455,6 +383,8 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags = 0) may be used for local URLs while another one may be used for remote URLs). + @see wxLaunchDefaultApplication(), wxExecute() + @header{wx/utils.h} */ bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); @@ -492,6 +422,27 @@ wxString wxLoadUserResource(const wxString& resourceName, */ void wxPostDelete(wxObject* object); + +/** + Compare function type for use with wxQsort() + + @header{wx/utils.h} +*/ +extern "C" +{ +typedef int (wxCMPFUNC_CONV *CMPFUNCDATA)(const void* pItem1, const void* pItem2, const void* user_data); +} + +/** + Function for performing a qsort operation including a user data + parameter. + + @header{wx/utils.h} +*/ +void wxQsort(void *const pbase, size_t total_elems, + size_t size, CMPFUNCDATA cmp, const void* user_data); + + /** Under X only, sets the current display name. This is the X host and display name such as "colonsay:0.0", and the function indicates which display @@ -510,7 +461,7 @@ void wxSetDisplayName(const wxString& displayName); By default, the functions strips both the mnemonics character (@c '&') which is used to indicate a keyboard shortkey, and the accelerators, which are used only in the menu items and are separated from the main text by the - @c \t (TAB) character. By using @a flags of @c wxStrip_Mnemonics or + @c \\t (TAB) character. By using @a flags of @c wxStrip_Mnemonics or @c wxStrip_Accel to strip only the former or the latter part, respectively. Notice that in most cases wxMenuItem::GetLabelFromText() or @@ -524,7 +475,7 @@ wxString wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); -/** @ingroup group_funcmacro_networkuseros */ +/** @addtogroup group_funcmacro_networkuseros */ //@{ /** @@ -614,7 +565,7 @@ wxString wxGetFullHostName(); @header{wx/utils.h} */ -wxString wxGetUserHome(const wxString& user = ""); +wxString wxGetUserHome(const wxString& user = wxEmptyString); /** This function returns the "user id" also known as "login name" under Unix @@ -721,7 +672,7 @@ bool wxIsPlatformLittleEndian(); -/** @ingroup group_funcmacro_procctrl */ +/** @addtogroup group_funcmacro_procctrl */ //@{ /** @@ -790,7 +741,8 @@ bool wxIsPlatformLittleEndian(); @param callback An optional pointer to wxProcess. - @see wxShell(), wxProcess, @ref page_samples_exec + @see wxShell(), wxProcess, @ref page_samples_exec, + wxLaunchDefaultApplication(), wxLaunchDefaultBrowser() @header{wx/utils.h} @@ -805,7 +757,7 @@ long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, //@} -/** @ingroup group_funcmacro_procctrl */ +/** @addtogroup group_funcmacro_procctrl */ //@{ /** This is an overloaded version of wxExecute(const wxString&,int,wxProcess*), @@ -826,6 +778,9 @@ long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, @param callback An optional pointer to wxProcess. + @see wxShell(), wxProcess, @ref page_samples_exec, + wxLaunchDefaultApplication(), wxLaunchDefaultBrowser() + @header{wx/utils.h} */ long wxExecute(char** argv, int flags = wxEXEC_ASYNC, @@ -834,7 +789,7 @@ long wxExecute(wchar_t** argv, int flags = wxEXEC_ASYNC, wxProcess* callback = NULL); //@} -/** @ingroup group_funcmacro_procctrl */ +/** @addtogroup group_funcmacro_procctrl */ //@{ /** @@ -848,16 +803,20 @@ long wxExecute(wchar_t** argv, int flags = wxEXEC_ASYNC, @param command The command to execute and any parameters to pass to it as a single string. + @param output + The string array where the stdout of the executed process is saved. @param flags Must include either wxEXEC_ASYNC or wxEXEC_SYNC and can also include wxEXEC_NOHIDE, wxEXEC_MAKE_GROUP_LEADER (in either case) or wxEXEC_NODISABLE and wxEXEC_NOEVENTS or wxEXEC_BLOCK, which is equal to their combination, in wxEXEC_SYNC case. + @see wxShell(), wxProcess, @ref page_samples_exec, + wxLaunchDefaultApplication(), wxLaunchDefaultBrowser() + @header{wx/utils.h} */ -long wxExecute(const wxString& command, wxArrayString& output, - int flags = 0); +long wxExecute(const wxString& command, wxArrayString& output, int flags = 0); /** This is an overloaded version of wxExecute(const wxString&,int,wxProcess*), @@ -869,12 +828,19 @@ long wxExecute(const wxString& command, wxArrayString& output, @param command The command to execute and any parameters to pass to it as a single string. + @param output + The string array where the stdout of the executed process is saved. + @param errors + The string array where the stderr of the executed process is saved. @param flags Must include either wxEXEC_ASYNC or wxEXEC_SYNC and can also include wxEXEC_NOHIDE, wxEXEC_MAKE_GROUP_LEADER (in either case) or wxEXEC_NODISABLE and wxEXEC_NOEVENTS or wxEXEC_BLOCK, which is equal to their combination, in wxEXEC_SYNC case. + @see wxShell(), wxProcess, @ref page_samples_exec, + wxLaunchDefaultApplication(), wxLaunchDefaultBrowser() + @header{wx/utils.h} */ long wxExecute(const wxString& command, wxArrayString& output, @@ -959,24 +925,28 @@ bool wxShell(const wxString& command = NULL); This function shuts down or reboots the computer depending on the value of the @a flags. - @note Doing this requires the corresponding access rights (superuser under - Unix, SE_SHUTDOWN privilege under Windows NT) and that this function - is only implemented under Unix and Win32. + @note Note that performing the shutdown requires the corresponding access + rights (superuser under Unix, SE_SHUTDOWN privilege under Windows NT) + and that this function is only implemented under Unix and MSW. @param flags - Either wxSHUTDOWN_POWEROFF or wxSHUTDOWN_REBOOT + One of @c wxSHUTDOWN_POWEROFF, @c wxSHUTDOWN_REBOOT or + @c wxSHUTDOWN_LOGOFF (currently implemented only for MSW) possibly + combined with @c wxSHUTDOWN_FORCE which forces shutdown under MSW by + forcefully terminating all the applications. As doing this can result + in a data loss, this flag shouldn't be used unless really necessary. @return @true on success, @false if an error occurred. @header{wx/utils.h} */ -bool wxShutdown(wxShutdownFlags flags); +bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF); //@} -/** @ingroup group_funcmacro_time */ +/** @addtogroup group_funcmacro_time */ //@{ /**