1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-11 00:39:59 +00:00
OpenMW/apps/openmw/mwgui/confirmationdialog.cpp

56 lines
1.5 KiB
C++
Raw Normal View History

2012-05-23 03:28:25 +00:00
#include "confirmationdialog.hpp"
2015-01-10 01:50:43 +00:00
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
2012-05-23 03:28:25 +00:00
namespace MWGui
{
ConfirmationDialog::ConfirmationDialog() :
WindowModal("openmw_confirmation_dialog.layout")
2012-05-23 03:28:25 +00:00
{
getWidget(mMessage, "Message");
getWidget(mOkButton, "OkButton");
getWidget(mCancelButton, "CancelButton");
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onCancelButtonClicked);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onOkButtonClicked);
}
void ConfirmationDialog::askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage)
2012-05-23 03:28:25 +00:00
{
setVisible(true);
mMessage->setCaptionWithReplacing(message);
mCancelButton->setCaptionWithReplacing(cancelMessage);
mOkButton->setCaptionWithReplacing(confirmMessage);
2012-05-23 03:28:25 +00:00
int height = mMessage->getTextSize().height + 72;
mMainWidget->setSize(mMainWidget->getWidth(), height);
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height+24);
center();
}
void ConfirmationDialog::exit()
2012-05-23 03:28:25 +00:00
{
setVisible(false);
eventCancelClicked();
2012-05-23 03:28:25 +00:00
}
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
{
exit();
}
2012-05-23 03:28:25 +00:00
void ConfirmationDialog::onOkButtonClicked(MyGUI::Widget* _sender)
{
setVisible(false);
eventOkClicked();
2012-05-23 03:28:25 +00:00
}
}