Small fix.

--HG--
branch : dev
This commit is contained in:
Martí­n Lucas Golini
2017-02-27 04:24:42 -03:00
parent 2048415772
commit 81f496fff5
2 changed files with 13 additions and 2 deletions

View File

@@ -61,6 +61,8 @@ UIPushButton::UIPushButton() :
mTextBox( NULL ),
mIconSpace( 0 )
{
setFlags( UI_AUTO_SIZE | UI_VALIGN_CENTER | UI_HALIGN_CENTER );
mIcon = eeNew( UIGfx, () );
mIcon->setParent( this );
mIcon->setFlags( UI_AUTO_SIZE | UI_VALIGN_CENTER | UI_HALIGN_CENTER );
@@ -91,7 +93,11 @@ bool UIPushButton::isType( const Uint32& type ) const {
return UIPushButton::getType() == type ? true : UIComplexControl::isType( type );
}
void UIPushButton::onSizeChange() {
void UIPushButton::onSizeChange() {
if ( ( mFlags & UI_AUTO_SIZE ) && NULL != getSkin() && 0 == mSize.getHeight() ) {
setInternalHeight( getSkinSize().getHeight() );
}
if ( NULL != mTextBox ) {
mTextBox->setSize( mSize );
mTextBox->setPosition( 0, 0 );

View File

@@ -639,10 +639,15 @@ void EETest::createNewUI() {
listBox->addListBoxItems( str );
UIProgressBar * progressBar = eeNew( UIProgressBar, () );
progressBar->setPosition( 50, 540 )->setSize( 200, 26 );
progressBar->setPosition( 50, 530 )->setSize( 200, 26 );
progressBar->setProgress( 60.f );
progressBar->setDisplayPercent( true );
UIPushButton * pushButton = eeNew( UIPushButton, () );
pushButton->setPosition( 50, 560 )->setSize( 200, 0 );
pushButton->setText( "PushButton" );
pushButton->setIcon( mTheme->getIconByName( "ok" ) );
UISprite * sprite = eeNew( UISprite, () );
sprite->setPosition( 50, 600 );
sprite->setSprite( &SP );