本文整理汇总了C++中mygui::UString类的典型用法代码示例。如果您正苦于以下问题:C++ UString类的具体用法?C++ UString怎么用?C++ UString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例6: bind
void FlashControl::bind(const MyGUI::UString& funcName, FlashDelegate::IDelegate* callback)
{
if (funcName.empty() || callback == 0)
return;
delegateMap[funcName] = callback;
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}
}
示例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()));
}
}
}
示例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);
}
示例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);
}
示例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();
}
}