Don't use wxMSW wxAppProgressIndicator if wxUSE_TASKBARBUTTON==0.

This class requires wxTaskBarButton to be really implemented, so there is no
need to even define the MSW-specific version of it if wxUSE_TASKBARBUTTON is 0
anyhow.

This fixes a compilation problem with wxUSE_TASKBARBUTTON==0 but, more
importantly, just makes more sense.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-09-20 22:07:37 +00:00
parent 4944c44676
commit c5ee5b8ea7
3 changed files with 6 additions and 15 deletions

View File

@ -29,7 +29,7 @@ private:
wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicatorBase);
};
#if defined(__WXMSW__)
#if defined(__WXMSW__) && wxUSE_TASKBARBUTTON
#include "wx/msw/appprogress.h"
#else
class wxAppProgressIndicator : public wxAppProgressIndicatorBase

View File

@ -31,9 +31,7 @@ public:
private:
int m_maxValue;
#if wxUSE_TASKBARBUTTON
wxVector<wxTaskBarButton*> m_taskBarButtons;
#endif // wxUSE_TASKBARBUTTON
wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator);
};

View File

@ -13,6 +13,8 @@
#pragma hdrstop
#endif
#if wxUSE_TASKBARBUTTON
#ifndef WX_PRECOMP
#include "wx/toplevel.h"
#endif
@ -26,7 +28,6 @@
wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* parent, int maxValue)
: m_maxValue(maxValue)
{
#if wxUSE_TASKBARBUTTON
if ( parent == NULL )
{
for ( wxWindowList::const_iterator it = wxTopLevelWindows.begin();
@ -47,19 +48,16 @@ wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* parent, int maxValue)
Reset();
SetRange(m_maxValue);
#endif // wxUSE_TASKBARBUTTON
}
wxAppProgressIndicator::~wxAppProgressIndicator()
{
#if wxUSE_TASKBARBUTTON
Reset();
for ( size_t i = 0; i < m_taskBarButtons.size(); ++i )
{
delete m_taskBarButtons[i];
}
#endif // wxUSE_TASKBARBUTTON
}
bool wxAppProgressIndicator::IsAvailable() const
@ -71,41 +69,36 @@ void wxAppProgressIndicator::SetValue(int value)
{
wxASSERT_MSG( value <= m_maxValue, wxT("invalid progress value") );
#if wxUSE_TASKBARBUTTON
for ( size_t i = 0; i < m_taskBarButtons.size(); ++i )
{
m_taskBarButtons[i]->SetProgressValue(value);
}
#endif // wxUSE_TASKBARBUTTON
}
void wxAppProgressIndicator::SetRange(int range)
{
m_maxValue = range;
#if wxUSE_TASKBARBUTTON
for ( size_t i = 0; i < m_taskBarButtons.size(); ++i )
{
m_taskBarButtons[i]->SetProgressRange(range);
}
#endif // wxUSE_TASKBARBUTTON
}
void wxAppProgressIndicator::Pulse()
{
#if wxUSE_TASKBARBUTTON
for ( size_t i = 0; i < m_taskBarButtons.size(); ++i )
{
m_taskBarButtons[i]->PulseProgress();
}
#endif // wxUSE_TASKBARBUTTON
}
void wxAppProgressIndicator::Reset()
{
#if wxUSE_TASKBARBUTTON
for ( size_t i = 0; i < m_taskBarButtons.size(); ++i )
{
m_taskBarButtons[i]->SetProgressState(wxTASKBAR_BUTTON_NO_PROGRESS);
}
#endif // wxUSE_TASKBARBUTTON
}
#endif // wxUSE_TASKBARBUTTON