forked from teamnwah/openmw-tes3coop
Remove horizontal messagebox layout, not used in vanilla (Fixes #1402)
This commit is contained in:
parent
d442853b3e
commit
40d6c8abf7
1 changed files with 41 additions and 91 deletions
|
@ -232,102 +232,52 @@ namespace MWGui
|
|||
buttonsWidth += buttonLeftPadding;
|
||||
|
||||
MyGUI::IntSize mainWidgetSize;
|
||||
if(buttonsWidth < fixedWidth)
|
||||
{
|
||||
// on one line
|
||||
if(textSize.width + 2*textPadding < buttonsWidth)
|
||||
{
|
||||
mainWidgetSize.width = buttonsWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWidgetSize.width = textSize.width + 3*textPadding;
|
||||
}
|
||||
mainWidgetSize.height = textSize.height + textButtonPadding + buttonHeight + buttonMainPadding;
|
||||
|
||||
MyGUI::IntPoint absPos;
|
||||
absPos.left = (gameWindowSize.width - mainWidgetSize.width)/2;
|
||||
absPos.top = (gameWindowSize.height - mainWidgetSize.height)/2;
|
||||
|
||||
mMainWidget->setPosition(absPos);
|
||||
mMainWidget->setSize(mainWidgetSize);
|
||||
|
||||
MyGUI::IntCoord messageWidgetCoord;
|
||||
messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
|
||||
messageWidgetCoord.top = textPadding;
|
||||
mMessageWidget->setCoord(messageWidgetCoord);
|
||||
|
||||
mMessageWidget->setSize(textSize);
|
||||
|
||||
MyGUI::IntCoord buttonCord;
|
||||
MyGUI::IntSize buttonSize(0, buttonHeight);
|
||||
int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding;
|
||||
|
||||
std::vector<MyGUI::Button*>::const_iterator button;
|
||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||
{
|
||||
buttonCord.left = left;
|
||||
buttonCord.top = textSize.height + textButtonPadding;
|
||||
|
||||
buttonSize.width = (*button)->getTextSize().width + 2*buttonPadding;
|
||||
buttonSize.height = (*button)->getTextSize().height + 2*buttonPadding;
|
||||
|
||||
(*button)->setCoord(buttonCord);
|
||||
(*button)->setSize(buttonSize);
|
||||
|
||||
left += buttonSize.width + buttonLeftPadding;
|
||||
}
|
||||
// among each other
|
||||
if(biggestButtonWidth > textSize.width) {
|
||||
mainWidgetSize.width = biggestButtonWidth + buttonTopPadding;
|
||||
}
|
||||
else
|
||||
{
|
||||
// among each other
|
||||
if(biggestButtonWidth > textSize.width) {
|
||||
mainWidgetSize.width = biggestButtonWidth + buttonTopPadding;
|
||||
}
|
||||
else {
|
||||
mainWidgetSize.width = textSize.width + 3*textPadding;
|
||||
}
|
||||
|
||||
MyGUI::IntCoord buttonCord;
|
||||
MyGUI::IntSize buttonSize(0, buttonHeight);
|
||||
|
||||
int top = textButtonPadding + buttonTopPadding + textSize.height;
|
||||
|
||||
std::vector<MyGUI::Button*>::const_iterator button;
|
||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||
{
|
||||
buttonSize.width = (*button)->getTextSize().width + buttonPadding*2;
|
||||
buttonSize.height = (*button)->getTextSize().height + buttonPadding*2;
|
||||
|
||||
buttonCord.top = top;
|
||||
buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2 - 5; // FIXME: -5 is not so nice :/
|
||||
|
||||
(*button)->setCoord(buttonCord);
|
||||
(*button)->setSize(buttonSize);
|
||||
|
||||
top += buttonSize.height + 2*buttonTopPadding;
|
||||
}
|
||||
|
||||
mainWidgetSize.height = top + buttonMainPadding;
|
||||
mMainWidget->setSize(mainWidgetSize);
|
||||
|
||||
MyGUI::IntPoint absPos;
|
||||
absPos.left = (gameWindowSize.width - mainWidgetSize.width)/2;
|
||||
absPos.top = (gameWindowSize.height - mainWidgetSize.height)/2;
|
||||
|
||||
mMainWidget->setPosition(absPos);
|
||||
|
||||
MyGUI::IntCoord messageWidgetCoord;
|
||||
messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
|
||||
messageWidgetCoord.top = textPadding;
|
||||
messageWidgetCoord.width = textSize.width;
|
||||
messageWidgetCoord.height = textSize.height;
|
||||
mMessageWidget->setCoord(messageWidgetCoord);
|
||||
else {
|
||||
mainWidgetSize.width = textSize.width + 3*textPadding;
|
||||
}
|
||||
|
||||
MyGUI::IntCoord buttonCord;
|
||||
MyGUI::IntSize buttonSize(0, buttonHeight);
|
||||
|
||||
int top = textButtonPadding + buttonTopPadding + textSize.height;
|
||||
|
||||
std::vector<MyGUI::Button*>::const_iterator button;
|
||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||
{
|
||||
buttonSize.width = (*button)->getTextSize().width + buttonPadding*2;
|
||||
buttonSize.height = (*button)->getTextSize().height + buttonPadding*2;
|
||||
|
||||
buttonCord.top = top;
|
||||
buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2 - 5; // FIXME: -5 is not so nice :/
|
||||
|
||||
(*button)->setCoord(buttonCord);
|
||||
(*button)->setSize(buttonSize);
|
||||
|
||||
top += buttonSize.height + 2*buttonTopPadding;
|
||||
}
|
||||
|
||||
mainWidgetSize.height = top + buttonMainPadding;
|
||||
mMainWidget->setSize(mainWidgetSize);
|
||||
|
||||
MyGUI::IntPoint absPos;
|
||||
absPos.left = (gameWindowSize.width - mainWidgetSize.width)/2;
|
||||
absPos.top = (gameWindowSize.height - mainWidgetSize.height)/2;
|
||||
|
||||
mMainWidget->setPosition(absPos);
|
||||
|
||||
MyGUI::IntCoord messageWidgetCoord;
|
||||
messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
|
||||
messageWidgetCoord.top = textPadding;
|
||||
messageWidgetCoord.width = textSize.width;
|
||||
messageWidgetCoord.height = textSize.height;
|
||||
mMessageWidget->setCoord(messageWidgetCoord);
|
||||
|
||||
// Set key focus to "Ok" button
|
||||
std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
|
||||
std::vector<MyGUI::Button*>::const_iterator button;
|
||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||
{
|
||||
if(Misc::StringUtils::ciEqual((*button)->getCaption(), ok))
|
||||
|
|
Loading…
Reference in a new issue