当前位置: 首页>>代码示例>>C++>>正文


C++ String::ToWide方法代码示例

本文整理汇总了C++中gd::String::ToWide方法的典型用法代码示例。如果您正苦于以下问题:C++ String::ToWide方法的具体用法?C++ String::ToWide怎么用?C++ String::ToWide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gd::String的用法示例。


在下文中一共展示了String::ToWide方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ShowTextInput

/**
 * Show a dialog so as to get a text from user
 */
bool GD_EXTENSION_API ShowTextInput( RuntimeScene & scene, gd::Variable & variable, const gd::String & message, const gd::String & title )
{
    sf::Clock timeSpent;
    gd::String result;

    //Display the box
    #if defined(WINDOWS)
    CInputBox ibox(NULL);
    if (ibox.DoModal(title.ToWide().c_str(), message.ToWide().c_str()))
        result = gd::String::FromWide(ibox.Text);
    #endif
    #if defined(LINUX) || defined(MACOS)
    std::string strResult;
    nw::TextInput dialog(title.ToLocale(), message.ToLocale(), strResult);
    dialog.wait_until_closed();
    result = gd::String::FromLocale(strResult); //Convert from locale
    #endif

    scene.GetTimeManager().NotifyPauseWasMade(timeSpent.getElapsedTime().asMicroseconds());//Don't take the time spent in this function in account.

    //Update the variable
    variable.SetString(result);

    return true;
}
开发者ID:yecaokinux,项目名称:GD,代码行数:28,代码来源:CommonDialogs.cpp

示例2: ShowMessageBox

/**
 * Display a simple message box.
 */
void GD_EXTENSION_API ShowMessageBox( RuntimeScene & scene, const gd::String & message, const gd::String & title )
{
    sf::Clock timeSpent;

    //Display the box
    #if defined(WINDOWS)
    MessageBoxW(NULL, message.ToWide().c_str(), title.ToWide().c_str(), MB_ICONINFORMATION);
    #endif
    #if defined(LINUX) || defined(MACOS)
    nw::MsgBox msgBox(title.ToLocale(), message.ToLocale());
    msgBox.wait_until_closed();
    #endif

    scene.GetTimeManager().NotifyPauseWasMade(timeSpent.getElapsedTime().asMicroseconds());//Don't take the time spent in this function in account.
}
开发者ID:yecaokinux,项目名称:GD,代码行数:18,代码来源:CommonDialogs.cpp

示例3: DisplayMessage

int DisplayMessage(const gd::String & message)
{
    std::cout << message;
    #if defined(WINDOWS)
    MessageBoxW(NULL, message.ToWide().c_str(), L"Fatal error", MB_ICONERROR);
    #endif
    return EXIT_FAILURE;
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:8,代码来源:main.cpp

示例4: ShowYesNoMsgBox

/**
 * Show a message box with Yes/No buttons
 */
void GD_EXTENSION_API ShowYesNoMsgBox( RuntimeScene & scene, gd::Variable & variable, const gd::String & message, const gd::String & title )
{
    sf::Clock timeSpent;

    gd::String result;

    //Display the box
    #if defined(WINDOWS)
    if( MessageBoxW(NULL, message.ToWide().c_str(), title.ToWide().c_str(), MB_ICONQUESTION | MB_YESNO) == IDYES)
        result = "yes";
    else
        result = "no";
    #endif
    #if defined(LINUX) || defined(MACOS)
    nw::YesNoMsgBox dialog(title.ToLocale(), message.ToLocale(), result.Raw());
    dialog.wait_until_closed();
    #endif

    scene.GetTimeManager().NotifyPauseWasMade(timeSpent.getElapsedTime().asMicroseconds());//Don't take the time spent in this function in account.

    //Update the variable
    variable.SetString(result); //Can only be "yes" or "no", no need to encode in UTF8
}
开发者ID:yecaokinux,项目名称:GD,代码行数:26,代码来源:CommonDialogs.cpp

示例5: ShowOpenFile

/**
 * Display an "open file" dialog
 */
void GD_EXTENSION_API ShowOpenFile( RuntimeScene & scene, gd::Variable & variable, const gd::String & title, gd::String filters )
{
    sf::Clock timeSpent;

    gd::String result;

    //Display the dialog
    #if defined(WINDOWS)
    //Process filters to match windows dialogs filters style.
    filters.Raw() = filters.Raw()+'\0';
    std::replace(filters.Raw().begin(), filters.Raw().end(), '|', '\0');

    OPENFILENAMEW toGetFileName; //Struct for the dialog
    wchar_t filePath[MAX_PATH];
    _wgetcwd(filePath, MAX_PATH);

    ZeroMemory(&toGetFileName, sizeof(OPENFILENAMEW));
    toGetFileName.lStructSize = sizeof(OPENFILENAMEW);
    toGetFileName.hwndOwner = NULL;
    toGetFileName.lpstrFile = filePath;
    toGetFileName.nMaxFile = MAX_PATH;
    toGetFileName.lpstrFilter = filters == "\0" ? NULL : filters.ToWide().c_str();
    toGetFileName.nFilterIndex = 1;
    toGetFileName.Flags = OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;;

    if(GetOpenFileNameW(&toGetFileName) == TRUE)
        result = gd::String::FromWide(filePath);
    #endif
    #if defined(LINUX) || defined(MACOS)
    std::string strResult;
    nw::OpenFile * dialog = new nw::OpenFile(title.ToLocale(), true, strResult);
    dialog->wait_until_closed();
    result = gd::String::FromLocale(strResult);
    #endif

    scene.GetTimeManager().NotifyPauseWasMade(timeSpent.getElapsedTime().asMicroseconds());//Don't take the time spent in this function in account.

    //Update the variable
    variable.SetString(result);
}
开发者ID:yecaokinux,项目名称:GD,代码行数:43,代码来源:CommonDialogs.cpp


注:本文中的gd::String::ToWide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。