2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an ”AS IS” BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrl_OptionMenu.cpp
20 * @brief This is the implementation file for the _OptionMenu class.
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include <FBaseColIEnumeratorT.h>
27 #include <FGrp_BitmapImpl.h>
28 #include "FUi_ControlImplManager.h"
29 #include "FUi_EcoreEvasMgr.h"
30 #include "FUi_ResourceManager.h"
31 #include "FUi_TouchManager.h"
32 #include "FUiAnim_VisualElement.h"
33 #include "FUiAnim_AnimationManager.h"
34 #include "FUi_AccessibilityContainer.h"
35 #include "FUi_AccessibilityElement.h"
36 #include "FUiCtrl_ActionEvent.h"
37 #include "FUiCtrl_Form.h"
38 #include "FUiCtrl_Frame.h"
39 #include "FUiCtrl_OptionMenu.h"
40 #include "FUiCtrl_Scroll.h"
41 #include "FUiCtrl_ContextMenu.h"
42 #include "FUiCtrl_OptionMenuItem.h"
44 using namespace Tizen::Graphics;
45 using namespace Tizen::Base;
46 using namespace Tizen::Media;
47 using namespace Tizen::Ui;
48 using namespace Tizen::Ui::Animations;
49 using namespace Runtime;
52 static const float TOUCH_PRESS_THRESHOLD_INSENSITIVE = 0.16f;
55 namespace Tizen { namespace Ui { namespace Controls
58 IMPLEMENT_PROPERTY(_OptionMenu);
60 _OptionMenu::_OptionMenu(void)
61 : __pOptionMenuPresenter(null)
63 , __isAttachedToMainTree(false)
64 , __isMaxVisibleCountSet(false)
66 , __currentFocusedIndex(-1)
67 , __selectedActionID(-1)
68 , __pBoundsTimingFunction(null)
69 , __pOpacityTimingFunction(null)
70 , __isAnimating(false)
71 , __windowRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
72 , __bodyRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
73 , __itemRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
74 , __pActionEvent(null)
75 , __pBackgroundNormalBitmap(null)
76 , __pBackgroundEffectBitmap(null)
77 , __layout(_CONTROL_ORIENTATION_PORTRAIT)
78 , __rotation(_CONTROL_ROTATION_0)
79 , __pScrollPanel(null)
81 , __pCurrentFrame(null)
84 __backgroundColor = Color(255, 255, 255, 255);
86 __textColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL] = Color(255, 255, 255, 255);
87 __textColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED] = Color(255, 255, 255, 255);
88 __textColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = Color(255, 255, 255, 255);
90 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL] = Color(255, 255, 255, 255);
91 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED] = Color(255, 255, 255, 255);
92 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = Color(255, 255, 255, 255);
95 _OptionMenu::~_OptionMenu(void)
97 if (__isAttachedToMainTree && GetOwner() != null)
99 GetOwner()->UnlockInputEvent();
102 if (__isAnimating && GetVisualElement())
104 GetVisualElement()->RemoveAllAnimations();
107 __pCurrentFrame = null;
109 if (__pScrollPanel != null)
111 __pScrollPanel->DetachAllChildren();
112 DetachChild(*__pScrollPanel);
113 delete __pScrollPanel;
114 __pScrollPanel = null;
117 if (__pSubMenu != null)
124 delete __pOptionMenuPresenter;
125 __pOptionMenuPresenter = null;
127 delete __pBackgroundNormalBitmap;
128 __pBackgroundNormalBitmap = null;
130 delete __pBackgroundEffectBitmap;
131 __pBackgroundEffectBitmap = null;
133 delete __pActionEvent;
134 __pActionEvent = null;
136 delete __pBoundsTimingFunction;
137 __pBoundsTimingFunction = null;
139 delete __pOpacityTimingFunction;
140 __pOpacityTimingFunction= null;
142 __actionId.RemoveAll();
144 RemoveAllAccessibilityElement();
148 _OptionMenu::CreateOptionMenuN(void)
150 result r = E_SUCCESS;
151 float minWidth = 0.0f;
152 float minHeight = 0.0f;
153 _OptionMenu* pOptionMenu = null;
154 _ScrollPanel* pScrollPanel = null;
155 _Scroll* pScroll = null;
157 GET_SHAPE_CONFIG(OPTIONMENU::LIST_MIN_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, minWidth);
158 GET_SHAPE_CONFIG(OPTIONMENU::LIST_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, minHeight);
160 pOptionMenu = new (std::nothrow) _OptionMenu();
161 SysTryReturn(NID_UI_CTRL, pOptionMenu != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
163 r = pOptionMenu->CreateRootVisualElement();
164 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
166 pOptionMenu->SetFocusable(true);
168 r = pOptionMenu->Initialize();
169 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to Initialize.", GetErrorMessage(r));
171 r = pOptionMenu->Install();
172 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to Install.", GetErrorMessage(r));
174 pOptionMenu->AcquireHandle();
175 pOptionMenu->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);
177 pOptionMenu->SetMovable(false);
178 pOptionMenu->SetResizable(false);
180 if (pOptionMenu->GetAccessibilityContainer() != null)
182 pOptionMenu->GetAccessibilityContainer()->Activate(true);
183 pOptionMenu->GetAccessibilityContainer()->AddListener(*pOptionMenu);
186 pScrollPanel = _ScrollPanel::CreateScrollPanelN(FloatRectangle(0.0f, 0.0f, minWidth, minHeight), SCROLL_PANEL_SCROLL_DIRECTION_VERTICAL, false, false);
187 pScrollPanel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);
189 pScroll = pScrollPanel->GetScrollBar();
190 SysTryCatch(NID_UI_CTRL, pScroll, , E_INVALID_STATE, "[%s] _Scroll is not constructed", GetErrorMessage(E_INVALID_STATE));
191 pScroll->SetContextMenuScrollType(true);
193 pOptionMenu->AttachChild(*(pScrollPanel));
195 pOptionMenu->__pScrollPanel = pScrollPanel;
207 _OptionMenu::GetScrollPanel(void)
209 return __pScrollPanel;
213 _OptionMenu::OnFocusGained(const _Control &source)
215 __currentFocusedIndex = 0;
222 _OptionMenu::OnFocusLost(const _Control &source)
224 __pOptionMenuPresenter->ClearFocus();
231 _OptionMenu::OnDrawFocus(void)
235 GetScrollPanel()->ScrollToTop();
237 __currentFocusedIndex = 0;
238 __pOptionMenuPresenter->DrawFocus(__currentFocusedIndex);
245 _OptionMenu::OnFocusModeStateChanged(void)
248 __pOptionMenuPresenter->ClearFocus();
253 _OptionMenu::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
255 _KeyCode keyCode = keyInfo.GetKeyCode();
259 if (keyCode == _KEY_TAB || keyCode == _KEY_UP || keyCode == _KEY_DOWN)
262 __currentFocusedIndex = 0;
263 __pOptionMenuPresenter->DrawFocus(__currentFocusedIndex);
269 int dividerHeight = 0;
270 int count = GetMaximumVisibleItemsCount();
271 int totalItemCount = GetItemCount();
273 GET_SHAPE_CONFIG(OPTIONMENU::ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, height);
274 GET_SHAPE_CONFIG(OPTIONMENU::LIST_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
279 if (__currentFocusedIndex < totalItemCount - 1)
281 if (__currentFocusedIndex < count - 1)
283 __currentFocusedIndex++;
287 int pos = GetScrollPanel()->GetScrollPosition();
288 GetScrollPanel()->SetScrollPosition(pos + height + 2 * dividerHeight);
289 __currentFocusedIndex++;
294 __currentFocusedIndex = totalItemCount - 1;
299 if (__currentFocusedIndex > 0)
301 if (__currentFocusedIndex < count - 1)
303 __currentFocusedIndex--;
307 int pos = GetScrollPanel()->GetScrollPosition();
308 GetScrollPanel()->SetScrollPosition(pos - height - 2 * dividerHeight);
309 __currentFocusedIndex--;
314 __currentFocusedIndex = 0;
322 __pOptionMenuPresenter->DrawFocus(__currentFocusedIndex);
328 _OptionMenu::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
330 _KeyCode keyCode = keyInfo.GetKeyCode();
332 if (keyCode == _KEY_ENTER && __isFocused)
334 __pOptionMenuPresenter->OnEnterKeyReleased(__currentFocusedIndex);
338 if (keyCode == _KEY_ESC || keyCode == _KEY_BACK)
341 __pOptionMenuPresenter->ClearFocus();
347 if (keyCode == _KEY_CONTEXT_MENU || keyCode == _KEY_MENU)
349 if (__isAttachedToMainTree)
365 _OptionMenu::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
367 if (keyName == L"ClosingOpacityAnimation" || keyName == L"OpeningOpacityAnimation")
369 __isAnimating = false;
372 if (keyName == L"ClosingOpacityAnimation")
374 SetVisibleState(false);
376 if (__selectedActionID != -1)
378 FireActionEvent(__selectedActionID);
379 __selectedActionID = -1;
385 _OptionMenu::Install(void)
387 result r = E_SUCCESS;
389 // load bitmap of a background and arrow
391 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to load bitmap.");
393 r = __actionId.Construct();
394 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to construct arraylist.");
396 _OptionMenuPresenter* pPresenter = new (std::nothrow) _OptionMenuPresenter(this);
397 SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
399 SetPresenter(*pPresenter);
401 r = pPresenter->Install();
407 _OptionMenu::Initialize(void)
409 result r = E_SUCCESS;
410 FloatDimension screen(0.0f, 0.0f);
411 Color backgroundColor(0, 0, 0, 0);
412 Color backgroundSelectedColor(0, 0, 0, 0);
413 Color itemTextColor(0, 0, 0, 0);
414 Color itemTextSelectedColor(0, 0, 0, 0);
416 screen = _ControlManager::GetInstance()->GetScreenSizeF();
418 r = SetBounds(FloatRectangle(0.0f, 0.0f, screen.width, screen.height));
419 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set option menu bounds.");
424 GET_COLOR_CONFIG(OPTIONMENU::ITEM_BG_NORMAL, backgroundColor);
425 GET_COLOR_CONFIG(OPTIONMENU::ITEM_BG_PRESSED, backgroundSelectedColor);
426 GET_COLOR_CONFIG(OPTIONMENU::ITEM_TEXT_NORMAL, itemTextColor);
427 GET_COLOR_CONFIG(OPTIONMENU::ITEM_TEXT_PRESSED, itemTextSelectedColor);
429 __backgroundColor = backgroundColor;
430 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL] = backgroundColor;
431 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED] = backgroundSelectedColor;
432 __textColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL] = itemTextColor;
433 __textColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED] = itemTextSelectedColor;
435 if (GetVisualElement() != null)
437 GetVisualElement()->SetSurfaceOpaque(false);
444 _OptionMenu::SetPresenter(const _OptionMenuPresenter& OptionMenuPresenter)
446 __pOptionMenuPresenter = const_cast <_OptionMenuPresenter*>(&OptionMenuPresenter);
452 _OptionMenu::OnDraw(void)
454 __pOptionMenuPresenter->Draw();
456 if(unlikely((_AccessibilityManager::IsActivated())))
458 _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
465 _OptionMenu::OnAttachedToMainTree(void)
467 result r = E_SUCCESS;
469 __isAttachedToMainTree = true;
471 _Control* pOwner = GetOwner();
474 __pCurrentFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
475 SysTryReturnResult(NID_UI_CTRL, __pCurrentFrame != null, E_SYSTEM, "Current frame instance is not available.");
477 _Form* pForm = __pCurrentFrame->GetCurrentForm();
478 pForm != null ? SetOwner(pForm) : SetOwner(__pCurrentFrame);
484 pOwner->LockInputEvent();
487 if (__pCurrentFrame != null)
489 __pCurrentFrame->AddFrameEventListener(*this);
492 __layout = pOwner->GetOrientation();
494 _Window* pOwnerWindow = pOwner->GetRootWindow();
496 if (pOwnerWindow != null)
498 int ownerRotation = GetEcoreEvasMgr()->GetEcoreEvas()->GetWindowRotation(*pOwnerWindow);
499 switch (ownerRotation)
502 __rotation = _CONTROL_ROTATION_0;
506 __rotation = _CONTROL_ROTATION_90;
510 __rotation = _CONTROL_ROTATION_180;
514 __rotation = _CONTROL_ROTATION_270;
518 __rotation = _CONTROL_ROTATION_0;
523 __pOptionMenuPresenter->CalculateItemMaximumWidth();
525 r = __pOptionMenuPresenter->CalculateWindowRect();
526 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
528 GetEcoreEvasMgr()->GetEcoreEvas()->SetWindowBounds(*this, GetBoundsF());
530 SetAllAccessibilityElement();
534 return _Window::OnAttachedToMainTree();
538 _OptionMenu::OnDetachingFromMainTree(void)
540 ReleaseTouchCapture();
542 if (__pCurrentFrame != null)
544 __pCurrentFrame->RemoveFrameEventListener(*this);
547 _Control* pOwner = GetOwner();
550 pOwner->UnlockInputEvent();
553 __isAttachedToMainTree = false;
555 __pScrollPanel->ScrollToTop();
557 return _Window::OnDetachingFromMainTree();
561 _OptionMenu::OnFrameDeactivated(const _Frame& source)
564 SetVisibleState(false);
569 _OptionMenu::OnFrameActivated(const _Frame& source)
575 _OptionMenu::OnFrameMinimized(const _Frame& source)
580 _OptionMenu::OnFrameRestored(const _Frame& source)
586 _OptionMenu::OnActivated(void)
588 _TouchManager* pTouchManager = _TouchManager::GetInstance();
590 if (pTouchManager != null)
592 pTouchManager->SetTouchCanceled(null);
594 SetTouchCapture(false, false);
596 return _Window::OnActivated();
600 _OptionMenu::OnDeactivated(void)
602 __pOptionMenuPresenter->ResetSelectedItem();
603 return _Window::OnDeactivated();
607 _OptionMenu::AddItem(const String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
609 result r = E_SUCCESS;
611 SysTryReturnResult(NID_UI_CTRL, (GetItemIndexFromActionId(actionId) == -1), E_SYSTEM, "A system error has occurred."
612 " The option menu already has an item with the same action id (%d)", actionId);
614 r = __pOptionMenuPresenter->AddItem(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
615 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add a item.");
617 __actionId.Add(actionId);
619 if (__isAttachedToMainTree)
621 __pOptionMenuPresenter->CalculateWindowRect();
628 _OptionMenu::InsertItemAt(int mainIndex, const String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
630 result r = E_SUCCESS;
632 SysTryReturnResult(NID_UI_CTRL, (GetItemIndexFromActionId(actionId) == -1), E_SYSTEM, "A system error has occurred."
633 " The option menu already has an item with the same action id (%d)", actionId);
635 r = __pOptionMenuPresenter->InsertItem(mainIndex, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
636 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add a item.");
638 __actionId.InsertAt(actionId, mainIndex);
640 if (__isAttachedToMainTree)
642 __pOptionMenuPresenter->CalculateWindowRect();
649 _OptionMenu::GetItemIndexFromActionId(int actionId) const
651 return __pOptionMenuPresenter->GetItemIndexFromActionId(actionId);
655 _OptionMenu::SetItemAt(int mainIndex, const String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
657 result r = E_SUCCESS;
659 r = __pOptionMenuPresenter->SetItem(mainIndex, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
660 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set a item.");
662 __actionId.SetAt(actionId, mainIndex);
664 if (__isAttachedToMainTree)
666 __pOptionMenuPresenter->CalculateWindowRect();
673 _OptionMenu::AddSubItem(int mainIndex, const String& text, int actionId)
675 result r = __pOptionMenuPresenter->AddSubItem(mainIndex, text, actionId);
676 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
678 if (__pSubMenu != null && mainIndex == __subMenuIndex)
680 __pSubMenu->AddItem(text, actionId, null, null, null);
687 _OptionMenu::InsertSubItemAt(int mainIndex, int subIndex, const String& text, int actionId)
689 result r = __pOptionMenuPresenter->InsertSubItemAt(mainIndex, subIndex, text, actionId);
690 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
692 if (__pSubMenu != null && mainIndex == __subMenuIndex)
694 __pSubMenu->InsertItem(subIndex, text, actionId, null, null, null);
701 _OptionMenu::SetSubItemAt(int mainIndex, int subIndex, const String& text, int actionId)
703 result r = __pOptionMenuPresenter->SetSubItemAt(mainIndex, subIndex, text, actionId);
704 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
706 if (__pSubMenu != null && mainIndex == __subMenuIndex)
708 __pSubMenu->SetItem(subIndex, text, actionId, null, null, null);
715 _OptionMenu::RemoveSubItemAt(int mainIndex, int subIndex)
717 result r = __pOptionMenuPresenter->RemoveSubItemAt(mainIndex, subIndex);
718 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
720 if (__pSubMenu != null && mainIndex == __subMenuIndex)
722 __pSubMenu->RemoveItemAt(subIndex);
729 _OptionMenu::GetSubItemCount(int mainIndex) const
731 return __pOptionMenuPresenter->GetSubItemCount(mainIndex);
735 _OptionMenu::GetSubItemIndexFromActionId(int actionId) const
737 return __pOptionMenuPresenter->GetSubItemIndexFromActionId(actionId);
741 _OptionMenu::GetSubItemActionIdAt(int mainIndex, int subIndex) const
743 return __pOptionMenuPresenter->GetSubItemActionIdAt(mainIndex, subIndex);
748 _OptionMenu::ShowSubMenu(int mainIndex, _OptionMenuItem& item)
750 if (__pSubMenu != null)
755 float textSize = 0.0f;
756 float itemHeight = 0.0f;
758 GET_SHAPE_CONFIG(OPTIONMENU::TEXT_SIZE, GetOrientation(), textSize);
759 GET_SHAPE_CONFIG(OPTIONMENU::LIST_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, itemHeight);
761 FloatRectangle itemBounds = item.GetBoundsF();
762 itemBounds.height = itemHeight;
763 float scrollPosition = __pScrollPanel->GetScrollPosition();
764 FloatPoint anchorPosition(0.0f, 0.0f);
765 ContextMenuCoreAlign alignment = CONTEXT_MENU_CORE_ALIGN_RIGHT;
767 if (__rotation == _CONTROL_ROTATION_270 && __layout == _CONTROL_ORIENTATION_LANDSCAPE)
769 alignment = CONTEXT_MENU_CORE_ALIGN_LEFT;
773 alignment = CONTEXT_MENU_CORE_ALIGN_RIGHT;
776 anchorPosition = FloatPoint(GetBoundsF().x + itemBounds.x + itemBounds.width / 2.0f, GetBoundsF().y + itemBounds.y + itemBounds.height / 2.0f - scrollPosition);
778 __pSubMenu = _ContextMenu::CreateContextMenuN(anchorPosition, CONTEXT_MENU_CORE_STYLE_LIST, alignment);
780 if (__pSubMenu == null)
782 return GetLastResult();
785 __pSubMenu->SetFocusable(true);
787 if (__pSubMenu->GetOwner() == null)
789 _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
790 SysTryReturnResult(NID_UI_CTRL, pFrame != null, E_SYSTEM, "This instance is not constructed.");
792 _Form* pForm = pFrame->GetCurrentForm();
795 __pSubMenu->SetOwner(pForm);
799 __pSubMenu->SetOwner(pFrame);
803 __pSubMenu->Initialize();
804 __pSubMenu->AddActionEventListener(*this);
806 _OptionMenuItem* pSubItem = null;
807 int subItemCount = item.GetSubItemCount();
808 for (int subIndex = 0; subIndex < subItemCount; subIndex++)
810 pSubItem = item.GetSubItem(subIndex);
811 if (pSubItem != null)
813 __pSubMenu->AddItem(pSubItem->GetText(), pSubItem->GetActionId(), null, null, null);
818 __subMenuIndex = mainIndex;
824 _OptionMenu::IsSubMenuShown(void) const
826 return (__pSubMenu != null) && __pSubMenu->IsAttached();
830 _OptionMenu::DestroySubMenu(void)
832 SysTryReturnResult(NID_UI_CTRL, __pSubMenu != null, E_SYSTEM, "A system error has occured. __pSubMenu is null.");
844 _OptionMenu::InsertItem(int index, const String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
846 result r = E_SUCCESS;
848 r = __pOptionMenuPresenter->InsertItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
849 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to insert a item.");
851 __actionId.InsertAt(actionId, index);
853 if (__isAttachedToMainTree)
855 __pOptionMenuPresenter->CalculateWindowRect();
862 _OptionMenu::SetItem(int index, const String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
864 result r = E_SUCCESS;
866 r = __pOptionMenuPresenter->SetItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
867 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set a item.");
869 __actionId.SetAt(actionId, index);
871 if (__isAttachedToMainTree)
873 __pOptionMenuPresenter->CalculateWindowRect();
880 _OptionMenu::RemoveItemAt(int index)
882 result r = E_SUCCESS;
884 r = __pOptionMenuPresenter->DeleteItem(index);
885 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove a item.");
887 __actionId.RemoveAt(index);
889 if (__isAttachedToMainTree)
891 __pOptionMenuPresenter->CalculateWindowRect();
898 _OptionMenu::RemoveAllItems(void)
900 result r = E_SUCCESS;
902 r = __pOptionMenuPresenter->DeleteItemAll();
903 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Failed to remove all items.", GetErrorMessage(r));
905 __actionId.RemoveAll();
907 if (__isAttachedToMainTree)
909 __pOptionMenuPresenter->CalculateWindowRect();
917 _OptionMenu::GetItemCount(void) const
919 return __actionId.GetCount();
923 _OptionMenu::GetItemIndexAt(int actionId) const
925 int count = __actionId.GetCount();
927 for (int i = 0; i < count; i++)
929 int index = GetItemActionIdAt(i);
931 if (actionId == index)
941 _OptionMenu::GetItemActionIdAt(int index) const
943 int count = __actionId.GetCount();
946 if (count <= 0 || index >= count)
951 __actionId.GetAt(index, actionId);
957 _OptionMenu::SetWindowRect(const FloatRectangle& rect)
965 _OptionMenu::GetWindowRect(void) const
971 _OptionMenu::SetBodyRect(const FloatRectangle& rect)
979 _OptionMenu::GetBodyRect(void) const
985 _OptionMenu::SetItemRect(const FloatRectangle& rect)
993 _OptionMenu::GetItemRect(void) const
999 _OptionMenu::SetPropertyMaxVisibleItemsCount(const Variant& count)
1001 int showCount = count.ToInt();
1003 SysTryReturnResult(NID_UI_CTRL, showCount > 0, E_INVALID_ARG, "Invalid argument is used. Count is invalid.");
1005 __showItemCount = showCount;
1011 _OptionMenu::GetPropertyMaxVisibleItemsCount(void) const
1013 return Variant(__showItemCount);
1017 _OptionMenu::GetMaximumVisibleItemsCount(void) const
1019 Variant count = GetProperty("maxVisibleItemsCount");
1021 return count.ToInt();
1025 _OptionMenu::SetShowItemCount(int count)
1029 r = SetProperty("maxVisibleItemsCount", Variant(count));
1030 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set property.");
1032 if (__isAttachedToMainTree)
1034 __pOptionMenuPresenter->CalculateWindowRect();
1035 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to calculate window.");
1042 _OptionMenu::SetPropertyColor(const Variant& color)
1044 __backgroundColor = color.ToColor();
1046 result r = LoadColorReplacedBitmap(__backgroundColor);
1047 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has occurred. Failed to load the color replacement bitmap.");
1053 _OptionMenu::GetPropertyColor(void) const
1055 return Variant(__backgroundColor);
1059 _OptionMenu::SetColor(const Graphics::Color& color)
1061 return SetProperty("color", Variant(color));
1065 _OptionMenu::GetColor(void) const
1067 Variant color = GetProperty("color");
1069 return color.ToColor();
1073 _OptionMenu::SetMaxVisibleItemsCount(int maxItemsCount)
1075 result r = SetPropertyMaxVisibleItemsCount(maxItemsCount);
1076 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1078 __isMaxVisibleCountSet = true;
1080 if (__isAttachedToMainTree)
1082 __pOptionMenuPresenter->CalculateWindowRect();
1089 _OptionMenu::SetPropertyNormalItemColor(const Variant& color)
1091 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL] = color.ToColor();
1093 return __pOptionMenuPresenter->ApplyColorProperty();
1097 _OptionMenu::GetPropertyNormalItemColor(void) const
1099 return Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL]);
1103 _OptionMenu::SetPropertyPressedItemColor(const Variant& color)
1105 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED] = color.ToColor();
1107 return __pOptionMenuPresenter->ApplyColorProperty();
1111 _OptionMenu::GetPropertyPressedItemColor(void) const
1113 return Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED]);
1117 _OptionMenu::SetPropertyHighlightedItemColor(const Variant & color)
1119 __itemColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = color.ToColor();
1121 return __pOptionMenuPresenter->ApplyColorProperty();
1125 _OptionMenu::GetPropertyHighlightedItemColor(void) const
1127 return Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]);
1131 _OptionMenu::SetItemColor(enum OptionMenuCoreItemStatus status, const Graphics::Color& color)
1133 result r = E_SUCCESS;
1135 if (status == OPTION_MENU_CORE_ITEM_STATUS_NORMAL)
1137 r = SetProperty("normalItemColor", Variant(color));
1139 else if (status == OPTION_MENU_CORE_ITEM_STATUS_PRESSED)
1141 r = SetProperty("pressedItemColor", Variant(color));
1145 r = SetProperty("highlightedItemColor", Variant(color));
1152 _OptionMenu::GetItemColor(enum OptionMenuCoreItemStatus status) const
1156 if (status == OPTION_MENU_CORE_ITEM_STATUS_NORMAL)
1158 Variant color = GetProperty("normalItemColor");
1159 itemColor = color.ToColor();
1162 else if (status == OPTION_MENU_CORE_ITEM_STATUS_PRESSED)
1164 Variant color = GetProperty("pressedItemColor");
1165 itemColor = color.ToColor();
1170 Variant color = GetProperty("highlightedItemColor");
1171 itemColor = color.ToColor();
1178 _OptionMenu::SetPropertyNormalItemTextColor(const Variant& color)
1180 __textColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL] = color.ToColor();
1182 return __pOptionMenuPresenter->ApplyColorProperty();
1186 _OptionMenu::GetPropertyNormalItemTextColor(void) const
1188 return Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL]);
1192 _OptionMenu::SetPropertyPressedItemTextColor(const Variant& color)
1194 __textColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED] = color.ToColor();
1196 return __pOptionMenuPresenter->ApplyColorProperty();
1200 _OptionMenu::GetPropertyPressedItemTextColor(void) const
1202 return Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED]);
1206 _OptionMenu::SetPropertyHighlightedItemTextColor(const Variant & color)
1208 __textColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = color.ToColor();
1210 return __pOptionMenuPresenter->ApplyColorProperty();
1214 _OptionMenu::GetPropertyHighlightedItemTextColor(void) const
1216 return Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]);
1220 _OptionMenu::SetTextColor(enum OptionMenuCoreItemStatus status, const Graphics::Color& color)
1222 result r = E_SUCCESS;
1224 if (status == OPTION_MENU_CORE_ITEM_STATUS_NORMAL)
1226 r = SetProperty("normalItemTextColor", Variant(color));
1228 else if (status == OPTION_MENU_CORE_ITEM_STATUS_PRESSED)
1230 r = SetProperty("pressedItemTextColor", Variant(color));
1234 r = SetProperty("highlightedItemTextColor", Variant(color));
1241 _OptionMenu::GetTextColor(enum OptionMenuCoreItemStatus status) const
1245 if (status == OPTION_MENU_CORE_ITEM_STATUS_NORMAL)
1247 Variant color = GetProperty("normalItemTextColor");
1248 textColor = color.ToColor();
1251 else if (status == OPTION_MENU_CORE_ITEM_STATUS_PRESSED)
1253 Variant color = GetProperty("pressedItemTextColor");
1254 textColor = color.ToColor();
1259 Variant color = GetProperty("highlightedItemTextColor");
1260 textColor = color.ToColor();
1267 _OptionMenu::AddActionEventListener(const _IActionEventListener& listener)
1269 result r = E_SUCCESS;
1271 if (__pActionEvent == null)
1273 __pActionEvent = _ActionEvent::CreateInstanceN(*this);
1274 SysTryReturnResult(NID_UI_CTRL, __pActionEvent != null, GetLastResult(), "Propagating.");
1276 r = __pActionEvent->AddListener(listener);
1277 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to remove action event listener.");
1283 delete __pActionEvent;
1284 __pActionEvent = null;
1289 _OptionMenu::RemoveActionEventListener(const _IActionEventListener& listener)
1291 SysTryReturnResult(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE,
1292 "The action event instance isn't constructed.");
1294 result r = E_SUCCESS;
1296 r = __pActionEvent->RemoveListener(listener);
1297 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove action event listener");
1303 _OptionMenu::FireActionEvent(int actionId)
1305 IEventArg* pArg = _ActionEvent::CreateActionEventArgN(actionId);
1306 result r = GetLastResult();
1307 SysTryReturnResult(NID_UI_CTRL, (pArg != null), r, "Propagating.");
1309 r = __pActionEvent->Fire(*pArg);
1315 _OptionMenu::GetActionEvent(void) const
1317 return __pActionEvent;
1321 _OptionMenu::LoadBitmap(void)
1323 result r = E_SUCCESS;
1324 Color backgroundColor;
1326 r = GET_BITMAP_CONFIG_N(OPTIONMENU::BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pBackgroundEffectBitmap);
1327 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
1329 backgroundColor = GetColor();
1331 r = LoadColorReplacedBitmap(backgroundColor);
1332 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
1337 delete __pBackgroundEffectBitmap;
1338 __pBackgroundEffectBitmap = null;
1344 _OptionMenu::LoadColorReplacedBitmap(const Color& color)
1346 result r = E_SUCCESS;
1348 // Delete old bitmap
1349 if (__pBackgroundNormalBitmap != null)
1351 delete __pBackgroundNormalBitmap;
1352 __pBackgroundNormalBitmap = null;
1355 r = GET_REPLACED_BITMAP_CONFIG_N(OPTIONMENU::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, color, __pBackgroundNormalBitmap);
1356 r = GetLastResult();
1357 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to load bitmap.");
1363 _OptionMenu::GetBackgroundNormalBitmap(void) const
1365 return __pBackgroundNormalBitmap;
1369 _OptionMenu::GetBackgroundEffectBitmap(void) const
1371 return __pBackgroundEffectBitmap;
1374 _UiTouchEventDelivery
1375 _OptionMenu::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1377 return __pOptionMenuPresenter->OnPreviewTouchPressed(source, touchinfo);
1381 _OptionMenu::OpenAnimation()
1383 VisualElementPropertyAnimation* pBoundsAnimation;
1384 VisualElementPropertyAnimation* pOpacityAnimation;
1386 _VisualElement* pVisualElement = GetVisualElement();
1387 SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get visual element.");
1389 FloatRectangle pEndBounds = pVisualElement->GetBounds();
1390 FloatRectangle pStartBounds(0.0f, 0.0f, 0.0f, 0.0f);
1391 pStartBounds = pEndBounds;
1393 float animationDistance = 0.0f;
1395 GET_SHAPE_CONFIG(OPTIONMENU::ANIMATION_DISTANCE_Y, _CONTROL_ORIENTATION_PORTRAIT, animationDistance);
1397 pStartBounds.y += animationDistance;
1399 pBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1400 SysTryReturnVoidResult(NID_UI_CTRL, pBoundsAnimation != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1402 pOpacityAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1403 SysTryCatch(NID_UI_CTRL, pOpacityAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1405 if (__pBoundsTimingFunction != null)
1407 delete __pBoundsTimingFunction;
1408 __pBoundsTimingFunction = null;
1411 __pBoundsTimingFunction = new (std::nothrow) SineThirtyThreeTimingFunction();
1412 SysTryCatch(NID_UI_CTRL, __pBoundsTimingFunction != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1414 pBoundsAnimation->SetPropertyName(L"bounds");
1415 pBoundsAnimation->SetStartValue(Variant(pStartBounds));
1416 pBoundsAnimation->SetEndValue(Variant(pEndBounds));
1417 pBoundsAnimation->SetTimingFunction(__pBoundsTimingFunction);
1418 pBoundsAnimation->SetDuration(ANIMATION_DURATION);
1420 pBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
1422 if (__pOpacityTimingFunction != null)
1424 delete __pOpacityTimingFunction;
1425 __pOpacityTimingFunction = null;
1428 __pOpacityTimingFunction = new (std::nothrow) SineSixtyTimingFunction();
1429 SysTryCatch(NID_UI_CTRL, __pOpacityTimingFunction != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1431 pOpacityAnimation->SetPropertyName(L"opacity");
1432 pOpacityAnimation->SetStartValue(Variant(0.0f));
1433 pOpacityAnimation->SetEndValue(Variant(1.0f));
1434 pBoundsAnimation->SetTimingFunction(__pOpacityTimingFunction);
1435 pOpacityAnimation->SetDuration(ANIMATION_DURATION);
1437 pOpacityAnimation->SetVisualElementAnimationStatusEventListener(this);
1439 pVisualElement->AddAnimation(L"OpeningBoundsAnimation", *pBoundsAnimation);
1440 pVisualElement->AddAnimation(L"OpeningOpacityAnimation", *pOpacityAnimation);
1442 __isAnimating = true;
1444 delete pBoundsAnimation;
1446 delete pOpacityAnimation;
1451 delete pBoundsAnimation;
1452 delete pOpacityAnimation;
1454 delete __pBoundsTimingFunction;
1455 __pBoundsTimingFunction = null;
1457 delete __pOpacityTimingFunction;
1458 __pOpacityTimingFunction = null;
1464 _OptionMenu::CloseAnimation(int actionId)
1466 __selectedActionID = actionId;
1468 VisualElementPropertyAnimation* pBoundsAnimation ;
1469 VisualElementPropertyAnimation* pOpacityAnimation;
1471 _VisualElement* pVisualElement = GetVisualElement();
1472 SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get visual element.");
1474 FloatRectangle pStartBounds = pVisualElement->GetBounds();
1475 FloatRectangle pEndBounds(0.0f, 0.0f, 0.0f, 0.0f);
1476 pEndBounds = pStartBounds;
1478 float animationDistance = 0.0f;
1480 GET_SHAPE_CONFIG(OPTIONMENU::ANIMATION_DISTANCE_Y, _CONTROL_ORIENTATION_PORTRAIT, animationDistance);
1482 pEndBounds.y += animationDistance;
1484 pBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1485 SysTryReturnVoidResult(NID_UI_CTRL, pBoundsAnimation != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1487 pOpacityAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1488 SysTryCatch(NID_UI_CTRL, pOpacityAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1490 if (__pBoundsTimingFunction != null)
1492 delete __pBoundsTimingFunction;
1493 __pBoundsTimingFunction = null;
1496 __pBoundsTimingFunction = new (std::nothrow) SineThirtyThreeTimingFunction();
1497 SysTryCatch(NID_UI_CTRL, __pBoundsTimingFunction != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1499 pBoundsAnimation->SetPropertyName(L"bounds");
1500 pBoundsAnimation->SetStartValue(Variant(pStartBounds));
1501 pBoundsAnimation->SetEndValue(Variant(pEndBounds));
1502 pBoundsAnimation->SetTimingFunction(__pBoundsTimingFunction);
1503 pBoundsAnimation->SetEndValueApplied(false);
1504 pBoundsAnimation->SetDuration(ANIMATION_DURATION);
1506 pBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
1508 if (__pOpacityTimingFunction != null)
1510 delete __pOpacityTimingFunction;
1511 __pOpacityTimingFunction = null;
1514 __pOpacityTimingFunction = new (std::nothrow) SineSixtyTimingFunction();
1515 SysTryCatch(NID_UI_CTRL, __pOpacityTimingFunction != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1517 pOpacityAnimation->SetPropertyName(L"opacity");
1518 pOpacityAnimation->SetStartValue(Variant(1.0f));
1519 pOpacityAnimation->SetEndValue(Variant(0.0f));
1520 pBoundsAnimation->SetEndValueApplied(false);
1521 pBoundsAnimation->SetTimingFunction(__pOpacityTimingFunction);
1522 pOpacityAnimation->SetDuration(ANIMATION_DURATION);
1524 pOpacityAnimation->SetVisualElementAnimationStatusEventListener(this);
1526 pVisualElement->AddAnimation(L"ClosingBoundsAnimation", *pBoundsAnimation);
1527 pVisualElement->AddAnimation(L"ClosingOpacityAnimation", *pOpacityAnimation);
1529 __isAnimating = true;
1531 delete pBoundsAnimation;
1532 delete pOpacityAnimation;
1537 delete pBoundsAnimation;
1539 delete pOpacityAnimation;
1541 delete __pBoundsTimingFunction;
1542 __pBoundsTimingFunction = null;
1544 delete __pOpacityTimingFunction;
1545 __pOpacityTimingFunction = null;
1551 _OptionMenu::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1553 return __pOptionMenuPresenter->OnTouchPressed(source, touchinfo);
1556 _UiTouchEventDelivery
1557 _OptionMenu::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1559 return __pOptionMenuPresenter->OnPreviewTouchMoved(source, touchinfo);
1563 _OptionMenu::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1565 return __pOptionMenuPresenter->OnTouchMoved(source, touchinfo);
1568 _UiTouchEventDelivery
1569 _OptionMenu::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1571 return __pOptionMenuPresenter->OnPreviewTouchReleased(source, touchinfo);
1575 _OptionMenu::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1577 return __pOptionMenuPresenter->OnTouchReleased(source, touchinfo);
1581 _OptionMenu::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1583 __pOptionMenuPresenter->OnTouchCanceled(source, touchinfo);
1585 SetVisibleState(false);
1591 _OptionMenu::OnActionPerformed(const _Control& source, int actionId)
1593 __pOptionMenuPresenter->OnActionPerformed(source, actionId);
1597 _OptionMenu::OnFontChanged(Font* pFont)
1599 return __pOptionMenuPresenter->OnFontChanged(pFont);
1603 _OptionMenu::OnFontInfoRequested(unsigned long& style, float& size)
1605 return __pOptionMenuPresenter->OnFontInfoRequested(style, size);
1609 _OptionMenu::OnChangeLayout(_ControlRotation rotation)
1611 __layout = GetOwner()->GetOrientation();
1613 if (!__isMaxVisibleCountSet)
1615 GET_SHAPE_CONFIG(OPTIONMENU::MAX_VISIBLE_ITEM_COUNT, __layout, __showItemCount);
1618 if (__isAttachedToMainTree)
1620 if(__rotation != rotation)
1622 SetVisibleState(false);
1626 __rotation = rotation;
1628 __pOptionMenuPresenter->ResetSelectedItem();
1632 _OptionMenu::OnOwnerChanged(_Control* pOldOwner)
1634 if (!__isAttachedToMainTree)
1639 _Control* pOwner = GetOwner();
1641 if (pOldOwner != null)
1643 pOldOwner->UnlockInputEvent();
1648 pOwner->LockInputEvent();
1652 _AccessibilityElement*
1653 _OptionMenu::GetAccessibilityElement(const int mainIndex) const
1655 _AccessibilityElement* pElement = null;
1656 result r = __accessibilityElements.GetAt(mainIndex, pElement);
1657 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed at AccessibilityElement.", GetErrorMessage(r));
1668 _OptionMenu::AddAccessibilityElement(const _AccessibilityElement& element)
1670 __accessibilityElements.Add(const_cast<_AccessibilityElement*>(&element));
1674 _OptionMenu::SetAllAccessibilityElement(void)
1676 RemoveAllAccessibilityElement();
1677 __pOptionMenuPresenter->SetAllAccessibilityElement();
1681 _OptionMenu::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1687 _OptionMenu::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1693 _OptionMenu::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1699 _OptionMenu::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1705 _OptionMenu::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1711 _OptionMenu::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1717 _OptionMenu::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1725 _OptionMenu::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1731 _OptionMenu::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1737 _OptionMenu::RemoveAllAccessibilityElement(void)
1739 _AccessibilityContainer* pAccessibilityContainer = GetAccessibilityContainer();
1740 if (pAccessibilityContainer != null && pAccessibilityContainer->IsActivated())
1742 pAccessibilityContainer->RemoveAllElement();
1749 _OptionMenu::GetItemFromPosition(const FloatPoint& position) const
1751 return __pOptionMenuPresenter->GetItemFromPosition(position);
1755 _OptionMenu::FindItem(int index) const
1757 return __pOptionMenuPresenter->FindItem(index);
1761 _OptionMenu::SetTopDrawnItemIndex(int index)
1763 return __pOptionMenuPresenter->SetTopDrawnItemIndex(index);
1767 _OptionMenu::GetLayout(void) const
1773 _OptionMenu::GetRotation(void) const
1778 }}} // Tizen::Ui: Control