Blocking traversaltag setting on KeyRelease: Fix for N_SE-53471
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_TableViewItem.cpp
index 5266968..a434ac3 100644 (file)
@@ -726,14 +726,14 @@ _TableViewItem::CreateDetailButton(void)
 }
 
 _Label*
-_TableViewItem::GetLabelCore(Label* label)
+_TableViewItem::GetLabelCore(Label* pLabel)
 {
-       if (label == null)
+       if (pLabel == null)
        {
                return null;
        }
 
-       _LabelImpl* pImpl = _LabelImpl::GetInstance(*label);
+       _LabelImpl* pImpl = _LabelImpl::GetInstance(*pLabel);
        return &pImpl->GetCore();
 }
 
@@ -1414,7 +1414,7 @@ _TableViewItem::FireItemTouchPressed()
 }
 
 void
-_TableViewItem::FireItemTouchReleased()
+_TableViewItem::FireItemTouchReleased(bool isTouchRelease)
 {
        if (__isTouchCancelOnPressRelease == true)
        {
@@ -1514,15 +1514,18 @@ _TableViewItem::FireItemTouchReleased()
 
        if (fireItemEvent)
        {
-               int groupIndex = -1;
-               int itemIndex = -1;
-               GetItemIndex(groupIndex, itemIndex);
-               if (GetParent())
+               if (isTouchRelease)
                {
-                       _TableView* pTableView = dynamic_cast<_TableView*>(GetParent());
-                       if (pTableView)
+                       int groupIndex = -1;
+                       int itemIndex = -1;
+                       GetItemIndex(groupIndex, itemIndex);
+                       if (GetParent())
                        {
-                               pTableView->SetFocusItemOnPressedState(groupIndex, itemIndex);
+                               _TableView* pTableView = dynamic_cast<_TableView*>(GetParent());
+                               if (pTableView)
+                               {
+                                       pTableView->SetFocusItemOnPressedState(groupIndex, itemIndex);
+                               }
                        }
                }
                FireItemEvent(selectedItem);
@@ -2116,11 +2119,9 @@ _TableViewItem::OnBoundsChanged(void)
                __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
        }
 
-
+       RemoveFocusRing(true);
        if (IsFocusModeStateEnabled())
        {
-               RemoveFocusRing(true);
-
                if (GetRootWindow() && GetRootWindow()->IsActivated()
                                && IsFocused())
                {
@@ -2360,7 +2361,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                        r = E_SYSTEM;
                }
        }
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred.  SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred.  SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
 
        if (__enabledState)
        {
@@ -2371,7 +2372,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                                if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED))
                                {
                                        r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
-                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                                }
                        }
                        else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
@@ -2379,7 +2380,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                                if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED))
                                {
                                        r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
-                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                                }
                        }
                        else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
@@ -2387,7 +2388,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                                if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED))
                                {
                                        r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
-                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                                }
                        }
                        else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
@@ -2395,7 +2396,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                                if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED))
                                {
                                        r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
-                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                                       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                                }
                        }
 
@@ -2424,7 +2425,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                        if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED))
                        {
                                r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
-                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                        }
                }
                else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
@@ -2432,7 +2433,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                        if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED))
                        {
                                r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
-                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                        }
                }
                else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
@@ -2440,7 +2441,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                        if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED))
                        {
                                r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
-                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                        }
                }
                else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
@@ -2448,7 +2449,7 @@ _TableViewItem::DrawSectionStyleBackground(void)
                        if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED))
                        {
                                r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
-                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+                               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
                        }
                }
 
@@ -2504,7 +2505,7 @@ _TableViewItem::DrawSectionStyleBackgroundCover(void)
        if (__enabledState)
        {
                _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
-               SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[%s] A system error has been occurred. SectionTableView  load failed", GetErrorMessage(E_SYSTEM) );
+               SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[%s] A system error has been occurred. SectionTableView  load failed", GetErrorMessage(E_SYSTEM));
 
                bgColor = pParent->GetBackgroundColor();
        }
@@ -2533,7 +2534,7 @@ _TableViewItem::DrawSectionStyleBackgroundCover(void)
        {
                r = E_SYSTEM;
        }
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
 
        if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
        {
@@ -2555,7 +2556,7 @@ _TableViewItem::DrawSectionStyleBackgroundCover(void)
        {
                r = E_SYSTEM;
        }
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
+       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
 
        __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
 
@@ -2979,7 +2980,7 @@ _TableViewItem::AdjustAnnexOnOffHandlerPosition()
                if (annexStartPositionX <= __annexOnOffHandlerPositionX
                        && annexEndPositionX >= __annexOnOffHandlerPositionX)
                {
-                       if (((annexEndPositionX - annexStartPositionX) / 2) < (__annexOnOffHandlerPositionX + (handlerBounds.width / 2)) - annexStartPositionX )
+                       if (((annexEndPositionX - annexStartPositionX) / 2) < (__annexOnOffHandlerPositionX + (handlerBounds.width / 2)) - annexStartPositionX)
                        {
                                handlerPositionX = annexEndPositionX;
                                SetChecked(true);
@@ -4898,6 +4899,11 @@ _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
                return false;
        }
 
+       if (IsReorderMode() || IsAnimationPlaying())
+       {
+               return false;
+       }
+
        _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
        _KeyCode keyCode = keyInfo.GetKeyCode();
        IListT<_Control*>* pFocusList = GetFocusListN();
@@ -5121,6 +5127,11 @@ _TableViewItem::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
                return false;
        }
 
+       if (IsReorderMode() || IsAnimationPlaying())
+       {
+               return false;
+       }
+
        _KeyCode keyCode = keyInfo.GetKeyCode();
 
        if (keyCode == _KEY_ENTER)
@@ -5145,7 +5156,7 @@ _TableViewItem::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
                {
                        __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
                }
-               FireItemTouchReleased();
+               FireItemTouchReleased(false);
                return true;
        }
        else if (keyCode == _KEY_LEFT || keyCode == _KEY_RIGHT)