OnBoundsChanged spec Implementation
authorSaravana Balaji <saravana.bs@samsung.com>
Thu, 21 Mar 2013 15:15:31 +0000 (20:45 +0530)
committerSaravana Balaji <saravana.bs@samsung.com>
Mon, 25 Mar 2013 09:53:20 +0000 (15:23 +0530)
Change-Id: I2c8d84964174d7d598d107388d7fa0514644c86e
Signed-off-by: Saravana Balaji <saravana.bs@samsung.com>
src/ui/controls/FUiCtrl_Edit.cpp
src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/controls/FUiCtrl_TokenEditPresenter.cpp
src/ui/inc/FUiCtrl_EditPresenter.h
src/ui/inc/FUiCtrl_TokenEditPresenter.h

index ab383e6..05f0ebf 100644 (file)
@@ -1988,6 +1988,15 @@ _Edit::OnBoundsChanged(void)
        {
                SysAssertf(_pEditPresenter != null, "_pEditPresenter is null");
 
+               if (!((GetEditStyle() & EDIT_STYLE_FLEXIBLE) == false))
+               {
+                       if (_pEditPresenter->IsUpdateInitialBounds())
+                       {
+                               FloatRectangle editBounds = GetBoundsF();
+                               _pEditPresenter->SetControlInitialBounds(editBounds);
+                       }
+               }
+
                _pEditPresenter->Resize();
 
                if(__isAccessibilityCreated)
index 3332fc3..162b9e7 100755 (executable)
@@ -225,6 +225,7 @@ _EditPresenter::_EditPresenter(void)
        , __textBlockMoveLeft(false)
        , __textBlockMoving(false)
        , __clipboardConnected(false)
+       , __updateInitialBounds(true)
 {
 }
 
@@ -1992,9 +1993,13 @@ _EditPresenter::Draw(Canvas& canvas)
        // Set scroll bar
        DrawScrollBar();
 
-       if (__pEdit->GetEditStyle() & EDIT_STYLE_FLEXIBLE)
+       //To avoid resizing to Flexible bounds on User SetBounds in Non-focussed mode
+       if (IsFocused())
        {
-               AdjustFlexibleHeight();
+               if (__pEdit->GetEditStyle() & EDIT_STYLE_FLEXIBLE)
+               {
+                       AdjustFlexibleHeight();
+               }
        }
 
        return r;
@@ -5250,6 +5255,18 @@ _EditPresenter::GetTextVisualElement(void)
        return __pTextVisualElement;
 }
 
+void
+_EditPresenter::SetControlInitialBounds(FloatRectangle initBounds)
+{
+       __initialBounds = initBounds;
+}
+
+bool
+_EditPresenter::IsUpdateInitialBounds(void)
+{
+       return __updateInitialBounds;
+}
+
 bool
 _EditPresenter::OnFocusGained(void)
 {
@@ -6178,7 +6195,10 @@ _EditPresenter::ChangeLayout(_ControlOrientation orientation)
                }
        }
 
-       __initialBounds = __pEdit->GetBoundsF();
+       if ((__pEdit->GetEditStyle() & EDIT_STYLE_FLEXIBLE) == false)
+       {
+               __initialBounds = __pEdit->GetBoundsF();
+       }
 
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to change layout.", GetErrorMessage(r));
 
@@ -8239,13 +8259,14 @@ _EditPresenter::CalculateFlexibleHeight(void)
 
                int maxHeight = _CoordinateSystemUtils::ConvertToInteger(CalculateMaximumFlexibleHeight());
 
-               if (expectedEditHeight >= maxHeight)
+               //If InitialBounds is more than expectedEdit height, set flexible height as initial height
+               if (expectedEditHeight < _CoordinateSystemUtils::ConvertToInteger(__initialBounds.height))
                {
-                       height = maxHeight;
+                       height = _CoordinateSystemUtils::ConvertToInteger(__initialBounds.height);
                }
