]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxProgressDialog::Was{Cancelled,Skipped}() convenience methods.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 20 Apr 2010 11:10:33 +0000 (11:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 20 Apr 2010 11:10:33 +0000 (11:10 +0000)
Although the information about "Cancel" and "Skip" buttons presses is returned
from Update(), sometimes it may be more convenient to ask the dialog about
whether it was cancelled or skipped instead of storing it in the program
itself.

Add the methods which allow to check for this.

Closes #10903.

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

docs/changes.txt
include/wx/generic/progdlgg.h
interface/wx/progdlg.h
src/generic/progdlgg.cpp

index ff8af7619897a559326195763f93325821639d9c..45f8609b992b4441f03d95ae76ed8d782659cfd6 100644 (file)
@@ -509,6 +509,7 @@ All (GUI):
 - Added support for gradient stops in wxGraphicsContext (Kit Bishop).
 - Added wxTransparentColour.
 - Added wxToolBar::GetToolByPos().
+- Added wxProgressDialog::Was{Cancelled,Skipped}() (Julien Weinzorn).
 
 GTK:
 
index 4a296b6af920bb7229320b965edfa5c954ba007a..5a90d1f1f45eb4431b336617705579611d937f52 100644 (file)
@@ -48,6 +48,11 @@ public:
 
     void SetRange(int maximum);
 
+    // Return whether "Cancel" or "Skip" button was pressed, always return
+    // false if the corresponding button is not shown.
+    bool WasCancelled() const;
+    bool WasSkipped() const;
+
     // Must provide overload to avoid hiding it (and warnings about it)
     virtual void Update() { wxDialog::Update(); }
 
index 7847a230c2ba73e38e75e3af7d58447a971b6460..221f1edaf1e0601dbe817cd925bd919d0ee2344f 100644 (file)
@@ -137,6 +137,32 @@ public:
     */
     void SetRange(int maximum);
 
+
+      /**
+         Returns true if the "Cancel" button was pressed.
+
+         Normally a Cancel button press is indicated by Update() returning
+         @false but sometimes it may be more convenient to check if the dialog
+         was cancelled from elsewhere in the code and this function allows to
+         do it.
+
+         It always returns @false if the Cancel button is not shown at all.
+
+         @since 2.9.1
+     */
+    bool WasCancelled() const;
+
+     /**
+         Returns true if the "Skip" button was pressed.
+
+         This is similar to WasCancelled() but returns @true if the "Skip"
+         button was pressed, not the "Cancel" one.
+
+         @since 2.9.1
+     */
+    bool WasSkipped() const;
+
+
     /**
         Updates the dialog, setting the progress bar to the new value and
         updating the message if new one is specified.
index 443d354104bc5e929e0e16c8c18660617a800d2d..ef7b89b24e5638af8739386a79e096422fee417a 100644 (file)
@@ -538,6 +538,18 @@ void wxProgressDialog::SetRange(int maximum)
 #endif // __WXMSW__
 }
 
+
+bool wxProgressDialog::WasCancelled() const
+{
+    return m_hasAbortButton && m_state == Canceled;
+}
+
+bool wxProgressDialog::WasSkipped() const
+{
+    return m_hasSkipButton && m_skip;
+}
+
+
 // ----------------------------------------------------------------------------
 // event handlers
 // ----------------------------------------------------------------------------