void erase_widget(MyGUI::VectorWidgetPtr& _mass, MyGUI::Widget* _widget) { for (MyGUI::VectorWidgetPtr::iterator iter = _mass.begin(); iter != _mass.end(); ++iter) { if (*iter == _widget) { *iter = _mass.back(); _mass.pop_back(); return; } } }
//------------------------------------------------------------------------------ void MyguiConsoleUI::buildGui() { // load console layout MyGUI::VectorWidgetPtr widgets = MyGUI::LayoutManager::getInstance().loadLayout("console.layout"); mwWnd = static_cast<MyGUI::Window*>(*widgets.begin()); mwWnd->setVisible(false); mwCmd = static_cast<MyGUI::EditBox*>(mwWnd->findWidget("cmd")); mwCwd = static_cast<MyGUI::TextBox*>(mwWnd->findWidget("cwd")); mwOutput = static_cast<MyGUI::EditBox*>(mwWnd->findWidget("output")); }
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; } }
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout) : WindowBase(parLayout), mPinned(false) { ExposedWindow* window = mMainWidget->castType<ExposedWindow>(); mPinButton = window->getSkinWidget ("Button"); mPinButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonPressed); MyGUI::Button* button = NULL; MyGUI::VectorWidgetPtr widgets = window->getSkinWidgetsByName("Action"); for (MyGUI::VectorWidgetPtr::iterator it = widgets.begin(); it != widgets.end(); ++it) { if ((*it)->isUserString("HideWindowOnDoubleClick")) button = (*it)->castType<MyGUI::Button>(); } if (button) button->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &WindowPinnableBase::onDoubleClick); }
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; } }