| 67 | } |
| 68 | |
| 69 | void ListBoxDataControl::invalidateList() |
| 70 | { |
| 71 | mLastIndex = MyGUI::ITEM_NONE; |
| 72 | mListBox->setIndexSelected(MyGUI::ITEM_NONE); |
| 73 | |
| 74 | if (mParentData != nullptr) |
| 75 | { |
| 76 | for (size_t index = 0; index < mListBox->getItemCount(); index++) |
| 77 | mListBox->setItemDataAt(index, nullptr); |
| 78 | |
| 79 | const Data::VectorData& childs = DataUtility::getChildsByType(mParentData, mThisType); |
| 80 | |
| 81 | while (mListBox->getItemCount() > childs.size()) |
| 82 | mListBox->removeItemAt(mListBox->getItemCount() - 1); |
| 83 | |
| 84 | while (mListBox->getItemCount() < childs.size()) |
| 85 | mListBox->addItem(MyGUI::UString(), nullptr); |
| 86 | |
| 87 | for (size_t index = 0; index < childs.size(); index++) |
| 88 | { |
| 89 | DataPtr child = childs.at(index); |
| 90 | |
| 91 | bool unique = isDataEnabled(child); |
| 92 | if (unique) |
| 93 | mListBox->setItemNameAt(index, child->getPropertyValue(mPropertyForName)); |
| 94 | else |
| 95 | mListBox->setItemNameAt( |
| 96 | index, |
| 97 | replaceTags(mColourName) + child->getPropertyValue(mPropertyForName)); |
| 98 | |
| 99 | mListBox->setItemDataAt(index, child); |
| 100 | |
| 101 | connectToProperty(child); |
| 102 | } |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | mListBox->removeAllItems(); |
| 107 | } |
| 108 | |
| 109 | if (mHelpPanel != nullptr) |
| 110 | mHelpPanel->setVisible(mListBox->getItemCount() == 0); |
| 111 | } |
| 112 | |
| 113 | void ListBoxDataControl::invalidateSelection() |
| 114 | { |
nothing calls this directly
no test coverage detected