Revert "modified focus UI when TableViewItem is empty"
authorwoojin nam <w.nam@samsung.com>
Fri, 28 Jun 2013 12:41:24 +0000 (12:41 +0000)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 28 Jun 2013 12:41:24 +0000 (12:41 +0000)
This reverts commit 994094a06c073712e81a517da110af669f6e309f

Change-Id: I8622a2407aa453facb25eccfa3dadcbf5d12edf4

src/ui/controls/FUiCtrl_TableViewPresenter.cpp

index e7590b3..94bd74d 100644 (file)
@@ -5286,118 +5286,124 @@ _TableViewPresenter::OnOcurredOverflowItems(const int currentCashSize, const int
 bool
 _TableViewPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
 {
-       _KeyCode keyCode = keyInfo.GetKeyCode();
-       _Control* pFocusedControl = null;
+        _KeyCode keyCode = keyInfo.GetKeyCode();
+        _Control* pFocusedControl = null;
        _Window* pTop = source.GetRootWindow();
        if (pTop)
        {
                pFocusedControl = pTop->GetCurrentFocusControl();
        }
 
-       _TableViewItem* pItem = null;
-       TableViewItemTag itemPos = {-1, -1};
+        _TableViewItem* pItem = null;
+        TableViewItemTag itemPos = {-1, -1};
 
-       switch (keyCode)
-       {
-       case _KEY_UP:
-               if (pFocusedControl != null)
-               {
-                       pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
-                       if (pItem != null)
-                       {
-                               pItem->GetItemIndex(itemPos.groupIndex, itemPos.itemIndex);
-                               TableViewItemTag firstItemPos = {-1, -1};
-                               GetFirstItem(firstItemPos);
-                               if (itemPos.groupIndex == firstItemPos.groupIndex && itemPos.itemIndex == firstItemPos.itemIndex)
-                               {
-                                       return false;
-                               }
+        switch (keyCode)
+        {
+        case _KEY_UP:
+                if (pFocusedControl != null)
+                {
+                        pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
+                        if (pItem != null)
+                        {
+                                pItem->GetItemIndex(itemPos.groupIndex, itemPos.itemIndex);
+                                TableViewItemTag firstItemPos = {-1, -1};
+                                GetFirstItem(firstItemPos);
+                                if (itemPos.groupIndex == firstItemPos.groupIndex && itemPos.itemIndex == firstItemPos.itemIndex)
+                                {
+                                        return false;
+                                }
 
-                               while (GetPreviousItemPosition(itemPos, itemPos))
-                               {
-                                       if (__pTableView->GetTableViewStyle() == TABLE_VIEW_STYLE_SIMPLE)
-                                       {
-                                               TableViewItemTag firstItemPos = {-1, -1};
-                                               GetFirstItem(firstItemPos);
-                                               if (itemPos.groupIndex == firstItemPos.groupIndex && itemPos.itemIndex == firstItemPos.itemIndex)
-                                               {
-                                                       return false;
-                                               }
-                                       }
+                                while (GetPreviousItemPosition(itemPos, itemPos))
+                                {
+                                        if (__pTableView->GetTableViewStyle() == TABLE_VIEW_STYLE_SIMPLE)
+                                        {
+                                                TableViewItemTag firstItemPos = {-1, -1};
+                                                GetFirstItem(firstItemPos);
+                                                if (itemPos.groupIndex == firstItemPos.groupIndex && itemPos.itemIndex == firstItemPos.itemIndex)
+                                                {
+                                                        return false;
+                                                }
+                                        }
 
-                                       if (IsGroupExpanded(itemPos.groupIndex) == false)
-                                       {
-                                               itemPos.itemIndex = -1;
-                                       }
+                                        if (IsGroupExpanded(itemPos.groupIndex) == false)
+                                        {
+                                                itemPos.itemIndex = -1;
+                                        }
 
-                                       pItem = static_cast <_TableViewItem*>(__pListModel->LoadItem(itemPos.groupIndex, itemPos.itemIndex));
-                                       if (pItem->GetBoundsF().y < GetScrollPosition())
-                                       {
-                                               ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
-                                       }
+                                        pItem = static_cast <_TableViewItem*>(__pListModel->LoadItem(itemPos.groupIndex, itemPos.itemIndex));
+                                        if (pItem->GetBoundsF().y < GetScrollPosition())
+                                        {
+                                                ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
+                                        }
 
-                                       if (pItem->GetEnableState())
-                                       {
-                                               pItem->SetFocused(true);
-                                               pItem->DrawFocus();
-                                               break;
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               return false;
-                       }
-               }
-               break;
+                                        if (pItem->GetEnableState())
+                                        {
+                                                pItem->SetFocused(true);
+                                                pItem->DrawFocus();
+                                                break;
+                                        }
+                                }
+                        }
+                        else
+                        {
+                                _Control* pParentControl = pFocusedControl->GetParent();
+                                pParentControl->SetFocused(true);
+                                pParentControl->DrawFocus();
+                                break;
+                        }
+                }
+                break;
 
-       case _KEY_DOWN:
-               if (pFocusedControl != null)
-               {
-                       pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
-                       if (pItem != null)
-                       {
-                               pItem->GetItemIndex(itemPos.groupIndex, itemPos.itemIndex);
-                               TableViewItemTag lastItemPos = {-1, -1};
-                               GetLastItem(lastItemPos);
-                               if (itemPos.groupIndex == lastItemPos.groupIndex && itemPos.itemIndex == lastItemPos.itemIndex)
-                               {
-                                       return false;
-                               }
+        case _KEY_DOWN:
+                if (pFocusedControl != null)
+                {
+                        pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
+                        if (pItem != null)
+                        {
+                                pItem->GetItemIndex(itemPos.groupIndex, itemPos.itemIndex);
+                                TableViewItemTag lastItemPos = {-1, -1};
+                                GetLastItem(lastItemPos);
+                                if (itemPos.groupIndex == lastItemPos.groupIndex && itemPos.itemIndex == lastItemPos.itemIndex)
+                                {
+                                        return false;
+                                }
 
-                               while (GetNextItemPosition(itemPos, itemPos))
-                               {
-                                       if (__pTableView->GetTableViewStyle() == TABLE_VIEW_STYLE_SIMPLE && itemPos.itemIndex == -1)
-                                       {
-                                               itemPos.itemIndex = 0;
-                                       }
+                                while (GetNextItemPosition(itemPos, itemPos))
+                                {
+                                        if (__pTableView->GetTableViewStyle() == TABLE_VIEW_STYLE_SIMPLE && itemPos.itemIndex == -1)
+                                        {
+                                                itemPos.itemIndex = 0;
+                                        }
 
-                                       pItem = static_cast <_TableViewItem*>(__pListModel->LoadItem(itemPos.groupIndex, itemPos.itemIndex));
-                                       if (pItem->GetBoundsF().y + pItem->GetBoundsF().height > GetScrollPosition() + __pTableView->GetBoundsF().height)
-                                       {
-                                               ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
-                                       }
+                                        pItem = static_cast <_TableViewItem*>(__pListModel->LoadItem(itemPos.groupIndex, itemPos.itemIndex));
+                                        if (pItem->GetBoundsF().y + pItem->GetBoundsF().height > GetScrollPosition() + __pTableView->GetBoundsF().height)
+                                        {
+                                                ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
+                                        }
 
-                                       if (pItem->GetEnableState())
-                                       {
-                                               pItem->SetFocused(true);
-                                               pItem->DrawFocus();
-                                               break;
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               return false;
-                       }
-               }
-               break;
+                                        if (pItem->GetEnableState())
+                                        {
+                                                pItem->SetFocused(true);
+                                                pItem->DrawFocus();
+                                                break;
+                                        }
+                                }
+                        }
+                        else
+                        {
+                                _Control* pParentControl = pFocusedControl->GetParent();
+                                pParentControl->SetFocused(true);
+                                pParentControl->DrawFocus();
+                                break;
+                        }
+                }
+                break;
 
-       default:
-               return false;
-       }
+        default:
+                return false;
+        }
 
-       return true;
+        return true;
 }
 
 bool