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