break;
}
- pActionEvent->Fire(*pEventArg);
-
pItem->SetFocused(false);
pItem->SetAndInvalidate(false);
__pContextMenu->SetFocused(false);
__pContextMenu->SetVisibleState(false);
+ pActionEvent->Fire(*pEventArg);
+
break;
}
case _KEY_ESC:
_OptionMenu::OnFocusModeStateChanged(void)
{
__isFocused = false;
- Invalidate(true);
-
+ __pOptionMenuPresenter->ClearFocus();
return;
}
, __upperDividerLine(false)
, __lowerDividerLine(false)
, __selected(false)
+ , __highlighted(false)
, __parentScrollEnable(false)
, __leftMargin(0.0f)
, __rightMargin(0.0f)
void
_OptionMenuItem::DrawItemBitmap(void)
{
- if (IsSelected())
+ if (__selected)
{
__pBitmapLabel->SetBackgroundBitmap(*__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_PRESSED]);
}
+ else if (__highlighted)
+ {
+ __pBitmapLabel->SetBackgroundBitmap(*__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
+ }
else
{
__pBitmapLabel->SetBackgroundBitmap(*__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL]);
}
bool
-_OptionMenuItem::GetParentScrollEnable() const
+_OptionMenuItem::GetParentScrollEnable(void) const
{
return __parentScrollEnable;
}
bool
-_OptionMenuItem::IsSelected() const
+_OptionMenuItem::IsSelected(void) const
{
return __selected;
}
+bool
+_OptionMenuItem::IsHighlighted(void) const
+{
+ return __highlighted;
+}
+
+void
+_OptionMenuItem::SetHighlighted(bool status)
+{
+ __highlighted = status;
+}
+
void
_OptionMenuItem::SetAndInvalidate(bool flag)
{
}
const Tizen::Graphics::Bitmap*
-_OptionMenuItem::GetMagentaBgBitmap() const
+_OptionMenuItem::GetMagentaBgBitmap(void) const
{
return __pMagentaBgBitmap;
}
, __itemBitmapHeight(0.0f)
, __itemFontSize(0.0f)
, __dividerHeight(0.0f)
+ , __focusedIndex(-1)
{
}
result
_OptionMenuPresenter::DrawFocus(int index)
{
- Draw();
result r = E_SUCCESS;
- int count = __pOptionMenu->GetMaximumVisibleItemsCount();
-
- Canvas* pCanvas;
- pCanvas = __pOptionMenu->GetCanvasN();
-
- SysTryReturn(NID_UI_CTRL, (pCanvas != null), r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- FloatRectangle bounds;
-
- if (index >= count)
- {
- index = count - 1;
- }
-
+ ClearFocus();
_OptionMenuItem* pItem = __pModel->GetItem(index);
- bounds = pItem->GetDrawRect();
-
- Bitmap* pBitmap = null;
- r = GET_BITMAP_CONFIG_N(FOCUSUI::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
- SysTryCatch(NID_UI_CTRL, (pBitmap != null), , r, "[%s] Propagating.", GetErrorMessage(r));
-
- if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
- {
- r = pCanvas->DrawNinePatchedBitmap(bounds, *pBitmap);
- }
- else
+ if (pItem != null)
{
- r = pCanvas->DrawBitmap(bounds, *pBitmap);
+ pItem->SetHighlighted(true);
+ pItem->Invalidate(true);
+ pItem->DrawFocus();
+ __focusedIndex = index;
}
- delete pCanvas;
- delete pBitmap;
-
return r;
+}
-CATCH:
- delete pCanvas;
- return r;
+void
+_OptionMenuPresenter::ClearFocus(void)
+{
+ _OptionMenuItem* pPreviousItem;
+ if (__focusedIndex != -1)
+ {
+ pPreviousItem = __pModel->GetItem(__focusedIndex);
+ if (pPreviousItem != null)
+ {
+ pPreviousItem->SetHighlighted(false);
+ pPreviousItem->RemoveFocusRing();
+ pPreviousItem->Invalidate(true);
+ }
+ }
}
void
_OptionMenuItem* pItem = null;
pItem = __pModel->GetItem(selectedIndex);
__selectedIndex = -1;
+ ClearFocus();
if (pItem != null)
{
{
__selectedIndex = -1;
}
+ ResetSelectedItem();
return true;
}
Tizen::Graphics::FloatRectangle GetPressedDrawRect(void) const;
void SetParentScrollEnable(bool enable);
- bool GetParentScrollEnable() const;
+ bool GetParentScrollEnable(void) const;
- bool IsSelected() const;
+ bool IsSelected(void) const;
+ bool IsHighlighted(void) const;
+
+ void SetHighlighted(bool status);
int Release(void);
bool __pressed;
bool __selected;
+ bool __highlighted;
bool __parentScrollEnable;
float __leftMargin;
virtual result Install(void);
virtual result Draw(void);
result DrawFocus(int index);
+ void ClearFocus(void);
void OnEnterKeyPressed(int selectedIndex);
virtual result DrawBackground(Tizen::Graphics::Canvas* pCanvas);
virtual result AddItem(const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap);
float __itemBitmapHeight;
float __itemFontSize;
float __dividerHeight;
+ int __focusedIndex;
}; // _OptionMenuListPresenter
}}} // Tizen::Ui: Control