MCPcopy Create free account
hub / github.com/MyGUI/mygui / sortList

Method sortList

MyGUIEngine/src/MyGUI_MultiListBox.cpp:407–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405 }
406
407 void MultiListBox::sortList()
408 {
409 if (ITEM_NONE == mSortColumnIndex)
410 return;
411
412 ListBox* list = mVectorColumnInfo[mSortColumnIndex].list;
413
414 size_t count = list->getItemCount();
415 if (0 == count)
416 return;
417
418 // shell sort
419 int first;
420 size_t last;
421 for (size_t step = count >> 1; step > 0; step >>= 1)
422 {
423 for (size_t i = 0; i < (count - step); i++)
424 {
425 first = (int)i;
426 while (first >= 0)
427 {
428 last = first + step;
429 if (compare(list, first, last))
430 {
431 BiIndexBase::swapItemsBackAt(first, last);
432 for (auto& iter : mVectorColumnInfo)
433 {
434 iter.list->swapItemsAt(first, last);
435 }
436 }
437 first--;
438 }
439 }
440 }
441
442 frameAdvise(false);
443
444 updateBackSelected(BiIndexBase::convertToBack(mItemSelected));
445 }
446
447 void MultiListBox::insertItemAt(size_t _index, const UString& _name, Any _data)
448 {

Callers

nothing calls this directly

Calls 3

compareFunction · 0.85
getItemCountMethod · 0.45
swapItemsAtMethod · 0.45

Tested by

no test coverage detected