-               else if (expectedEditHeight < _CoordinateSystemUtils::ConvertToInteger(__initialBounds.height))
+               else if (expectedEditHeight >= maxHeight)
                {
-                       height = _CoordinateSystemUtils::ConvertToInteger(__initialBounds.height);
+                       height = maxHeight;
                }
                else
                {
@@ -8318,7 +8339,14 @@ _EditPresenter::SetFlexBounds(const Rectangle& bounds)
        pVisualElement->SetAnimationProvider(__pEditVEDelegator);
        pVisualElement->SetImplicitAnimationEnabled(true);
 
+       if (!((__pEdit->GetEditStyle() & EDIT_STYLE_FLEXIBLE) == false))
+       {
+               __updateInitialBounds = false;
+       }
+
        __pEdit->SetBounds(bounds);
+       __updateInitialBounds = true;
+
        Resize();
 
        __pEdit->Invalidate();
@@ -8352,7 +8380,15 @@ _EditPresenter::SetFlexBounds(const FloatRectangle& bounds)
        pVisualElement->SetAnimationProvider(__pEditVEDelegator);
        pVisualElement->SetImplicitAnimationEnabled(true);
 
+       //Modify InitialBounds only on User calls and on Orientation change
+       if (!((__pEdit->GetEditStyle() & EDIT_STYLE_FLEXIBLE) == false))
+       {
+               __updateInitialBounds = false;
+       }
+
        __pEdit->SetBounds(bounds);
+       __updateInitialBounds = true;
+
        Resize();
 
        __pEdit->Invalidate();
index 322a943..4cbcf58 100755 (executable)
@@ -291,7 +291,6 @@ _TokenEditPresenter::_TokenEditPresenter(void)
        , __pTimingFunction(null)
        , __descriptionTextRectForScroll(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
        , __previousTitleWidth(-1.0f)
-       , __previousEditBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
        , __isTokenEditPresenterInitialized(false)
        , __isFocus(false)
        , __previousCursorPosition(0)
@@ -500,8 +499,6 @@ _TokenEditPresenter::Initialize(const _Control& control)
        r = GET_BITMAP_CONFIG_N(TOKENEDIT::BG_PRESSED_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pTokenBgPressedEffectBitmap);
        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       __previousEditBounds = __pTokenEdit->GetBoundsF();
-
        __isTokenEditPresenterInitialized = true;
 
        __previousCursorPosition = GetCursorPosition();
@@ -1266,7 +1263,7 @@ _TokenEditPresenter::CalculateTokenPositionFromIndex(int startIndex, bool leftWa
                                findPrevTokenLoopFlag = false;
                        }
 
-                       float tempTextWidth = tokenEditBounds.width - pPreviousToken->displayRect.x - pPreviousToken->displayRect.width - tokenHorizontalSpacing - __pTokenEdit->GetHorizontalMarginF(EDIT_TEXT_RIGHT_MARGIN);
+                       float tempTextWidth = tokenEditBounds.width - pPreviousToken->displayRect.x - pPreviousToken->displayRect.width - tokenHorizontalSpacing - tokenTextRightMargin - __pTokenEdit->GetHorizontalMarginF(EDIT_TEXT_RIGHT_MARGIN);
                        if (tokenTextLeftMargin + pToken->GetTextPixelWidth() + tokenTextRightMargin > tempTextWidth)           // Line change
                        {
                                pToken->displayRect.x = tokenTextLeftMargin + __pTokenEdit->GetHorizontalMarginF(EDIT_TEXT_LEFT_MARGIN);
@@ -1919,8 +1916,7 @@ _TokenEditPresenter::RecalculateTokenBounds(float position)
                __descriptionTextRect.y = __descriptionTextRectForScroll.y + __scrollValue;
        }
 
-       __pTokenEdit->Draw();
-       __pTokenEdit->Show();
+       __pTokenEdit->Invalidate();
 
        r = SetInitialBounds();
        SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set bounds.");
@@ -1981,8 +1977,7 @@ _TokenEditPresenter::SetTokenBoundsByTouchInfo(const _TouchInfo& touchinfo)
                                __descriptionTextRect.y = __descriptionTextRectForScroll.y + __scrollValue;
                        }
 
-                       __pTokenEdit->Draw();
-                       __pTokenEdit->Show();
+                       __pTokenEdit->Invalidate();
                }
                else
                {
@@ -2315,7 +2310,7 @@ _TokenEditPresenter::AdjustFlexibleHeight(void)
        FloatRectangle displayScrollBounds = GetDisplayScrollBoundsF();
        float calcHeight = CalculateFlexibleHeightF();
 
-       if(!_FloatCompare(editRect.height, calcHeight))
+       if (!_FloatCompare(editRect.height, calcHeight))
        {
                displayScrollBounds.height = calcHeight;
                SetScrollBarBounds(displayScrollBounds);
@@ -2910,7 +2905,7 @@ _TokenEditPresenter::OnTextCommitted(const String& commitText)
        {
                CheckTokenScrolling();
        }
-       __pTokenEdit->Draw();
+       __pTokenEdit->Invalidate();
 
        return;
 }
@@ -3408,423 +3403,6 @@ _TokenEditPresenter::OnVisualElementAnimationFinished (const Tizen::Ui::Animatio
        return;
 }
 
-float
-_TokenEditPresenter::ResizeTokenAndAdjustEllipsis(int index, float value, bool isTokenShrink)
-{
-       if (isTokenShrink)
-       {
-               float trimValue = value;
-               float extraTrimValue = 0.0f;
-
-               _Token* pToken = null;
-               pToken = static_cast <_Token*>(__pTokenList->GetAt(index));
-               SysTryReturn(NID_UI_CTRL, pToken != null, -1.0f, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-               float tokenMinimumSize = 0.0f;
-
-               _ControlOrientation orientation = __pTokenEdit->GetOrientation();
-
-               GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_MIN_WIDTH, orientation, tokenMinimumSize);
-
-               if ((pToken->displayRect.width - trimValue) >= tokenMinimumSize)
-               {
-                       pToken->displayRect.width -= trimValue;
-               }
-               else
-               {
-                       extraTrimValue = (tokenMinimumSize - (pToken->displayRect.width - trimValue));
-                       pToken->displayRect.width = tokenMinimumSize;
-               }
-
-               InitializeTokenVisibilityAt(index);
-
-               pToken->pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
-               pToken->pTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
-
-               return extraTrimValue;
-       }
-       else
-       {
-               float expandValue = value;
-               float extraExpandValue = 0.0f;
-
-               _Token* pToken = null;
-               pToken = static_cast <_Token*>(__pTokenList->GetAt(index));
-               SysTryReturn(NID_UI_CTRL, pToken != null, -1.0f, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-               float tokenTextLeftMargin = 0.0f;
-               float tokenTextRightMargin = 0.0f;
-
-               _ControlOrientation orientation = __pTokenEdit->GetOrientation();
-
-               GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_LEFT_MARGIN, orientation, tokenTextLeftMargin);
-               GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
-
-               float tokenTextWidth = pToken->GetTextPixelWidth();
-
-               float tokenDisplayRectWidth = _CoordinateSystemUtils::ConvertToFloat(tokenTextLeftMargin + tokenTextWidth + tokenTextRightMargin);
-               if ((pToken->displayRect.width + expandValue) <= tokenDisplayRectWidth)
-               {
-                       pToken->displayRect.width += expandValue;
-               }
-               else
-               {
-                       extraExpandValue = ((pToken->displayRect.width + expandValue) - tokenDisplayRectWidth);
-                       pToken->displayRect.width = tokenDisplayRectWidth;
-               }
-
-               InitializeTokenVisibilityAt(index);
-
-               pToken->pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
-               pToken->pTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
-
-               return extraExpandValue;
-       }
-
-       return -1;
-}
-
-int
-_TokenEditPresenter::PickToken(int index, FloatRectangle tokenDispRect, bool isTokenShrink)
-{
-       int tokenCount = __pTokenList->GetCount();
-
-       float tokenMinimumSize = 0.0f;
-       float tokenTextLeftMargin = 0.0f;
-       float tokenTextRightMargin = 0.0f;
-
-       _ControlOrientation orientation = __pTokenEdit->GetOrientation();
-
-       GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_MIN_WIDTH, orientation, tokenMinimumSize);
-       GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_LEFT_MARGIN, orientation, tokenTextLeftMargin);
-       GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
-
-       if (isTokenShrink)
-       {
-               if (index < tokenCount)
-               {
-                       for (int i = index; i >= 0; i--)
-                       {
-                               _Token* pToken = null;
-                               pToken = static_cast <_Token*>(__pTokenList->GetAt(i));
-                               SysTryReturn(NID_UI_CTRL, pToken != null, -1, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-                               FloatRectangle tokenRect = pToken->displayRect;
-                               if (_FloatCompare(tokenDispRect.y, tokenRect.y))
-                               {
-                                       float tokenMinSize = _CoordinateSystemUtils::ConvertToFloat(tokenMinimumSize);
-                                       if (tokenRect.width > tokenMinSize)
-                                       {
-                                               return i;
-                                       }
-                               }
-                       }
-               }
-       }
-       else
-       {
-               for (int i = index; i < tokenCount; i++)
-               {
-                       _Token* pToken = null;
-                       pToken = static_cast <_Token*>(__pTokenList->GetAt(i));
-                       SysTryReturn(NID_UI_CTRL, pToken != null, -1, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-                       FloatRectangle tokenRect = pToken->displayRect;
-                       if (_FloatCompare(tokenDispRect.y, tokenRect.y))
-                       {
-                               float tokenTextWidth = pToken->GetTextPixelWidth();
-                               float currentTokenWidth = _CoordinateSystemUtils::ConvertToFloat(tokenTextLeftMargin + tokenTextWidth + tokenTextRightMargin);
-
-                               if (tokenRect.width < currentTokenWidth)
-                               {
-                                       return i;
-                               }
-                       }
-               }
-       }
-
-       return -1;
-}
-
-void
-_TokenEditPresenter::RepositionToken(int currentTokenIndex, float moveDistance, bool isTokenShrink)
-{
-       int tokenCount = __pTokenList->GetCount();
-
-       _Token* pCurrentToken = null;
-       pCurrentToken = static_cast <_Token*>(__pTokenList->GetAt(currentTokenIndex));
-       SysTryReturnVoidResult(NID_UI_CTRL, pCurrentToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-       FloatRectangle currentTokenRect = pCurrentToken->displayRect;
-
-       if (currentTokenIndex < (tokenCount - 1))
-       {
-               for (int i = currentTokenIndex + 1; i < tokenCount; i++)
-               {
-                       _Token* pToken = null;
-                       pToken = static_cast <_Token*>(__pTokenList->GetAt(i));
-                       SysTryReturnVoidResult(NID_UI_CTRL, pToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-                       if (pToken)
-                       {
-                               FloatRectangle tokenRect = pToken->displayRect;
-                               if (_FloatCompare(currentTokenRect.y, tokenRect.y))
-                               {
-                                       if (isTokenShrink)
-                                       {
-                                               pToken->displayRect.x -= moveDistance;
-                                       }
-                                       else
-                                       {
-                                               pToken->displayRect.x += moveDistance;
-                                       }
-
-                                       InitializeTokenVisibilityAt(i);
-                               }
-                               else
-                               {
-                                       break;
-                               }
-                       }
-               }
-       }
-
-       return;
-}
-
-void
-_TokenEditPresenter::ShrinkTokens()
-{
-       float tokenTextRightMargin = 0.0f;
-
-       _ControlOrientation orientation = __pTokenEdit->GetOrientation();
-       GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
-
-       int tokenCount = __pTokenList->GetCount();
-       FloatRectangle currentEditBounds = __pTokenEdit->GetBoundsF();
-
-       for (int i = 0; i < tokenCount; i++)
-       {
-               bool isTokenPicked = false;
-               _Token* pToken = null;
-               _Token* pNextToken = null;
-
-               pToken = static_cast <_Token*>(__pTokenList->GetAt(i));
-               SysTryReturnVoidResult(NID_UI_CTRL, pToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-               FloatRectangle tokenRect = pToken->displayRect;
-
-               FloatRectangle nextTokenRect;
-               if (i < tokenCount - 1)
-               {
-                       pNextToken = static_cast <_Token*>(__pTokenList->GetAt(i + 1));
-                       SysTryReturnVoidResult(NID_UI_CTRL, pNextToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-                       nextTokenRect = pNextToken->displayRect;
-               }
-
-               if (pNextToken)
-               {
-                       if (nextTokenRect.y > tokenRect.y)
-                       {
-                               isTokenPicked = true;
-                       }
-               }
-               else
-               {
-                       isTokenPicked = true;
-               }
-
-               //"pToken" (isTokenPicked = true) is the last token in a row
-               if (isTokenPicked == false)
-               {
-                       continue;
-               }
-
-               float tokenEndPoint = tokenRect.x + tokenRect.width + tokenTextRightMargin + __pTokenEdit->GetHorizontalMarginF(EDIT_TEXT_RIGHT_MARGIN);
-               if (tokenEndPoint <= currentEditBounds.width)
-               {
-                       continue;
-               }
-
-               //Trimming Token required
-               float trimValue = tokenEndPoint - currentEditBounds.width;
-
-               while (trimValue > 0.0f)
-               {
-                       int tokenIndex = PickToken(i, tokenRect, true);
-                       if (tokenIndex >= 0)
-                       {
-                               float extraTrimValue = ResizeTokenAndAdjustEllipsis(tokenIndex, trimValue, true);
-                               if (extraTrimValue < 0.0f)
-                               {
-                                       SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-                                       break;
-                               }
-
-                               if ((trimValue - extraTrimValue) > 0.0f)
-                               {
-                                       RepositionToken(tokenIndex, (trimValue - extraTrimValue), true);
-                               }
-
-                               trimValue = extraTrimValue;
-                       }
-                       else
-                       {
-                               break;
-                       }
-               }
-       }
-
-       return;
-}
-
-float
-_TokenEditPresenter::GetPickedTokenEndPoint(int index, Tizen::Graphics::FloatRectangle tokenDispRect)
-{
-       float tokenTextRightMargin = 0.0f;
-       float endValue = 0.0f;
-
-       _ControlOrientation orientation = __pTokenEdit->GetOrientation();
-       GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
-
-       float marginValue = tokenTextRightMargin + __pTokenEdit->GetHorizontalMarginF(EDIT_TEXT_RIGHT_MARGIN);;
-
-       FloatRectangle lastTokenRect(0.0f, 0.0f, 0.0f, 0.0f);
-
-       int tokenCount = __pTokenList->GetCount();
-       for (int i = index; i < tokenCount; i++)
-       {
-               _Token* pToken = null;
-               pToken = static_cast <_Token*>(__pTokenList->GetAt(i));
-               SysTryReturn(NID_UI_CTRL, pToken != null, 0, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-               FloatRectangle tokenRect = pToken->displayRect;
-               if (_FloatCompare(tokenDispRect.y, tokenRect.y))
-               {
-                       lastTokenRect = tokenRect;
-               }
-               else
-               {
-                       break;
-               }
-       }
-
-       endValue = marginValue + lastTokenRect.x + lastTokenRect.width;
-
-       return endValue;
-}
-
-void
-_TokenEditPresenter::ExpandTokens()
-{
-       int tokenCount = __pTokenList->GetCount();
-       FloatRectangle currentEditBounds = __pTokenEdit->GetBoundsF();
-
-       for (int i = tokenCount - 1; i >= 0; i--)
-       {
-               bool isTokenPicked = false;
-               _Token* pToken = null;
-               _Token* pPrevToken = null;
-
-               pToken = static_cast <_Token*>(__pTokenList->GetAt(i));
-               SysTryReturnVoidResult(NID_UI_CTRL, pToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-               FloatRectangle tokenRect = pToken->displayRect;
-
-               FloatRectangle prevTokenRect;
-               if (i > 0)
-               {
-                       pPrevToken = static_cast <_Token*>(__pTokenList->GetAt(i - 1));
-                       SysTryReturnVoidResult(NID_UI_CTRL, pPrevToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
-                       prevTokenRect = pPrevToken->displayRect;
-               }
-
-               if (pPrevToken)
-               {
-                       if (prevTokenRect.y < tokenRect.y)
-                       {
-                               isTokenPicked = true;
-                       }
-               }
-               else
-               {
-                       isTokenPicked = true;
-               }
-
-               //"pToken" (isTokenPicked = true) is the first token in a row
-               if (isTokenPicked == false)
-               {
-                       continue;
-               }
-
-               float tokenEndPoint = GetPickedTokenEndPoint(i, tokenRect);;
-
-               if ((_FloatCompare(tokenEndPoint, 0.0f)) || (tokenEndPoint >= currentEditBounds.width))
-               {
-                       continue;
-               }
-
-               //Expanding Token required
-               float expandValue = currentEditBounds.width - tokenEndPoint;
-
-               while (expandValue > 0.0f)
-               {
-                       int tokenIndex = PickToken(i, tokenRect, false);
-                       if (tokenIndex >= 0)
-                       {
-                               float extraExpandValue = ResizeTokenAndAdjustEllipsis(tokenIndex, expandValue, false);
-                               if (extraExpandValue < 0.0f)
-                               {
-                                       SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-                                       break;
-                               }
-
-                               if ((expandValue - extraExpandValue) > 0.0f)
-                               {
-                                       RepositionToken(tokenIndex, (expandValue - extraExpandValue), false);
-                               }
-
-                               expandValue = extraExpandValue;
-                       }
-                       else
-                       {
-                               break;
-                       }
-               }
-       }
-
-       return;
-}
-
-void
-_TokenEditPresenter::OnBoundsChanged(void)
-{
-       if (!__isTokenEditPresenterInitialized)
-       {
-               return;
-       }
-
-       int tokenCount = __pTokenList->GetCount();
-       SysTryReturnVoidResult(NID_UI_CTRL, tokenCount > 0, E_SUCCESS, "No Tokens available.");
-
-       FloatRectangle tokenEditBounds = __pTokenEdit->GetBoundsF();
-
-       if (tokenEditBounds.width < __previousEditBounds.width)
-       {
-               ShrinkTokens();
-       }
-       else if (tokenEditBounds.width > __previousEditBounds.width)
-       {
-               ExpandTokens();
-       }
-
-       __previousEditBounds = tokenEditBounds;
-
-       return;
-}
-
 void
 _TokenEditPresenter::OnTimerExpired(Timer& timer)
 {
@@ -3949,4 +3527,24 @@ _TokenEditPresenter::ChangeLayout(_ControlOrientation orientation)
        return r;
 }
 
+void
+_TokenEditPresenter::OnBoundsChanged(void)
+{
+       if (!__isTokenEditPresenterInitialized)
+       {
+               return;
+       }
+
+       _ControlOrientation orientation = __pTokenEdit->GetOrientation();
+       FloatRectangle tokenEditBounds = __pTokenEdit->GetBoundsF();
+
+       if (IsUpdateInitialBounds())
+       {
+               SetControlInitialBounds(tokenEditBounds);
+       }
+       ChangeInternalLayout(orientation);
+
+       return;
+}
+
 }}} //Tizen::Ui::Controls
index b42a0a4..35de054 100644 (file)
@@ -322,6 +322,8 @@ public:
        void SendOpaqueCommand (const Tizen::Base::String& command);
        Tizen::Ui::Animations::_VisualElement* GetTextVisualElement(void);
        bool IsBounded(void) const;
+       void SetControlInitialBounds(Tizen::Graphics::FloatRectangle initBounds);
+       bool IsUpdateInitialBounds(void);
 
 protected:
        void StopTitleSlidingTimer(void);
@@ -570,6 +572,7 @@ private:
        bool __textBlockMoveLeft;
        bool __textBlockMoving;
        bool __clipboardConnected;
+       bool __updateInitialBounds;
 }; // _EditPresenter
 
 }}} // Tizen::Ui::Controls
index 3a5ad91..3a30fd8 100644 (file)
@@ -173,14 +173,6 @@ private:
        int CalculateVisibleTokenCount(void);
        result InitializeDescriptionText(void);
        bool CheckCopyPastePopupShowStatus(void);
-
-       float ResizeTokenAndAdjustEllipsis(int index, float value, bool isTokenShrink);
-       int PickToken(int index, Tizen::Graphics::FloatRectangle tokenDispRect, bool isTokenShrink);
-       void RepositionToken(int currentTokenIndex, float moveDistance, bool isTokenShrink);
-       float GetPickedTokenEndPoint(int index, Tizen::Graphics::FloatRectangle tokenDispRect);
-       void ShrinkTokens();
-       void ExpandTokens();
-
        result ChangeInternalLayout(_ControlOrientation orientation);
 
 private:
@@ -245,8 +237,6 @@ private:
 
        float __previousTitleWidth;
 
-       Tizen::Graphics::FloatRectangle __previousEditBounds;
-
        bool __isTokenEditPresenterInitialized;
 
        bool __isFocus;