diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl
index f66828d1f2..222f2afbd7 100644
--- a/build/bakefiles/files.bkl
+++ b/build/bakefiles/files.bkl
@@ -1097,6 +1097,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/access.h
wx/anidecod.h
wx/animdecod.h
+ wx/appprog.h
wx/artprov.h
wx/bitmap.h
wx/bookctrl.h
@@ -1186,6 +1187,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/splitter.h
wx/srchctrl.h
wx/statline.h
+ wx/taskbarbutton.h
wx/tbarbase.h
wx/tglbtn.h
wx/tipwin.h
@@ -1204,7 +1206,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/xpmdecod.h
wx/xpmhand.h
wx/xrc/xmlreshandler.h
- wx/taskbarbutton.h
@@ -1954,6 +1955,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/msw/accel.cpp
src/msw/anybutton.cpp
src/msw/artmsw.cpp
+ src/msw/appprog.cpp
src/msw/bmpbuttn.cpp
src/msw/button.cpp
src/msw/checkbox.cpp
@@ -1997,12 +1999,12 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/msw/statusbar.cpp
src/msw/statline.cpp
src/msw/stattext.cpp
+ src/msw/taskbarbutton.cpp
src/msw/toolbar.cpp
src/msw/textctrl.cpp
src/msw/textentry.cpp
src/msw/tglbtn.cpp
src/msw/treectrl.cpp
- src/msw/taskbarbutton.cpp
wx/generic/clrpickerg.h
@@ -2090,6 +2092,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/msw/statusbar.h
wx/msw/statline.h
wx/msw/stattext.h
+ wx/msw/taskbarbutton.h
wx/msw/toolbar.h
wx/msw/textctrl.h
wx/msw/textentry.h
@@ -2098,7 +2101,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/msw/toplevel.h
wx/msw/treectrl.h
wx/msw/window.h
- wx/msw/taskbarbutton.h
diff --git a/include/wx/appprog.h b/include/wx/appprog.h
new file mode 100644
index 0000000000..1100d730d8
--- /dev/null
+++ b/include/wx/appprog.h
@@ -0,0 +1,38 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/appprog.h
+// Purpose: wxAppProgressIndicator interface.
+// Author: Chaobin Zhang
+// Created: 2014-09-05
+// Copyright: (c) 2014 wxWidgets development team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_APPPROG_H_
+#define _WX_APPPROG_H_
+
+#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+class WXDLLIMPEXP_CORE wxAppProgressIndicatorBase
+{
+public:
+ wxAppProgressIndicatorBase() {}
+ virtual ~wxAppProgressIndicatorBase() {}
+ virtual void SetValue(int value) = 0;
+ virtual void SetRange(int range) = 0;
+ virtual void Pulse() = 0;
+ virtual void Reset() = 0;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicatorBase);
+};
+
+#if defined(__WXMSW__)
+ #include "wx/msw/appprog.h"
+#endif
+
+#endif // _WX_APPPROG_H_
diff --git a/include/wx/msw/appprog.h b/include/wx/msw/appprog.h
new file mode 100644
index 0000000000..527ca8e1a8
--- /dev/null
+++ b/include/wx/msw/appprog.h
@@ -0,0 +1,39 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/msw/appprog.h
+// Purpose: wxAppProgressIndicator interface.
+// Author: Chaobin Zhang
+// Created: 2014-09-05
+// Copyright: (c) 2014 wxWidgets development team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MSW_APPPROG_H_
+#define _WX_MSW_APPPROG_H_
+
+#include "wx/vector.h"
+
+class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
+
+class WXDLLIMPEXP_CORE wxAppProgressIndicator
+ : public wxAppProgressIndicatorBase
+{
+public:
+ wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100);
+ virtual ~wxAppProgressIndicator();
+
+ virtual void SetValue(int value) wxOVERRIDE;
+ virtual void SetRange(int range) wxOVERRIDE;
+ virtual void Pulse() wxOVERRIDE;
+ virtual void Reset() wxOVERRIDE;
+
+private:
+ int m_maxValue;
+
+#if wxUSE_TASKBARBUTTON
+ wxVector m_taskBarButtons;
+#endif // wxUSE_TASKBARBUTTON
+
+ wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator);
+};
+
+#endif // _WX_MSW_APPPROG_H_
diff --git a/include/wx/msw/gauge.h b/include/wx/msw/gauge.h
index e5dab20020..d073ad182c 100644
--- a/include/wx/msw/gauge.h
+++ b/include/wx/msw/gauge.h
@@ -15,9 +15,7 @@
extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[];
-#if wxUSE_TASKBARBUTTON
class WXDLLIMPEXP_FWD_CORE wxAppProgressIndicator;
-#endif
// Group box
class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase
@@ -75,9 +73,7 @@ private:
void SetIndeterminateMode();
void SetDeterminateMode();
-#if wxUSE_TASKBARBUTTON
wxAppProgressIndicator* m_appProgressIndicator;
-#endif
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge)
};
diff --git a/include/wx/taskbarbutton.h b/include/wx/taskbarbutton.h
index 6d612f1a0e..6470253356 100644
--- a/include/wx/taskbarbutton.h
+++ b/include/wx/taskbarbutton.h
@@ -131,23 +131,6 @@ private:
wxDECLARE_NO_COPY_CLASS(wxTaskBarButton);
};
-class WXDLLIMPEXP_CORE wxAppProgressIndicator
-{
-public:
- wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100);
- virtual ~wxAppProgressIndicator();
- void SetValue(int value);
- void SetRange(int range);
- void Pulse();
- void Reset();
-
-private:
- int m_maxValue;
- wxTaskBarButton* m_taskBarButton;
-
- wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator);
-};
-
enum wxTaskBarJumpListItemType
{
wxTASKBAR_JUMP_LIST_SEPARATOR,
diff --git a/src/msw/appprog.cpp b/src/msw/appprog.cpp
new file mode 100644
index 0000000000..fe5cf1a4b7
--- /dev/null
+++ b/src/msw/appprog.cpp
@@ -0,0 +1,102 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/msw/appprog.cpp
+// Purpose: Implementation of wxAppProgressIndicator.
+// Author: Chaobin Zhang
+// Created: 2014-09-05
+// Copyright: (c) 2014 wxWidgets development team
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/toplevel.h"
+#endif
+
+#include "wx/appprog.h"
+#include "wx/msw/taskbarbutton.h"
+
+// ----------------------------------------------------------------------------
+// wxAppProgressIndicator Implementation.
+// ----------------------------------------------------------------------------
+wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* parent, int maxValue)
+ : m_maxValue(maxValue)
+{
+#if wxUSE_TASKBARBUTTON
+ if ( parent == NULL )
+ {
+ for ( wxWindowList::const_iterator it = wxTopLevelWindows.begin();
+ it != wxTopLevelWindows.end();
+ ++it )
+ {
+ m_taskBarButtons.push_back(new wxTaskBarButtonImpl(*it));
+ }
+ }
+ else
+ {
+ m_taskBarButtons.push_back(new wxTaskBarButtonImpl(parent));
+ }
+
+ 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
+}
+
+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
+}
diff --git a/src/msw/gauge.cpp b/src/msw/gauge.cpp
index c4bef3d943..4ad5074221 100644
--- a/src/msw/gauge.cpp
+++ b/src/msw/gauge.cpp
@@ -33,8 +33,8 @@
#include "wx/msw/wrapcctl.h" // include "properly"
#endif
+#include "wx/appprog.h"
#include "wx/msw/private.h"
-#include "wx/taskbarbutton.h"
// ----------------------------------------------------------------------------
// constants
@@ -95,7 +95,6 @@ bool wxGauge::Create(wxWindow *parent,
// in case we need to emulate indeterminate mode...
m_nDirection = wxRIGHT;
-#if wxUSE_TASKBARBUTTON
m_appProgressIndicator = NULL;
if ( (style & wxGA_PROGRESS) != 0 )
{
@@ -106,7 +105,6 @@ bool wxGauge::Create(wxWindow *parent,
new wxAppProgressIndicator(topParent, range);
}
}
-#endif
SetRange(range);
@@ -115,9 +113,7 @@ bool wxGauge::Create(wxWindow *parent,
wxGauge::~wxGauge()
{
-#if wxUSE_TASKBARBUTTON
delete m_appProgressIndicator;
-#endif
}
WXDWORD wxGauge::MSWGetStyle(long style, WXDWORD *exstyle) const
@@ -168,10 +164,8 @@ void wxGauge::SetRange(int r)
::SendMessage(GetHwnd(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
#endif // PBM_SETRANGE32/!PBM_SETRANGE32
-#if wxUSE_TASKBARBUTTON
if ( m_appProgressIndicator )
m_appProgressIndicator->SetRange(m_rangeMax);
-#endif
}
void wxGauge::SetValue(int pos)
@@ -186,7 +180,6 @@ void wxGauge::SetValue(int pos)
::SendMessage(GetHwnd(), PBM_SETPOS, pos, 0);
-#if wxUSE_TASKBARBUTTON
if ( m_appProgressIndicator )
{
m_appProgressIndicator->SetValue(pos);
@@ -195,7 +188,6 @@ void wxGauge::SetValue(int pos)
m_appProgressIndicator->Reset();
}
}
-#endif
}
}
@@ -260,10 +252,8 @@ void wxGauge::Pulse()
wxGaugeBase::Pulse();
}
-#if wxUSE_TASKBARBUTTON
- if ( m_appProgressIndicator )
- m_appProgressIndicator->Pulse();
-#endif
+ if ( m_appProgressIndicator )
+ m_appProgressIndicator->Pulse();
}
#endif // wxUSE_GAUGE
diff --git a/src/msw/taskbarbutton.cpp b/src/msw/taskbarbutton.cpp
index 5369f6f5c6..1bed644ae5 100644
--- a/src/msw/taskbarbutton.cpp
+++ b/src/msw/taskbarbutton.cpp
@@ -938,46 +938,6 @@ wxThumbBarButton* wxTaskBarButtonImpl::GetThumbBarButtonByIndex(size_t index)
return m_thumbBarButtons[index];
}
-// ----------------------------------------------------------------------------
-// wxAppProgressIndicator Implementation.
-// ----------------------------------------------------------------------------
-wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* parent, int maxValue)
- : m_maxValue(maxValue),
- m_taskBarButton(new wxTaskBarButtonImpl(parent))
-{
- Reset();
- SetRange(m_maxValue);
-}
-
-wxAppProgressIndicator::~wxAppProgressIndicator()
-{
- m_taskBarButton->SetProgressState(wxTASKBAR_BUTTON_NO_PROGRESS);
- delete m_taskBarButton;
-}
-
-void wxAppProgressIndicator::SetValue(int value)
-{
- wxASSERT_MSG( value <= m_maxValue, wxT("invalid progress value") );
-
- m_taskBarButton->SetProgressValue(value);
-}
-
-void wxAppProgressIndicator::SetRange(int range)
-{
- m_maxValue = range;
- m_taskBarButton->SetProgressRange(range);
-}
-
-void wxAppProgressIndicator::Pulse()
-{
- m_taskBarButton->PulseProgress();
-}
-
-void wxAppProgressIndicator::Reset()
-{
- m_taskBarButton->SetProgressState(wxTASKBAR_BUTTON_NO_PROGRESS);
-}
-
// ----------------------------------------------------------------------------
// wxTaskBarJumpListItem Implementation.
// ----------------------------------------------------------------------------