From df5a43363a23a80a1a05ec6ffa0e7c089073357b Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 30 Mar 2017 17:05:56 +0400 Subject: [PATCH] Confirmation dialogs size fix --- apps/openmw/mwgui/confirmationdialog.cpp | 17 ++++++++++++----- apps/openmw/mwgui/confirmationdialog.hpp | 3 ++- files/mygui/openmw_confirmation_dialog.layout | 10 +++++----- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/confirmationdialog.cpp b/apps/openmw/mwgui/confirmationdialog.cpp index e4312914f..33f8dbe3e 100644 --- a/apps/openmw/mwgui/confirmationdialog.cpp +++ b/apps/openmw/mwgui/confirmationdialog.cpp @@ -17,19 +17,26 @@ namespace MWGui } void ConfirmationDialog::askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage) + { + mCancelButton->setCaptionWithReplacing(cancelMessage); + mOkButton->setCaptionWithReplacing(confirmMessage); + + askForConfirmation(message); + } + + void ConfirmationDialog::askForConfirmation(const std::string& message) { setVisible(true); mMessage->setCaptionWithReplacing(message); - mCancelButton->setCaptionWithReplacing(cancelMessage); - mOkButton->setCaptionWithReplacing(confirmMessage); + int height = mMessage->getTextSize().height + 60; - int height = mMessage->getTextSize().height + 72; + int width = mMessage->getTextSize().width + 24; - mMainWidget->setSize(mMainWidget->getWidth(), height); + mMainWidget->setSize(width, height); - mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height+24); + mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height + 24); center(); } diff --git a/apps/openmw/mwgui/confirmationdialog.hpp b/apps/openmw/mwgui/confirmationdialog.hpp index 14caa7748..745c7a1a5 100644 --- a/apps/openmw/mwgui/confirmationdialog.hpp +++ b/apps/openmw/mwgui/confirmationdialog.hpp @@ -9,7 +9,8 @@ namespace MWGui { public: ConfirmationDialog(); - void askForConfirmation(const std::string& message, const std::string& confirmMessage="#{sOk}", const std::string& cancelMessage="#{sCancel}"); + void askForConfirmation(const std::string& message); + void askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage); virtual void exit(); typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void; diff --git a/files/mygui/openmw_confirmation_dialog.layout b/files/mygui/openmw_confirmation_dialog.layout index 2d533135a..39e77cb93 100644 --- a/files/mygui/openmw_confirmation_dialog.layout +++ b/files/mygui/openmw_confirmation_dialog.layout @@ -1,10 +1,10 @@ - + - + @@ -12,14 +12,14 @@ - + - + - +