Fix errors in handling of maximum field in wxGenericProgressDialog.

Provide a SetMaximum() function for setting just m_maximum and return its
value from GetRange() instead of using m_gauge->GetRange() which doesn't work
when the native MSW version is used nor when the range is > USHRT_MAX under
MSW in any case.

More generally, this should fix a lot of bugs for progress dialogs using such
range as the values were not interpreted correctly in many places.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-09-10 17:25:58 +00:00
parent 4f4d6f44f9
commit 2de77c6a54
3 changed files with 69 additions and 59 deletions

View File

@@ -67,7 +67,7 @@ public:
protected:
// This ctor is used by the native MSW implementation only.
wxGenericProgressDialog(wxWindow *parent, int maximum, int style);
wxGenericProgressDialog(wxWindow *parent, int style);
void Create(const wxString& title,
const wxString& message,
@@ -75,6 +75,12 @@ protected:
wxWindow *parent,
int style);
// Update just the m_maximum field, this is used by public SetRange() but,
// unlike it, doesn't update the controls state. This makes it useful for
// both this class and its derived classes that don't use m_gauge to
// display progress.
void SetMaximum(int maximum);
// Return the labels to use for showing the elapsed/estimated/remaining
// times respectively.
static wxString GetElapsedLabel() { return _("Elapsed time:"); }
@@ -144,7 +150,7 @@ private:
static void SetTimeLabel(unsigned long val, wxStaticText *label);
// common part of all ctors
void Init(wxWindow *parent, int maximum, int style);
void Init(wxWindow *parent, int style);
// create the label with given text and another one to show the time nearby
// as the next windows in the sizer, returns the created control