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); wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicatorBase);
}; };
#if defined(__WXMSW__) #if defined(__WXMSW__) && wxUSE_TASKBARBUTTON
#include "wx/msw/appprogress.h" #include "wx/msw/appprogress.h"
#else #else
class wxAppProgressIndicator : public wxAppProgressIndicatorBase class wxAppProgressIndicator : public wxAppProgressIndicatorBase

View File

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

View File

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