Adjust loading box size for large captions

moveref
scrawl 10 years ago
parent 866fdfe8bd
commit 37e11b7272

@ -34,6 +34,7 @@ namespace MWGui
getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar");
getWidget(mLoadingBox, "LoadingBox");
mProgressBar->setScrollViewPage(1);
@ -46,6 +47,11 @@ namespace MWGui
void LoadingScreen::setLabel(const std::string &label)
{
mLoadingText->setCaptionWithReplacing(label);
int padding = mLoadingBox->getWidth() - mLoadingText->getWidth();
MyGUI::IntSize size(mLoadingText->getTextSize().width+padding, mLoadingBox->getHeight());
size.width = std::max(300, size.width);
mLoadingBox->setSize(size);
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mLoadingBox->getTop());
}
LoadingScreen::~LoadingScreen()

@ -47,6 +47,8 @@ namespace MWGui
size_t mProgress;
MyGUI::Widget* mLoadingBox;
MyGUI::TextBox* mLoadingText;
MyGUI::ScrollBar* mProgressBar;
BackgroundImage* mBackgroundImage;

@ -4,9 +4,9 @@
<!-- The entire screen -->
<Widget type="Widget" layer="LoadingScreen" position="0 0 300 300" name="_Main" align="Stretch">
<Widget type="Widget" skin="MW_Dialog" position="0 245 300 48" align="Bottom HCenter">
<Widget type="Widget" skin="MW_Dialog" position="0 245 300 48" align="Bottom HCenter" name="LoadingBox">
<Widget type="TextBox" skin="SandText" position="20 8 260 18" name="LoadingText">
<Widget type="TextBox" skin="SandText" position="20 8 260 18" align="Stretch" name="LoadingText">
<Property key="TextAlign" value="Center"/>
</Widget>

Loading…
Cancel
Save