__pItemDivider = _TableViewItemControl::CreateTableViewItemControlN();
r = GetLastResult();
SysTryReturn(NID_UI_CTRL, __pItemDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
+ __pItemDivider->SetFocusable(false);
AttachSystemChild(*__pItemDivider);
_AccessibilityContainer* pContainer = __pItemDivider->GetAccessibilityContainer();
{
__pItemTopDivider = _TableViewItemControl::CreateTableViewItemControlN();
SysTryReturn(NID_UI_CTRL, __pItemTopDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
+ __pItemTopDivider->SetFocusable(false);
AttachSystemChild(*__pItemTopDivider);
_AccessibilityContainer* pContainer = __pItemTopDivider->GetAccessibilityContainer();
__pItemAnnexLeftDivider = _TableViewItemControl::CreateTableViewItemControlN();
r = GetLastResult();
SysTryReturn(NID_UI_CTRL, __pItemAnnexLeftDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
+ __pItemAnnexLeftDivider->SetFocusable(false);
AttachSystemChild(*__pItemAnnexLeftDivider);
}
{
__pItemAnnexRightDivider = _TableViewItemControl::CreateTableViewItemControlN();
SysTryReturn(NID_UI_CTRL, __pItemAnnexRightDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
+ __pItemAnnexRightDivider->SetFocusable(false);
AttachSystemChild(*__pItemAnnexRightDivider);
}
float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
__pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
__pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+ GetLabelCore(__pItemAnnex)->SetFocusable(true);
AttachSystemChild(*GetLabelCore(__pItemAnnex));
}
float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
__pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
__pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+ GetLabelCore(__pItemAnnex)->SetFocusable(true);
AttachSystemChild(*GetLabelCore(__pItemAnnex));
}
float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
__pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
__pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+ GetLabelCore(__pItemAnnex)->SetFocusable(true);
AttachSystemChild(*GetLabelCore(__pItemAnnex));
}
float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
__pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
__pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+ GetLabelCore(__pItemAnnex)->SetFocusable(true);
AttachSystemChild(*GetLabelCore(__pItemAnnex));
}
__pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
}
__pSimpleItemText->SetBackgroundColor(Color(0, 0, 0, 0));
+ GetLabelCore(__pSimpleItemText)->SetFocusable(true);
}
SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pSimpleItemBitmap->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
-
__pSimpleItemBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
+ GetLabelCore(__pSimpleItemBitmap)->SetFocusable(true);
}
}
__pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
_Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText);
+ pHeaderFooterItemTextCore->SetFocusable(true);
AttachChild(*pHeaderFooterItemTextCore);
}
return false;
}
+bool
+_TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+ _Control* pFocusedControl = GetFocused();
+ _Control* pChildControl = null;
+ _TableViewItem* pItem = null;
+
+ switch (keyCode)
+ {
+ case _KEY_LEFT:
+ if (pFocusedControl != null)
+ {
+ pChildControl = GetPreviousFocusChildControl(*pFocusedControl);
+ }
+ break;
+
+ case _KEY_RIGHT:
+ if (pFocusedControl != null)
+ {
+ pChildControl = GetNextFocusChildControl(*pFocusedControl);
+ }
+ break;
+
+ default:
+ return false;
+ }
+
+ if (pFocusedControl != null)
+ {
+ if (pChildControl)
+ {
+ pChildControl->SetFocused(true);
+ pChildControl->DrawFocus();
+ }
+ else
+ {
+ _Control* pParentControl = pFocusedControl->GetParent();
+ pParentControl->SetFocused(true);
+ pParentControl->DrawFocus();
+ }
+ }
+
+ return true;
+}
+
+bool
+_TableViewItem::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (keyCode == _KEY_LEFT || keyCode == _KEY_RIGHT)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+_Control*
+_TableViewItem::GetPreviousFocusChildControl(const _Control& source)
+{
+ _Control* pParentControl = null;
+ float sourcePosition = 0.0f;
+
+ _Control* pSource = const_cast<_Control*>(&source);
+ _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
+ if (pItem != null)
+ {
+ pParentControl = pSource;
+ sourcePosition = pParentControl->GetBoundsF().width;
+ }
+ else
+ {
+ pParentControl = source.GetParent();
+ sourcePosition = source.GetBoundsF().x;
+ }
+
+ if (pParentControl == null)
+ {
+ return null;
+ }
+
+ int childControlCount = pParentControl->GetChildCount();
+ float position = 0.0f;
+ _Control* destination = null;
+
+ for(int i=0; i<childControlCount; i++)
+ {
+ _Control* pChildControl = pParentControl->GetChild(i);
+ if (pChildControl != null && pChildControl->IsFocusable())
+ {
+ float childPosition = pChildControl->GetBoundsF().x;
+ if (childPosition < sourcePosition)
+ {
+ if (childPosition > position)
+ {
+ position = childPosition;
+ destination = pChildControl;
+ }
+ else if (_FloatCompare(position, 0.0f))
+ {
+ position = childPosition;
+ destination = pChildControl;
+ }
+ }
+ }
+ }
+ return destination;
+}
+
+_Control*
+_TableViewItem::GetNextFocusChildControl(const _Control& source)
+{
+ _Control* pParentControl = null;
+ float sourcePosition = 0.0f;
+
+ _Control* pSource = const_cast<_Control*>(&source);
+ _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
+ if (pItem != null)
+ {
+ pParentControl = pSource;
+ sourcePosition = 0.0f;
+ }
+ else
+ {
+ pParentControl = source.GetParent();
+ sourcePosition = source.GetBoundsF().x;
+ }
+
+ if (pParentControl == null)
+ {
+ return null;
+ }
+
+ int childControlCount = pParentControl->GetChildCount();
+ float position = 0.0f;
+ _Control* destination = null;
+
+ for(int i=0; i<childControlCount; i++)
+ {
+ _Control* pChildControl = pParentControl->GetChild(i);
+ if (pChildControl != null && pChildControl->IsFocusable())
+ {
+ float childPosition = pChildControl->GetBoundsF().x;
+ if (childPosition > sourcePosition)
+ {
+ if (childPosition < position)
+ {
+ position = childPosition;
+ destination = pChildControl;
+ }
+ else if (_FloatCompare(position, 0.0f))
+ {
+ position = childPosition;
+ destination = pChildControl;
+ }
+ }
+ }
+ }
+ return destination;
+}
+
+bool
+_TableViewItem::IsChildControlFocusManage(void) const
+{
+ return true;
+}
}}} // Tizen::Ui::Controls
}
bool
+_TableViewPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+ _Control* pFocusedControl = __pTableView->GetFocused();
+ _TableView* pTableView = null;
+ _TableViewItem* pItem = null;
+ TableViewItemTag itemPos = {-1, -1};
+
+ switch (keyCode)
+ {
+ case _KEY_UP:
+ if (pFocusedControl != null)
+ {
+ pTableView = dynamic_cast<_TableView*>(pFocusedControl);
+ if (pTableView != null)
+ {
+ GetLastItem(itemPos);
+ if (IsGroupExpanded(itemPos.groupIndex) == false)
+ {
+ itemPos.itemIndex = -1;
+ }
+
+ ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
+ pItem = FindItem(itemPos);
+ if (pItem != null)
+ {
+ pItem->SetFocused(true);
+ pItem->DrawFocus();
+ }
+ }
+ else
+ {
+ pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
+ if (pItem != null)
+ {
+ pItem->GetItemIndex(itemPos.groupIndex, itemPos.itemIndex);
+ if (GetPreviousItemPosition(itemPos, itemPos))
+ {
+ _Control* pChildControl = null;
+ int childControlCount = pItem->GetChildCount();
+ for (int i=0; i<childControlCount; i++)
+ {
+ pChildControl = pItem->GetChild(i);
+ if (pChildControl != null)
+ {
+ pChildControl->OnFocusLost(*pChildControl);
+ }
+ }
+
+ if (__pTableView->GetTableViewStyle() == TABLE_VIEW_STYLE_SIMPLE)
+ {
+ TableViewItemTag firstItemPos = {-1, -1};
+ GetFirstItem(firstItemPos);
+ if (itemPos.groupIndex == firstItemPos.groupIndex && itemPos.itemIndex == firstItemPos.itemIndex)
+ {
+ if (__pTableView != null)
+ {
+ __pTableView->SetFocused(true);
+ __pTableView->DrawFocus();
+ }
+ break;
+ }
+ }
+
+ 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);
+ }
+ }
+ else
+ {
+ if (__pTableView != null)
+ {
+ __pTableView->SetFocused(true);
+ __pTableView->DrawFocus();
+ }
+ break;
+ }
+ }
+ else
+ {
+ _Control* pParentControl = pFocusedControl->GetParent();
+ pParentControl->SetFocused(true);
+ pParentControl->DrawFocus();
+ break;
+ }
+
+ pItem = FindItem(itemPos);
+ if (pItem != null)
+ {
+ pItem->SetFocused(true);
+ pItem->DrawFocus();
+ }
+ }
+ }
+ break;
+
+ case _KEY_DOWN:
+ if (pFocusedControl != null)
+ {
+ pTableView = dynamic_cast<_TableView*>(pFocusedControl);
+ if (pTableView != null)
+ {
+ GetFirstItem(itemPos);
+ if (__pTableView->GetTableViewStyle() == TABLE_VIEW_STYLE_SIMPLE)
+ {
+ itemPos.itemIndex = 0;
+ }
+
+ ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
+ pItem = FindItem(itemPos);
+ if (pItem != null)
+ {
+ pItem->SetFocused(true);
+ pItem->DrawFocus();
+ }
+ }
+ else
+ {
+ pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
+ if (pItem != null)
+ {
+ pItem->GetItemIndex(itemPos.groupIndex, itemPos.itemIndex);
+ if (GetNextItemPosition(itemPos, itemPos))
+ {
+ _Control* pChildControl = null;
+ int childControlCount = pItem->GetChildCount();
+ for (int i=0; i<childControlCount; i++)
+ {
+ pChildControl = pItem->GetChild(i);
+ if (pChildControl != null)
+ {
+ pChildControl->OnFocusLost(*pChildControl);
+ }
+ }
+
+ 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);
+ }
+ }
+ else
+ {
+ if (__pTableView != null)
+ {
+ __pTableView->SetFocused(true);
+ __pTableView->DrawFocus();
+ }
+ break;
+ }
+ }
+ else
+ {
+ _Control* pParentControl = pFocusedControl->GetParent();
+ pParentControl->SetFocused(true);
+ pParentControl->DrawFocus();
+ break;
+ }
+
+ pItem = FindItem(itemPos);
+ if (pItem != null)
+ {
+ pItem->SetFocused(true);
+ pItem->DrawFocus();
+ }
+ }
+ }
+ break;
+
+ case _KEY_ENTER:
+ if (pFocusedControl != null)
+ {
+ pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
+ if (pItem != null)
+ {
+ TableViewNotifyType eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
+ int annexStyle = pItem->GetItemStyle();
+ pItem->GetItemIndex(itemPos.groupIndex, itemPos.itemIndex);
+ if ((annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
+ || (annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
+ || (annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
+ {
+ if (pItem->IsChecked())
+ {
+ eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
+ }
+ else
+ {
+ eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
+ }
+ }
+ else if (__pTableView->GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED && itemPos.itemIndex == -1)
+ {
+ if (IsGroupExpanded(itemPos.groupIndex))
+ {
+ CollapseGroup(itemPos.groupIndex, false);
+ }
+ else
+ {
+ ExpandGroup(itemPos.groupIndex, false);
+ }
+ eventType = TABLEVIEW_NOTIFY_TYPE_NONE;
+ }
+ __pTableView->FireTableViewItemEvent(itemPos.groupIndex, itemPos.itemIndex, eventType, pItem);
+ }
+ }
+ break;
+
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool
+_TableViewPresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (keyCode == _KEY_UP || keyCode == _KEY_DOWN || keyCode == _KEY_ENTER)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool
_TableViewPresenter::GetAccessibilityElementFocusedState(void)
{
_TableViewItem* pItem = null;