本文整理汇总了C++中mygui::WidgetPtr::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ WidgetPtr::getParent方法的具体用法?C++ WidgetPtr::getParent怎么用?C++ WidgetPtr::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::WidgetPtr
的用法示例。
在下文中一共展示了WidgetPtr::getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void PropertiesPanelView::update(MyGUI::WidgetPtr _current_widget)
{
current_widget = _current_widget;
if (nullptr == current_widget)
current_widget_rectangle->setVisible(false);
else
{
MyGUI::LayerManager::getInstance().upLayerItem(current_widget);
MyGUI::IntCoord coord = current_widget->getCoord();
MyGUI::WidgetPtr parent = current_widget->getParent();
if (nullptr != parent)
{
// если выбрали виджет на табе, то подн¤ть лист таба
if (parent->getTypeName() == "Sheet" || parent->getTypeName() == MyGUI::TabItem::getClassTypeName())
{
MyGUI::TabPtr tab = parent->getParent()->castType<MyGUI::Tab>();
MyGUI::SheetPtr sheet = parent->castType<MyGUI::Sheet>();
tab->setItemSelected(sheet);
}
// если выбрали лист таба, то подн¤ть лист таба
if (current_widget->getTypeName() == "Sheet" || current_widget->getTypeName() == MyGUI::TabItem::getClassTypeName())
{
MyGUI::TabPtr tab = parent->castType<MyGUI::Tab>();
MyGUI::SheetPtr sheet = current_widget->castType<MyGUI::Sheet>();
tab->setItemSelected(sheet);
}
coord = current_widget->getAbsoluteCoord();
}
current_widget_rectangle->setVisible(true);
current_widget_rectangle->setCoord(coord);
MyGUI::InputManager::getInstance().setKeyFocusWidget(current_widget_rectangle);
}
// delete all previous properties
for (std::vector<MyGUI::StaticTextPtr>::iterator iter = propertiesText.begin(); iter != propertiesText.end(); ++iter)
(*iter)->setVisible(false);
for (MyGUI::VectorWidgetPtr::iterator iter = propertiesElement.begin(); iter != propertiesElement.end(); ++iter)
(*iter)->setVisible(false);
if (nullptr == _current_widget)
{
mMainWidget->setVisible(false);
}
else
{
mMainWidget->setVisible(true);
pairs_counter = 0;
mPanelMainProperties->update(_current_widget);
mPanelTypeProperties->update(_current_widget, PanelProperties::TYPE_PROPERTIES);
mPanelGeneralProperties->update(_current_widget, PanelProperties::WIDGET_PROPERTIES);
mPanelEvents->update(_current_widget, PanelProperties::EVENTS);
mPanelItems->update(_current_widget);
mPanelUserData->update(_current_widget);
}
}
示例2: remove
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;
}
}
示例3: serialiseWidget
void EditorWidgets::serialiseWidget(WidgetContainer * _container, MyGUI::xml::xmlNodePtr _node)
{
MyGUI::xml::xmlNodePtr node = _node->createChild("Widget");
node->addAttributes("type", _container->type);
if ("" != _container->skin) node->addAttributes("skin", _container->skin);
if ("" != _container->position) node->addAttributes("position", _container->position);
if ("" != _container->position_real) node->addAttributes("position_real", _container->position_real);
if ("" != _container->align) node->addAttributes("align", _container->align);
if ("" != _container->layer) node->addAttributes("layer", _container->layer);
if ("" != _container->name) node->addAttributes("name", _container->name);
for (StringPairs::iterator iter = _container->mProperty.begin(); iter != _container->mProperty.end(); ++iter)
{
MyGUI::xml::xmlNodePtr nodeProp = node->createChild("Property");
nodeProp->addAttributes("key", iter->first);
nodeProp->addAttributes("value", iter->second);
}
for (MapString::iterator iter = _container->mUserString.begin(); iter != _container->mUserString.end(); ++iter)
{
MyGUI::xml::xmlNodePtr nodeProp = node->createChild("UserString");
nodeProp->addAttributes("key", iter->first);
nodeProp->addAttributes("value", iter->second);
}
// метод медленный, т.к. квадратичная сложность
for (std::vector<WidgetContainer*>::iterator iter = widgets.begin(); iter != widgets.end(); ++iter)
{
MyGUI::WidgetPtr parent = (*iter)->widget->getParent();
// сынок - это ты?
if (_container->widget->getWidgetType() == "Window"){
if (null != parent)
if (_container->widget == parent->getParent()) serialiseWidget(*iter, node);
}else if (_container->widget == parent) serialiseWidget(*iter, node);
}
}