Reset progress state to no progress when destructing.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty 2014-09-10 14:53:47 +00:00
parent 4f4b6b8c3c
commit e903ebda55
3 changed files with 23 additions and 18 deletions

View File

@ -130,6 +130,22 @@ private:
wxDECLARE_NO_COPY_CLASS(wxTaskBarButton);
};
class WXDLLIMPEXP_CORE wxAppProgressIndicator
{
public:
wxAppProgressIndicator(wxTopLevelWindow *parent, int maxValue);
virtual ~wxAppProgressIndicator();
bool Update(int value);
bool Pulse();
private:
void Init();
wxTopLevelWindow *m_parent;
int m_maxValue;
wxScopedPtr<wxTaskBarButton> m_taskBarButton;
};
enum WXDLLIMPEXP_CORE wxJumpListItemType {
wxJUMP_LIST_SEPARATOR,
wxJUMP_LIST_TASK,
@ -172,22 +188,6 @@ private:
int m_iconIndex;
};
class WXDLLIMPEXP_CORE wxAppProgressIndicator
{
public:
wxAppProgressIndicator(wxTopLevelWindow *parent, int maxValue);
virtual ~wxAppProgressIndicator() { }
bool Update(int value);
bool Pulse();
private:
void Init();
wxTopLevelWindow *m_parent;
int m_maxValue;
wxScopedPtr<wxTaskBarButton> m_taskBarButton;
};
typedef wxVector<wxJumpListItem> wxJumpListItems;
class WXDLLIMPEXP_CORE wxJumpList

View File

@ -422,7 +422,7 @@ void MyFrame::OnShowProgressDialog(wxCommandEvent& WXUNUSED(event))
NULL,
wxPD_AUTO_HIDE
);
wxAppProgressIndicator indicator(&dlg, PROGRESS_COUNT);
wxAppProgressIndicator indicator(this, PROGRESS_COUNT);
for ( int i = 0; i <= PROGRESS_COUNT; i++ )
{
if ( !dlg.Update(i) )
@ -442,7 +442,7 @@ void MyFrame::OnPulseProgressDialog(wxCommandEvent& WXUNUSED(event))
NULL,
wxPD_AUTO_HIDE
);
wxAppProgressIndicator indicator(&dlg, PROGRESS_COUNT);
wxAppProgressIndicator indicator(this, PROGRESS_COUNT);
for ( int i = 0; i <= PROGRESS_COUNT; i++ )
{
if ( !dlg.Pulse() )

View File

@ -706,6 +706,11 @@ wxAppProgressIndicator::wxAppProgressIndicator(wxTopLevelWindow *parent, int max
{
}
wxAppProgressIndicator::~wxAppProgressIndicator()
{
m_taskBarButton->SetProgressState(wxTASKBAR_BUTTON_NO_PROGRESS);
}
bool wxAppProgressIndicator::Update(int value)
{
wxASSERT_MSG( value <= m_maxValue, wxT("invalid progress value") );