本文整理汇总了C++中mygui::UString类的典型用法代码示例。如果您正苦于以下问题:C++ UString类的具体用法?C++ UString怎么用?C++ UString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: notifyButtonPressed
void Console::notifyButtonPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char)
{
MyGUI::EditBox* edit = _sender->castType<MyGUI::EditBox>();
size_t len = edit->getCaption().length();
if ((_key == MyGUI::KeyCode::Backspace) && (len > 0) && (mAutocomleted))
{
edit->deleteTextSelection();
len = edit->getCaption().length();
edit->eraseText(len - 1);
}
MyGUI::UString command = edit->getCaption();
if (command.length() == 0)
return;
for (MapDelegate::iterator iter = mDelegates.begin(); iter != mDelegates.end(); ++iter)
{
if (iter->first.find(command) == 0)
{
if (command == iter->first) break;
edit->setCaption(iter->first);
edit->setTextSelection(command.length(), iter->first.length());
mAutocomleted = true;
return;
}
}
mAutocomleted = false;
}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:28,代码来源:Console.cpp
示例2: executeCommand
bool CommandManager::executeCommand(const MyGUI::UString& _command)
{
bool result = false;
MyGUI::UString command = _command;
size_t index = _command.find('.');
MYGUI_LOG(Warning , "+++++:Menu Command apply :" << command << "+++++");
if (index != MyGUI::UString::npos)
{
command = _command.substr(0, index);
mData = _command.substr(index + 1);
}
MapDelegate::iterator iter = mDelegates.find(command);
if (iter != mDelegates.end())
{
iter->second(command, result);
}
else
{
MYGUI_LOG(Warning, "Command '" << command << "' not found");
}
mData.clear();
return result;
}
开发者ID:ruananswer,项目名称:RssDemo2013,代码行数:26,代码来源:CommandManager.cpp
示例3: updateActorTheme
void StatePanel::updateActorTheme(const MyGUI::UString& commandName, bool& result)
{
std::string materialname = commandName.substr(commandName.find_first_of('_') + 1);
Animation * anim = getActiveAnimation();
if(anim != nullptr)
{
anim->upateActorTheme(materialname);
}
}
开发者ID:dtbinh,项目名称:AncelApp,代码行数:9,代码来源:StatePanel.cpp
示例4: toNumber
inline NumberType toNumber(MyGUI::UString numberString)
{
if (numberString.substr(0, 4).compare("true") == 0) return 1;
else if (numberString.substr(0, 4).compare("false") == 0) return 0;
std::istringstream converter(numberString);
if (typeid(NumberType) == typeid(bool))
{
int result;
return (converter >> result).fail() ? false : !!result;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:12,代码来源:FlashValue.cpp
示例5: CalcTextWidth
MyGUI::IntSize CalcTextWidth( MyGUI::UString text,string font ){
MyGUI::FontManager* pfm = MyGUI::FontManager::getInstancePtr();
MyGUI::IFont* pf = pfm->getByName(font);
MyGUI::IntSize size;
size.height = pf->getDefaultHeight();
if( pf ){
for( MyGUI::UString::iterator i=text.begin();i!=text.end();++i ){
MyGUI::GlyphInfo* pg = pf->getGlyphInfo(*i);
if( pg ){
size.width += (int)pg->width;
}
}
}
return size;
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:15,代码来源:SimpleUI.cpp
示例6: bind
void FlashControl::bind(const MyGUI::UString& funcName, FlashDelegate::IDelegate* callback)
{
if (funcName.empty() || callback == 0)
return;
delegateMap[funcName] = callback;
}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:7,代码来源:FlashControl.cpp
示例7: convertProjectName
MyGUI::UString EditorState::convertProjectName(const MyGUI::UString& _fileName)
{
size_t pos = mFileName.find_last_of("\\/");
MyGUI::UString shortName = pos == MyGUI::UString::npos ? mFileName : mFileName.substr(pos + 1);
addUserTag("ResourceName", shortName);
size_t index = _fileName.find("|");
if (index == MyGUI::UString::npos)
return _fileName;
MyGUI::UString fileName = _fileName.substr(0, index);
MyGUI::UString itemIndexName = _fileName.substr(index + 1);
size_t itemIndex = MyGUI::utility::parseValue<size_t>(itemIndexName);
MyGUI::xml::Document doc;
if (!doc.open(fileName))
return _fileName;
MyGUI::xml::ElementPtr root = doc.getRoot();
if ((nullptr == root) || (root->getName() != "MyGUI"))
return _fileName;
if (root->findAttribute("type") == "Resource")
{
// берем детей и крутимся
MyGUI::xml::ElementEnumerator element = root->getElementEnumerator();
while (element.next("Resource"))
{
if (element->findAttribute("type") == "ResourceLayout")
{
if (itemIndex == 0)
{
// поменять на теги
std::string resourceName = element->findAttribute("name");
addUserTag("ResourceName", resourceName);
return MyGUI::utility::toString(fileName, " [", resourceName, "]");
}
else
{
itemIndex --;
}
}
}
}
return _fileName;
}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:47,代码来源:EditorState.cpp
示例8:
//--------------------------------------------------------------------------------
void Chat::Log(const MyGUI::UString& str, const MyGUI::UString& color)
{
Framework::System::Log::Debug(std::string("Chat: ") + str.asUTF8());
mMessagesMutex.lock();
mMessages.push_back(std::make_pair(str,color));
mMessagesMutex.unlock();
}
开发者ID:commodoremartin,项目名称:SkyrimOnline,代码行数:11,代码来源:Chat.cpp
示例9: addRecentFolder
void RecentFilesManager::addRecentFolder(const MyGUI::UString& _folder)
{
MyGUI::UString folder(_folder);
if (_folder.empty())
folder = MyGUI::UString(common::getSystemCurrentFolder());
mRecentFolders.insert(mRecentFolders.begin(), folder);
checkArray(mRecentFolders, mMaxRecentFolders);
}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:10,代码来源:RecentFilesManager.cpp
示例10: setModeSaveLoadDialog
void EditorState::setModeSaveLoadDialog(bool _save, const MyGUI::UString& _filename)
{
if (_save)
mOpenSaveFileDialog->setDialogInfo(localise("Save"), localise("Save"));
else
mOpenSaveFileDialog->setDialogInfo(localise("Load"), localise("Load"));
size_t pos = _filename.find_last_of(L"\\/");
if (pos == MyGUI::UString::npos)
{
mOpenSaveFileDialog->setFileName(_filename);
}
else
{
mOpenSaveFileDialog->setCurrentFolder(_filename.substr(0, pos));
mOpenSaveFileDialog->setFileName(_filename.substr(pos + 1));
}
mOpenSaveFileDialog->setVisible(true);
mModeSaveDialog = _save;
}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:21,代码来源:EditorState.cpp
示例11: showMessages
void GroupMessage::showMessages()
{
if (mWarningMessages.size())
{
MyGUI::UString warningMess;
for (MyGUI::VectorString::iterator iter = mWarningMessages.begin(); iter != mWarningMessages.end(); ++iter)
{
if (warningMess.empty()) warningMess = warningMess + *iter;
else warningMess = warningMess + "\n" + *iter;
}
if (!warningMess.empty())
MyGUI::Message::createMessageBox("Message", localise("Warning"), warningMess, MyGUI::MessageBoxStyle::IconWarning | MyGUI::MessageBoxStyle::Ok);
mWarningMessages.clear();
}
if (mErrorMessages.size())
{
MyGUI::UString errorMessages;
for (MyGUI::VectorString::iterator iter = mErrorMessages.begin(); iter != mErrorMessages.end(); ++iter)
{
if (errorMessages.empty()) errorMessages = errorMessages + *iter;
else errorMessages = errorMessages + "\n" + *iter;
}
if (!errorMessages.empty())
MyGUI::Message::createMessageBox("Message", localise("Error"), errorMessages , MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok);
mErrorMessages.clear();
}
}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:30,代码来源:GroupMessage.cpp
示例12: editBoxUpdated
void SpaceShipDesignerGUI::editBoxUpdated(MyGUI::EditBox *widget)
{
MyGUI::UString caption = widget->getCaption();
if(widget->getName() == "SelectFloorFrom")
{
if(caption == "")
mParent->enableSelectedFloorFrom(false);
else
{
mParent->setSelectedFloorFrom(atoi(caption.asUTF8().c_str()));
}
}
else if(widget->getName() == "SelectFloorTo")
{
if(caption == "")
mParent->enableSelectedFloorTo(false);
else
{
mParent->setSelectedFloorTo(atoi(caption.asUTF8().c_str()));
}
}
}
开发者ID:Gerold31,项目名称:SpaceCraft,代码行数:22,代码来源:SpaceShipDesignerGUI.cpp
示例13: setCaption
void EditText::setCaption(const MyGUI::UString& _value)
{
if (mCaption != _value) {
mCaption = _value;
mTextOutDate = true;
}
if (mFont) {
mFont->AllocateSymbols(_value.c_str());
}
if (nullptr != mNode)
mNode->outOfDate(mRenderItem);
}
开发者ID:andryblack,项目名称:sandbox,代码行数:14,代码来源:sb_mygui_edit_text.cpp
示例14: update
void TextView::update(const MyGUI::UString& _text, const Sandbox::FontPtr& _font , MyGUI::Align _align, int _maxWidth)
{
m_font = _font;
mViewSize.clear();
mTextData.Clear();
FontAlign align = ALIGN_LEFT;
if (_align.isHCenter())
align = ALIGN_CENTER;
if (_align.isRight())
align = ALIGN_RIGHT;
mTextData.Fill(_text.c_str(), _font, _maxWidth, align);
mViewSize = MyGUI::IntSize(mTextData.size.w,mTextData.size.h);
}
开发者ID:andryblack,项目名称:sandbox,代码行数:17,代码来源:sb_mygui_text_view.cpp
示例15: showMessages
void GroupMessage::showMessages()
{
if (mWarningMessages.size())
{
MyGUI::UString warningMess;
for (VectorUString::const_iterator iter = mWarningMessages.begin(); iter != mWarningMessages.end(); ++iter)
{
if (warningMess.empty())
warningMess = warningMess + *iter;
else
warningMess = warningMess + "\n" + *iter;
}
if (!warningMess.empty())
{
/*MyGUI::Message* message = */MessageBoxManager::getInstance().create(
replaceTags("Warning"),
warningMess,
MyGUI::MessageBoxStyle::IconWarning | MyGUI::MessageBoxStyle::Ok);
}
mWarningMessages.clear();
}
if (mErrorMessages.size())
{
MyGUI::UString errorMessages;
for (VectorUString::const_iterator iter = mErrorMessages.begin(); iter != mErrorMessages.end(); ++iter)
{
if (errorMessages.empty())
errorMessages = errorMessages + *iter;
else
errorMessages = errorMessages + "\n" + *iter;
}
if (!errorMessages.empty())
{
/*MyGUI::Message* message = */MessageBoxManager::getInstance().create(
replaceTags("Error"),
errorMessages,
MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok);
}
mErrorMessages.clear();
}
}
开发者ID:alexis-,项目名称:iwe,代码行数:44,代码来源:GroupMessage.cpp
示例16: keyPressed
bool WinState::keyPressed(const OIS::KeyEvent &e)
{
MyGUI::UString txt = user_name_txt->getCaption();
if ((int)e.key==14 && txt.size()>0)
{
txt.resize(txt.size()-1);
}
else
{
if (((int)e.text >=65 && (int)e.text<=90) || ((int)e.text>=97 && (int)e.text<=122))
{
if (txt.size()<CONSTANTS_MAX_USERNAME_SIZE) txt.push_back(e.text);
}
}
user_name_txt->setCaption(txt);
if ((e.key == OIS::KC_ESCAPE) || (e.key == OIS::KC_RETURN) || (e.key == OIS::KC_R))
{
cout << "NEW RECORD TO SAVE" << endl;
save_record();
popState();
}
return true;
}
开发者ID:jalcolea,项目名称:cars,代码行数:24,代码来源:WinState.cpp
示例17: setCurrentFolder
void OpenSaveFileDialog::setCurrentFolder(const MyGUI::UString& _folder)
{
mCurrentFolder = _folder.empty() ? MyGUI::UString(common::getSystemCurrentFolder()) : _folder;
update();
}
开发者ID:alexis-,项目名称:iwe,代码行数:6,代码来源:OpenSaveFileDialog.cpp
示例18: keyPressed
bool PlayState::keyPressed(const OIS::KeyEvent &e)
{
if (!user_name_txt->getVisible())
{
// if (paused) pause(); // ESTO NO ES NECESARIO. AL HACER UN PUSHSTATE EL GAMEMANAGER LLAMARÁ A PAUSE() AUTOMATICAMENTE
// else
if (!paused)
{
if (e.key == OIS::KC_P) {
paused = true;
pushState(PauseState::getSingletonPtr());
}
else if (e.key == OIS::KC_G) {
paused = true;
game_over();
}
else if (e.key == OIS::KC_W) {
win();
}
else if (e.key == OIS::KC_UP)
{
_pacmanDir = UP_DIR;
}
else if (e.key == OIS::KC_DOWN) {
_pacmanDir = DOWN_DIR;
}
else if (e.key == OIS::KC_LEFT) {
_pacmanDir = LEFT_DIR;
}
else if (e.key == OIS::KC_RIGHT) {
_pacmanDir = RIGHT_DIR;
}
// else if (e.key == OIS::KC_ESCAPE) {
// popState();
// pushState(IntroState::getSingletonPtr());
// }
}
}
else
{
sounds::getInstance()->play_effect("eat_fruit");
MyGUI::UString txt = user_name_txt->getCaption();
if ((int)e.key==14 && txt.size()>0) txt.resize(txt.size()-1);
else
{
if (((int)e.text >=65 && (int)e.text<=90) || ((int)e.text>=97 && (int)e.text<=122))
{
if (txt.size()<3) txt.push_back(e.text);
}
}
user_name_txt->setCaption(txt);
if (e.key==OIS::KC_RETURN)
{
cout << "NEW RECORD TO SAVE" << endl;
records::getInstance()->add_record(txt,get_score());
records::getInstance()->saveFile(NULL);
sounds::getInstance()->play_effect("eat_ghost");
user_name_txt->setVisible(false);
popState();
stopWorld = false;
}
}
return true;
}
开发者ID:trojanwarrior,项目名称:pacman,代码行数:66,代码来源:PlayState.cpp
示例19: Show
bool GuiPopup::Show(
PopupDelegate* delegate, const UString& title, bool modal,
const MyGUI::UString& text0, const MyGUI::UString& text1, const MyGUI::UString& text2, const MyGUI::UString& text3,
const MyGUI::UString& edit0, const MyGUI::UString& edit1, const MyGUI::UString& edit2, const MyGUI::UString& edit3,
const MyGUI::UString& button0, const MyGUI::UString& button1, const MyGUI::UString& button2, const MyGUI::UString& button3)
{
if (isVisible)
return false;
isVisible = true;
btnResult = -1;
// window -----------------------
int numEdits = 0;
if (!text0.empty()) ++numEdits; if (!text1.empty()) ++numEdits;
if (!text2.empty()) ++numEdits; if (!text3.empty()) ++numEdits;
int scr_w = mPlatform->getRenderManagerPtr()->getViewSize().width, scr_h = mPlatform->getRenderManagerPtr()->getViewSize().height;
int wnd_w = 392, wnd_h = 140 + numEdits * 80,
wnd_x = (scr_w - wnd_w)/2, wnd_y = (scr_h - wnd_h)/2; // center
mWnd = mGUI->createWidget<Window>("WindowC", wnd_x,wnd_y, wnd_w,wnd_h, Align::Center, "Popup", "WndPop");
mWnd->setColour(Colour(0.8f,0.96f,1.f));
mWnd->setAlpha(0.9f);
mWnd->setCaption(title);
mDelegates.clear(); // add delegate
mDelegates += delegate;
if (modal)
InputManager::getInstance().addWidgetModal(mWnd);
// text, edit -----------------------
int y = 24, yadd = 80;
if (!text0.empty()) {
TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16, y, 352,28, Align::Default, "PopText0"); text->setCaption(text0);
EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit0"); edit->setCaption(edit0);
y += yadd;
}
if (!text1.empty()) {
TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16, y, 352,28, Align::Default, "PopText1"); text->setCaption(text1);
EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit1"); edit->setCaption(edit1);
y += yadd;
}
if (!text2.empty()) {
TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16, y, 352,28, Align::Default, "PopText2"); text->setCaption(text2);
EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit2"); edit->setCaption(edit2);
y += yadd;
}
if (!text3.empty()) {
TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16, y, 352,28, Align::Default, "PopText3"); text->setCaption(text3);
EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit3"); edit->setCaption(edit3);
y += yadd;
}
// buttons -----------------------
y += 12;
int numBtns = 0;
if (!button0.empty()) ++numBtns; if (!button1.empty()) ++numBtns;
if (!button2.empty()) ++numBtns; if (!button3.empty()) ++numBtns;
if (numBtns == 0) ++numBtns; // at least 1
int xmarg = 20, w = (wnd_w - xmarg*2) / numBtns;
int x = wnd_w - xmarg - w;
if (!button0.empty()) {
Button* btn = mWnd->createWidget<Button>("Button", x,y, w-16,36, Align::Default, "PopBtn0"); btn->setCaption(button0);
btn->setColour(Colour(0.7f,0.85f,1.0f));
btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick); x -= w;
}
if (!button1.empty()) {
Button* btn = mWnd->createWidget<Button>("Button", x,y, w-16,36, Align::Default, "PopBtn1"); btn->setCaption(button1);
btn->setColour(Colour(0.6f,0.8f,1.0f));
btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick); x -= w;
}
if (!button2.empty()) {
Button* btn = mWnd->createWidget<Button>("Button", x,y, w-16,36, Align::Default, "PopBtn2"); btn->setCaption(button2);
btn->setColour(Colour(0.6f,0.8f,1.0f));
btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick); x -= w;
}
if (!button3.empty()) {
Button* btn = mWnd->createWidget<Button>("Button", x,y, w-16,36, Align::Default, "PopBtn3"); btn->setCaption(button3);
btn->setColour(Colour(0.6f,0.8f,1.0f));
btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick); x -= w;
}
return true;
}
开发者ID:jacobgogogo,项目名称:stuntrally,代码行数:88,代码来源:Gui_Popup.cpp
示例20: notifyTreeNodePrepare
void SampleLayout::notifyTreeNodePrepare(MyGUI::TreeControl* pTreeControl, MyGUI::TreeControl::Node* pNode)
{
if (pNode == pTreeControl->getRoot())
return;
pNode->removeAll();
/*#ifdef MYGUI_OGRE_PLATFORM
Ogre::Archive* pArchive = *(pNode->getData<Ogre::Archive*>());
MyGUI::UString strPath(getPath(pNode));
Ogre::StringVectorPtr Resources = pArchive->find(strPath + "*", false, true);
for (Ogre::StringVector::iterator Iterator = Resources->begin(); Iterator != Resources->end(); ++Iterator)
{
MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node(*Iterator, "Folder");
pChild->setData(pArchive);
pNode->add(pChild);
}
Resources = pArchive->find(strPath + "*", false, false);
for (Ogre::StringVector::iterator Iterator = Resources->begin(); Iterator != Resources->end(); ++Iterator)
{
MyGUI::UString strName(*Iterator);
MyGUI::UString strExtension;
size_t nPosition = strName.rfind(".");
if (nPosition != MyGUI::UString::npos)
{
strExtension = strName.substr(nPosition + 1);
std::transform(strExtension.begin(), strExtension.end(), strExtension.begin(), tolower);
}
MyGUI::UString strImage;
if (strExtension == "png" || strExtension == "tif" || strExtension == "tiff" || strExtension == "jpg" || strExtension == "jpeg")
strImage = "Image";
else
if (strExtension == "mat" || strExtension == "material")
strImage = "Material";
else
if (strExtension == "layout")
strImage = "Layout";
else
if (strExtension == "ttf" || strExtension == "font" || strExtension == "fontdef")
strImage = "Font";
else
if (strExtension == "txt" || strExtension == "text")
strImage = "Text";
else
if (strExtension == "xml")
strImage = "XML";
else
if (strExtension == "mesh")
strImage = "Mesh";
else
if (strExtension == "htm" || strExtension == "html")
strImage = "HTML";
else
strImage = "Unknown";
MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node(strName, strImage);
pChild->setPrepared(true);
pNode->add(pChild);
}
#else*/
PairFileInfo info = *(pNode->getData<PairFileInfo>());
// если папка, то добавляем детей
if (info.second.folder)
{
std::wstring path = info.first + L"/" + info.second.name;
common::VectorFileInfo result;
common::getSystemFileList(result, path, L"*.*");
for (common::VectorFileInfo::iterator item = result.begin(); item != result.end(); ++item)
{
if ((*item).name == L".." || (*item).name == L".")
continue;
if ((*item).folder)
{
MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node((*item).name, "Folder");
pChild->setData(PairFileInfo(path, *item));
pNode->add(pChild);
}
else
{
MyGUI::UString strName((*item).name);
MyGUI::UString strExtension;
size_t nPosition = strName.rfind(".");
if (nPosition != MyGUI::UString::npos)
{
strExtension = strName.substr(nPosition + 1);
std::transform(strExtension.begin(), strExtension.end(), strExtension.begin(), tolower);
}
MyGUI::UString strImage;
if (strExtension == "png" || strExtension == "tif" || strExtension == "tiff" || strExtension == "jpg" || strExtension == "jpeg")
strImage = "Image";
else if (strExtension == "mat" || strExtension == "material")
strImage = "Material";
else if (strExtension == "layout")
strImage = "Layout";
else if (strExtension == "ttf" || strExtension == "font" || strExtension == "fontdef")
//.........这里部分代码省略.........
开发者ID:chhawk,项目名称:MyGUI,代码行数:101,代码来源:DemoKeeper.cpp
注:本文中的mygui::UString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论