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_OptionMenuItem.cpp
20 * @brief This is the implementation file for the _OptionMenuItem class.
23 #include <FBaseSysLog.h>
24 #include <FGrp_BitmapImpl.h>
25 #include "FUi_AccessibilityContainer.h"
26 #include "FUi_AccessibilityElement.h"
27 #include "FUi_CoordinateSystemUtils.h"
29 #include "FUi_ResourceManager.h"
31 #include "FUiCtrl_ScrollPanel.h"
32 #include "FUiCtrl_OptionMenuItem.h"
34 using namespace Tizen::Base;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Ui;
39 static const float TOUCH_PRESS_THRESHOLD_INSENSITIVE = 0.16f;
42 namespace Tizen { namespace Ui { namespace Controls
45 _OptionMenuItem::_OptionMenuItem(void)
46 : __type(OPTION_MENU_ITEM_DRAWING_TYPE_NONE)
48 , __upperDividerLine(false)
49 , __lowerDividerLine(false)
51 , __highlighted(false)
52 , __parentScrollEnable(false)
55 , __dividerHeight(0.0f)
56 , __bgPressedMargin(0.0f)
57 , __textLeftMargin(0.0f)
58 , __textRightMargin(0.0f)
59 , __textTopMargin(0.0f)
60 , __textBottomMargin(0.0f)
61 , __arrowLeftMargin(0.0f)
62 , __arrowRightMargin(0.0f)
67 , __pMagentaBgBitmap(null)
68 , __pArrowBitmap(null)
69 , __pArrowPressedBitmap(null)
70 , __size(FloatDimension(0.0f, 0.0f))
71 , __drawRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
72 , __pBitmapLabel(null)
74 , __pUpperDividerLineLabel(null)
75 , __pBackgroundLabel(null)
76 , __pLowerDividerLineLabel(null)
80 _ControlOrientation orientation = GetOrientation();
82 __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL] = null;
83 __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_PRESSED] = null;
84 __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED] = null;
86 GET_SHAPE_CONFIG(OPTIONMENU::LIST_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __leftMargin);
87 GET_SHAPE_CONFIG(OPTIONMENU::LIST_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __rightMargin);
88 GET_SHAPE_CONFIG(OPTIONMENU::LIST_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __dividerHeight);
89 GET_SHAPE_CONFIG(OPTIONMENU::ITEM_BG_PRESSED_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __bgPressedMargin);
91 GET_SHAPE_CONFIG(OPTIONMENU::TEXT_LEFT_MARGIN, orientation, __textLeftMargin);
92 GET_SHAPE_CONFIG(OPTIONMENU::TEXT_RIGHT_MARGIN, orientation, __textRightMargin);
93 GET_SHAPE_CONFIG(OPTIONMENU::TEXT_TOP_MARGIN, orientation, __textTopMargin);
94 GET_SHAPE_CONFIG(OPTIONMENU::TEXT_BOTTOM_MARGIN, orientation, __textBottomMargin);
95 GET_SHAPE_CONFIG(OPTIONMENU::LEFT_MARGIN, orientation, __arrowLeftMargin);
96 GET_SHAPE_CONFIG(OPTIONMENU::RIGHT_MARGIN, orientation, __arrowRightMargin);
97 GET_SHAPE_CONFIG(OPTIONMENU::ARROW_MARGIN, orientation, __arrowMargin);
98 GET_SHAPE_CONFIG(OPTIONMENU::ITEM_HEIGHT, orientation, __itemHeight);
100 GET_COLOR_CONFIG(OPTIONMENU::ITEM_BG_PRESSED, __selectedBgColor);
101 GET_COLOR_CONFIG(OPTIONMENU::LIST_ITEM_DIVIDER_01_NORMAL, __lowerDividerLineColor); // lower divider of item n and
102 GET_COLOR_CONFIG(OPTIONMENU::LIST_ITEM_DIVIDER_02_NORMAL, __upperDividerLineColor); // upper divider of item n+1 are bonded together.
103 GET_BITMAP_CONFIG_N(OPTIONMENU::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pMagentaBgBitmap);
105 InitializeAccessibilityElement();
108 _OptionMenuItem::~_OptionMenuItem(void)
110 if (__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL] != null)
112 delete __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL];
113 __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL] = null;
116 if (__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_PRESSED] != null)
118 delete __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_PRESSED];
119 __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_PRESSED] = null;
122 if (__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED] != null)
124 delete __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED];
125 __pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED] = null;
128 if (__pUpperDividerLineLabel != null)
130 DetachChild(*__pUpperDividerLineLabel);
131 delete __pUpperDividerLineLabel;
132 __pUpperDividerLineLabel = null;
135 if (__pBackgroundLabel != null)
137 DetachChild(*__pBackgroundLabel);
138 delete __pBackgroundLabel;
139 __pBackgroundLabel = null;
142 if (__pBitmapLabel != null)
144 DetachChild(*__pBitmapLabel);
145 delete __pBitmapLabel;
146 __pBitmapLabel = null;
149 if (__pTextLabel != null)
151 DetachChild(*__pTextLabel);
156 delete __pMagentaBgBitmap;
157 __pMagentaBgBitmap = null;
159 delete __pArrowBitmap;
160 __pArrowBitmap = null;
162 delete __pArrowPressedBitmap;
163 __pArrowPressedBitmap = null;
165 if (__pLowerDividerLineLabel != null)
167 DetachChild(*__pLowerDividerLineLabel);
168 delete __pLowerDividerLineLabel;
169 __pLowerDividerLineLabel = null;
172 if (__pArrowLabel != null)
174 DetachChild(*__pArrowLabel);
175 delete __pArrowLabel;
176 __pArrowLabel = null;
179 if (__pSubItems != null)
181 __pSubItems->RemoveAll(true);
186 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
189 pContainer->RemoveAllElement();
194 _OptionMenuItem::CreateOptionMenuItemN(void)
198 _OptionMenuItem* pItem = null;
200 pItem = new (std::nothrow) _OptionMenuItem();
203 SetLastResult(E_OUT_OF_MEMORY);
207 pItem->AcquireHandle();
209 SetLastResult(E_SUCCESS);
214 _OptionMenuItem::InsertSubItemAt(_OptionMenuItem& subItem, int index)
216 if (__pSubItems == null)
218 __pSubItems = new (std::nothrow) ArrayList;
219 SysTryReturn(NID_UI_CTRL, (__pSubItems != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
221 result r = __pSubItems->Construct();
226 SysLogException(NID_UI_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
231 SysTryReturn(NID_UI_CTRL, (index >= 0 && index <= __pSubItems->GetCount()), E_INVALID_ARG, E_INVALID_ARG,
232 "[E_INVALID_ARG] The specified index (%d) is greater than the available items count.", index);
234 return __pSubItems->InsertAt(subItem, index);
238 _OptionMenuItem::SetSubItemAt(_OptionMenuItem& subItem, int index)
240 _OptionMenuItem* pItem = static_cast<_OptionMenuItem*>(__pSubItems->GetAt(index));
242 pItem->SetText(subItem.GetText());
243 pItem->SetActionId(subItem.GetActionId());
251 _OptionMenuItem::RemoveSubItemAt(int index)
253 SysTryReturn(NID_UI_CTRL, (__pSubItems != null), E_SYSTEM, E_SYSTEM,
254 "[E_SYSTEM] A system error has occurred. The sub items list is null.");
255 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < __pSubItems->GetCount()), E_SYSTEM, E_SYSTEM,
256 "[E_SYSTEM] A system error has occurred. The specified index (%d) is greater than the available items count.", index);
258 return __pSubItems->RemoveAt(index, true);
262 _OptionMenuItem::HasSubItem(void) const
264 return (__pSubItems != null && __pSubItems->GetCount() > 0);
268 _OptionMenuItem::GetSubItemCount(void) const
270 if (__pSubItems == null)
275 return __pSubItems->GetCount();
279 _OptionMenuItem::GetSubItem(int index)
281 SysTryReturn(NID_UI_CTRL, (__pSubItems != null), null, E_SYSTEM,
282 "[E_SYSTEM] A system error has occurred. The sub items list is null.", index);
283 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < __pSubItems->GetCount()), null, E_SYSTEM,
284 "[E_SYSTEM] A system error has occurred. The specified index (%d) is greater than the available items count.", index);
286 return static_cast<_OptionMenuItem*>(__pSubItems->GetAt(index));
290 _OptionMenuItem::InitializeAccessibilityElement(void)
292 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
295 pContainer->Activate(true);
296 _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
297 SysTryReturnVoidResult(NID_UI_CTRL, pElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
299 pElement->SetTrait(L"Optionual popup");
300 pElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
301 pContainer->AddElement(*pElement);
308 _OptionMenuItem::SetBitmapLabel(_Label* pLabel)
310 __pBitmapLabel = pLabel;
314 _OptionMenuItem::SetTextLabel(_Label* pLabel)
316 __pTextLabel = pLabel;
320 _OptionMenuItem::GetBitmapLabel(void) const
322 if (__pBitmapLabel == null)
327 return const_cast<_Label*>(__pBitmapLabel);
331 _OptionMenuItem::GetTextLabel(void) const
333 if (__pTextLabel == null)
338 return const_cast<_Label*>(__pTextLabel);
342 _OptionMenuItem::SetType(OptionMenuItemDrawingType type)
347 OptionMenuItemDrawingType
348 _OptionMenuItem::GetType(void) const
354 _OptionMenuItem::SetActionId(int actionId)
356 __actionId = actionId;
360 _OptionMenuItem::GetActionId(void) const
366 _OptionMenuItem::SetUpperDivider(bool drawDivider)
368 __upperDividerLine = drawDivider;
372 _OptionMenuItem::SetLowerDivider(bool drawDivider)
374 __lowerDividerLine = drawDivider;
378 _OptionMenuItem::HasUpperDivider(void) const
380 return __upperDividerLine;
384 _OptionMenuItem::HasLowerDivider(void) const
386 return __lowerDividerLine;
390 _OptionMenuItem::SetTextSize(float size)
396 _OptionMenuItem::SetText(const String& text)
404 _OptionMenuItem::GetText(void) const
410 _OptionMenuItem::SetBitmap(OptionMenuItemDrawingStatus status, const Bitmap* pBitmap)
412 if (status < OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL || status > OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED)
414 return E_INVALID_ARG;
417 SysTryReturn(NID_UI_CTRL, (status != OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL || pBitmap != null), E_INVALID_ARG,
418 E_INVALID_ARG, "[E_INVALID_ARG] The normal bitmap must not be null.");
420 Bitmap* pClonedBitmap = _BitmapImpl::CloneN(*pBitmap);
422 // If bitmap is in _OptionMenuItem, delete old one.
423 if (__pBitmap[status] != null)
425 delete __pBitmap[status];
426 __pBitmap[status] = null;
429 __pBitmap[status] = pClonedBitmap;
435 _OptionMenuItem::GetBitmap(OptionMenuItemDrawingStatus status) const
437 if (status < OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL || status > OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED)
442 return __pBitmap[status];
446 _OptionMenuItem::SetSize(Tizen::Graphics::FloatDimension size)
451 Tizen::Graphics::FloatDimension
452 _OptionMenuItem::GetSize(void) const
458 _OptionMenuItem::SetDrawRect(Tizen::Graphics::FloatRectangle rect)
464 _OptionMenuItem::GetDrawRect(void) const
470 _OptionMenuItem::SetPressedDrawRect(Tizen::Graphics::FloatRectangle rect)
472 __pressedDrawRect = rect;
476 _OptionMenuItem::GetPressedDrawRect(void) const
478 return __pressedDrawRect;
482 _OptionMenuItem::Release(void)
490 _OptionMenuItem::OnBoundsChanged(void)
492 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
495 _AccessibilityElement* pElement = pContainer->GetChildElement(0);
498 pElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
504 _OptionMenuItem::OnDraw(void)
510 _OptionMenuItem::DrawItem(void)
512 if (__upperDividerLine)
514 DrawItemUpperDivider();
517 if (__lowerDividerLine)
519 DrawItemLowerDivider();
522 DrawItemBackground();
525 if (HasSubItem() == true)
532 _OptionMenuItem::DrawItemBitmap(void)
536 __pBitmapLabel->SetBackgroundBitmap(*__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_PRESSED]);
538 else if (__highlighted)
540 __pBitmapLabel->SetBackgroundBitmap(*__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
544 __pBitmapLabel->SetBackgroundBitmap(*__pBitmap[OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL]);
547 FloatRectangle bounds = __pTextLabel->GetBoundsF();
548 FloatRectangle itemBounds = GetBoundsF();
550 float bitmapWidth = (__type == OPTION_MENU_ITEM_DRAWING_TYPE_BITMAP) ? __pBitmapLabel->GetBoundsF().width : 0.0f;
551 float textLabelX = __leftMargin + bitmapWidth;
553 bounds.x = textLabelX;
554 bounds.width = itemBounds.width;
556 bounds.width = bounds.width - __textLeftMargin - __textRightMargin - bitmapWidth;
560 bounds.width = bounds.width - __arrowLeftMargin - __arrowRightMargin;
563 __pTextLabel->SetBounds(bounds);
564 __pBitmapLabel->Invalidate();
565 __pTextLabel->Invalidate();
569 _OptionMenuItem::DrawArrow(void)
571 FloatRectangle bounds = GetBoundsF();
572 FloatRectangle textRect;
573 textRect.height = bounds.height - __textTopMargin - __textBottomMargin;
574 textRect.width = bounds.width - __arrowLeftMargin - __arrowRightMargin - __textLeftMargin - __textRightMargin;
575 textRect.x = bounds.x + __arrowLeftMargin + __textLeftMargin;
576 textRect.y = bounds.y + ((bounds.height - textRect.height) / 2.0f);
578 textRect.width -= __arrowMargin;
581 Bitmap *pArrowBitmap = null;
582 result r = E_SUCCESS;
583 FloatRectangle arrowbounds(0.0f, 0.0f, 0.0f, 0.0f);
585 if (__pArrowBitmap == null)
587 // Load Contextual Popup Arrow Bitmap
588 r = GET_BITMAP_CONFIG_N(OPTIONMENU::CONTEXTUAL_POPUP_ARROW, BITMAP_PIXEL_FORMAT_ARGB8888, pArrowBitmap);
589 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
591 GET_COLOR_CONFIG(OPTIONMENU::CONTEXTUAL_POPUP_ARROW_NORMAL, arrowColor);
592 __pArrowBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pArrowBitmap, Color::GetColor(COLOR_ID_MAGENTA), arrowColor);
593 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
599 if (__pArrowPressedBitmap == null)
601 // Load Contextual Popup Arrow Pressed Bitmap
602 r = GET_BITMAP_CONFIG_N(OPTIONMENU::CONTEXTUAL_POPUP_ARROW, BITMAP_PIXEL_FORMAT_ARGB8888, pArrowBitmap);
603 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
605 GET_COLOR_CONFIG(OPTIONMENU::CONTEXTUAL_POPUP_ARROW_PRESSED, arrowColor);
606 __pArrowPressedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pArrowBitmap, Color::GetColor(COLOR_ID_MAGENTA), arrowColor);
607 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
613 if (__pArrowLabel == null)
615 __pArrowLabel = _Label::CreateLabelN();
616 SysTryCatch(NID_UI_CTRL, (__pArrowLabel != null), , r, "[%s] Propagating.", GetErrorMessage(r));
618 AttachChild(*__pArrowLabel);
620 _AccessibilityContainer* pContainer = __pArrowLabel->GetAccessibilityContainer();
623 pContainer->Activate(false);
627 arrowbounds = FloatRectangle(bounds.x + bounds.width - __arrowMargin - __rightMargin,
628 (__itemHeight - __pArrowBitmap->GetHeight())/2.0f, __pArrowBitmap->GetWidth(), __pArrowBitmap->GetHeight());
629 __pArrowLabel->SetBounds(FloatRectangle(arrowbounds));
631 if (__selected == true)
633 __pArrowLabel->SetBackgroundBitmap(*__pArrowPressedBitmap);
637 __pArrowLabel->SetBackgroundBitmap(*__pArrowBitmap);
640 __pArrowLabel->Invalidate();
647 delete __pArrowBitmap;
648 __pArrowBitmap = null;
650 delete __pArrowPressedBitmap;
651 __pArrowPressedBitmap = null;
653 delete __pArrowLabel;
654 __pArrowLabel = null;
658 _OptionMenuItem::DrawItemUpperDivider(void)
660 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
661 Color dividerLineColor(0, 0, 0, 0);
663 if (__pUpperDividerLineLabel == null)
665 __pUpperDividerLineLabel = _Label::CreateLabelN();
666 SysTryReturnVoidResult(NID_UI_CTRL, __pUpperDividerLineLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
668 AttachChild(*__pUpperDividerLineLabel);
670 _AccessibilityContainer* pContainer = __pUpperDividerLineLabel->GetAccessibilityContainer();
673 pContainer->Activate(false);
677 bounds = GetBoundsF();
678 if (__selected == false)
680 dividerLineColor = __upperDividerLineColor;
683 __pUpperDividerLineLabel->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, __dividerHeight));
684 __pUpperDividerLineLabel->SetBackgroundColor(dividerLineColor);
685 __pUpperDividerLineLabel->Invalidate();
689 _OptionMenuItem::GetSubItemIndexFromActionId(int actionId) const
691 if (__pSubItems == null)
697 int subItemCount = __pSubItems->GetCount();
698 const _OptionMenuItem* pItem = null;
699 for (index = 0; index < subItemCount; index++)
701 pItem = static_cast<const _OptionMenuItem*>(__pSubItems->GetAt(index));
704 if (pItem->__actionId == actionId)
715 _OptionMenuItem::DrawItemBackground(void)
717 SetBackgroundColor(Color(0, 0, 0, 0));
719 if (__pBackgroundLabel == null)
721 __pBackgroundLabel = _Label::CreateLabelN();
722 SysTryReturnVoidResult(NID_UI_CTRL, __pBackgroundLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
724 __pBackgroundLabel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);
725 AttachChild(*__pBackgroundLabel);
726 MoveChildToBottom(*__pBackgroundLabel);
728 _AccessibilityContainer* pContainer = __pBackgroundLabel->GetAccessibilityContainer();
731 pContainer->Activate(false);
735 Color color= Color(0, 0, 0, 0);
736 if (__selected == true)
738 color = __selectedBgColor;
741 FloatRectangle bounds = GetBoundsF();
742 _ScrollPanel* pScrollPanel = static_cast<_ScrollPanel*>(GetParent());
743 FloatRectangle boundsScrollPanel = pScrollPanel->GetBoundsF();
745 __pBackgroundLabel->SetBounds(FloatRectangle(0, 0, bounds.width, bounds.height));
747 Bitmap* BgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*__pMagentaBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
748 SysTryReturnVoidResult(NID_UI_CTRL, BgBitmap, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
750 __pBackgroundLabel->SetBackgroundBitmap(*BgBitmap);
754 __pBackgroundLabel->Invalidate();
758 _OptionMenuItem::DrawItemLowerDivider(void)
760 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
761 Color dividerLineColor(0, 0, 0, 0);
763 if (__pLowerDividerLineLabel == null)
765 __pLowerDividerLineLabel = _Label::CreateLabelN();
766 SysTryReturnVoidResult(NID_UI_CTRL, __pLowerDividerLineLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
768 AttachChild(*__pLowerDividerLineLabel);
770 _AccessibilityContainer* pContainer = __pLowerDividerLineLabel->GetAccessibilityContainer();
773 pContainer->Activate(false);
777 bounds = GetBoundsF();
778 if (__selected == false)
780 dividerLineColor = __lowerDividerLineColor;
783 __pLowerDividerLineLabel->SetBounds(FloatRectangle(0.0f, bounds.height - __dividerHeight, bounds.width, __dividerHeight));
784 __pLowerDividerLineLabel->SetBackgroundColor(dividerLineColor);
785 __pLowerDividerLineLabel->Invalidate();
788 _UiTouchEventDelivery
789 _OptionMenuItem::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
791 SetAndInvalidate(true);
793 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
797 _OptionMenuItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
799 SetAndInvalidate(true);
804 _UiTouchEventDelivery
805 _OptionMenuItem::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
807 TouchMoved(source, touchinfo);
809 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
813 _OptionMenuItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
815 TouchMoved(source, touchinfo);
820 _UiTouchEventDelivery
821 _OptionMenuItem::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
823 SetAndInvalidate(false);
825 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
829 _OptionMenuItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
831 SetAndInvalidate(false);
838 _OptionMenuItem::TouchMoved(const _Control& source, const _TouchInfo& touchinfo)
840 FloatPoint touchPosition = touchinfo.GetCurrentPosition();
844 if (__parentScrollEnable)
854 int oldSelected = __selected;
856 FloatRectangle bounds(0.0f, 0.0f, __size.width, __size.height);
857 if (bounds.Contains(touchPosition))
866 if (oldSelected != __selected)
875 _OptionMenuItem::OnFontChanged(Tizen::Graphics::Font* pFont)
877 String fontName = _Control::GetFont();
879 if (__pTextLabel != null)
881 __pTextLabel->SetFont(fontName);
886 _OptionMenuItem::OnFontInfoRequested(unsigned long& style, float& size)
888 style = FONT_STYLE_PLAIN;
893 _OptionMenuItem::SetParentScrollEnable(bool enable)
895 __parentScrollEnable = enable;
899 _OptionMenuItem::GetParentScrollEnable(void) const
901 return __parentScrollEnable;
905 _OptionMenuItem::IsSelected(void) const
911 _OptionMenuItem::IsHighlighted(void) const
913 return __highlighted;
917 _OptionMenuItem::SetHighlighted(bool status)
919 __highlighted = status;
923 _OptionMenuItem::SetAndInvalidate(bool flag)
930 const Tizen::Graphics::Bitmap*
931 _OptionMenuItem::GetMagentaBgBitmap(void) const
933 return __pMagentaBgBitmap;
936 }}} // Tizen::Ui::Controls