From ae7e6cc946f85a9f12ab97f5860bf8d6235ec12a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 31 Dec 2008 13:27:28 +0000 Subject: [PATCH 1/1] added default ctor and Create() to wxRearrangeDialog for consistency git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/rearrangectrl.h | 21 +++++++++++++++++++- interface/wx/rearrangectrl.h | 38 +++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/include/wx/rearrangectrl.h b/include/wx/rearrangectrl.h index eb52fd96e4..da1b0c1d69 100644 --- a/include/wx/rearrangectrl.h +++ b/include/wx/rearrangectrl.h @@ -173,6 +173,9 @@ private: class WXDLLIMPEXP_CORE wxRearrangeDialog : public wxDialog { public: + // default ctor, use Create() later + wxRearrangeDialog() { Init(); } + // ctor for the dialog: message is shown inside the dialog itself, order // and items are passed to wxRearrangeList used internally wxRearrangeDialog(wxWindow *parent, @@ -181,13 +184,29 @@ public: const wxArrayInt& order, const wxArrayString& items, const wxPoint& pos = wxDefaultPosition, - const wxString& name = wxRearrangeDialogNameStr); + const wxString& name = wxRearrangeDialogNameStr) + { + Init(); + + Create(parent, message, title, order, items, pos, name); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& title, + const wxArrayInt& order, + const wxArrayString& items, + const wxPoint& pos = wxDefaultPosition, + const wxString& name = wxRearrangeDialogNameStr); // get the order of items after it was modified by the user wxArrayInt GetOrder() const { return m_ctrl->GetList()->GetCurrentOrder(); } private: + // common part of all ctors + void Init() { m_ctrl = NULL; } + wxRearrangeCtrl *m_ctrl; DECLARE_NO_COPY_CLASS(wxRearrangeDialog) diff --git a/interface/wx/rearrangectrl.h b/interface/wx/rearrangectrl.h index 721fe1c15e..9160b3efa7 100644 --- a/interface/wx/rearrangectrl.h +++ b/interface/wx/rearrangectrl.h @@ -266,9 +266,30 @@ public: class wxRearrangeDialog { public: + /** + Default constructor. + + Create() must be called later to effectively create the control. + */ + wxRearrangeDialog(); + /** Constructor creating the dialog. + Please see Create() for the parameters description. + */ + wxRearrangeDialog(wxWindow *parent, + const wxString& message, + const wxString& title, + const wxArrayInt& order, + const wxArrayString& items, + const wxPoint& pos = wxDefaultPosition, + const wxString& name = wxRearrangeDialogNameStr); + + /** + Effectively creates the dialog for an object created using the default + constructor. + @param parent The dialog parent, possibly @NULL. @param message @@ -284,14 +305,17 @@ public: Optional dialog position. @param name Optional dialog name. + @return + @true if the dialog was successfully created or @false if creation + failed. */ - wxRearrangeDialog(wxWindow *parent, - const wxString& message, - const wxString& title, - const wxArrayInt& order, - const wxArrayString& items, - const wxPoint& pos = wxDefaultPosition, - const wxString& name = wxRearrangeDialogNameStr); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& title, + const wxArrayInt& order, + const wxArrayString& items, + const wxPoint& pos = wxDefaultPosition, + const wxString& name = wxRearrangeDialogNameStr); /** Return the array describing the order of items after it was modified by -- 2.45.2