void ListBoxDataControl::notifyChangeProperty(PropertyPtr _sender) { if (mParentData == nullptr) return; if (mParentData != _sender->getOwner()->getParent()) return; for (size_t index = 0; index < mListBox->getItemCount(); index ++) { DataPtr data = *mListBox->getItemDataAt<DataPtr>(index); if (data == _sender->getOwner()) { bool unique = isDataEnabled(data); if (unique) mListBox->setItemNameAt(index, data->getPropertyValue(mPropertyForName)); else mListBox->setItemNameAt(index, replaceTags(mColourName) + data->getPropertyValue(mPropertyForName)); } } }
void ListBoxDataControl::invalidateList() { mLastIndex = MyGUI::ITEM_NONE; mListBox->setIndexSelected(MyGUI::ITEM_NONE); if (mParentData != nullptr) { for (size_t index = 0; index < mListBox->getItemCount(); index ++) mListBox->setItemDataAt(index, nullptr); const Data::VectorData& childs = DataUtility::getChildsByType(mParentData, mThisType); while (mListBox->getItemCount() > childs.size()) mListBox->removeItemAt(mListBox->getItemCount() - 1); while (mListBox->getItemCount() < childs.size()) mListBox->addItem("", nullptr); for (size_t index = 0; index < childs.size(); index ++) { DataPtr child = childs.at(index); bool unique = isDataEnabled(child); if (unique) mListBox->setItemNameAt(index, child->getPropertyValue(mPropertyForName)); else mListBox->setItemNameAt(index, replaceTags(mColourName) + child->getPropertyValue(mPropertyForName)); mListBox->setItemDataAt(index, child); connectToProperty(child); } } else { mListBox->removeAllItems(); } if (mHelpPanel != nullptr) mHelpPanel->setVisible(mListBox->getItemCount() == 0); }
//------------------------------------------------------------------------------ // Check the data filters and return true if we should process this type message //------------------------------------------------------------------------------ bool OutputHandler::isDataTypeEnabled(const DataRecordHandle* const handle) const { unsigned int id = handle->getRecord()->id(); return isDataEnabled(id); }