Allow 2-step creation of wxGenericProgressDialog.
Add default ctor and Create() with the same parameters as the non-default ctor. Closes #13555. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69926 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,6 +27,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowDisabler;
|
|||||||
class WXDLLIMPEXP_CORE wxGenericProgressDialog : public wxDialog
|
class WXDLLIMPEXP_CORE wxGenericProgressDialog : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
wxGenericProgressDialog();
|
||||||
wxGenericProgressDialog(const wxString& title, const wxString& message,
|
wxGenericProgressDialog(const wxString& title, const wxString& message,
|
||||||
int maximum = 100,
|
int maximum = 100,
|
||||||
wxWindow *parent = NULL,
|
wxWindow *parent = NULL,
|
||||||
@@ -34,6 +35,12 @@ public:
|
|||||||
|
|
||||||
virtual ~wxGenericProgressDialog();
|
virtual ~wxGenericProgressDialog();
|
||||||
|
|
||||||
|
bool Create(const wxString& title,
|
||||||
|
const wxString& message,
|
||||||
|
int maximum = 100,
|
||||||
|
wxWindow *parent = NULL,
|
||||||
|
int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
|
||||||
|
|
||||||
virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL);
|
virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL);
|
||||||
virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);
|
virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);
|
||||||
|
|
||||||
@@ -67,15 +74,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// This ctor is used by the native MSW implementation only.
|
|
||||||
wxGenericProgressDialog(wxWindow *parent, int style);
|
|
||||||
|
|
||||||
void Create(const wxString& title,
|
|
||||||
const wxString& message,
|
|
||||||
int maximum,
|
|
||||||
wxWindow *parent,
|
|
||||||
int style);
|
|
||||||
|
|
||||||
// Update just the m_maximum field, this is used by public SetRange() but,
|
// 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
|
// 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
|
// both this class and its derived classes that don't use m_gauge to
|
||||||
@@ -95,7 +93,7 @@ protected:
|
|||||||
|
|
||||||
// Return the progress dialog style. Prefer to use HasPDFlag() if possible.
|
// Return the progress dialog style. Prefer to use HasPDFlag() if possible.
|
||||||
int GetPDStyle() const { return m_pdStyle; }
|
int GetPDStyle() const { return m_pdStyle; }
|
||||||
|
void SetPDStyle(int pdStyle) { m_pdStyle = pdStyle; }
|
||||||
|
|
||||||
// Updates estimated times from a given progress bar value and stores the
|
// Updates estimated times from a given progress bar value and stores the
|
||||||
// results in provided arguments.
|
// results in provided arguments.
|
||||||
@@ -151,7 +149,7 @@ private:
|
|||||||
static void SetTimeLabel(unsigned long val, wxStaticText *label);
|
static void SetTimeLabel(unsigned long val, wxStaticText *label);
|
||||||
|
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init(wxWindow *parent, int style);
|
void Init();
|
||||||
|
|
||||||
// create the label with given text and another one to show the time nearby
|
// 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
|
// as the next windows in the sizer, returns the created control
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ wxIMPLEMENT_CLASS(wxProgressDialog, wxDialog)
|
|||||||
// wxGenericProgressDialog creation
|
// wxGenericProgressDialog creation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxGenericProgressDialog::Init(wxWindow *parent, int style)
|
void wxGenericProgressDialog::Init()
|
||||||
{
|
{
|
||||||
// we may disappear at any moment, let the others know about it
|
// we may disappear at any moment, let the others know about it
|
||||||
SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT);
|
SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT);
|
||||||
@@ -95,9 +95,8 @@ void wxGenericProgressDialog::Init(wxWindow *parent, int style)
|
|||||||
// Initialize all our members that we always use (even when we don't
|
// Initialize all our members that we always use (even when we don't
|
||||||
// create a valid window in this class).
|
// create a valid window in this class).
|
||||||
|
|
||||||
m_pdStyle = style;
|
m_pdStyle = 0;
|
||||||
|
m_parentTop = NULL;
|
||||||
m_parentTop = wxGetTopLevelParent(parent);
|
|
||||||
|
|
||||||
m_gauge = NULL;
|
m_gauge = NULL;
|
||||||
m_msg = NULL;
|
m_msg = NULL;
|
||||||
@@ -129,10 +128,10 @@ void wxGenericProgressDialog::Init(wxWindow *parent, int style)
|
|||||||
m_tempEventLoop = NULL;
|
m_tempEventLoop = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGenericProgressDialog::wxGenericProgressDialog(wxWindow *parent, int style)
|
wxGenericProgressDialog::wxGenericProgressDialog()
|
||||||
: wxDialog()
|
: wxDialog()
|
||||||
{
|
{
|
||||||
Init(parent, style);
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGenericProgressDialog::wxGenericProgressDialog(const wxString& title,
|
wxGenericProgressDialog::wxGenericProgressDialog(const wxString& title,
|
||||||
@@ -142,24 +141,25 @@ wxGenericProgressDialog::wxGenericProgressDialog(const wxString& title,
|
|||||||
int style)
|
int style)
|
||||||
: wxDialog()
|
: wxDialog()
|
||||||
{
|
{
|
||||||
Init(parent, style);
|
Init();
|
||||||
|
|
||||||
Create( title, message, maximum, parent, style );
|
Create( title, message, maximum, parent, style );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericProgressDialog::Create( const wxString& title,
|
bool wxGenericProgressDialog::Create( const wxString& title,
|
||||||
const wxString& message,
|
const wxString& message,
|
||||||
int maximum,
|
int maximum,
|
||||||
wxWindow *parent,
|
wxWindow *parent,
|
||||||
int style )
|
int style )
|
||||||
{
|
{
|
||||||
// Notice that GetParentForModalDialog() needs the dialog window style, not
|
m_parentTop = wxGetTopLevelParent(parent);
|
||||||
// our wxProgressDialog-specific style.
|
m_pdStyle = style;
|
||||||
|
|
||||||
wxWindow* const
|
wxWindow* const
|
||||||
realParent = GetParentForModalDialog(parent, GetWindowStyle());
|
realParent = GetParentForModalDialog(parent, GetWindowStyle());
|
||||||
wxDialog::Create(realParent, wxID_ANY, title);
|
|
||||||
|
|
||||||
SetTitle( title );
|
if (!wxDialog::Create(realParent, wxID_ANY, title))
|
||||||
|
return false;
|
||||||
|
|
||||||
SetMaximum(maximum);
|
SetMaximum(maximum);
|
||||||
|
|
||||||
@@ -309,6 +309,7 @@ void wxGenericProgressDialog::Create( const wxString& title,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericProgressDialog::UpdateTimeEstimates(int value,
|
void wxGenericProgressDialog::UpdateTimeEstimates(int value,
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ wxProgressDialog::wxProgressDialog( const wxString& title,
|
|||||||
int maximum,
|
int maximum,
|
||||||
wxWindow *parent,
|
wxWindow *parent,
|
||||||
int style )
|
int style )
|
||||||
: wxGenericProgressDialog(parent, style),
|
: wxGenericProgressDialog(),
|
||||||
m_taskDialogRunner(NULL),
|
m_taskDialogRunner(NULL),
|
||||||
m_sharedData(NULL),
|
m_sharedData(NULL),
|
||||||
m_message(message),
|
m_message(message),
|
||||||
@@ -317,6 +317,7 @@ wxProgressDialog::wxProgressDialog( const wxString& title,
|
|||||||
if ( HasNativeTaskDialog() )
|
if ( HasNativeTaskDialog() )
|
||||||
{
|
{
|
||||||
SetParent(GetParentForModalDialog(parent, GetWindowStyle()));
|
SetParent(GetParentForModalDialog(parent, GetWindowStyle()));
|
||||||
|
SetPDStyle(style);
|
||||||
SetMaximum(maximum);
|
SetMaximum(maximum);
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
|
|||||||
Reference in New Issue
Block a user