Commit 17e885c9a9f952e9b4ef006904aea374ab161c96
Committed by
Paul Wisbey
1 parent
84aee878
Remove redundant call to ResourceImage::GetImageSize()
Change-Id: I6fd663fad743bd52f1667108492cd92c3c150ad3
Showing
1 changed file
with
4 additions
and
9 deletions
examples/text-field/text-field-example.cpp
| @@ -43,7 +43,7 @@ namespace | @@ -43,7 +43,7 @@ namespace | ||
| 43 | 43 | ||
| 44 | const float BORDER_WIDTH = 4.0f; | 44 | const float BORDER_WIDTH = 4.0f; |
| 45 | 45 | ||
| 46 | - const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.0, 0.25, 0.0 ); | 46 | + const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.8, 0.25, 0.0 ); |
| 47 | 47 | ||
| 48 | } // unnamed namespace | 48 | } // unnamed namespace |
| 49 | 49 | ||
| @@ -90,10 +90,6 @@ public: | @@ -90,10 +90,6 @@ public: | ||
| 90 | button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); | 90 | button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); |
| 91 | button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); | 91 | button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); |
| 92 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 92 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 93 | - button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | ||
| 94 | - ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE ); | ||
| 95 | - button.SetSize( imageSize.GetWidth(), imageSize.GetHeight() ); | ||
| 96 | - | ||
| 97 | return button; | 93 | return button; |
| 98 | } | 94 | } |
| 99 | 95 | ||
| @@ -107,7 +103,7 @@ public: | @@ -107,7 +103,7 @@ public: | ||
| 107 | 103 | ||
| 108 | // Launch a pop-up containing TextField | 104 | // Launch a pop-up containing TextField |
| 109 | mField = CreateTextField( stageSize, mButtonLabel ); | 105 | mField = CreateTextField( stageSize, mButtonLabel ); |
| 110 | - mPopup = CreatePopup( stageSize.width * 0.8f ); | 106 | + mPopup = CreatePopup(); |
| 111 | mPopup.Add( mField ); | 107 | mPopup.Add( mField ); |
| 112 | mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched ); | 108 | mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched ); |
| 113 | stage.Add( mPopup ); | 109 | stage.Add( mPopup ); |
| @@ -132,13 +128,12 @@ public: | @@ -132,13 +128,12 @@ public: | ||
| 132 | return field; | 128 | return field; |
| 133 | } | 129 | } |
| 134 | 130 | ||
| 135 | - Popup CreatePopup( float width ) | 131 | + Popup CreatePopup() |
| 136 | { | 132 | { |
| 137 | Popup popup = Popup::New(); | 133 | Popup popup = Popup::New(); |
| 138 | popup.SetParentOrigin( ParentOrigin::CENTER ); | 134 | popup.SetParentOrigin( ParentOrigin::CENTER ); |
| 139 | popup.SetAnchorPoint( AnchorPoint::CENTER ); | 135 | popup.SetAnchorPoint( AnchorPoint::CENTER ); |
| 140 | - popup.SetSize( width, 0.0f ); | ||
| 141 | - popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); | 136 | + popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 142 | popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); | 137 | popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); |
| 143 | popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched ); | 138 | popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched ); |
| 144 | 139 |