// ----------------------------------------------------------------------------
void MessageDialog::loadedFromFile()
{
    LabelWidget* message = getWidget<LabelWidget>("title");
    message->setText( m_msg, false );

    // If the dialog is a simple 'OK' dialog, then hide the "Yes" button and
    // change "Cancel" to "OK"
    if (m_type == MessageDialog::MESSAGE_DIALOG_OK)
    {
        ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
        yesbtn->setVisible(false);

        ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
        cancelbtn->setText(_("OK"));
        cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    }
    else if (m_type == MessageDialog::MESSAGE_DIALOG_YESNO)
    {
        ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
        cancelbtn->setText(_("No"));

    }
    else if (m_type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL)
    {
        // In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok'
        ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
        yesbtn->setText(_("OK"));
    }
}
示例#2
0
void MessageDialog::doInit(MessageDialogType type,
                           IConfirmDialogListener* listener, bool own_listener)
{
    if (StateManager::get()->getGameState() == GUIEngine::GAME)
    {
        World::getWorld()->schedulePause(World::IN_GAME_MENU_PHASE);
    }


    loadFromFile("confirm_dialog.stkgui");

    m_listener = listener;
    m_own_listener = own_listener;

    LabelWidget* message = getWidget<LabelWidget>("title");
    message->setText( m_msg.c_str(), false );

    // If the dialog is a simple 'OK' dialog, then hide the "Yes" button and
    // change "Cancel" to "OK"
    if (type == MessageDialog::MESSAGE_DIALOG_OK)
    {
        ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
        yesbtn->setVisible(false);

        ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
        cancelbtn->setText(_("OK"));
        cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    }
    else if (type == MessageDialog::MESSAGE_DIALOG_YESNO)
    {
        ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");

        ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
        cancelbtn->setText(_("No"));

    }
    else if (type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL)
    {
        // In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok'
        ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
        yesbtn->setText(_("OK"));
    }
}
void MessageDialog::doInit(irr::core::stringw msg, MessageDialogType type,
                           IConfirmDialogListener* listener, bool own_listener)
{
    loadFromFile("confirm_dialog.stkgui");

    m_listener = listener;
    m_own_listener = own_listener;
    
    LabelWidget* message = getWidget<LabelWidget>("title");
    message->setText( msg.c_str(), false );

    // If the dialog is a simple 'OK' dialog, then hide the "Yes" button and
    // change "Cancel" to "OK"
    if (type == MessageDialog::MESSAGE_DIALOG_OK)
    {
        ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
        yesbtn->setVisible(false);

        ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
        cancelbtn->setText(_("OK"));
        cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    }
}