From: MinSung Jin Date: Fri, 28 Jun 2013 04:36:58 +0000 (+0900) Subject: modified focus UI when TableViewItem is empty X-Git-Tag: accepted/tizen/20130924.144426~1^2~277 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=994094a06c073712e81a517da110af669f6e309f;p=platform%2Fframework%2Fnative%2Fuifw.git modified focus UI when TableViewItem is empty Change-Id: I20b083d0d37b755b41c3595004f798f09d0e87cc Signed-off-by: MinSung Jin --- diff --git a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp index 94bd74d..e7590b3 100644 --- a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp +++ b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp @@ -5286,124 +5286,118 @@ _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 - { - _Control* pParentControl = pFocusedControl->GetParent(); - pParentControl->SetFocused(true); - pParentControl->DrawFocus(); - break; - } - } - break; + if (pItem->GetEnableState()) + { + pItem->SetFocused(true); + pItem->DrawFocus(); + break; + } + } + } + else + { + return false; + } + } + 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 - { - _Control* pParentControl = pFocusedControl->GetParent(); - pParentControl->SetFocused(true); - pParentControl->DrawFocus(); - break; - } - } - break; + if (pItem->GetEnableState()) + { + pItem->SetFocused(true); + pItem->DrawFocus(); + break; + } + } + } + else + { + return false; + } + } + break; - default: - return false; - } + default: + return false; + } - return true; + return true; } bool