1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/openmw/mwgui/confirmationdialog.cpp
scrawl e0d6670ac4 Move video skip detection to WindowManager
Fixes a bug where skipping using Esc would not work if a mouse button had been pressed previously
2014-06-10 01:57:54 +02:00

50 lines
1.2 KiB
C++

#include "confirmationdialog.hpp"
namespace MWGui
{
ConfirmationDialog::ConfirmationDialog() :
WindowModal("openmw_confirmation_dialog.layout")
{
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::open(const std::string& message)
{
setVisible(true);
mMessage->setCaptionWithReplacing(message);
int height = mMessage->getTextSize().height + 72;
mMainWidget->setSize(mMainWidget->getWidth(), height);
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height+24);
center();
}
void ConfirmationDialog::exit()
{
setVisible(false);
eventCancelClicked();
}
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
{
exit();
}
void ConfirmationDialog::onOkButtonClicked(MyGUI::Widget* _sender)
{
setVisible(false);
eventOkClicked();
}
}