Move wxAppProgressIndicator into its own header.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77641 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
</set>
|
||||
|
||||
<!-- ====================================================================== -->
|
||||
@@ -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
|
||||
</set>
|
||||
<set var="MSW_HDR" hints="files">
|
||||
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
|
||||
</set>
|
||||
<set var="MSW_RSC" hints="files">
|
||||
<!-- Resources must be installed together with headers: -->
|
||||
|
38
include/wx/appprog.h
Normal file
38
include/wx/appprog.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/appprog.h
|
||||
// Purpose: wxAppProgressIndicator interface.
|
||||
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
||||
// 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_
|
39
include/wx/msw/appprog.h
Normal file
39
include/wx/msw/appprog.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/appprog.h
|
||||
// Purpose: wxAppProgressIndicator interface.
|
||||
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
||||
// 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<wxTaskBarButton*> m_taskBarButtons;
|
||||
#endif // wxUSE_TASKBARBUTTON
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator);
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_APPPROG_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)
|
||||
};
|
||||
|
@@ -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,
|
||||
|
102
src/msw/appprog.cpp
Normal file
102
src/msw/appprog.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/msw/appprog.cpp
|
||||
// Purpose: Implementation of wxAppProgressIndicator.
|
||||
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
||||
// 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
|
||||
}
|
@@ -33,8 +33,8 @@
|
||||
#include "wx/msw/wrapcctl.h" // include <commctrl.h> "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
|
||||
}
|
||||
|
||||
#endif // wxUSE_GAUGE
|
||||
|
@@ -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.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user