Add wxProgressDialog::Was{Cancelled,Skipped}() convenience methods.
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
This commit is contained in:
parent
ccb3689a19
commit
f994a8ac8d
@ -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:
|
||||
|
||||
|
@ -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(); }
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user