UITextBox set as auto size if no size is set when the text is being set.

--HG--
branch : dev
This commit is contained in:
Martí­n Lucas Golini
2017-02-28 18:07:40 -03:00
parent 702015b6c3
commit 42131ce1eb
3 changed files with 6 additions and 3 deletions
-1
View File
@@ -40,7 +40,6 @@ UICommonDialog::UICommonDialog( const UICommonDialog::CreateParams& Params ) :
}
UITextBox * lookIn = UITextBox::New();
lookIn->setFlags( UI_AUTO_SIZE );
lookIn->setParent( getContainer() );
lookIn->setPosition( 6, 13 );
lookIn->setVisible( true );
+1 -1
View File
@@ -189,8 +189,8 @@ const bool& UIProgressBar::getDisplayPercent() const {
void UIProgressBar::updateTextBox() {
mTextBox->setVisible( mStyleConfig.displayPercent );
mTextBox->setSize( mSize );
mTextBox->setText( String::toStr( (Int32)( ( mProgress / mTotalSteps ) * 100.f ) ) + "%" );
mTextBox->center();
}
UITextBox * UIProgressBar::getTextBox() const {
+5 -1
View File
@@ -111,6 +111,10 @@ void UITextBox::setText( const String& text ) {
mTextCache->setText( text );
}
if ( mSize == Sizei::Zero ) {
setFlags( UI_AUTO_SIZE );
}
autoShrink();
autoSize();
autoAlign();
@@ -168,7 +172,7 @@ void UITextBox::shrinkText( const Uint32& MaxWidth ) {
}
void UITextBox::autoSize() {
if ( mFlags & UI_AUTO_SIZE ) {
if ( ( mFlags & UI_AUTO_SIZE ) ) {
setPixelsSize( Sizei( (int)mTextCache->getTextWidth(), (int)mTextCache->getTextHeight() ) );
}
}