//################################################################################################## // // Custom Visualization Core library // Copyright (C) 2011-2012 Ceetron AS // // This library is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This library is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at <> // for more details. // //################################################################################################## #include "cafPdmUiOrdering.h" namespace caf { //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- PdmUiOrdering::~PdmUiOrdering() { for (size_t i = 0; i < m_createdGroups.size(); ++i) { delete m_createdGroups[i]; m_createdGroups[i] = NULL; } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- PdmUiGroup* PdmUiOrdering::addNewGroup(QString displayName) { PdmUiGroup* group = new PdmUiGroup; group->setUiName(displayName); m_createdGroups.push_back(group); m_ordering.push_back(group); return group; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool PdmUiOrdering::contains(const PdmUiItem* item) { for (size_t i = 0; i < m_ordering.size(); ++i) { if (m_ordering[i] == item) return true; if (m_ordering[i] && m_ordering[i]->isUiGroup()) { if (static_cast(m_ordering[i])->contains(item)) return true; } } return false; } } //End of namespace caf