Revert " modify license, permission and remove ^M char"
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_ContextMenu.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file                FUiCtrl_ContextMenu.cpp
19  * @brief               This is the implementation file for the _ContextMenu class.
20  */
21
22 #include <FBaseErrorDefine.h>
23 #include <FBaseSysLog.h>
24 #include <FGrp_BitmapImpl.h>
25 #include <FBaseColIEnumeratorT.h>
26 #include "FUi_ControlImplManager.h"
27 #include "FUi_ResourceManager.h"
28 #include "FUiAnim_VisualElement.h"
29 #include "FUiAnim_AnimationManager.h"
30 #include "FUi_AccessibilityContainer.h"
31 #include "FUi_AccessibilityElement.h"
32 #include "FUiCtrl_Form.h"
33 #include "FUiCtrl_Frame.h"
34 #include "FUiCtrl_ContextMenu.h"
35
36 using namespace Tizen::Graphics;
37 using namespace Tizen::Media;
38 using namespace Tizen::Ui::Animations;
39
40 namespace {
41 static const float TOUCH_PRESS_THRESHOLD_INSENSITIVE = 0.16f;
42 }
43
44 namespace Tizen { namespace Ui { namespace Controls
45 {
46
47 IMPLEMENT_PROPERTY(_ContextMenu);
48
49 _ContextMenu::_ContextMenu(const FloatPoint& point, enum ContextMenuCoreStyle style, enum ContextMenuCoreAlign contextMenuAlign)
50         : __pContextMenuPresenter(null)
51         , __style(style)
52         , __align(contextMenuAlign)
53         , __showItemCount(MAX_CONTEXTMENU_LIST_SHOW_ITEM)
54         , __showItemMaxCount(0)
55         , __isAttachedToMainTree(false)
56         , __ownerInputEnableState(false)
57         , __anchorPoint(point)
58         , __bodyRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
59         , __arrowRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
60         , __windowRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
61         , __pActionEvent(null)
62         , __pBackgroundNormalBitmap(null)
63         , __pBackgroundEffectBitmap(null)
64         , __dropPosition(CONTEXT_MENU_CORE_DROP_POSITION_INVALID)
65         , __layout(_CONTROL_ORIENTATION_PORTRAIT)
66         , __pScrollPanel(null)
67 {
68         __backgroundColor = Color(255, 255, 255, 255);
69
70         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL] = Color(255, 255, 255, 255);
71         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED] = Color(255, 255, 255, 255);
72         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = Color(255, 255, 255, 255);
73
74         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL] = Color(255, 255, 255, 255);
75         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED] = Color(255, 255, 255, 255);
76         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = Color(255, 255, 255, 255);
77
78         for (int i = 0; i < CONTEXT_MENU_CORE_DROP_POSITION_MAX; i++)
79         {
80                 __pArrowNormalBitmap[i] = null;
81                 __pArrowEffectBitmap[i] = null;
82         }
83 }
84
85 _ContextMenu::~_ContextMenu(void)
86 {
87         _Control* pOwner = GetOwner();
88         if (__isAttachedToMainTree == true && pOwner != null)
89         {
90                 pOwner->UnlockInputEvent();
91         }
92
93         if (__pScrollPanel) {
94                 __pScrollPanel->DetachAllChildren();
95                 DetachChild(*__pScrollPanel);
96                 delete __pScrollPanel;
97                 __pScrollPanel = null;
98         }
99
100         delete __pContextMenuPresenter;
101         __pContextMenuPresenter = null;
102
103         if (__pBackgroundNormalBitmap != null)
104         {
105                 delete __pBackgroundNormalBitmap;
106                 __pBackgroundNormalBitmap = null;
107         }
108
109         if (__pBackgroundEffectBitmap != null)
110         {
111                 delete __pBackgroundEffectBitmap;
112                 __pBackgroundEffectBitmap = null;
113         }
114
115         if (__pActionEvent)
116         {
117                 delete __pActionEvent;
118                 __pActionEvent = null;
119         }
120
121         for (int i = 0; i < CONTEXT_MENU_CORE_DROP_POSITION_MAX; i++)
122         {
123                 delete __pArrowNormalBitmap[i];
124                 __pArrowNormalBitmap[i] = null;
125
126                 delete __pArrowEffectBitmap[i];
127                 __pArrowEffectBitmap[i] = null;
128         }
129
130         __actionId.RemoveAll();
131
132         RemoveAllAccessibilityElement();
133 }
134
135
136 bool
137 _ContextMenu::IsActivatedOnOpen(void) const
138 {
139         return false;
140 }
141
142 _ContextMenu*
143 _ContextMenu::CreateContextMenuN(const FloatPoint& point, enum ContextMenuCoreStyle style, enum ContextMenuCoreAlign contextMenuAlign)
144 {
145         _ContextMenu* pContextMenu = new (std::nothrow) _ContextMenu(point, style, contextMenuAlign);
146         SysTryReturn(NID_UI_CTRL, pContextMenu != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
147
148         result r = E_SUCCESS;
149
150         r = pContextMenu->CreateRootVisualElement();
151         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
152
153         pContextMenu->SetActivationEnabled(false);
154
155         r = pContextMenu->Initialize();
156         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to Initialize.", GetErrorMessage(r));
157
158         r = pContextMenu->Install();
159         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to Install.", GetErrorMessage(r));
160
161         pContextMenu->AcquireHandle();
162         pContextMenu->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);
163
164         if (pContextMenu->GetAccessibilityContainer() != null)
165         {
166                 pContextMenu->GetAccessibilityContainer()->Activate(true);
167         }
168
169         if (style == CONTEXT_MENU_CORE_STYLE_LIST)
170         {
171                 float minWidth, minHeight;      // for visible scrollbar when scrollable
172                 GET_SHAPE_CONFIG(CONTEXTMENU::LIST_MIN_WIDTH,   _CONTROL_ORIENTATION_PORTRAIT, minWidth);
173                 GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, minHeight);
174                 pContextMenu->__pScrollPanel = _ScrollPanel::CreateScrollPanelN(FloatRectangle(0.0f, 0.0f, minWidth, minHeight), SCROLL_PANEL_SCROLL_DIRECTION_VERTICAL, false, false);
175                 pContextMenu->__pScrollPanel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);
176                 pContextMenu->AttachChild(*(pContextMenu->__pScrollPanel));
177         }
178
179         return pContextMenu;
180
181 CATCH:
182         delete pContextMenu;
183
184         return null;
185 }
186
187 _ScrollPanel*
188 _ContextMenu::GetScrollPanel(void)
189 {
190         return __pScrollPanel;
191 }
192
193 result
194 _ContextMenu::Install(void)
195 {
196         result r = E_SUCCESS;
197
198         // load bitmap of a background and arrow
199         r = LoadBitmap();
200         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to load bitmap.");
201
202         r = __actionId.Construct();
203         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to construct arraylist.");
204
205         if (__style == CONTEXT_MENU_CORE_STYLE_LIST)
206         {
207                 _IContextMenuPresenter* pPresenter = new (std::nothrow) _ContextMenuListPresenter(this);
208                 SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
209
210                 SetPresenter(*pPresenter);
211
212                 r = pPresenter->Install();
213         }
214         else
215         {
216                 _IContextMenuPresenter* pPresenter = new (std::nothrow) _ContextMenuGridPresenter(this);
217                 SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
218
219                 SetPresenter(*pPresenter);
220
221                 r = pPresenter->Install();
222         }
223
224         return r;
225 }
226
227 result
228 _ContextMenu::Initialize(void)
229 {
230         FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF();
231         result r = E_SUCCESS;
232
233         Color backgroundColor;
234         Color backgroundSelectedColor;
235         Color itemTextColor;
236         Color itemTextSelectedColor;
237
238         r = SetBounds(FloatRectangle(0.0f, 0.0f, screen.width, screen.height));
239         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "SetBounds failed.");
240
241         SetMovable(false);
242         SetResizable(false);
243
244         GET_COLOR_CONFIG(CONTEXTMENU::BG_NORMAL, backgroundColor);
245         GET_COLOR_CONFIG(CONTEXTMENU::ITEM_BG_PRESSED, backgroundSelectedColor);
246         GET_COLOR_CONFIG(CONTEXTMENU::ITEM_TEXT_NORMAL, itemTextColor);
247         GET_COLOR_CONFIG(CONTEXTMENU::ITEM_TEXT_PRESSED, itemTextSelectedColor);
248
249         __backgroundColor = backgroundColor;
250         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL] = backgroundColor;
251         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED] = backgroundSelectedColor;
252         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL] = itemTextColor;
253         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED] = itemTextSelectedColor;
254
255         if (GetVisualElement() != null)
256         {
257                 GetVisualElement()->SetSurfaceOpaque(false);
258         }
259
260         return r;
261
262 }
263
264 result
265 _ContextMenu::SetPresenter(const _IContextMenuPresenter& ContextMenuPresenter)
266 {
267         __pContextMenuPresenter = const_cast <_IContextMenuPresenter*>(&ContextMenuPresenter);
268
269         return E_SUCCESS;
270 }
271
272 void
273 _ContextMenu::OnDraw()
274 {
275         __pContextMenuPresenter->Draw();
276         if(unlikely((_AccessibilityManager::IsActivated())))
277         {
278                 _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
279         }
280 }
281
282 result
283 _ContextMenu::OnAttachedToMainTree(void)
284 {
285         result r = E_SUCCESS;
286
287 #if defined(WINDOW_BASE_ROTATE)
288         __layout = _ControlManager::GetInstance()->GetOrientation();
289 #endif
290
291         _Control* pOwner = GetOwner();
292         if (pOwner == null)
293         {
294                 _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
295                 SysTryReturn(NID_UI_CTRL, pFrame != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Current frame instance is not available.");
296
297                 _Form* pForm = pFrame->GetCurrentForm();
298                 pForm != null ? SetOwner(pForm) : SetOwner(pFrame);
299
300 #if !defined(WINDOW_BASE_ROTATE)
301                 __layout = _ControlManager::GetInstance()->GetOrientation();
302 #endif
303                 GET_SHAPE_CONFIG(CONTEXTMENU::ITEM_MAX_COUNT, __layout, __showItemMaxCount);
304         }
305         else if (pOwner != null && __isAttachedToMainTree == false)
306         {
307                 pOwner->LockInputEvent();
308         }
309
310         AdjustDropPosition();
311
312         if (GetItemCount() <= 0)
313         {
314                 __pContextMenuPresenter->CalculateShowItemCount();
315         }
316
317         __pContextMenuPresenter->CalculateWindowRect();
318
319         r = Open();
320
321         SetVisibleState(true);
322
323         if (__style == CONTEXT_MENU_CORE_STYLE_LIST)
324         {
325                 SetTouchCapture(false, false);
326         }
327         else
328         {
329                 SetTouchCapture(true, false);
330         }
331
332         SetAllAccessibilityElement();
333
334         __isAttachedToMainTree = true;
335
336         _VisualElement* pVisualElement = GetVisualElement();
337
338         FloatRectangle pBounds = pVisualElement->GetBounds();
339
340         float oldBoundsX = pBounds.x;
341         float oldBoundsY = pBounds.y;
342         float distanceX = 0.0f;
343         float distanceY = 0.0f;
344
345         GET_SHAPE_CONFIG(CONTEXTMENU::APPEARING_ANIMATION_DISTANCE_X, __layout, distanceX);
346         GET_SHAPE_CONFIG(CONTEXTMENU::APPEARING_ANIMATION_DISTANCE_Y, __layout, distanceY);
347
348         switch(GetDropPosition())
349         {
350         case CONTEXT_MENU_CORE_DROP_POSITION_UP:
351                 pBounds.y += distanceY;
352                 break;
353         case CONTEXT_MENU_CORE_DROP_POSITION_DOWN:
354                 pBounds.y -= distanceY;
355                 break;
356         case CONTEXT_MENU_CORE_DROP_POSITION_LEFT:
357                 pBounds.x += distanceX;
358                 break;
359         case CONTEXT_MENU_CORE_DROP_POSITION_RIGHT:
360                 pBounds.x -= distanceX;
361                 break;
362         default:
363                 break;
364         }
365
366         pVisualElement->SetBounds(pBounds);
367         pVisualElement->SetOpacity(0.0f);
368
369         bool enable = pVisualElement->IsImplicitAnimationEnabled();
370
371         pVisualElement->SetImplicitAnimationEnabled(true);
372
373         pBounds.x = oldBoundsX;
374         pBounds.y = oldBoundsY;
375         pVisualElement->SetBounds(pBounds);
376         pVisualElement->SetOpacity(1.0f);
377
378         pVisualElement->SetImplicitAnimationEnabled(enable);
379
380         return r;
381 }
382
383 result
384 _ContextMenu::OnDetachingFromMainTree(void)
385 {
386         result r = E_SUCCESS;
387
388         ReleaseTouchCapture();
389
390         _Control* pOwner = GetOwner();
391         if (pOwner != null)
392         {
393                 pOwner->UnlockInputEvent();
394         }
395
396         __isAttachedToMainTree = false;
397
398         return r;
399 }
400
401 result
402 _ContextMenu::AddItem(const Base::String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap,
403                                           const Bitmap* pHighlightedBitmap)
404 {
405         result r = E_SUCCESS;
406
407         r = __pContextMenuPresenter->AddItem(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
408         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to add a item.");
409
410         __actionId.Add(actionId);
411
412         __pContextMenuPresenter->CalculateShowItemCount();
413         __pContextMenuPresenter->CalculateWindowRect();
414
415         return r;
416 }
417
418 result
419 _ContextMenu::InsertItem(int index, const Base::String& text, int actionId, const Bitmap* pNormalBitmap,
420                                                  const Bitmap* pPressedBitmap,
421                                                  const Bitmap* pHighlightedBitmap)
422 {
423         result r = E_SUCCESS;
424
425         r = __pContextMenuPresenter->InsertItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
426         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to insert a item.");
427
428         __actionId.InsertAt(actionId, index);
429
430         __pContextMenuPresenter->CalculateShowItemCount();
431         __pContextMenuPresenter->CalculateWindowRect();
432
433         return r;
434 }
435
436 result
437 _ContextMenu::SetItem(int index, const Base::String& text, int actionId, const Bitmap* pNormalBitmap,
438                                           const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
439 {
440         result r = E_SUCCESS;
441
442         r = __pContextMenuPresenter->SetItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap);
443         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set a item.");
444
445         __actionId.SetAt(actionId, index);
446
447         __pContextMenuPresenter->CalculateWindowRect();
448
449         return r;
450 }
451
452 result
453 _ContextMenu::RemoveItemAt(int index)
454 {
455         result r = E_SUCCESS;
456
457         r = __pContextMenuPresenter->DeleteItem(index);
458         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove a item.");
459
460         __actionId.RemoveAt(index);
461
462         __pContextMenuPresenter->CalculateShowItemCount();
463         __pContextMenuPresenter->CalculateWindowRect();
464
465         return r;
466 }
467
468 result
469 _ContextMenu::RemoveAllItems(void)
470 {
471         result r = E_SUCCESS;
472
473         r = __pContextMenuPresenter->DeleteItemAll();
474         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove all items.");
475
476         __actionId.RemoveAll();
477
478         __pContextMenuPresenter->CalculateShowItemCount();
479         __pContextMenuPresenter->CalculateWindowRect();
480
481         return r;
482 }
483
484 int
485 _ContextMenu::GetItemCount(void) const
486 {
487         return __actionId.GetCount();
488 }
489
490 int
491 _ContextMenu::GetItemIndexAt(int actionId) const
492 {
493         int count = __actionId.GetCount();
494
495         for (int i = 0; i < count; i++)
496         {
497                 int index = GetItemActionIdAt(i);
498
499                 if (actionId == index)
500                 {
501                         return i;
502                 }
503         }
504
505         return -1;
506 }
507
508 int
509 _ContextMenu::GetItemActionIdAt(int index) const
510 {
511         int count = __actionId.GetCount();
512         int actionId = -1;
513
514         if (count <= 0 || index >= count)
515         {
516                 return -1;
517         }
518
519         __actionId.GetAt(index, actionId);
520
521         return actionId;
522 }
523
524 result
525 _ContextMenu::SetAnchorPosition(float x, float y)
526 {
527         __anchorPoint.x = x;
528         __anchorPoint.y = y;
529
530         if (__align == CONTEXT_MENU_CORE_ALIGN_AUTO)
531         {
532                 AdjustDropPosition();
533         }
534
535         __pContextMenuPresenter->CalculateWindowRect();
536         return E_SUCCESS;
537 }
538
539 FloatPoint
540 _ContextMenu::GetAnchorPosition(void) const
541 {
542         return __anchorPoint;
543 }
544
545 result
546 _ContextMenu::SetBodyRect(const FloatRectangle& rect)
547 {
548         __bodyRect = rect;
549
550         return E_SUCCESS;
551 }
552
553 FloatRectangle
554 _ContextMenu::GetBodyRect(void) const
555 {
556         return __bodyRect;
557 }
558
559 result
560 _ContextMenu::SetArrowRect(const FloatRectangle& rect)
561 {
562         __arrowRect = rect;
563
564         return E_SUCCESS;
565 }
566
567 FloatRectangle
568 _ContextMenu::GetArrowRect(void) const
569 {
570         return __arrowRect;
571 }
572
573 result
574 _ContextMenu::SetWindowRect(const FloatRectangle& rect)
575 {
576         __windowRect = rect;
577
578         return E_SUCCESS;
579 }
580
581 FloatRectangle
582 _ContextMenu::GetWindowRect(void) const
583 {
584         return __windowRect;
585 }
586
587 result
588 _ContextMenu::SetPropertyMaxVisibleItemsCount(const Variant& count)
589 {
590         int showCount = count.ToInt();
591
592         if (showCount < 1)
593         {
594                 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Count is invalid.");
595                 return E_INVALID_ARG;
596         }
597
598
599         __showItemCount = showCount;
600
601         return E_SUCCESS;
602 }
603
604 Variant
605 _ContextMenu::GetPropertyMaxVisibleItemsCount(void) const
606 {
607         return Tizen::Ui::Variant(__showItemCount);
608 }
609
610 int
611 _ContextMenu::GetShowItemCount(void) const
612 {
613         Variant count = GetProperty("maxVisibleItemsCount");
614
615         return count.ToInt();
616 }
617
618 int
619 _ContextMenu::GetShowItemMaxCount(void) const
620 {
621         return __showItemMaxCount;
622 }
623
624 result
625 _ContextMenu::SetShowItemCount(int count)
626 {
627         result r;
628
629         r = SetProperty("maxVisibleItemsCount", Variant(count));
630         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set property.");
631
632         if (__style == CONTEXT_MENU_CORE_STYLE_LIST)
633         {
634                 r = __pContextMenuPresenter->CalculateWindowRect();
635                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to calculate window.");
636         }
637
638         return E_SUCCESS;
639 }
640
641 result
642 _ContextMenu::SetPropertyColor(const Variant& color)
643 {
644         __backgroundColor = color.ToColor();
645
646         LoadColorReplacedBitmap(__backgroundColor);
647
648         return E_SUCCESS;
649 }
650
651 Variant
652 _ContextMenu::GetPropertyColor(void) const
653 {
654         return Tizen::Ui::Variant(__backgroundColor);
655 }
656
657 result
658 _ContextMenu::SetColor(const Graphics::Color& color)
659 {
660         return SetProperty("color", Variant(color));
661 }
662
663 Color
664 _ContextMenu::GetColor(void) const
665 {
666         Variant color = GetProperty("color");
667
668         return color.ToColor();
669 }
670
671 result
672 _ContextMenu::SetPropertyNormalItemColor(const Variant& color)
673 {
674         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL] = color.ToColor();
675
676         return __pContextMenuPresenter->ApplyColorProperty();
677 }
678
679 Variant
680 _ContextMenu::GetPropertyNormalItemColor(void) const
681 {
682         return Tizen::Ui::Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL]);
683 }
684
685 result
686 _ContextMenu::SetPropertyPressedItemColor(const Variant& color)
687 {
688         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED] = color.ToColor();
689
690         return __pContextMenuPresenter->ApplyColorProperty();
691 }
692
693 Variant
694 _ContextMenu::GetPropertyPressedItemColor(void) const
695 {
696         return Tizen::Ui::Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED]);
697 }
698
699 result
700 _ContextMenu::SetPropertyHighlightedItemColor(const Variant & color)
701 {
702         __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = color.ToColor();
703
704         return __pContextMenuPresenter->ApplyColorProperty();
705 }
706
707 Variant
708 _ContextMenu::GetPropertyHighlightedItemColor(void) const
709 {
710         return Tizen::Ui::Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]);
711 }
712
713 result
714 _ContextMenu::SetItemColor(enum ContextMenuCoreItemStatus status, const Graphics::Color& color)
715 {
716         result r = E_SUCCESS;
717
718         if (status == CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL)
719         {
720                 r = SetProperty("normalItemColor", Variant(color));
721         }
722         else if (status == CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED)
723         {
724                 r = SetProperty("pressedItemColor", Variant(color));
725         }
726         else
727         {
728                 r = SetProperty("highlightedItemColor", Variant(color));
729         }
730
731         return r;
732 }
733
734 Color
735 _ContextMenu::GetItemColor(enum ContextMenuCoreItemStatus status) const
736 {
737         Color itemColor;
738
739         if (status == CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL)
740         {
741                 Variant color = GetProperty("normalItemColor");
742                 itemColor = color.ToColor();
743
744         }
745         else if (status == CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED)
746         {
747                 Variant color = GetProperty("pressedItemColor");
748                 itemColor = color.ToColor();
749
750         }
751         else
752         {
753                 Variant color = GetProperty("highlightedItemColor");
754                 itemColor = color.ToColor();
755         }
756
757         return itemColor;
758
759 }
760
761 result
762 _ContextMenu::SetPropertyNormalItemTextColor(const Variant& color)
763 {
764         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL] = color.ToColor();
765
766         return __pContextMenuPresenter->ApplyColorProperty();
767 }
768
769 Variant
770 _ContextMenu::GetPropertyNormalItemTextColor(void) const
771 {
772         return Tizen::Ui::Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL]);
773 }
774
775 result
776 _ContextMenu::SetPropertyPressedItemTextColor(const Variant& color)
777 {
778         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED] = color.ToColor();
779
780         return __pContextMenuPresenter->ApplyColorProperty();
781 }
782
783 Variant
784 _ContextMenu::GetPropertyPressedItemTextColor(void) const
785 {
786         return Tizen::Ui::Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED]);
787 }
788
789 result
790 _ContextMenu::SetPropertyHighlightedItemTextColor(const Variant & color)
791 {
792         __textColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED] = color.ToColor();
793
794         return __pContextMenuPresenter->ApplyColorProperty();
795 }
796
797 Variant
798 _ContextMenu::GetPropertyHighlightedItemTextColor(void) const
799 {
800         return Tizen::Ui::Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]);
801 }
802
803 result
804 _ContextMenu::SetTextColor(enum ContextMenuCoreItemStatus status, const Graphics::Color& color)
805 {
806         result r = E_SUCCESS;
807
808         if (status == CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL)
809         {
810                 r = SetProperty("normalItemTextColor", Variant(color));
811         }
812         else if (status == CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED)
813         {
814                 r = SetProperty("pressedItemTextColor", Variant(color));
815         }
816         else
817         {
818                 r = SetProperty("highlightedItemTextColor", Variant(color));
819         }
820
821         return r;
822
823 }
824
825 Color
826 _ContextMenu::GetTextColor(enum ContextMenuCoreItemStatus status) const
827 {
828         Color textColor;
829
830         if (status == CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL)
831         {
832                 Variant color = GetProperty("normalItemTextColor");
833                 textColor = color.ToColor();
834
835         }
836         else if (status == CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED)
837         {
838                 Variant color = GetProperty("pressedItemTextColor");
839                 textColor = color.ToColor();
840
841         }
842         else
843         {
844                 Variant color = GetProperty("highlightedItemTextColor");
845                 textColor = color.ToColor();
846         }
847
848         return textColor;
849 }
850
851 result
852 _ContextMenu::AddActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener)
853 {
854         result r = E_SUCCESS;
855
856         if (__pActionEvent == null)
857         {
858                 __pActionEvent = _ActionEvent::CreateInstanceN(*this);
859                 SysTryReturn(NID_UI_CTRL, __pActionEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
860                                         "[E_OUT_OF_MEMORY] The memory is insufficient.")
861
862                 r = __pActionEvent->AddListener(listener);
863                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to remove an action event listener.")
864         }
865
866         return r;
867
868 CATCH:
869         delete __pActionEvent;
870         __pActionEvent = null;
871         return r;
872 }
873
874 result
875 _ContextMenu::RemoveActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener)
876 {
877         SysTryReturn(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, E_INVALID_STATE,
878                         "[E_INVALID_STATE] The action event instance isn't constructed.")
879
880         result r = E_SUCCESS;
881
882         r = __pActionEvent->RemoveListener(listener);
883         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove an action event listener")
884
885         return r;
886 }
887
888 Tizen::Ui::Controls::_ActionEvent*
889 _ContextMenu::GetActionEvent(void) const
890 {
891         return __pActionEvent;
892 }
893
894 result
895 _ContextMenu::LoadBitmap(void)
896 {
897         Color backgroundColor;
898
899         // Delete old bitmap
900         if (__pBackgroundEffectBitmap != null)
901         {
902                 delete __pBackgroundEffectBitmap;
903                 __pBackgroundEffectBitmap = null;
904         }
905
906         for (int i = 0; i < CONTEXT_MENU_CORE_DROP_POSITION_MAX; i++)
907         {
908                 if (__pArrowEffectBitmap[i] != null)
909                 {
910                         delete __pArrowEffectBitmap[i];
911                         __pArrowEffectBitmap[i] = null;
912                 }
913         }
914
915         backgroundColor = GetColor();
916
917
918         result r;
919         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_EFFECT_UP, BITMAP_PIXEL_FORMAT_ARGB8888,
920                         __pArrowEffectBitmap[CONTEXT_MENU_CORE_DROP_POSITION_UP]);
921         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
922
923         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_EFFECT_DOWN, BITMAP_PIXEL_FORMAT_ARGB8888,
924                         __pArrowEffectBitmap[CONTEXT_MENU_CORE_DROP_POSITION_DOWN]);
925         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
926
927         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_EFFECT_LEFT, BITMAP_PIXEL_FORMAT_ARGB8888,
928                         __pArrowEffectBitmap[CONTEXT_MENU_CORE_DROP_POSITION_LEFT]);
929         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
930
931         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_EFFECT_RIGHT, BITMAP_PIXEL_FORMAT_ARGB8888,
932                         __pArrowEffectBitmap[CONTEXT_MENU_CORE_DROP_POSITION_RIGHT]);
933         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
934
935         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::BG_OUTLINE_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pBackgroundEffectBitmap);
936         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
937
938         r = LoadColorReplacedBitmap(backgroundColor);
939         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
940
941         return r;
942
943 CATCH:
944         delete __pBackgroundEffectBitmap;
945         __pBackgroundEffectBitmap = null;
946
947         for (int i = 0; i < CONTEXT_MENU_CORE_DROP_POSITION_MAX; i++)
948         {
949
950                 delete __pArrowEffectBitmap[i];
951                 __pArrowEffectBitmap[i] = null;
952         }
953
954         return r;
955 }
956
957 result
958 _ContextMenu::LoadColorReplacedBitmap(const Tizen::Graphics::Color& color)
959 {
960         Bitmap* ptempNormalBitmap = null;
961
962         // Delete old bitmap
963         if (__pBackgroundNormalBitmap != null)
964         {
965                 delete __pBackgroundNormalBitmap;
966                 __pBackgroundNormalBitmap = null;
967         }
968
969         for (int i = 0; i < CONTEXT_MENU_CORE_DROP_POSITION_MAX; i++)
970         {
971                 if (__pArrowNormalBitmap[i] != null)
972                 {
973                         delete __pArrowNormalBitmap[i];
974                         __pArrowNormalBitmap[i] = null;
975                 }
976         }
977
978         result r;
979         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_NORMAL_UP, BITMAP_PIXEL_FORMAT_ARGB8888, ptempNormalBitmap);
980         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
981         __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_UP] = _BitmapImpl::GetColorReplacedBitmapN(*ptempNormalBitmap,
982                         Color::GetColor(COLOR_ID_MAGENTA), color);
983         SysTryCatch(NID_UI_CTRL, __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_UP] != null, , GetLastResult(),
984                         "[%s] Propagating.", GetErrorMessage(GetLastResult()));
985         delete ptempNormalBitmap;
986         ptempNormalBitmap = null;
987
988         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_NORMAL_DOWN, BITMAP_PIXEL_FORMAT_ARGB8888, ptempNormalBitmap);
989         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
990         __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_DOWN] = _BitmapImpl::GetColorReplacedBitmapN(*ptempNormalBitmap,
991                         Color::GetColor(COLOR_ID_MAGENTA), color);
992         SysTryCatch(NID_UI_CTRL, __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_DOWN] != null, , GetLastResult(),
993                         "[%s] Propagating.", GetErrorMessage(GetLastResult()));
994         delete ptempNormalBitmap;
995         ptempNormalBitmap = null;
996
997         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_NORMAL_LEFT, BITMAP_PIXEL_FORMAT_ARGB8888, ptempNormalBitmap);
998         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
999         __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_LEFT] = _BitmapImpl::GetColorReplacedBitmapN(*ptempNormalBitmap,
1000                         Color::GetColor(COLOR_ID_MAGENTA), color);
1001         SysTryCatch(NID_UI_CTRL, __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_LEFT] != null, , GetLastResult(),
1002                         "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1003         delete ptempNormalBitmap;
1004         ptempNormalBitmap = null;
1005
1006         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::ANCHOR_NORMAL_RIGHT, BITMAP_PIXEL_FORMAT_ARGB8888, ptempNormalBitmap);
1007         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
1008         __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_RIGHT] = _BitmapImpl::GetColorReplacedBitmapN(*ptempNormalBitmap,
1009                         Color::GetColor(COLOR_ID_MAGENTA), color);
1010         SysTryCatch(NID_UI_CTRL, __pArrowNormalBitmap[CONTEXT_MENU_CORE_DROP_POSITION_RIGHT] != null, , GetLastResult(),
1011                         "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1012         delete ptempNormalBitmap;
1013         ptempNormalBitmap = null;
1014
1015         r = GET_BITMAP_CONFIG_N(CONTEXTMENU::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, ptempNormalBitmap);
1016         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap.");
1017         __pBackgroundNormalBitmap = _BitmapImpl::GetColorReplacedBitmapN(*ptempNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
1018         SysTryCatch(NID_UI_CTRL, __pBackgroundNormalBitmap != null, , GetLastResult(), "[%s] Propagating.",
1019                         GetErrorMessage(GetLastResult()));
1020         delete ptempNormalBitmap;
1021
1022         return r;
1023
1024 CATCH:
1025         delete ptempNormalBitmap;
1026
1027         delete __pBackgroundNormalBitmap;
1028         __pBackgroundNormalBitmap = null;
1029
1030         for (int i = 0; i < CONTEXT_MENU_CORE_DROP_POSITION_MAX; i++)
1031         {
1032                 delete __pArrowNormalBitmap[i];
1033                 __pArrowNormalBitmap[i] = null;
1034         }
1035
1036         return r;
1037 }
1038
1039 const Bitmap*
1040 _ContextMenu::GetArrowNormalBitmap(ContextMenuCoreDropPosition dropPosition) const
1041 {
1042         if (dropPosition == CONTEXT_MENU_CORE_DROP_POSITION_INVALID || dropPosition == CONTEXT_MENU_CORE_DROP_POSITION_MAX)
1043         {
1044                 return null;
1045         }
1046
1047         return __pArrowNormalBitmap[dropPosition];
1048 }
1049
1050 const Bitmap*
1051 _ContextMenu::GetArrowEffectBitmap(ContextMenuCoreDropPosition dropPosition) const
1052 {
1053         if (dropPosition == CONTEXT_MENU_CORE_DROP_POSITION_INVALID || dropPosition == CONTEXT_MENU_CORE_DROP_POSITION_MAX)
1054         {
1055                 return null;
1056         }
1057
1058         return __pArrowEffectBitmap[dropPosition];
1059 }
1060
1061 const Bitmap*
1062 _ContextMenu::GetBackgroundNormalBitmap(void) const
1063 {
1064         return __pBackgroundNormalBitmap;
1065 }
1066
1067 const Bitmap*
1068 _ContextMenu::GetBackgroundEffectBitmap(void) const
1069 {
1070         return __pBackgroundEffectBitmap;
1071 }
1072
1073 enum ContextMenuCoreDropPosition
1074 _ContextMenu::GetDropPosition(void) const
1075 {
1076         return __dropPosition;
1077 }
1078
1079 void
1080 _ContextMenu::AdjustDropPosition(void)
1081 {
1082         FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF();
1083
1084         if (__align == CONTEXT_MENU_CORE_ALIGN_UP)
1085         {
1086                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_UP;
1087         }
1088         else if (__align == CONTEXT_MENU_CORE_ALIGN_DOWN)
1089         {
1090                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_DOWN;
1091         }
1092         else if (__align == CONTEXT_MENU_CORE_ALIGN_LEFT)
1093         {
1094                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_LEFT;
1095         }
1096         else if (__align == CONTEXT_MENU_CORE_ALIGN_RIGHT)
1097         {
1098                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_RIGHT;
1099         }
1100         else
1101         {
1102                 if (__layout == _CONTROL_ORIENTATION_LANDSCAPE)
1103                 {
1104                         screen.SetSize(screen.height, screen.width);
1105                 }
1106
1107                 if (screen.height > screen.width)
1108                 {
1109                         if ((screen.height / 2.0f) > __anchorPoint.y)
1110                         {
1111                                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_DOWN;
1112                         }
1113                         else
1114                         {
1115                                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_UP;
1116                         }
1117                 }
1118                 else
1119                 {
1120                         if ((screen.width / 2.0f) > __anchorPoint.x)
1121                         {
1122                                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_RIGHT;
1123                         }
1124                         else
1125                         {
1126                                 __dropPosition = CONTEXT_MENU_CORE_DROP_POSITION_LEFT;
1127                         }
1128                 }
1129         }
1130 }
1131
1132 _UiTouchEventDelivery
1133 _ContextMenu::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1134 {
1135         return __pContextMenuPresenter->OnPreviewTouchPressed(source, touchinfo);
1136 }
1137
1138 bool
1139 _ContextMenu::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1140 {
1141         return __pContextMenuPresenter->OnTouchPressed(source, touchinfo);
1142 }
1143
1144 _UiTouchEventDelivery
1145 _ContextMenu::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1146 {
1147         return __pContextMenuPresenter->OnPreviewTouchMoved(source, touchinfo);
1148 }
1149
1150 bool
1151 _ContextMenu::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1152 {
1153         return __pContextMenuPresenter->OnTouchMoved(source, touchinfo);
1154 }
1155
1156 _UiTouchEventDelivery
1157 _ContextMenu::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1158 {
1159         return __pContextMenuPresenter->OnPreviewTouchReleased(source, touchinfo);
1160 }
1161
1162 bool
1163 _ContextMenu::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1164 {
1165         return __pContextMenuPresenter->OnTouchReleased(source, touchinfo);
1166 }
1167
1168 bool
1169 _ContextMenu::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1170 {
1171         __pContextMenuPresenter->OnTouchCanceled(source, touchinfo);
1172
1173         SetVisibleState(false);
1174
1175         return true;
1176 }
1177
1178 void
1179 _ContextMenu::OnFontChanged(Tizen::Graphics::Font* pFont)
1180 {
1181         return __pContextMenuPresenter->OnFontChanged(pFont);
1182 }
1183
1184 void
1185 _ContextMenu::OnFontInfoRequested(unsigned long& style, float& size)
1186 {
1187         return __pContextMenuPresenter->OnFontInfoRequested(style, size);
1188 }
1189
1190 void
1191 _ContextMenu::OnVisibleStateChanged(void)
1192 {
1193         _Window::OnVisibleStateChanged();
1194 }
1195
1196 void
1197 _ContextMenu::OnChangeLayout(_ControlOrientation orientation)
1198 {
1199         GET_SHAPE_CONFIG(CONTEXTMENU::ITEM_MAX_COUNT, orientation, __showItemMaxCount);
1200
1201         if (__isAttachedToMainTree == true)
1202         {
1203                 if (__layout != orientation)
1204                 {
1205                         SetVisibleState(false);
1206                 }
1207         }
1208
1209         __layout = orientation;
1210 }
1211
1212 void
1213 _ContextMenu::OnOwnerChanged(_Control* pOldOwner)
1214 {
1215         _Control* pOwner = GetOwner();
1216
1217         if (pOldOwner != null)
1218         {
1219                 pOldOwner->UnlockInputEvent();
1220         }
1221
1222         if (pOwner != null)
1223         {
1224                 pOwner->LockInputEvent();
1225         }
1226 }
1227
1228 _AccessibilityElement*
1229 _ContextMenu::GetAccessibilityElement(const int mainIndex) const
1230 {
1231         _AccessibilityElement* pElement = null;
1232         result r = __accessibilityElements.GetAt(mainIndex, pElement);
1233         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed at AccessibilityElement.", GetErrorMessage(r));
1234
1235         return pElement;
1236
1237 CATCH:
1238         delete pElement;
1239
1240         return null;
1241 }
1242
1243 void
1244 _ContextMenu::AddAccessibilityElement(const _AccessibilityElement& element)
1245 {
1246         __accessibilityElements.Add(const_cast<_AccessibilityElement*>(&element));
1247 }
1248
1249 void
1250 _ContextMenu::SetAllAccessibilityElement(void)
1251 {
1252         RemoveAllAccessibilityElement();
1253         __pContextMenuPresenter->SetAllAccessibilityElement();
1254 }
1255
1256 void
1257 _ContextMenu::RemoveAllAccessibilityElement(void)
1258 {
1259         while (__accessibilityElements.GetCount() > 0)
1260         {
1261                 _AccessibilityElement* pElement = null;
1262                 if (__accessibilityElements.GetAt(0, pElement) == E_SUCCESS)
1263                 {
1264                         __accessibilityElements.RemoveAt(0);
1265                         pElement->GetParent()->RemoveElement(*pElement);
1266                 }
1267         }
1268 }
1269
1270 _ContextMenuItemInfo
1271 _ContextMenu::GetItemFromPosition(const FloatPoint& position) const
1272 {
1273         return __pContextMenuPresenter->GetItemFromPosition(position);
1274 }
1275
1276 _ContextMenuItemInfo
1277 _ContextMenu::FindItem(int index) const
1278 {
1279         return __pContextMenuPresenter->FindItem(index);
1280 }
1281
1282 result
1283 _ContextMenu::SetTopDrawnItemIndex(int index)
1284 {
1285         return __pContextMenuPresenter->SetTopDrawnItemIndex(index);
1286 }
1287
1288 _ControlOrientation
1289 _ContextMenu::GetLayout(void) const
1290 {
1291         return __layout;
1292 }
1293
1294 }}} // Tizen::Ui: Control