void EditorWidgets::remove(MyGUI::WidgetPtr _widget) { // дети вперед MyGUI::VectorWidgetPtr childs = _widget->getChilds(); for (MyGUI::VectorWidgetPtr::iterator iter = childs.begin(); iter != childs.end(); ++iter) { if (null != find(*iter)) remove(*iter); } WidgetContainer * _container = find(_widget); MyGUI::Gui::getInstance().destroyWidget(_widget); if (null != _container) { widgets.erase(std::find(widgets.begin(), widgets.end(), _container)); delete _container; } }
void EditorWidgets::remove(MyGUI::WidgetPtr _widget) { // дети вперед MyGUI::VectorWidgetPtr childs = _widget->getChilds(); for (MyGUI::VectorWidgetPtr::iterator iter = childs.begin(); iter != childs.end(); ++iter) { if (null != find(*iter)) remove(*iter); } WidgetContainer * _container = find(_widget); MyGUI::WidgetPtr parent = _widget->getParent(); // FIXME у таба все не как у людей if ((null != parent) && (parent->getWidgetType() == "Tab")) MyGUI::castWidget<MyGUI::Tab>(parent)->removeSheet(MyGUI::castWidget<MyGUI::Sheet>(_widget)); else MyGUI::Gui::getInstance().destroyWidget(_widget); if (null != _container) { widgets.erase(std::find(widgets.begin(), widgets.end(), _container)); delete _container; } }