X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5778dedc92f6d31435aa1cda6846979a0e9ad35b..ae1cdb2d075b89badb7e429cde5f331ccbff2aef:/src/common/rearrangectrl.cpp?ds=sidebyside diff --git a/src/common/rearrangectrl.cpp b/src/common/rearrangectrl.cpp index 5f6bc2bf06..a6865f9036 100644 --- a/src/common/rearrangectrl.cpp +++ b/src/common/rearrangectrl.cpp @@ -3,7 +3,6 @@ // Purpose: implementation of classes in wx/rearrangectrl.h // Author: Vadim Zeitlin // Created: 2008-12-15 -// RCS-ID: $Id$ // Copyright: (c) 2008 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -134,11 +133,11 @@ void wxRearrangeList::Swap(int pos1, int pos2) // first the label const wxString stringTmp = GetString(pos1); SetString(pos1, GetString(pos2)); - Check(pos1, IsChecked(pos2)); + SetString(pos2, stringTmp); // then the checked state const bool checkedTmp = IsChecked(pos1); - SetString(pos2, stringTmp); + Check(pos1, IsChecked(pos2)); Check(pos2, checkedTmp); // and finally the client data, if necessary @@ -150,8 +149,8 @@ void wxRearrangeList::Swap(int pos1, int pos2) case wxClientData_Object: { - wxClientData * const dataTmp = GetClientObject(pos1); - SetClientObject(pos1, GetClientObject(pos2)); + wxClientData * const dataTmp = DetachClientObject(pos1); + SetClientObject(pos1, DetachClientObject(pos2)); SetClientObject(pos2, dataTmp); } break; @@ -285,8 +284,19 @@ bool wxRearrangeDialog::Create(wxWindow *parent, // notice that the items in this sizer should be inserted accordingly to // wxRearrangeDialogSizerPositions order wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL); - sizerTop->Add(new wxStaticText(this, wxID_ANY, message), - wxSizerFlags().Border()); + + if ( !message.empty() ) + { + sizerTop->Add(new wxStaticText(this, wxID_ANY, message), + wxSizerFlags().Border()); + } + else + { + // for convenience of other wxRearrangeDialog code that depends on + // positions of sizer items, insert a dummy zero-sized item + sizerTop->AddSpacer(0); + } + sizerTop->Add(m_ctrl, wxSizerFlags(1).Expand().Border()); sizerTop->Add(CreateSeparatedButtonSizer(wxOK | wxCANCEL),