Really add wxGA_PROGRESS support to wxGauge in wxOSX
Finish the work started in 11a5b83e2c
by moving
more wxAppProgressIndicator-related parts of wxMSW wxGauge implementation into
the base class and reusing them from the wxOSX version.
Also remove MSW-specific test for wxUSE_TASKBARBUTTON from the widgets sample
which prevented this style from being taken into account at all under Mac.
See #16638.
This commit is contained in:
@@ -293,10 +293,8 @@ void GaugeWidgetsPage::CreateGauge()
|
|||||||
if ( m_chkSmooth->GetValue() )
|
if ( m_chkSmooth->GetValue() )
|
||||||
flags |= wxGA_SMOOTH;
|
flags |= wxGA_SMOOTH;
|
||||||
|
|
||||||
#if wxUSE_TASKBARBUTTON
|
|
||||||
if ( m_chkProgress->GetValue() )
|
if ( m_chkProgress->GetValue() )
|
||||||
flags |= wxGA_PROGRESS;
|
flags |= wxGA_PROGRESS;
|
||||||
#endif
|
|
||||||
|
|
||||||
int val = 0;
|
int val = 0;
|
||||||
if ( m_gauge )
|
if ( m_gauge )
|
||||||
|
@@ -155,6 +155,9 @@ bool wxGaugeBase::Create(wxWindow *parent,
|
|||||||
void wxGaugeBase::SetRange(int range)
|
void wxGaugeBase::SetRange(int range)
|
||||||
{
|
{
|
||||||
m_rangeMax = range;
|
m_rangeMax = range;
|
||||||
|
|
||||||
|
if ( m_appProgressIndicator )
|
||||||
|
m_appProgressIndicator->SetRange(m_rangeMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGaugeBase::GetRange() const
|
int wxGaugeBase::GetRange() const
|
||||||
@@ -165,6 +168,15 @@ int wxGaugeBase::GetRange() const
|
|||||||
void wxGaugeBase::SetValue(int pos)
|
void wxGaugeBase::SetValue(int pos)
|
||||||
{
|
{
|
||||||
m_gaugePos = pos;
|
m_gaugePos = pos;
|
||||||
|
|
||||||
|
if ( m_appProgressIndicator )
|
||||||
|
{
|
||||||
|
m_appProgressIndicator->SetValue(pos);
|
||||||
|
if ( pos == 0 )
|
||||||
|
{
|
||||||
|
m_appProgressIndicator->Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGaugeBase::GetValue() const
|
int wxGaugeBase::GetValue() const
|
||||||
@@ -203,6 +215,9 @@ void wxGaugeBase::Pulse()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ( m_appProgressIndicator )
|
||||||
|
m_appProgressIndicator->Pulse();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GAUGE
|
#endif // wxUSE_GAUGE
|
||||||
|
@@ -145,7 +145,7 @@ void wxGauge::SetRange(int r)
|
|||||||
if ( IsInIndeterminateMode() )
|
if ( IsInIndeterminateMode() )
|
||||||
SetDeterminateMode();
|
SetDeterminateMode();
|
||||||
|
|
||||||
m_rangeMax = r;
|
wxGaugeBase::SetRange(r);
|
||||||
|
|
||||||
#ifdef PBM_SETRANGE32
|
#ifdef PBM_SETRANGE32
|
||||||
::SendMessage(GetHwnd(), PBM_SETRANGE32, 0, r);
|
::SendMessage(GetHwnd(), PBM_SETRANGE32, 0, r);
|
||||||
@@ -153,9 +153,6 @@ void wxGauge::SetRange(int r)
|
|||||||
// fall back to PBM_SETRANGE (limited to 16 bits)
|
// fall back to PBM_SETRANGE (limited to 16 bits)
|
||||||
::SendMessage(GetHwnd(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
|
::SendMessage(GetHwnd(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
|
||||||
#endif // PBM_SETRANGE32/!PBM_SETRANGE32
|
#endif // PBM_SETRANGE32/!PBM_SETRANGE32
|
||||||
|
|
||||||
if ( m_appProgressIndicator )
|
|
||||||
m_appProgressIndicator->SetRange(m_rangeMax);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetValue(int pos)
|
void wxGauge::SetValue(int pos)
|
||||||
@@ -166,18 +163,9 @@ void wxGauge::SetValue(int pos)
|
|||||||
|
|
||||||
if ( GetValue() != pos )
|
if ( GetValue() != pos )
|
||||||
{
|
{
|
||||||
m_gaugePos = pos;
|
wxGaugeBase::SetValue(pos);
|
||||||
|
|
||||||
::SendMessage(GetHwnd(), PBM_SETPOS, pos, 0);
|
::SendMessage(GetHwnd(), PBM_SETPOS, pos, 0);
|
||||||
|
|
||||||
if ( m_appProgressIndicator )
|
|
||||||
{
|
|
||||||
m_appProgressIndicator->SetValue(pos);
|
|
||||||
if ( pos == 0 )
|
|
||||||
{
|
|
||||||
m_appProgressIndicator->Reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,15 +223,15 @@ void wxGauge::Pulse()
|
|||||||
SetIndeterminateMode();
|
SetIndeterminateMode();
|
||||||
|
|
||||||
SendMessage(GetHwnd(), PBM_STEPIT, 0, 0);
|
SendMessage(GetHwnd(), PBM_STEPIT, 0, 0);
|
||||||
|
|
||||||
|
if ( m_appProgressIndicator )
|
||||||
|
m_appProgressIndicator->Pulse();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// emulate indeterminate mode
|
// emulate indeterminate mode
|
||||||
wxGaugeBase::Pulse();
|
wxGaugeBase::Pulse();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_appProgressIndicator )
|
|
||||||
m_appProgressIndicator->Pulse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GAUGE
|
#endif // wxUSE_GAUGE
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "wx/gauge.h"
|
#include "wx/gauge.h"
|
||||||
|
|
||||||
|
#include "wx/appprogress.h"
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
bool wxGauge::Create( wxWindow *parent,
|
bool wxGauge::Create( wxWindow *parent,
|
||||||
@@ -66,6 +67,9 @@ int wxGauge::GetValue() const
|
|||||||
void wxGauge::Pulse()
|
void wxGauge::Pulse()
|
||||||
{
|
{
|
||||||
GetPeer()->PulseGauge();
|
GetPeer()->PulseGauge();
|
||||||
|
|
||||||
|
if ( m_appProgressIndicator )
|
||||||
|
m_appProgressIndicator->Pulse();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GAUGE
|
#endif // wxUSE_GAUGE
|
||||||
|
Reference in New Issue
Block a user