本文整理汇总了C++中mygui::Widget::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Widget::getName方法的具体用法?C++ Widget::getName怎么用?C++ Widget::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::Widget
的用法示例。
在下文中一共展示了Widget::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
BaseGui::BaseGui(std::string & layout)
{
std::string mainWidgetName = "main";
_layoutRoot = MyGUI::LayoutManager::getInstance().loadLayout(layout);
_mainWidget = nullptr;
for (MyGUI::VectorWidgetPtr::iterator it = _layoutRoot.begin(); it != _layoutRoot.end(); it++)
{
MyGUI::Widget* ptr = *it;
if (ptr->getName() == mainWidgetName)
{
_mainWidget = ptr;
return;
}
}
std::cout << "Could not find widget named " + mainWidgetName + " in layout " + layout << std::endl;
}
示例2: getWidgetSlotByScreenPosition_modified
MyGUI::Widget* StashPanel::getWidgetSlotByScreenPosition_modified(const MyGUI::types::TPoint<int>& _value)
{
int slot_count = this->mslot_container_panelWidget->getChildCount();
for (int i = 0; i < slot_count; i++)
{
MyGUI::Widget* widget = this->mslot_container_panelWidget->getChildAt(i);
if (widget->getAbsoluteRect().inside(_value))
{
MyGUI::types::TRect<int> big_rect = widget->getAbsoluteRect();
MyGUI::types::TSize<int> big_size = widget->getSize();
/********/
/* 1 2 */
/* 3 4 */
/********/
MyGUI::types::TRect<int> rect_1;
rect_1.set(big_rect.left, big_rect.top, big_rect.left + big_size.width / 2, big_rect.top + big_size.height / 2);
MyGUI::types::TRect<int> rect_2;
rect_2.set(big_rect.left + big_size.width / 2, big_rect.top, big_rect.left + big_size.width, big_rect.top + big_size.height / 2);
MyGUI::types::TRect<int> rect_3;
rect_3.set(big_rect.left, big_rect.top + big_size.height / 2, big_rect.left + big_size.width / 2, big_rect.top + big_size.height);
MyGUI::types::TRect<int> rect_4;
rect_4.set(big_rect.left + big_size.width / 2, big_rect.top + big_size.height / 2, big_rect.left + big_size.width , big_rect.top + big_size.height);
if (rect_1.inside(_value))
{
//LogManager::getSingletonPtr()->logMessage("rect_1");
return widget;
}
if (rect_2.inside(_value))
{
//LogManager::getSingletonPtr()->logMessage("rect_2");
std::string name = widget->getName();
std::vector<std::string> splitted = MyGUI::utility::split(name, "_");
if (!splitted.empty())
{
std::string slot_num = splitted.at(3);
std::vector<std::string> splitted_number = MyGUI::utility::split(slot_num, "x");
if (!splitted_number.empty())
{
int r = StringConverter::parseInt(splitted_number.at(0));
int c = StringConverter::parseInt(splitted_number.at(1));
MyGUI::Widget* ret = this->getWidgetSlotByRC(r, c+1);
return ret;
}
}
}
if (rect_3.inside(_value))
{
//LogManager::getSingletonPtr()->logMessage("rect_3");
std::string name = widget->getName();
std::vector<std::string> splitted = MyGUI::utility::split(name, "_");
if (!splitted.empty())
{
std::string slot_num = splitted.at(3);
std::vector<std::string> splitted_number = MyGUI::utility::split(slot_num, "x");
if (!splitted_number.empty())
{
int r = StringConverter::parseInt(splitted_number.at(0));
int c = StringConverter::parseInt(splitted_number.at(1));
MyGUI::Widget* ret = this->getWidgetSlotByRC(r+1, c);
return ret;
}
}
}
if (rect_4.inside(_value))
{
//LogManager::getSingletonPtr()->logMessage("rect_4");
std::string name = widget->getName();
std::vector<std::string> splitted = MyGUI::utility::split(name, "_");
if (!splitted.empty())
{
std::string slot_num = splitted.at(3);
std::vector<std::string> splitted_number = MyGUI::utility::split(slot_num, "x");
if (!splitted_number.empty())
{
int r = StringConverter::parseInt(splitted_number.at(0));
int c = StringConverter::parseInt(splitted_number.at(1));
MyGUI::Widget* ret = this->getWidgetSlotByRC(r+1, c+1);
return ret;
}
}
}
return widget; //should not return this !
}
}
return 0;
}