mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-27 08:37:58 +03:00
UITextBox set as auto size if no size is set when the text is being set.
--HG-- branch : dev
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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() ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user