2012-05-23 03:28:25 +00:00
|
|
|
#include "confirmationdialog.hpp"
|
|
|
|
|
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
2012-07-03 10:30:50 +00:00
|
|
|
#include "../mwbase/world.hpp"
|
2012-05-23 03:28:25 +00:00
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2012-08-12 16:11:09 +00:00
|
|
|
ConfirmationDialog::ConfirmationDialog(MWBase::WindowManager& parWindowManager) :
|
2012-08-26 08:52:06 +00:00
|
|
|
WindowModal("openmw_confirmation_dialog.layout", parWindowManager)
|
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::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();
|
|
|
|
|
|
|
|
int okButtonWidth = mOkButton->getTextSize().width + 24;
|
|
|
|
mOkButton->setCoord(mMainWidget->getWidth() - 30 - okButtonWidth,
|
|
|
|
mOkButton->getTop(),
|
|
|
|
okButtonWidth,
|
|
|
|
mOkButton->getHeight());
|
|
|
|
|
|
|
|
int cancelButtonWidth = mCancelButton->getTextSize().width + 24;
|
|
|
|
mCancelButton->setCoord(mMainWidget->getWidth() - 30 - okButtonWidth - cancelButtonWidth - 8,
|
|
|
|
mCancelButton->getTop(),
|
|
|
|
cancelButtonWidth,
|
|
|
|
mCancelButton->getHeight());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
2012-05-28 10:34:29 +00:00
|
|
|
eventCancelClicked();
|
|
|
|
|
2012-08-26 08:52:06 +00:00
|
|
|
setVisible(false);
|
2012-05-23 03:28:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ConfirmationDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
eventOkClicked();
|
|
|
|
|
|
|
|
setVisible(false);
|
|
|
|
}
|
|
|
|
}
|