using namespace Tizen::Base::Runtime;
using namespace Tizen::Ui;
+const int MAX_ITEM_COUNT = 7;\r
+\r
namespace Tizen { namespace Ui { namespace Controls
{
return static_cast<const _OptionMenuImpl*>(optionMenu._pControlImpl);
}
-_OptionMenuImpl::_OptionMenuImpl(OptionMenu* pPublic, _OptionMenu* pCore)
+_OptionMenuImpl::_OptionMenuImpl(OptionMenu* pPublic, _ContextMenu* pCore)\r
: _WindowImpl(pPublic, pCore)
, __pPublicActionEvent(null)
{
{
ClearLastResult();
- _OptionMenu* pCore = _OptionMenu::CreateOptionMenuN();
+ _ContextMenu* pCore = _ContextMenu::CreateContextMenuN(Tizen::Graphics::FloatPoint(-1,-1),CONTEXT_MENU_CORE_STYLE_LIST, CONTEXT_MENU_CORE_ALIGN_UP);\r
result r = GetLastResult();
SysTryReturn(NID_UI_CTRL, (pCore != null), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ pCore->SetShowItemCount(MAX_ITEM_COUNT);\r
_OptionMenuImpl* pImpl = new (std::nothrow) _OptionMenuImpl(&control, pCore);
r = CheckConstruction(pCore, pImpl);
{
ClearLastResult();
- return GetCore().AddItem(text, actionId);
+ return GetCore().AddItem(text, actionId, null, null ,null);\r
}
+result\r
+_OptionMenuImpl::AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, int actionId)\r
+{\r
+ ClearLastResult();\r
+\r
+ return GetCore().AddItem(L" ", actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap);\r
+}\r
+\r
+result\r
+_OptionMenuImpl::AddItem(const Tizen::Base::String &text, int actionId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap)\r
+{\r
+ ClearLastResult();\r
+\r
+ return GetCore().AddItem(text, actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap);\r
+}\r
+\r
result
_OptionMenuImpl::InsertItemAt(int mainIndex, const String& text, int actionId)
SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified main index (%d) is negative.", mainIndex);
- return GetCore().InsertItemAt(mainIndex, text, actionId);
+ return GetCore().InsertItem(mainIndex, text, actionId, null, null, null);\r
}
result
SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified main index (%d) is negative.", mainIndex);
- return GetCore().SetItemAt(mainIndex, text, actionId);
+ return GetCore().SetItem(mainIndex, text, actionId, null, null, null);\r
}
result
{
ClearLastResult();
- return GetCore().GetItemIndexFromActionId(actionId);
+ return 0;//GetCore().GetItemIndexFromActionId(actionId);\r
}
int
SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified main index (%d) is negative.", mainIndex);
- return GetCore().AddSubItem(mainIndex, text, actionId);
+ return E_SUCCESS;//GetCore().AddSubItem(mainIndex, text, actionId);\r
}
result
SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified sub index (%d) is negative.", subIndex);
- return GetCore().InsertSubItemAt(mainIndex, subIndex, text, actionId);
+ return E_SUCCESS;//GetCore().InsertSubItemAt(mainIndex, subIndex, text, actionId);\r
}
result
SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified sub index (%d) is negative.", subIndex);
- return GetCore().SetSubItemAt(mainIndex, subIndex, text, actionId);
+ return E_SUCCESS;//GetCore().SetSubItemAt(mainIndex, subIndex, text, actionId);\r
}
result
SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified sub index (%d) is negative.", subIndex);
- return GetCore().RemoveSubItemAt(mainIndex, subIndex);
+ return E_SUCCESS;//GetCore().RemoveSubItemAt(mainIndex, subIndex);\r
}
int
SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified main index (%d) is negative.", mainIndex);
- return GetCore().GetSubItemCount(mainIndex);
+ return 0;//GetCore().GetSubItemCount(mainIndex);\r
}
int
{
ClearLastResult();
- return GetCore().GetSubItemIndexFromActionId(actionId);
+ return 0;//GetCore().GetSubItemIndexFromActionId(actionId);\r
}
int
SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] The specified sub index (%d) is negative.", subIndex);
- return GetCore().GetSubItemActionIdAt(mainIndex, subIndex);
+ return 0;//GetCore().GetSubItemActionIdAt(mainIndex, subIndex);\r
}
result
return static_cast <OptionMenu&>(_ControlImpl::GetPublic());
}
-const _OptionMenu&
+const _ContextMenu&\r
_OptionMenuImpl::GetCore(void) const
{
- return static_cast <const _OptionMenu&>(_ControlImpl::GetCore());
+ return static_cast <const _ContextMenu&>(_ControlImpl::GetCore());\r
}
-_OptionMenu&
+_ContextMenu&\r
_OptionMenuImpl::GetCore(void)
{
- return static_cast <_OptionMenu&>(_ControlImpl::GetCore());
+ return static_cast <_ContextMenu&>(_ControlImpl::GetCore());\r
}
void
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0/\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+/**\r
+ * @file FUiCtrl_OptionMenuListPresenter.cpp\r
+ * @brief This is the implementation file for the _OptionMenuListPresenter class.\r
+ */\r
+\r
+#include <FBaseErrorDefine.h>\r
+#include <FBaseSysLog.h>\r
+#include <FGrp_BitmapImpl.h>\r
+#include <FGrp_CanvasImpl.h>\r
+#include <FGrp_TextTextSimple.h>\r
+#include "FUi_AccessibilityContainer.h"\r
+#include "FUi_AccessibilityElement.h"\r
+#include "FUi_CoordinateSystemUtils.h"\r
+#include "FUi_Math.h"\r
+#include "FUi_ResourceManager.h"\r
+#include "FUiCtrl_ActionEvent.h"\r
+#include "FUiCtrl_IActionEventListener.h"\r
+\r
+#include "FUiCtrl_OptionMenuListPresenter.h"\r
+\r
+using namespace Tizen::Graphics;\r
+using namespace Tizen::Ui;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Runtime;\r
+using namespace Tizen::Graphics::_Text;\r
+\r
+const int MAX_MAIN_ITEM_COUNT = 12;\r
+\r
+namespace {\r
+static const float TOUCH_PRESS_THRESHOLD_INSENSITIVE = 0.16f;\r
+static const int CONTEXT_MENU_LIST_ELEMENT_TEXT = 0;\r
+static const int CONTEXT_MENU_LIST_ELEMENT_BITMAP = 1;\r
+}\r
+\r
+namespace Tizen { namespace Ui { namespace Controls\r
+{\r
+\r
+_OptionMenuListPresenter::_OptionMenuListPresenter(_ContextMenu* pContextMenu)\r
+ : __pContextMenu(pContextMenu)\r
+ , __pModel(null)\r
+ , __pFont(null)\r
+ , __layoutSize(FloatDimension(0.0f, 0.0f))\r
+ , __touchOutRect(false)\r
+ , __selectedIndex(-1)\r
+ , __scrollEnable(false)\r
+ , __maxWidth(0.0f)\r
+ , __minWidth(0.0f)\r
+ , __topMargin(0.0f)\r
+ , __bottomMargin(0.0f)\r
+ , __leftMargin(0.0f)\r
+ , __rightMargin(0.0f)\r
+ , __screenTopMargin(0.0f)\r
+ , __screenBottomMargin(0.0f)\r
+ , __screenLeftMargin(0.0f)\r
+ , __screenRightMargin(0.0f)\r
+ , __arrowTopMargin(0.0f)\r
+ , __arrowBottomMargin(0.0f)\r
+ , __arrowRightMargin(0.0f)\r
+ , __arrowLeftMargin(0.0f)\r
+ , __arrowWidth(0.0f)\r
+ , __arrowHeight(0.0f)\r
+ , __itemWidth(0.0f)\r
+ , __itemMinWidth(0.0f)\r
+ , __itemHeight(0.0f)\r
+ , __itemMaxWidth(0.0f)\r
+ , __itemGap(0.0f)\r
+ , __itemBitmapWidth(0.0f)\r
+ , __itemBitmapHeight(0.0f)\r
+ , __itemFontSize(0.0f)\r
+ , __dividerHeight(0.0f)\r
+ , __anchorPopupOverlap(0.0f)\r
+{\r
+\r
+}\r
+\r
+_OptionMenuListPresenter::~_OptionMenuListPresenter(void)\r
+{\r
+ __pContextMenu = null;\r
+\r
+ delete __pModel;\r
+ __pModel = null;\r
+\r
+ __pFont = null;\r
+\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::Install(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ LoadShape();\r
+\r
+ __pModel = new (std::nothrow) _ContextMenuModel;\r
+ SysTryCatch(NID_UI_CTRL, __pModel != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");\r
+\r
+ r = __pModel->Construct();\r
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create data instance.");\r
+\r
+ __pFont = __pContextMenu->GetFallbackFont();\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_CTRL, (__pFont != null), , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+\r
+CATCH:\r
+ delete __pModel;\r
+ __pModel = null;\r
+\r
+ __pFont = null;\r
+\r
+ return r;\r
+}\r
+\r
+\r
+void\r
+_OptionMenuListPresenter::LoadShape(void)\r
+{\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_MIN_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, __itemMinWidth);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_MAX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, __itemMaxWidth);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __itemHeight);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_GAP, _CONTROL_ORIENTATION_PORTRAIT, __itemGap);\r
+\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __topMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __bottomMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __leftMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __rightMargin);\r
+\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::SCREEN_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __screenTopMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::SCREEN_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __screenBottomMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::SCREEN_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __screenLeftMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::SCREEN_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __screenRightMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __arrowTopMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __arrowBottomMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __arrowLeftMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __arrowRightMargin);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, __arrowWidth);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __arrowHeight);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ICON_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, __itemBitmapWidth);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ICON_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __itemBitmapHeight);\r
+\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __itemFontSize);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __dividerHeight);\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_POPUP_OVERLAP, _CONTROL_ORIENTATION_PORTRAIT, __anchorPopupOverlap);\r
+\r
+ __itemWidth = __itemMinWidth;\r
+}\r
+\r
+_ContextMenuItem*\r
+_OptionMenuListPresenter::CreateItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap)\r
+{\r
+ _ContextMenuItem* pItem = _ContextMenuItem::CreateContextMenuItemN();\r
+ SysTryReturn(NID_UI_CTRL, pItem != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");\r
+\r
+ ContextMenuItemDrawingType itemType = CONTEXT_MENU_ITEM_DRAWING_TYPE_TEXT;\r
+ _Label* pLabel = null;\r
+ result r = E_SUCCESS;\r
+\r
+ if (pNormalBitmap != null)\r
+ {\r
+ r = pItem->SetBitmap(CONTEXT_MENU_ITEM_DRAWING_STATUS_NORMAL, pNormalBitmap);\r
+ if (r != E_SUCCESS)\r
+ {\r
+ delete pItem;\r
+ return null;\r
+ }\r
+\r
+ // add bitmap label\r
+ pLabel = _Label::CreateLabelN();\r
+ pLabel->SetBackgroundBitmap(*pNormalBitmap);\r
+ pLabel->SetBackgroundColor(Color(0, 0, 0, 0));\r
+\r
+ int bitmapY = (__itemHeight - __itemBitmapHeight ) / 2;\r
+ pLabel->SetBounds(FloatRectangle(__leftMargin, bitmapY, __itemBitmapWidth, __itemBitmapHeight));\r
+ pLabel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);\r
+ pItem->AttachChild(*pLabel);\r
+ _AccessibilityContainer* pContainer = pLabel->GetAccessibilityContainer();\r
+ if (pContainer)\r
+ {\r
+ pContainer->Activate(false);\r
+ }\r
+ pItem->SetBitmapLabel(pLabel);\r
+\r
+ itemType = CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP;\r
+ }\r
+\r
+ if (pPressedBitmap != null)\r
+ {\r
+ r = pItem->SetBitmap(CONTEXT_MENU_ITEM_DRAWING_STATUS_PRESSED, pPressedBitmap);\r
+ if (r != E_SUCCESS)\r
+ {\r
+ delete pItem;\r
+ return null;\r
+ }\r
+ }\r
+\r
+ pItem->SetType(itemType);\r
+ pItem->SetActionId(actionId);\r
+\r
+ pItem->SetTextSize(__itemFontSize);\r
+ r = pItem->SetText(text);\r
+ if (r != E_SUCCESS)\r
+ {\r
+ delete pItem;\r
+ return null;\r
+ }\r
+\r
+ // calculate item size\r
+ float bitmapWidth = (itemType == CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP) ? __itemBitmapWidth : 0.0f;\r
+\r
+ FloatDimension textArea(0.0f, 0.0f);\r
+ FloatDimension itemSize(0.0f, 0.0f);\r
+\r
+ __pFont->GetTextExtent(text, text.GetLength(), textArea);\r
+ float labelLeftMargin = 0.0f, labelTopMargin = 0.0f;\r
+ GET_SHAPE_CONFIG(LABEL::LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, labelLeftMargin);\r
+ GET_SHAPE_CONFIG(LABEL::TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, labelTopMargin);\r
+ textArea.width += 2.0f * labelLeftMargin;\r
+ textArea.height += 2.0f * labelTopMargin;\r
+ itemSize.height = __itemHeight + (__dividerHeight * 2.0f);\r
+ itemSize.width = __leftMargin + textArea.width + __rightMargin + bitmapWidth;\r
+\r
+ itemSize.width = itemSize.width < __itemMinWidth ? __itemMinWidth : itemSize.width;\r
+\r
+ if (itemSize.width > __itemMaxWidth)\r
+ {\r
+ textArea.width -= itemSize.width - __itemMaxWidth;\r
+ itemSize.width = __itemMaxWidth;\r
+ }\r
+\r
+ pItem->SetSize(itemSize);\r
+\r
+ // add text label\r
+ float textLabelX = __leftMargin + bitmapWidth;\r
+\r
+ pLabel = _Label::CreateLabelN();\r
+ pLabel->SetText(text);\r
+ ContextMenuCoreItemStatus itemStatus = CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL;\r
+ pLabel->SetTextColor(__pContextMenu->GetTextColor(itemStatus));\r
+ pLabel->SetBackgroundColor(Color(0, 0, 0, 0));\r
+\r
+ itemSize = pItem->GetSize();\r
+ pLabel->SetBounds(FloatRectangle(textLabelX, (itemSize.height - textArea.height) / 2.0f, textArea.width, textArea.height));\r
+ pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);\r
+ pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);\r
+ pLabel->SetTextConfig(__itemFontSize, LABEL_TEXT_STYLE_NORMAL);\r
+\r
+ pLabel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);\r
+ pItem->AttachChild(*pLabel);\r
+ _AccessibilityContainer* pContainer = pLabel->GetAccessibilityContainer();\r
+ if (pContainer)\r
+ {\r
+ pContainer->Activate(false);\r
+ }\r
+ pItem->SetTextLabel(pLabel);\r
+\r
+ __itemWidth = __itemWidth < itemSize.width ? itemSize.width : __itemWidth;\r
+\r
+ pItem->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);\r
+ return pItem;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::AddItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* normalBitmap,\r
+ const Tizen::Graphics::Bitmap* pPressedBitmap,\r
+ const Tizen::Graphics::Bitmap* pHighlightedBitmap)\r
+{\r
+ SysTryReturn(NID_UI_CTRL, (__pModel->GetItemCount() < MAX_MAIN_ITEM_COUNT), E_SYSTEM, E_SYSTEM,\r
+ "[E_SYSTEM] A system error has occurred. The maximum items count is reached.");\r
+ _ContextMenuItem* pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap);\r
+ SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
+\r
+ result r = __pModel->AddItem(pItem);\r
+\r
+ if (r != E_SUCCESS)\r
+ {\r
+ delete pItem;\r
+ SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item.");\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::InsertItem(int index, const Tizen::Base::String& text, int actionId,\r
+ const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap,\r
+ const Tizen::Graphics::Bitmap* pHighlightedBitmap)\r
+{\r
+ if (text.GetLength() == 0 && normalBitmap == null && pPressedBitmap == null)\r
+ {\r
+ return E_INVALID_ARG;\r
+ }\r
+\r
+ _ContextMenuItem* pItem = null;\r
+\r
+ pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap);\r
+ SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
+\r
+ result r = __pModel->InsertItem(pItem, index);\r
+ if (r != E_SUCCESS)\r
+ {\r
+ delete pItem;\r
+ SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item.");\r
+ }\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::SetItem(int index, const Tizen::Base::String& text, int actionId,\r
+ const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap,\r
+ const Tizen::Graphics::Bitmap* pHighlightedBitmap)\r
+{\r
+ if (text.GetLength() == 0 && normalBitmap == null && pPressedBitmap == null)\r
+ {\r
+ return E_INVALID_ARG;\r
+ }\r
+\r
+ result r = __pContextMenu->GetScrollPanel()->DetachChild(*__pModel->GetItem(index));\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to detach item.");\r
+\r
+ _ContextMenuItem* pItem = null;\r
+ pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap);\r
+ SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
+\r
+ r = __pModel->SetItem(pItem, index);\r
+ if (r != E_SUCCESS)\r
+ {\r
+ delete pItem;\r
+ SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item.");\r
+ }\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::DeleteItem(int index)\r
+{\r
+ if (__pContextMenu->GetItemCount() <= 0)\r
+ {\r
+ SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Invalid argument.");\r
+ return E_INVALID_STATE;\r
+ }\r
+\r
+ result r = __pContextMenu->GetScrollPanel()->DetachChild(*__pModel->GetItem(index));\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to detach item.");\r
+\r
+ r = __pModel->RemoveItem(index);\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item.");\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::DeleteItemAll(void)\r
+{\r
+ if (__pContextMenu->GetItemCount() <= 0)\r
+ {\r
+ SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Invalid argument.");\r
+ return E_INVALID_STATE;\r
+ }\r
+\r
+ __pContextMenu->GetScrollPanel()->DetachAllChildren();\r
+\r
+ result r = __pModel->RemoveAllItem();\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item all.");\r
+\r
+ return r;\r
+}\r
+\r
+\r
+int\r
+_OptionMenuListPresenter::CalculateShowItemCount(void)\r
+{\r
+ int itemMaxCount = 0;\r
+ _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();\r
+ GET_SHAPE_CONFIG(CONTEXTMENU::ITEM_MAX_COUNT, orientation, itemMaxCount);\r
+\r
+ int maxVisibleCount = __pContextMenu->GetShowItemCount();\r
+\r
+ return maxVisibleCount > itemMaxCount ? itemMaxCount : maxVisibleCount;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::CalculateWindowRect(void)\r
+{\r
+ result r = CalculateRect();\r
+ AdjustItemPosition();\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::ApplyColorProperty(void)\r
+{\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+result\r
+_OptionMenuListPresenter::CalculateRect(void)\r
+{\r
+ Tizen::Graphics::FloatRectangle windowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu window itself\r
+ Tizen::Graphics::FloatRectangle bodyRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // bg surronding showing items, relative to window\r
+ Tizen::Graphics::FloatRectangle arrowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window\r
+ Tizen::Graphics::FloatRectangle itemRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window\r
+\r
+ float bodyTopMargin = __topMargin;\r
+ float bodyBottomMargin = __bottomMargin;\r
+ float bodyLeftMargin = __leftMargin;\r
+ float bodyRightMargin = __rightMargin;\r
+\r
+\r
+ FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF();\r
+\r
+ if (__pContextMenu->GetLayout() == _CONTROL_ORIENTATION_LANDSCAPE)\r
+ {\r
+ screen.SetSize(screen.height, screen.width);\r
+ }\r
+\r
+ // calculate layout size (__layoutSize)\r
+ AdjustItemLayout();\r
+\r
+ bodyRect.width = __layoutSize.width + bodyLeftMargin + bodyRightMargin;\r
+ bodyRect.height = __layoutSize.height + bodyTopMargin + bodyBottomMargin;\r
+\r
+ bodyRect.x = 0;\r
+ // Set body position y\r
+ bodyRect.y = screen.height - bodyRect.height;\r
+ // - check top margin\r
+\r
+\r
+ float correctLength = __arrowTopMargin - __anchorPopupOverlap;\r
+ windowRect.x = bodyRect.x;\r
+ windowRect.y = bodyRect.y;\r
+ windowRect.width = bodyRect.width;\r
+ windowRect.height = bodyRect.height;\r
+\r
+ bodyRect.x = 0.0f;\r
+ bodyRect.y = 0.0f;\r
+\r
+\r
+ if (_ControlManager::GetInstance()->GetOrientationStatus() == _CONTROL_ROTATION_270)\r
+ {\r
+ windowRect.x = screen.width - bodyRect.width;\r
+ }\r
+\r
+ itemRect.x = bodyRect.x;\r
+ itemRect.y = bodyRect.y;\r
+ itemRect.width = __layoutSize.width;\r
+ itemRect.height = __layoutSize.height;\r
+\r
+ __pContextMenu->SetWindowRect(windowRect);\r
+ __pContextMenu->SetBodyRect(bodyRect);\r
+ __pContextMenu->SetArrowRect(arrowRect);\r
+ __pContextMenu->SetItemRect(itemRect);\r
+\r
+ // _ScrollPanel API call sequence: SetBounds() -> SetScrollAreaBounds()\r
+ // _Scroll visual interaction if Bounds < ScrollAreaBounds\r
+ if (__pContextMenu->IsVisible())\r
+ {\r
+ __pContextMenu->GetScrollPanel()->SetBounds(FloatRectangle(bodyRect.x + bodyLeftMargin, bodyRect.y + bodyTopMargin, __layoutSize.width, __layoutSize.height));\r
+ int itemCount = __pModel->GetItemCount();\r
+ float itemHeight = __itemHeight + (__dividerHeight * 2.0f);\r
+ float layoutClientHeight = itemCount * itemHeight - (__dividerHeight * 2.0f);\r
+ __pContextMenu->GetScrollPanel()->SetClientAreaHeight(layoutClientHeight);\r
+ }\r
+\r
+ __pContextMenu->SetMovable(true);\r
+ __pContextMenu->SetResizable(true);\r
+\r
+ __pContextMenu->SetMinimumSize(FloatDimension(0.0f, 0.0f));\r
+ __pContextMenu->SetMaximumSize(screen);\r
+ __pContextMenu->SetBounds(windowRect);\r
+\r
+ __pContextMenu->SetMovable(false);\r
+ __pContextMenu->SetResizable(false);\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+void\r
+_OptionMenuListPresenter::AdjustItemLayout(void)\r
+{\r
+ FloatDimension layoutSize(0.0f, 0.0f);\r
+\r
+ int itemCount = __pModel->GetItemCount();\r
+ if (itemCount <= 0)\r
+ {\r
+ __layoutSize.width = __itemWidth;\r
+ __layoutSize.height = __itemHeight;\r
+ return;\r
+ }\r
+\r
+ layoutSize = AdjustItemLayoutStyle();\r
+\r
+ FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF();\r
+ if (__pContextMenu->GetLayout() == _CONTROL_ORIENTATION_LANDSCAPE)\r
+ {\r
+ screen.SetSize(screen.height, screen.width);\r
+ }\r
+\r
+ int maxHeight = screen.height;// - __screenTopMargin - __screenBottomMargin - __arrowHeight;\r
+ if (layoutSize.height > maxHeight)\r
+ {\r
+ layoutSize.height = maxHeight;\r
+ }\r
+\r
+ __layoutSize = layoutSize;\r
+}\r
+\r
+\r
+Tizen::Graphics::FloatDimension\r
+_OptionMenuListPresenter::AdjustItemLayoutStyle(void)\r
+{\r
+ int itemMaxCount = CalculateShowItemCount();\r
+\r
+ int itemCount = __pModel->GetItemCount();\r
+ float itemHeight = __itemHeight + (__dividerHeight * 2.0f);\r
+\r
+ FloatDimension layoutSize(__itemWidth, 0.0f);\r
+\r
+ float layoutClientHeight = itemCount * itemHeight - (__dividerHeight * 2.0f);\r
+ float layoutMaxHeight = itemMaxCount * itemHeight - (__dividerHeight * 2.0f);\r
+ if (layoutClientHeight > layoutMaxHeight)\r
+ {\r
+ __scrollEnable = true;\r
+ layoutSize.height = layoutMaxHeight;\r
+ }\r
+ else\r
+ {\r
+ __scrollEnable = false;\r
+ layoutSize.height = layoutClientHeight;\r
+ }\r
+\r
+ return layoutSize;\r
+}\r
+\r
+void\r
+_OptionMenuListPresenter::AdjustItemPosition(void)\r
+{\r
+ int itemCount = __pModel->GetItemCount();\r
+ if (itemCount <= 0)\r
+ {\r
+ return;\r
+ }\r
+\r
+ float itemHeight = __itemHeight + (__dividerHeight * 2.0f);\r
+ float drawItemY = 0.0f;\r
+\r
+ float x = __pContextMenu->GetBodyRect().x;\r
+ float y = __pContextMenu->GetBodyRect().y ;\r
+\r
+ _ContextMenuItem* pItem = null;\r
+\r
+ for (int i = 0; i < itemCount; i++)\r
+ {\r
+ pItem = __pModel->GetItem(i);\r
+\r
+ if (pItem == null)\r
+ {\r
+ break;\r
+ }\r
+\r
+ FloatRectangle drawRect(x, drawItemY + y, __itemWidth, itemHeight);\r
+\r
+ pItem->SetDrawRect(drawRect);\r
+ pItem->SetUpperDivider(i > 0);\r
+ pItem->SetLowerDivider(i < itemCount - 1);\r
+ pItem->SetParentScrollEnable(__scrollEnable);\r
+ pItem->SetBounds(FloatRectangle(0.0f, drawItemY, drawRect.width, drawRect.height));\r
+\r
+ if (pItem->HasParent() == false)\r
+ {\r
+ __pContextMenu->GetScrollPanel()->AttachChild(*pItem);\r
+ }\r
+\r
+ drawItemY += itemHeight;\r
+ }\r
+}\r
+\r
+int\r
+_OptionMenuListPresenter::GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& point) const\r
+{\r
+ int index = -1;\r
+ int itemCount = __pModel->GetItemCount();\r
+\r
+ if (itemCount < 0)\r
+ {\r
+ return -1;\r
+ }\r
+\r
+ _ContextMenuItem* pItem = null;\r
+\r
+ float scrollPosition = __pContextMenu->GetScrollPanel()->GetScrollPosition();\r
+ FloatPoint position(point.x, point.y + scrollPosition);\r
+\r
+ for (int i = 0; i < itemCount; i++)\r
+ {\r
+ pItem = __pModel->GetItem(i);\r
+\r
+ if (pItem == null)\r
+ {\r
+ break;\r
+ }\r
+\r
+ FloatRectangle drawRect = pItem->GetDrawRect();\r
+\r
+ if (drawRect.Contains(position) == true)\r
+ {\r
+ index = i;\r
+ break;\r
+ }\r
+ }\r
+\r
+ return index;\r
+}\r
+\r
+\r
+result\r
+_OptionMenuListPresenter::Draw(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ Canvas* pCanvas = __pContextMenu->GetCanvasN();\r
+ SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
+\r
+ // Clear canvas for drawing area of the ContextMenu.\r
+ pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));\r
+ Tizen::Graphics::FloatRectangle bounds(__pContextMenu->GetWindowRect());\r
+ pCanvas->Clear(Tizen::Graphics::FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));\r
+\r
+ r = DrawBackground(pCanvas);\r
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to draw background.");\r
+\r
+ //r = DrawArrow(pCanvas);\r
+ //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to draw arrow.");\r
+\r
+ delete pCanvas;\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::DrawBackground(Canvas* pCanvas)\r
+{\r
+ SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");\r
+\r
+ result r = E_SUCCESS;\r
+\r
+ Tizen::Graphics::FloatRectangle bodyRect = __pContextMenu->GetBodyRect();\r
+\r
+ const Bitmap* pBackgroundNormalBitmap = __pContextMenu->GetBackgroundNormalBitmap();\r
+ const Bitmap* pBackgroundEffectBitmap = __pContextMenu->GetBackgroundEffectBitmap();\r
+\r
+ if (pBackgroundNormalBitmap == null && pBackgroundEffectBitmap == null)\r
+ {\r
+ pCanvas->SetForegroundColor(__pContextMenu->GetColor());\r
+ pCanvas->DrawRectangle(bodyRect);\r
+ }\r
+ else\r
+ {\r
+ if (pBackgroundNormalBitmap != null)\r
+ {\r
+ r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundNormalBitmap);\r
+ }\r
+\r
+ if (pBackgroundEffectBitmap != null)\r
+ {\r
+ r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundEffectBitmap);\r
+ }\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+\r
+result\r
+_OptionMenuListPresenter::DrawArrow(Canvas* pCanvas)\r
+{\r
+ SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");\r
+\r
+ result r = E_SUCCESS;\r
+ Tizen::Graphics::FloatRectangle arrowRect = __pContextMenu->GetArrowRect();\r
+ ContextMenuCoreDropPosition dropPosition = __pContextMenu->GetDropPosition();\r
+\r
+ const Bitmap* pArrowNormalBitmap = __pContextMenu->GetArrowNormalBitmap(dropPosition);\r
+ const Bitmap* pEffectArrowBitmap = __pContextMenu->GetArrowEffectBitmap(dropPosition);\r
+\r
+ if (pArrowNormalBitmap != null)\r
+ {\r
+ r = DrawBitmap(*pCanvas, arrowRect, *pArrowNormalBitmap);\r
+ }\r
+\r
+ if (pEffectArrowBitmap != null)\r
+ {\r
+ r = DrawBitmap(*pCanvas, arrowRect, *pEffectArrowBitmap);\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+_UiTouchEventDelivery\r
+_OptionMenuListPresenter::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)\r
+{\r
+ return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;\r
+}\r
+\r
+bool\r
+_OptionMenuListPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)\r
+{\r
+ FloatPoint touchPosition = touchinfo.GetCurrentPosition();\r
+ FloatRectangle itemRect = __pContextMenu->GetItemRect();\r
+\r
+ if (!itemRect.Contains(touchPosition))\r
+ {\r
+ __selectedIndex = -1;\r
+ __touchOutRect = true;\r
+ return true;\r
+ }\r
+\r
+ __selectedIndex = GetItemIndexFromPosition(touchPosition);\r
+ __touchOutRect = false;\r
+ return true;\r
+}\r
+\r
+_UiTouchEventDelivery\r
+_OptionMenuListPresenter::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)\r
+{\r
+ return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;\r
+}\r
+\r
+bool\r
+_OptionMenuListPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)\r
+{\r
+ FloatPoint touchPosition = touchinfo.GetCurrentPosition();\r
+\r
+ if (__touchOutRect)\r
+ {\r
+ FloatRectangle itemRect = __pContextMenu->GetItemRect();\r
+ if (!itemRect.Contains(touchPosition))\r
+ {\r
+ __selectedIndex = -1;\r
+ __pContextMenu->SetVisibleState(false);\r
+\r
+ return true;\r
+ }\r
+ }\r
+\r
+ int currentSelectedIndex = GetItemIndexFromPosition(touchPosition);\r
+ if (__selectedIndex != -1 && (__selectedIndex == currentSelectedIndex))\r
+ {\r
+ _ContextMenuItem* pItem = null;\r
+ pItem = __pModel->GetItem(__selectedIndex);\r
+\r
+ __selectedIndex = -1;\r
+ __pContextMenu->SetVisibleState(false);\r
+\r
+ int actionId = pItem->GetActionId();\r
+\r
+ _ActionEvent* pActionEvent = __pContextMenu->GetActionEvent();\r
+ if (pActionEvent == null)\r
+ {\r
+ return true;\r
+ }\r
+\r
+ IEventArg* pEventArg = _ActionEvent::CreateActionEventArgN(actionId);\r
+ if (pEventArg == null)\r
+ {\r
+ return true;\r
+ }\r
+\r
+ PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);\r
+ pActionEvent->Fire(*pEventArg);\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+_UiTouchEventDelivery\r
+_OptionMenuListPresenter::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)\r
+{\r
+ return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;\r
+}\r
+\r
+bool\r
+_OptionMenuListPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)\r
+{\r
+ if (__scrollEnable)\r
+ {\r
+ __selectedIndex = -1;\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+_OptionMenuListPresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)\r
+{\r
+ __pModel->ResetAllItem();\r
+\r
+ return true;\r
+}\r
+\r
+void\r
+_OptionMenuListPresenter::OnFontChanged(Tizen::Graphics::Font* pFont)\r
+{\r
+ __pFont = pFont;\r
+ String fontName = __pContextMenu->GetFont();\r
+\r
+ int itemCount = __pModel->GetItemCount();\r
+ for (int i = 0; i < itemCount; i++)\r
+ {\r
+ _ContextMenuItem* pItem = __pModel->GetItem(i);\r
+ if (pItem != null)\r
+ {\r
+ pItem->SetFont(fontName);\r
+ }\r
+ }\r
+}\r
+\r
+void\r
+_OptionMenuListPresenter::OnFontInfoRequested(unsigned long& style, float& size)\r
+{\r
+ style = FONT_STYLE_PLAIN;\r
+ size = __itemFontSize;\r
+}\r
+\r
+void\r
+_OptionMenuListPresenter::SetAllAccessibilityElement(void)\r
+{\r
+ _AccessibilityContainer* pContainerContextMenu = __pContextMenu->GetAccessibilityContainer();\r
+ if (pContainerContextMenu != null)\r
+ {\r
+ _AccessibilityElement* pElementContextMenu = new (std::nothrow) _AccessibilityElement(true);\r
+ SysTryReturnVoidResult(NID_UI_CTRL, pElementContextMenu, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");\r
+\r
+ pElementContextMenu->SetSupportOperatingGesture(false);\r
+ pElementContextMenu->SetTrait(L"Contextual popup");\r
+ pElementContextMenu->SetHint(L"double tap to close");\r
+ pElementContextMenu->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height));\r
+ pContainerContextMenu->AddElement(*pElementContextMenu);\r
+ __pContextMenu->AddAccessibilityElement(*pElementContextMenu);\r
+\r
+ int itemCount = __pModel->GetItemCount();\r
+ for (int i = 0; i < itemCount; i++)\r
+ {\r
+ _ContextMenuItem* pItem = __pModel->GetItem(i);\r
+ if (pItem)\r
+ {\r
+ _AccessibilityContainer* pContainer = pItem->GetAccessibilityContainer();\r
+ if (pContainer != null)\r
+ {\r
+ LinkedListT<_AccessibilityElement*> accessibilityElements;\r
+ _AccessibilityElement* pElement = null;\r
+\r
+ pContainer->GetElements(accessibilityElements);\r
+ if (accessibilityElements.GetAt(0, pElement) == E_SUCCESS)\r
+ {\r
+ pElement->SetName(L"ContextMenuItem" + Integer::ToString(i));\r
+ if (pItem->GetType() == CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP)\r
+ {\r
+ pElement->SetLabel(L"icon " + pItem->GetText());\r
+ }\r
+ else\r
+ {\r
+ pElement->SetLabel(pItem->GetText());\r
+ }\r
+\r
+ pElement->SetBounds(FloatRectangle(0.0f, 0.0f, pItem->GetBoundsF().width, pItem->GetBoundsF().height));\r
+ }\r
+ pContainerContextMenu->AddChildContainer(*pContainer);\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+_ContextMenuItemInfo\r
+_OptionMenuListPresenter::GetItemFromPosition(const FloatPoint& position)\r
+{\r
+ _ContextMenuItemInfo itemInfo;\r
+ int index = GetItemIndexFromPosition(position);\r
+ itemInfo.pContextMenuItem = __pModel->GetItem(index);\r
+\r
+ itemInfo.bListItem = false;\r
+ itemInfo.pListItem = null;\r
+ return itemInfo;\r
+}\r
+\r
+_ContextMenuItemInfo\r
+_OptionMenuListPresenter::FindItem(int index)\r
+{\r
+ _ContextMenuItemInfo itemInfo;\r
+ itemInfo.bListItem = false;\r
+ itemInfo.pListItem = null;\r
+ itemInfo.pContextMenuItem = __pModel->GetItem(index);\r
+ return itemInfo;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::SetTopDrawnItemIndex(int index)\r
+{\r
+ return E_SUCCESS;\r
+}\r
+\r
+result\r
+_OptionMenuListPresenter::DrawBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Graphics::Bitmap& bitmap)\r
+{\r
+ result r = E_SUCCESS;\r
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))\r
+ {\r
+ r = canvas.DrawNinePatchedBitmap(bounds, bitmap);\r
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw ninepatched bitmap.")\r
+ }\r
+ else\r
+ {\r
+ r = canvas.DrawBitmap(bounds, bitmap);\r
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw bitmap.")\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+}}} // Tizen::Ui: Control\r