Fix inserting multiple items to wxRearrangeList
In wxRearrangeList implementations (like wxMSW) where DoInsertItemsInLoop() and DoInsertOneItem() are not used to insert multiple items, DoInsertItems() has to be overriden to do this insertion. See #17836.
This commit is contained in:
@@ -134,6 +134,7 @@ All (GUI):
|
|||||||
- Add wxStyledTextCtrl::AutoCompGetCurrentText() (NewPagodi).
|
- Add wxStyledTextCtrl::AutoCompGetCurrentText() (NewPagodi).
|
||||||
- Extend wxStyledTextCtrl::FindText() to return end position of matched
|
- Extend wxStyledTextCtrl::FindText() to return end position of matched
|
||||||
text (NewPagodi).
|
text (NewPagodi).
|
||||||
|
- Fix adding/removing items to/from wxRearrangeList.
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -100,6 +100,8 @@ public:
|
|||||||
virtual void Check(unsigned int item, bool check = true) wxOVERRIDE;
|
virtual void Check(unsigned int item, bool check = true) wxOVERRIDE;
|
||||||
|
|
||||||
int DoInsertOneItem(const wxString& item, unsigned int pos) wxOVERRIDE;
|
int DoInsertOneItem(const wxString& item, unsigned int pos) wxOVERRIDE;
|
||||||
|
int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos,
|
||||||
|
void **clientData, wxClientDataType type) wxOVERRIDE;
|
||||||
void DoDeleteOneItem(unsigned int n) wxOVERRIDE;
|
void DoDeleteOneItem(unsigned int n) wxOVERRIDE;
|
||||||
void DoClear() wxOVERRIDE;
|
void DoClear() wxOVERRIDE;
|
||||||
|
|
||||||
|
@@ -190,11 +190,25 @@ void wxRearrangeList::OnCheck(wxCommandEvent& event)
|
|||||||
|
|
||||||
int wxRearrangeList::DoInsertOneItem(const wxString& item, unsigned int pos)
|
int wxRearrangeList::DoInsertOneItem(const wxString& item, unsigned int pos)
|
||||||
{
|
{
|
||||||
wxCheckListBox::DoInsertOneItem(item, pos);
|
int ret = wxCheckListBox::DoInsertOneItem(item, pos);
|
||||||
// Item is not checked initially.
|
// Item is not checked initially.
|
||||||
const int idx = ~m_order.size();
|
const int idx = ~m_order.size();
|
||||||
m_order.Insert(idx, pos);
|
m_order.Insert(idx, pos);
|
||||||
return pos;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxRearrangeList::DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos,
|
||||||
|
void **clientData, wxClientDataType type)
|
||||||
|
{
|
||||||
|
int ret = wxCheckListBox::DoInsertItems(items, pos, clientData, type);
|
||||||
|
const size_t numItems = items.GetCount();
|
||||||
|
for ( size_t i = 0; i < numItems; i++ )
|
||||||
|
{
|
||||||
|
// Item is not checked initially.
|
||||||
|
const int idx = ~m_order.size();
|
||||||
|
m_order.Insert(idx, pos+i);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRearrangeList::DoDeleteOneItem(unsigned int n)
|
void wxRearrangeList::DoDeleteOneItem(unsigned int n)
|
||||||
|
Reference in New Issue
Block a user