Fix handling of wxGA_PROGRESS in wxGauge under MSW
This was broken by the refactoring during the addition of OS X implementation
of wxAppProgressIndicator in 11a5b83e2c
, restore
this functionality by explicitly calling the code initializing the progress
indicator in wxGaugeBase from wxMSW implementation.
Closes #17301.
This commit is contained in:
@@ -99,6 +99,13 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
|
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
|
||||||
|
|
||||||
|
// Initialize m_appProgressIndicator if necessary, i.e. if this object has
|
||||||
|
// wxGA_PROGRESS style. This method is supposed to be called from the
|
||||||
|
// derived class Create() if it doesn't call the base class Create(), which
|
||||||
|
// already does it, after initializing the window style and range.
|
||||||
|
void InitProgressIndicatorIfNeeded();
|
||||||
|
|
||||||
|
|
||||||
// the max position
|
// the max position
|
||||||
int m_rangeMax;
|
int m_rangeMax;
|
||||||
|
|
||||||
|
@@ -104,6 +104,20 @@ wxCONSTRUCTOR_6( wxGauge, wxWindow*, Parent, wxWindowID, Id, int, Range, \
|
|||||||
// wxGauge creation
|
// wxGauge creation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxGaugeBase::InitProgressIndicatorIfNeeded()
|
||||||
|
{
|
||||||
|
m_appProgressIndicator = NULL;
|
||||||
|
if ( HasFlag(wxGA_PROGRESS) )
|
||||||
|
{
|
||||||
|
wxWindow* topParent = wxGetTopLevelParent(this);
|
||||||
|
if ( topParent != NULL )
|
||||||
|
{
|
||||||
|
m_appProgressIndicator =
|
||||||
|
new wxAppProgressIndicator(topParent, GetRange());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool wxGaugeBase::Create(wxWindow *parent,
|
bool wxGaugeBase::Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
int range,
|
int range,
|
||||||
@@ -122,23 +136,15 @@ bool wxGaugeBase::Create(wxWindow *parent,
|
|||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
#endif // wxUSE_VALIDATORS
|
#endif // wxUSE_VALIDATORS
|
||||||
|
|
||||||
m_appProgressIndicator = NULL;
|
|
||||||
if ( (style & wxGA_PROGRESS) != 0 )
|
|
||||||
{
|
|
||||||
wxWindow* topParent = wxGetTopLevelParent(this);
|
|
||||||
if ( topParent != NULL )
|
|
||||||
{
|
|
||||||
m_appProgressIndicator =
|
|
||||||
new wxAppProgressIndicator(topParent, range);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetRange(range);
|
SetRange(range);
|
||||||
SetValue(0);
|
SetValue(0);
|
||||||
|
|
||||||
#if wxGAUGE_EMULATE_INDETERMINATE_MODE
|
#if wxGAUGE_EMULATE_INDETERMINATE_MODE
|
||||||
m_nDirection = wxRIGHT;
|
m_nDirection = wxRIGHT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
InitProgressIndicatorIfNeeded();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -97,6 +97,8 @@ bool wxGauge::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetRange(range);
|
SetRange(range);
|
||||||
|
|
||||||
|
InitProgressIndicatorIfNeeded();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user