mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-13 04:42:12 +03:00
More padding work.
--HG-- branch : dev-widget-padding
This commit is contained in:
@@ -23,9 +23,13 @@
|
||||
<TextView layout_width="match_parent" layout_height="match_parent" text="testing match_parent" textSize="24dp" padding="12dp" backgroundColor="#333" gravity="center" />
|
||||
<TextView layout_width="wrap_content" layout_height="wrap_content" text="testing padding" textSize="24dp" padding="12dp" backgroundColor="#242424" />
|
||||
<TextView layout_width="wrap_content" layout_height="wrap_content" text="testing margin" textSize="24dp" padding="12dp" backgroundColor="#242424" layout_gravity="top|right" layout_margin="12dp" />
|
||||
<TextView layout_width="wrap_content" layout_height="wrap_content" text="testing margin" textSize="24dp" backgroundColor="#242424" layout_gravity="bottom|left" layout_margin="12dp" />
|
||||
<TextView layout_width="wrap_content" layout_height="wrap_content" text="testing margin padding" textSize="24dp" backgroundColor="#242424" layout_gravity="bottom|right" layout_margin="12dp" padding="12dp" />
|
||||
<TextView id="tm" layout_width="wrap_content" layout_height="wrap_content" text="testing margin" textSize="24dp" backgroundColor="#242424" layout_gravity="bottom|left" layout_margin="12dp" />
|
||||
<TextView id="tmp" layout_width="wrap_content" layout_height="wrap_content" text="testing margin padding" textSize="24dp" backgroundColor="#242424" layout_gravity="bottom|right" layout_margin="12dp" padding="12dp" />
|
||||
<Loader layout_width="350dp" layout_height="350dp" layout_gravity="center" fillColor="#999" />
|
||||
<!--<Sprite layout_width="96dp" layout_height="96dp" src="bn" padding="8dp" backgroundColor="#888" gravity="center" layout_marginTop="56dp" gravity="right|bottom" />
|
||||
<TextureRegion layout_width="96dp" layout_height="96dp" src="bn01" padding="8dp" backgroundColor="#787" gravity="center" layout_marginTop="162dp" gravity="right|bottom" />-->
|
||||
<PushButton layout_width="wrap_content" layout_height="wrap_content" text="testing padding" layout_gravity="bottom|right" gravity="center" padding="8dp" layout_to_top_of="tmp" />
|
||||
<PushButton text="OK!" textSize="16dp" icon="ok" gravity="center" layout_gravity="left|bottom" gravity="center" layout_width="wrap_content" layout_height="wrap_content" layout_marginBottom="8dp" padding="8dp" layout_to_top_of="tm" />
|
||||
</RelativeLayout>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
@@ -29,10 +29,6 @@ class EE_API UIPushButton : public UIWidget {
|
||||
|
||||
virtual const String& getText();
|
||||
|
||||
void setPadding( const Rectf& padding );
|
||||
|
||||
const Rectf& getPadding() const;
|
||||
|
||||
void setIconHorizontalMargin( Int32 margin );
|
||||
|
||||
const Int32& getIconHorizontalMargin() const;
|
||||
@@ -83,8 +79,6 @@ class EE_API UIPushButton : public UIWidget {
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
void autoPadding();
|
||||
|
||||
virtual void onAlphaChange();
|
||||
|
||||
virtual void onStateChange();
|
||||
@@ -93,6 +87,10 @@ class EE_API UIPushButton : public UIWidget {
|
||||
|
||||
virtual void onThemeLoaded();
|
||||
|
||||
virtual void onAutoSize();
|
||||
|
||||
virtual void onPaddingChange();
|
||||
|
||||
virtual Uint32 onKeyDown( const KeyEvent& Event );
|
||||
|
||||
virtual Uint32 onKeyUp( const KeyEvent& Event );
|
||||
|
||||
@@ -6,3 +6,4 @@
|
||||
../../src/thirdparty/libvorbis/include
|
||||
../../src/eepp/audio
|
||||
../../include/eepp/audio
|
||||
/usr/include/freetype2/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <eepp/ui/uipushbutton.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <pugixml/pugixml.hpp>
|
||||
#include <eepp/graphics/globaltextureatlas.hpp>
|
||||
#include <eepp/graphics/drawablesearcher.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/ui/uiscenenode.hpp>
|
||||
|
||||
@@ -34,8 +34,10 @@ UIPushButton::UIPushButton() :
|
||||
|
||||
mIcon = UIImage::New();
|
||||
mIcon->setParent( this );
|
||||
mIcon->setLayoutSizeRules( FIXED, FIXED );
|
||||
mIcon->setFlags( GfxFlags );
|
||||
mIcon->unsetFlags( UI_AUTO_SIZE );
|
||||
mIcon->setScaleType( UIScaleType::FitInside );
|
||||
|
||||
if ( mStyleConfig.IconMinSize.x != 0 && mStyleConfig.IconMinSize.y != 0 ) {
|
||||
mIcon->setSize( mStyleConfig.IconMinSize.asFloat() );
|
||||
@@ -45,7 +47,7 @@ UIPushButton::UIPushButton() :
|
||||
mIcon->setEnabled( false );
|
||||
|
||||
mTextBox = UITextView::New();
|
||||
mTextBox->setLayoutSizeRules( FIXED, FIXED );
|
||||
mTextBox->setLayoutSizeRules( WRAP_CONTENT, WRAP_CONTENT );
|
||||
mTextBox->setParent( this );
|
||||
mTextBox->setVisible( true );
|
||||
mTextBox->setEnabled( false );
|
||||
@@ -70,55 +72,96 @@ bool UIPushButton::isType( const Uint32& type ) const {
|
||||
return UIPushButton::getType() == type ? true : UIWidget::isType( type );
|
||||
}
|
||||
|
||||
void UIPushButton::onSizeChange() {
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) && NULL != getSkin() && 0 == mDpSize.getHeight() ) {
|
||||
void UIPushButton::onAutoSize() {
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) && NULL != getSkin() ) {
|
||||
setInternalHeight( getSkinSize().getHeight() );
|
||||
}
|
||||
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) ) {
|
||||
Int32 txtW = NULL != mTextBox ? PixelDensity::pxToDpI( mTextBox->getTextWidth() ) : 0;
|
||||
Int32 minSize = txtW + ( NULL != mIcon ? mIcon->getSize().getWidth() : 0 )
|
||||
+ mStyleConfig.IconHorizontalMargin + mTextBox->getPadding().Left + mTextBox->getPadding().Right +
|
||||
( NULL != getSkin() ? getSkin()->getBorderSize().Left + getSkin()->getBorderSize().Right : 0 );
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) && NULL != getSkin() && ( 0 == mDpSize.getHeight() || mLayoutHeightRules == WRAP_CONTENT ) ) {
|
||||
Float h = eemax<Float>( PixelDensity::dpToPx( getSkinSize().getHeight() ), mTextBox->getTextHeight() );
|
||||
|
||||
if ( minSize > mDpSize.getWidth() ) {
|
||||
setInternalWidth( minSize );
|
||||
setInternalPixelsHeight( h + mRealPadding.Top + mRealPadding.Bottom );
|
||||
}
|
||||
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) || mLayoutWidthRules == WRAP_CONTENT ) {
|
||||
Int32 txtW = NULL != mTextBox ? mTextBox->getTextWidth() : 0;
|
||||
|
||||
Int32 minSize = txtW +
|
||||
( NULL != mIcon ? mIcon->getRealSize().getWidth() : 0 ) +
|
||||
PixelDensity::dpToPxI( mStyleConfig.IconHorizontalMargin ) + mRealPadding.Left + mRealPadding.Right +
|
||||
( NULL != getSkin() ? PixelDensity::dpToPxI( getSkin()->getBorderSize().Left + getSkin()->getBorderSize().Right ) : 0 );
|
||||
|
||||
if ( minSize > mSize.getWidth() ) {
|
||||
setInternalPixelsWidth( minSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( NULL != mTextBox ) {
|
||||
mTextBox->setSize( mDpSize );
|
||||
mTextBox->setPosition( 0, 0 );
|
||||
void UIPushButton::onPaddingChange() {
|
||||
onSizeChange();
|
||||
|
||||
UIWidget::onPaddingChange();
|
||||
}
|
||||
|
||||
void UIPushButton::onSizeChange() {
|
||||
onAutoSize();
|
||||
|
||||
Rectf autoPadding;
|
||||
|
||||
if ( mFlags & UI_AUTO_PADDING ) {
|
||||
autoPadding = makePadding( true, true, true, true );
|
||||
}
|
||||
|
||||
mIcon->setPosition( mStyleConfig.IconHorizontalMargin, 0 );
|
||||
if ( mRealPadding.Top > autoPadding.Top ) autoPadding.Top = mRealPadding.Top;
|
||||
if ( mRealPadding.Bottom > autoPadding.Bottom ) autoPadding.Bottom = mRealPadding.Bottom;
|
||||
if ( mRealPadding.Left > autoPadding.Left ) autoPadding.Left = mRealPadding.Left;
|
||||
if ( mRealPadding.Right > autoPadding.Right ) autoPadding.Right = mRealPadding.Right;
|
||||
|
||||
mIcon->setPixelsPosition( autoPadding.Left + mStyleConfig.IconHorizontalMargin, 0 );
|
||||
mIcon->centerVertical();
|
||||
|
||||
if ( NULL != mTextBox ) {
|
||||
Vector2f position;
|
||||
|
||||
switch ( fontVAlignGet( getFlags() ) ) {
|
||||
case UI_VALIGN_CENTER:
|
||||
position.y = ( mSize.getHeight() - mTextBox->getRealSize().getHeight() ) / 2;
|
||||
break;
|
||||
case UI_VALIGN_BOTTOM:
|
||||
position.y = mSize.y - mTextBox->getRealSize().getHeight() - autoPadding.Bottom;
|
||||
break;
|
||||
case UI_VALIGN_TOP:
|
||||
position.y = autoPadding.Top;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( fontHAlignGet( getFlags() ) ) {
|
||||
case UI_HALIGN_LEFT:
|
||||
mTextBox->setPosition( mIcon->getPosition().x + mIcon->getSize().getWidth(), 0 );
|
||||
mTextBox->setSize( mDpSize.getWidth() - mIcon->getPosition().x - mIcon->getSize().getWidth(), mDpSize.getHeight() );
|
||||
case UI_HALIGN_RIGHT:
|
||||
position.x = mSize.getWidth() - mTextBox->getRealSize().getWidth() - autoPadding.Right;
|
||||
break;
|
||||
case UI_HALIGN_CENTER:
|
||||
if ( NULL != mIcon->getDrawable() ) {
|
||||
Uint32 iconPos = mIcon->getPosition().x + mIcon->getSize().getWidth();
|
||||
Uint32 txtOff = mTextBox->getPosition().x + mTextBox->getAlignOffset().x;
|
||||
position.x = ( mSize.getWidth() - mTextBox->getRealSize().getWidth() ) / 2;
|
||||
|
||||
if ( iconPos >= txtOff) {
|
||||
if ( NULL != mIcon->getDrawable() ) {
|
||||
Uint32 iconPos = mIcon->getRealPosition().x + mIcon->getRealSize().getWidth();
|
||||
|
||||
if ( iconPos >= position.x ) {
|
||||
Float px = PixelDensity::dpToPx(1);
|
||||
|
||||
mTextBox->setPosition( iconPos + px, mTextBox->getPosition().y );
|
||||
|
||||
mTextBox->setSize( mDpSize.getWidth() - mIcon->getPosition().x - mIcon->getSize().getWidth() - px, mDpSize.getHeight() );
|
||||
position.x = iconPos + px;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case UI_HALIGN_LEFT:
|
||||
position.x = mIcon->getRealPosition().x + mIcon->getRealSize().getWidth();
|
||||
break;
|
||||
}
|
||||
|
||||
mTextBox->setPixelsPosition( position );
|
||||
}
|
||||
|
||||
if ( NULL != mTextBox && 0 == mTextBox->getText().size() ) {
|
||||
if ( NULL != mTextBox && mTextBox->getText().empty() ) {
|
||||
mIcon->center();
|
||||
}
|
||||
}
|
||||
@@ -139,23 +182,11 @@ void UIPushButton::onThemeLoaded() {
|
||||
mStyleConfig.IconHorizontalMargin = RMargin.Left;
|
||||
}
|
||||
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) && NULL != getSkin() ) {
|
||||
setInternalHeight( getSkinSize().getHeight() );
|
||||
}
|
||||
|
||||
autoPadding();
|
||||
|
||||
onSizeChange();
|
||||
onAutoSize();
|
||||
|
||||
UIWidget::onThemeLoaded();
|
||||
}
|
||||
|
||||
void UIPushButton::autoPadding() {
|
||||
if ( mFlags & UI_AUTO_PADDING ) {
|
||||
mTextBox->setPadding( makePadding( true, false, true, false ) );
|
||||
}
|
||||
}
|
||||
|
||||
UIPushButton * UIPushButton::setIcon( Drawable * Icon ) {
|
||||
mIcon->setDrawable( Icon );
|
||||
onSizeChange();
|
||||
@@ -176,14 +207,6 @@ const String& UIPushButton::getText() {
|
||||
return mTextBox->getText();
|
||||
}
|
||||
|
||||
void UIPushButton::setPadding( const Rectf& padding ) {
|
||||
mTextBox->setPadding( padding );
|
||||
}
|
||||
|
||||
const Rectf& UIPushButton::getPadding() const {
|
||||
return mTextBox->getPadding();
|
||||
}
|
||||
|
||||
void UIPushButton::setIconHorizontalMargin( Int32 margin ) {
|
||||
mStyleConfig.IconHorizontalMargin = margin;
|
||||
onSizeChange();
|
||||
@@ -360,15 +383,15 @@ bool UIPushButton::setAttribute( const NodeAttribute& attribute ) {
|
||||
|
||||
if ( NULL != mTheme && NULL != ( icon = mTheme->getIconByName( val ) ) ) {
|
||||
setIcon( icon );
|
||||
} else if ( NULL != ( icon = GlobalTextureAtlas::instance()->getByName( val ) ) ) {
|
||||
} else if ( NULL != ( icon = DrawableSearcher::searchByName( val ) ) ) {
|
||||
setIcon( icon );
|
||||
}
|
||||
} else {
|
||||
attributeSet = UIWidget::setAttribute( attribute );
|
||||
}
|
||||
|
||||
mTextBox->setAttribute( attribute );
|
||||
mTextBox->setLayoutSizeRules( FIXED, FIXED );
|
||||
if ( !attributeSet && ( String::startsWith( name, "text" ) || String::startsWith( name, "font" ) ) )
|
||||
mTextBox->setAttribute( attribute );
|
||||
|
||||
return attributeSet;
|
||||
}
|
||||
|
||||
@@ -126,11 +126,21 @@ void UISprite::setRenderMode( const RenderMode& render ) {
|
||||
}
|
||||
|
||||
void UISprite::updateSize() {
|
||||
if ( mFlags & UI_AUTO_SIZE ) {
|
||||
if ( NULL != mSprite ) {
|
||||
if ( NULL != mSprite ) {
|
||||
if ( mFlags & UI_AUTO_SIZE ) {
|
||||
if ( NULL != mSprite->getCurrentTextureRegion() && mSprite->getCurrentTextureRegion()->getDpSize().asFloat() != mDpSize )
|
||||
setSize( mSprite->getCurrentTextureRegion()->getDpSize().asFloat() );
|
||||
}
|
||||
|
||||
if ( NULL != mSprite->getCurrentTextureRegion() ) {
|
||||
if ( mLayoutWidthRules == WRAP_CONTENT ) {
|
||||
setInternalPixelsWidth( mSprite->getCurrentTextureRegion()->getPxSize().getWidth() + mRealPadding.Left + mRealPadding.Right );
|
||||
}
|
||||
|
||||
if ( mLayoutHeightRules == WRAP_CONTENT ) {
|
||||
setInternalPixelsHeight( mSprite->getCurrentTextureRegion()->getPxSize().getHeight() + mRealPadding.Top + mRealPadding.Bottom );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,19 +151,19 @@ void UISprite::autoAlign() {
|
||||
TextureRegion * tTextureRegion = mSprite->getCurrentTextureRegion();
|
||||
|
||||
if ( HAlignGet( mFlags ) == UI_HALIGN_CENTER ) {
|
||||
mAlignOffset.x = mDpSize.getWidth() / 2 - tTextureRegion->getDpSize().getWidth() / 2;
|
||||
mAlignOffset.x = ( mSize.getWidth() - tTextureRegion->getPxSize().getWidth() ) / 2;
|
||||
} else if ( fontHAlignGet( mFlags ) == UI_HALIGN_RIGHT ) {
|
||||
mAlignOffset.x = mDpSize.getWidth() - tTextureRegion->getDpSize().getWidth();
|
||||
mAlignOffset.x = mSize.getWidth() - tTextureRegion->getPxSize().getWidth() - mRealPadding.Right;
|
||||
} else {
|
||||
mAlignOffset.x = 0;
|
||||
mAlignOffset.x = mRealPadding.Left;
|
||||
}
|
||||
|
||||
if ( VAlignGet( mFlags ) == UI_VALIGN_CENTER ) {
|
||||
mAlignOffset.y = mDpSize.getHeight() / 2 - tTextureRegion->getDpSize().getHeight() / 2;
|
||||
mAlignOffset.y = ( mSize.getHeight() - tTextureRegion->getPxSize().getHeight() ) / 2;
|
||||
} else if ( fontVAlignGet( mFlags ) == UI_VALIGN_BOTTOM ) {
|
||||
mAlignOffset.y = mDpSize.getHeight() - tTextureRegion->getDpSize().getHeight();
|
||||
mAlignOffset.y = mSize.getHeight() - tTextureRegion->getPxSize().getHeight() - mRealPadding.Bottom;
|
||||
} else {
|
||||
mAlignOffset.y = 0;
|
||||
mAlignOffset.y = mRealPadding.Top;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <eepp/graphics/textureregion.hpp>
|
||||
#include <pugixml/pugixml.hpp>
|
||||
#include <eepp/graphics/globaltextureatlas.hpp>
|
||||
#include <eepp/graphics/textureatlasmanager.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -51,10 +52,18 @@ UITextureRegion * UITextureRegion::setTextureRegion( Graphics::TextureRegion * T
|
||||
}
|
||||
|
||||
void UITextureRegion::onAutoSize() {
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) && Sizef::Zero == mDpSize ) {
|
||||
if ( NULL != mTextureRegion ) {
|
||||
if ( NULL != mTextureRegion ) {
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) && Sizef::Zero == mDpSize ) {
|
||||
setSize( mTextureRegion->getDpSize().asFloat() );
|
||||
}
|
||||
|
||||
if ( mLayoutWidthRules == WRAP_CONTENT ) {
|
||||
setInternalPixelsWidth( mTextureRegion->getPxSize().getWidth() + mRealPadding.Left + mRealPadding.Right );
|
||||
}
|
||||
|
||||
if ( mLayoutHeightRules == WRAP_CONTENT ) {
|
||||
setInternalPixelsHeight( mTextureRegion->getPxSize().getHeight() + mRealPadding.Top + mRealPadding.Bottom );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +77,7 @@ void UITextureRegion::draw() {
|
||||
|
||||
if ( mScaleType == UIScaleType::Expand ) {
|
||||
mTextureRegion->setOffset( Vector2i( 0, 0 ) );
|
||||
mTextureRegion->setDestSize( Vector2f( (int)mSize.x, (int)mSize.y ) );
|
||||
mTextureRegion->setDestSize( Vector2f( (int)mSize.x - mRealPadding.Left - mRealPadding.Right, (int)mSize.y - mRealPadding.Top - mRealPadding.Bottom ) );
|
||||
|
||||
autoAlign();
|
||||
|
||||
@@ -78,8 +87,8 @@ void UITextureRegion::draw() {
|
||||
mTextureRegion->setOffset( Vector2i( 0, 0 ) );
|
||||
|
||||
Sizei pxSize = mTextureRegion->getPxSize();
|
||||
Float Scale1 = mSize.x / (Float)pxSize.x;
|
||||
Float Scale2 = mSize.y / (Float)pxSize.y;
|
||||
Float Scale1 = ( mSize.x - mRealPadding.Left - mRealPadding.Right ) / (Float)pxSize.x;
|
||||
Float Scale2 = ( mSize.y - mRealPadding.Top - mRealPadding.Bottom ) / (Float)pxSize.y;
|
||||
|
||||
if ( Scale1 < 1 || Scale2 < 1 ) {
|
||||
if ( Scale2 < Scale1 )
|
||||
@@ -152,19 +161,19 @@ void UITextureRegion::autoAlign() {
|
||||
return;
|
||||
|
||||
if ( HAlignGet( mFlags ) == UI_HALIGN_CENTER ) {
|
||||
mAlignOffset.x = mSize.getWidth() / 2 - mTextureRegion->getDestSize().x / 2;
|
||||
mAlignOffset.x = ( mSize.getWidth() - mTextureRegion->getDestSize().x ) / 2;
|
||||
} else if ( fontHAlignGet( mFlags ) == UI_HALIGN_RIGHT ) {
|
||||
mAlignOffset.x = mSize.getWidth() - mTextureRegion->getDestSize().x;
|
||||
mAlignOffset.x = mSize.getWidth() - mTextureRegion->getDestSize().x - mRealPadding.Right;
|
||||
} else {
|
||||
mAlignOffset.x = 0;
|
||||
mAlignOffset.x = mRealPadding.Left;
|
||||
}
|
||||
|
||||
if ( VAlignGet( mFlags ) == UI_VALIGN_CENTER ) {
|
||||
mAlignOffset.y = mSize.getHeight() / 2 - mTextureRegion->getDestSize().y / 2;
|
||||
mAlignOffset.y = ( mSize.getHeight() - mTextureRegion->getDestSize().y ) / 2;
|
||||
} else if ( fontVAlignGet( mFlags ) == UI_VALIGN_BOTTOM ) {
|
||||
mAlignOffset.y = mSize.getHeight() - mTextureRegion->getDestSize().y;
|
||||
mAlignOffset.y = mSize.getHeight() - mTextureRegion->getDestSize().y - mRealPadding.Bottom;
|
||||
} else {
|
||||
mAlignOffset.y = 0;
|
||||
mAlignOffset.y = mRealPadding.Top;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,9 +196,9 @@ bool UITextureRegion::setAttribute( const NodeAttribute& attribute ) {
|
||||
const std::string& name = attribute.getName();
|
||||
|
||||
if ( "src" == name || "textureregion" == name || "subtexture" == name ) {
|
||||
DrawableResource * res = NULL;
|
||||
Drawable * res = NULL;
|
||||
|
||||
if ( NULL != ( res = GlobalTextureAtlas::instance()->getByName( attribute.asString() ) ) && res->getDrawableType() == Drawable::TEXTUREREGION ) {
|
||||
if ( NULL != ( res = TextureAtlasManager::instance()->getTextureRegionByName( attribute.asString() ) ) && res->getDrawableType() == Drawable::TEXTUREREGION ) {
|
||||
setTextureRegion( static_cast<TextureRegion*>( res ) );
|
||||
}
|
||||
} else if ( "scaletype" == name ) {
|
||||
|
||||
@@ -171,8 +171,9 @@ void UIWinMenu::refreshButtons() {
|
||||
UISelectButton * pbut = it->first;
|
||||
UITextView * tbox = pbut->getTextBox();
|
||||
|
||||
pbut->setLayoutSizeRules( FIXED, FIXED );
|
||||
pbut->setStyleConfig( mStyleConfig );
|
||||
pbut->setSize( PixelDensity::pxToDpI( tbox->getTextWidth() ) + mStyleConfig.ButtonMargin, getSize().getHeight() );
|
||||
pbut->setPixelsSize( tbox->getTextWidth() + PixelDensity::dpToPx( mStyleConfig.ButtonMargin ), getRealSize().getHeight() );
|
||||
pbut->setPosition( xpos, ycenter );
|
||||
|
||||
xpos += pbut->getSize().getWidth() + mStyleConfig.MarginBetweenButtons;
|
||||
|
||||
Reference in New Issue
Block a user