From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Wed, 9 Jul 2008 02:32:16 +0000 (+0000)
Subject: show busy cursor in wxLaunchDefaultBrowser and add a new flag to avoid it (#9678)
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f75e0c15ae7d3fcf8c9c32572050d1bb597cc888

show busy cursor in wxLaunchDefaultBrowser and add a new flag to avoid it (#9678)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54558 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/docs/changes.txt b/docs/changes.txt
index 042470ed71..5a746326f2 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -370,6 +370,7 @@ All (GUI):
 - Added wxGenericStaticBitmap suitable for display of large bitmaps.
 - Support wxListCtrl::GetViewRect() in report view too.
 - Implement wxListCtrl::GetSubItemRect() in generic version (David Barnard).
+- Show busy cursor in wxLaunchDefaultBrowser and add wxBROWSER_NOBUSYCURSOR.
 
 wxGTK:
 
diff --git a/include/wx/utils.h b/include/wx/utils.h
index 868e744809..7e9a195160 100644
--- a/include/wx/utils.h
+++ b/include/wx/utils.h
@@ -572,7 +572,8 @@ WXDLLIMPEXP_BASE void wxQsort(void *const pbase, size_t total_elems,
 // flags for wxLaunchDefaultBrowser
 enum
 {
-    wxBROWSER_NEW_WINDOW = 1
+    wxBROWSER_NEW_WINDOW   = 0x01,
+    wxBROWSER_NOBUSYCURSOR = 0x02
 };
 
 // Launch url in the user's default internet browser
diff --git a/interface/wx/utils.h b/interface/wx/utils.h
index bd0ddb7b6a..8bade8cd74 100644
--- a/interface/wx/utils.h
+++ b/interface/wx/utils.h
@@ -422,12 +422,19 @@ long wxNewId();
 void wxRegisterId(long id);
 
 /**
-    Opens the @a url in user's default browser. If the @a flags parameter
-    contains @c wxBROWSER_NEW_WINDOW flag, a new window is opened for the URL
-    (currently this is only supported under Windows). 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.
+    Opens the @a url in user's default browser.
+
+    If the @a flags parameter contains @c wxBROWSER_NEW_WINDOW flag, a new
+    window is opened for the URL (currently this is only supported under
+    Windows).
+
+    And unless the @a flags parameter contains @c wxBROWSER_NOBUSYCURSOR flag,
+    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.
 
     Returns @true if the application was successfully launched.
 
diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp
index 0c46279c19..a0aa6a98c4 100644
--- a/src/common/utilscmn.cpp
+++ b/src/common/utilscmn.cpp
@@ -940,7 +940,7 @@ void wxQsort(void *const pbase, size_t total_elems,
 bool wxLaunchDefaultApplication(const wxString &document, int flags)
 {
     wxUnusedVar(flags);
-    
+
 #ifdef __UNIX__
     // Our best best is to use xdg-open from freedesktop.org cross-desktop
     // compatibility suite xdg-utils
@@ -968,7 +968,7 @@ bool wxLaunchDefaultApplication(const wxString &document, int flags)
 bool wxCocoaLaunchDefaultBrowser(const wxString& url, int flags);
 #endif
 
-bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
+static bool DoLaunchDefaultBrowser(const wxString& urlOrig, int flags)
 {
     wxUnusedVar(flags);
 
@@ -1176,6 +1176,15 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
     return false;
 }
 
+bool wxLaunchDefaultBrowser(const wxString& url, int flags)
+{
+    if ( flags & wxBROWSER_NOBUSYCURSOR )
+        return DoLaunchDefaultBrowser(url, flags);
+
+    wxBusyCursor bc;
+    return DoLaunchDefaultBrowser(url, flags);
+}
+
 // ----------------------------------------------------------------------------
 // Menu accelerators related functions
 // ----------------------------------------------------------------------------
@@ -1492,8 +1501,8 @@ wxString wxGetPasswordFromUser(const wxString& message,
 
 #if wxUSE_COLOURDLG
 
-wxColour wxGetColourFromUser(wxWindow *parent, 
-                             const wxColour& colInit, 
+wxColour wxGetColourFromUser(wxWindow *parent,
+                             const wxColour& colInit,
                              const wxString& caption,
                              wxColourData *ptrData)
 {