本文整理汇总了C++中mygui::WidgetPtr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ WidgetPtr::getName方法的具体用法?C++ WidgetPtr::getName怎么用?C++ WidgetPtr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::WidgetPtr
的用法示例。
在下文中一共展示了WidgetPtr::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guiCallback
void GraphicsImpl::guiCallback(MyGUI::WidgetPtr sender)
{
std::string name = sender->getName();
if (name == "do") {
InformationManager::Instance()->postDataToFeed("gui_event", DataContainer(DO_BUTTON));
}
if (name == "exit") {
InformationManager::Instance()->postDataToFeed("gui_event", DataContainer(EXIT_BUTTON));
}
}
示例2: ButtonClick
void GuiPopup::ButtonClick(MyGUI::WidgetPtr wp)
{
// get result button id
btnResult = -1;
sscanf(wp->getName().c_str(), "PopBtn%d", &btnResult);
// save return fields from edits
EditBox* ed;
ed = (EditBox*)mWnd->findWidget("PopEdit0"); if (ed) edit0 = ed->getCaption();
ed = (EditBox*)mWnd->findWidget("PopEdit1"); if (ed) edit1 = ed->getCaption();
ed = (EditBox*)mWnd->findWidget("PopEdit2"); if (ed) edit2 = ed->getCaption();
ed = (EditBox*)mWnd->findWidget("PopEdit3"); if (ed) edit3 = ed->getCaption();
//Hide(); // done in delegate
mDelegates();
}
示例3: if
SpaceShipDesignerGUI::SpaceShipDesignerGUI(ENGINE *engine, SpaceShipDesigner *parent)
{
mParent = parent;
mEngine = engine;
mGUI = engine->loadGUI("Designer.layout");
for(MyGUI::VectorWidgetPtr::iterator i=mGUI.begin(); i!=mGUI.end(); ++i)
{
MyGUI::WidgetPtr w = *i;
if(w->getName() == "Root")
{
mRoot = w;
mRoot->setSize(mEngine->getWindow()->getWidth(), mEngine->getWindow()->getHeight());
for(size_t j=0; j<mRoot->getChildCount(); j++)
{
if(w->getChildAt(j)->getTypeName() == "Button")
w->getChildAt(j)->eventMouseButtonClick = MyGUI::newDelegate(SpaceShipDesignerGUI::buttonClicked);
else if(w->getChildAt(j)->getTypeName() == "EditBox")
((MyGUI::EditBox *)w->getChildAt(j))->eventEditTextChange = MyGUI::newDelegate(SpaceShipDesignerGUI::editBoxUpdated);
}
}
}
}
示例4: loadLayoutRecursive
void DashBoard::loadLayoutRecursive(MyGUI::WidgetPtr w)
{
std::string name = w->getName();
std::string anim = w->getUserString("anim");
std::string debug = w->getUserString("debug");
std::string linkArgs = w->getUserString("link");
// make it unclickable
w->setUserString("interactive", "0");
if (!debug.empty())
{
w->setVisible(false);
return;
}
// find the root widget and ignore debug widgets
if (name.size() > prefix.size())
{
std::string prefixLessName = name.substr(prefix.size());
if (prefixLessName == "_Main")
{
mainWidget = (MyGUI::WindowPtr)w;
// resize it
windowResized();
}
// ignore debug widgets
if (prefixLessName == "DEBUG")
{
w->setVisible(false);
return;
}
}
// animations for this control?
if (!linkArgs.empty())
{
layoutLink_t ctrl;
memset(&ctrl, 0, sizeof(ctrl));
if (!name.empty()) strncpy(ctrl.name, name.c_str(), 255);
ctrl.widget = w;
ctrl.initialSize = w->getSize();
ctrl.initialPosition = w->getPosition();
ctrl.last = 1337.1337f; // force update
ctrl.lastState = true;
// establish the link
{
replaceString(linkArgs, ">", ">");
replaceString(linkArgs, "<", "<");
String linkName = "";
if (linkArgs.empty())
{
LOG("Dashboard ("+filename+"/"+name+"): empty Link");
return;
}
// conditional checks
// TODO: improve the logic, this is crap ...
if (linkArgs.find(">") != linkArgs.npos)
{
Ogre::StringVector args = Ogre::StringUtil::split(linkArgs, ">");
if (args.size() == 2)
{
linkName = args[0];
ctrl.conditionArgument = StringConverter::parseReal(args[1]);
ctrl.condition = CONDITION_GREATER;
} else
{
LOG("Dashboard ("+filename+"/"+name+"): error in conditional Link: " + linkArgs);
return;
}
} else if (linkArgs.find("<") != linkArgs.npos )
{
Ogre::StringVector args = Ogre::StringUtil::split(linkArgs, "<");
if (args.size() == 2)
{
linkName = args[0];
ctrl.conditionArgument = StringConverter::parseReal(args[1]);
ctrl.condition = CONDITION_LESSER;
} else
{
LOG("Dashboard ("+filename+"/"+name+"): error in conditional Link: " + linkArgs);
return;
}
} else
{
ctrl.condition = CONDITION_NONE;
ctrl.conditionArgument = 0;
linkName = linkArgs;
}
// now try to get the enum id for it
int linkID = manager->getLinkIDForName(linkName);
if (linkID < 0)
{
//.........这里部分代码省略.........