positionY = GetBoundsF().height - contentsHeight;
}
__pHeaderFooterItemText->Construct(FloatRectangle(0.0f, positionY, GetBoundsF().width, contentsHeight), text);
-
__pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
__pHeaderFooterItemText->SetTextColor(textColor);
__pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
bool
_TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
{
- _KeyCode keyCode = keyInfo.GetKeyCode();
- _Control* pFocusedControl = null;
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+ IListT<_Control*>* pFocusList = GetFocusListN();
+ _Control* pChildControl = null;
+ _Control* pFocusedControl = null;
_Window* pTop = source.GetRootWindow();
+
if (pTop)
{
pFocusedControl = pTop->GetFocusControl();
}
- _Control* pChildControl = null;
- switch (keyCode)
- {
- case _KEY_LEFT:
- if (pFocusedControl != null)
- {
- pChildControl = GetPreviousFocusChildControl(*pFocusedControl);
- }
- break;
+ int count = pFocusList->GetCount();
+
+ if (pFocusedControl == null)
+ {
+ return false;
+ }
+
+ switch (keyCode)
+ {
+ case _KEY_LEFT:
+ if (pFocusList == null)
+ {
+ break;
+ }
+
+ if (IsFocused() == false)
+ {
+ for(int i=0; i<count; i++)
+ {
+ pFocusList->GetAt(i, pChildControl);
+ if (pChildControl == null)
+ {
+ continue;
+ }
+
+ if (pChildControl->IsFocused())
+ {
+ if (i == count -1)
+ {
+ pChildControl = null;
+ break;
+ }
+
+ for (int j=i+1; j<count; j++)
+ {
+ pFocusList->GetAt(j, pChildControl);
+ if (pChildControl == null)
+ {
+ continue;
+ }
+
+ if (pChildControl->IsFocusable())
+ {
+ break;
+ }
+ else
+ {
+ pChildControl = null;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ if (pChildControl == null)
+ {
+ for (int i=0; i<count; i++)
+ {
+ pFocusList->GetAt(i, pChildControl);
+ if (pChildControl == null)
+ {
+ continue;
+ }
+
+ if (pChildControl->IsFocusable())
+ {
+ break;
+ }
+ else
+ {
+ pChildControl = null;
+ }
+ }
+ }
+
+ if (pChildControl)
+ {
+ pChildControl->SetFocused(true);
+ pChildControl->DrawFocus();
+ }
+ break;
case _KEY_RIGHT:
- if (pFocusedControl != null)
+ if (pFocusList == null)
+ {
+ break;
+ }
+
+ if (IsFocused() == false)
+ {
+ for(int i=count-1; i>=0; i--)
+ {
+ pFocusList->GetAt(i, pChildControl);
+ if (pChildControl == null)
+ {
+ continue;
+ }
+
+ if (pChildControl->IsFocused())
+ {
+ if (i == 0)
+ {
+ pChildControl = null;
+ break;
+ }
+
+ for(int j=i-1; j>=0; j--)
+ {
+ pFocusList->GetAt(j, pChildControl);
+ if (pChildControl == null)
+ {
+ continue;
+ }
+
+ if (pChildControl->IsFocusable())
+ {
+ break;
+ }
+ else
+ {
+ pChildControl = null;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ if (pChildControl == null)
+ {
+ for (int i=count-1; i>=0; i--)
+ {
+ pFocusList->GetAt(i, pChildControl);
+ if (pChildControl == null)
+ {
+ continue;
+ }
+
+ if (pChildControl->IsFocusable())
+ {
+ break;
+ }
+ else
+ {
+ pChildControl = null;
+ }
+ }
+ }
+
+ if (pChildControl)
{
- pChildControl = GetNextFocusChildControl(*pFocusedControl);
+ pChildControl->SetFocused(true);
+ pChildControl->DrawFocus();
}
break;
return false;
}
- if (keyCode == _KEY_LEFT || keyCode == _KEY_RIGHT)
- {
- if (pFocusedControl != null)
- {
- if (pChildControl)
- {
- pChildControl->SetFocused(true);
- pChildControl->DrawFocus();
- }
- else
- {
- _Control* pParentControl = pFocusedControl->GetParent();
- pParentControl->SetFocused(true);
- pParentControl->DrawFocus();
- }
- }
- }
return true;
}
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};
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;
return false;
}
+void
+_TableViewPresenter::OnDrawFocus(void)
+{
+ _Control* pFocusedControl = null;
+ _Window* pTop = __pTableView->GetRootWindow();
+ if (pTop)
+ {
+ pFocusedControl = pTop->GetFocusControl();
+ }
+
+ _TableView* pTableView = null;
+ _TableViewItem* pItem = null;
+ TableViewItemTag itemPos = {-1, -1};
+
+ 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();
+ }
+ }
+ }
+}
+
+void
+_TableViewPresenter::OnFocusModeStateChanged(void)
+{
+ _Control* pFocusedControl = null;
+ _Window* pTop = __pTableView->GetRootWindow();
+ if (pTop)
+ {
+ pFocusedControl = pTop->GetFocusControl();
+ }
+
+ _TableViewItem* pItem = null;
+ pItem = dynamic_cast<_TableViewItem*>(pFocusedControl);
+ if (pItem != null)
+ {
+ pItem->SetFocused(false);
+ }
+}
+
bool
_TableViewPresenter::GetAccessibilityElementFocusedState(void)
{