X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fpush-button-impl.cpp;h=1a5c3a435e5acc64ea2830b7509074c3d5376352;hp=08948ded567795e51eea622dfc9559b0472c4ece;hb=c38b9091faab34444644f626356abbdb875548d8;hpb=cc82bd9b187cda8fe2c8336b73fd1fa9376cfebd diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp index 08948de..1a5c3a4 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp @@ -23,6 +23,7 @@ #include // INTERNAL INCLUDES +#include namespace Dali { @@ -1071,6 +1072,23 @@ Vector3 PushButton::GetNaturalSize() size.height = std::max( size.height, imageSize.height ); } } + + // If label, test against it's size + Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( GetLabel() ); + if( textLabel ) + { + Vector3 textLabelSize = textLabel.GetNaturalSize(); + + if( widthIsZero ) + { + size.width = std::max( size.width, textLabelSize.width + TEXT_PADDING * 2.0f ); + } + + if( heightIsZero ) + { + size.height = std::max( size.height, textLabelSize.height + TEXT_PADDING * 2.0f ); + } + } } return size;