Tizen 2.1 base
[framework/osp/uifw.git] / inc / FUiCtrlContextMenu.h
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 /**
19  * @file        FUiCtrlContextMenu.h
20  * @brief       This is the header file for the %ContextMenu class.
21  *
22  * This header file contains the declarations of the %ContextMenu class and its helper classes.
23  */
24
25 #ifndef _FUI_CTRL_CONTEXT_MENU_H_
26 #define _FUI_CTRL_CONTEXT_MENU_H_
27
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FBaseString.h>
31 #include <FGrpBitmap.h>
32 #include <FGrpRectangle.h>
33 #include <FUiWindow.h>
34 #include <FUiContainer.h>
35 #include <FUiIActionEventListener.h>
36
37 namespace Tizen { namespace Graphics
38 {
39 class Bitmap;
40 };
41 };
42
43 namespace Tizen { namespace Ui { namespace Controls
44 {
45
46 /**
47  * @enum ContextMenuStyle
48  *
49  * Defines the %ContextMenu style.
50  *
51  * @since       2.0
52  */
53 enum ContextMenuStyle
54 {
55         CONTEXT_MENU_STYLE_LIST,/**< The style of the vertical list of image + text */
56         CONTEXT_MENU_STYLE_GRID,/**< The style of the grid of buttons */
57         CONTEXT_MENU_STYLE_ICON /**<@if OSPDEPREC @deprecated This enumeration field is deprecated because this style can be implemented using the CONTEXT_MENU_STYLE_GRID style @endif */
58 } ;
59
60 /**
61  * @enum ContextMenuItemStatus
62  *
63  * Defines the possible states of the %ContextMenu control item.
64  *
65  * @since 2.0
66  */
67 enum ContextMenuItemStatus
68 {
69         CONTEXT_MENU_ITEM_STATUS_NORMAL,                /**< The normal state */
70         CONTEXT_MENU_ITEM_STATUS_PRESSED,               /**< The pressed state  */
71         CONTEXT_MENU_ITEM_STATUS_HIGHLIGHTED    /**< The highlighted state */
72 };
73
74 /**
75  * @enum ContextMenuAnchorDirection
76  *
77  * Defines the direction of the %ContextMenu control.
78  *
79  * @since 2.0
80  */
81 enum ContextMenuAnchorDirection
82 {
83         CONTEXT_MENU_ANCHOR_DIRECTION_LEFTWARD, /**< The anchor arrow direction is leftward */
84         CONTEXT_MENU_ANCHOR_DIRECTION_RIGHTWARD,/**< The anchor arrow direction is rightward */
85         CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD,   /**< The anchor arrow direction is upward */
86         CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD, /**< The anchor arrow direction is downward */
87         CONTEXT_MENU_ANCHOR_DIRECTION_AUTO              /**< The anchor arrow direction is auto */
88 };
89
90 /**
91  * @class       ContextMenu
92  * @brief This class defines the common behavior of a %ContextMenu control.
93  *
94  * @since       2.0
95  *
96  * The %ContextMenu class displays a special purpose window that is used to present users with context-sensitive options.
97  *
98  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_contextmenus.htm">ContextMenu</a>.
99  *
100  * The following example demonstrates how to use the %ContextMenu class.
101
102  *
103  * @code
104 // Sample code for ContextMenuSample.h
105 #include <FUi.h>
106 class ContextMenuSample
107         : public Tizen::Ui::Controls::Form
108     , public Tizen::Ui::IActionEventListener
109 {
110 public:
111         ContextMenuSample(void)
112         :__pContextMenu(null){}
113
114         bool Initialize(void);
115         void ShowContextMenu(bool show);
116         virtual result OnInitializing(void);
117         virtual result OnTerminating(void);
118
119         // IActionEventListener
120         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
121
122 private:
123         static const int ID_CONTEXTMENU_ITEM1 = 101;
124         static const int ID_CONTEXTMENU_ITEM2 = 102;
125         static const int ID_BTN_SHOW_CONTEXTMENU = 103;
126
127         Tizen::Ui::Controls::ContextMenu *__pContextMenu;
128 };
129
130  *      @endcode
131  *
132  *      @code
133
134 // Sample code for ContextMenuSample.cpp
135 #include <FGraphics.h>
136
137 #include "ContextMenuSample.h"
138
139 using namespace Tizen::Graphics;
140 using namespace Tizen::Ui::Controls;
141
142 bool
143 ContextMenuSample::Initialize(void)
144 {
145         Construct(FORM_STYLE_NORMAL);
146         return true;
147 }
148
149 result
150 ContextMenuSample::OnInitializing(void)
151 {
152         result r = E_SUCCESS;
153
154         // Creates an instance of ContextMenu
155         __pContextMenu = new ContextMenu();
156         __pContextMenu->Construct(Point(400, 150), CONTEXT_MENU_STYLE_LIST);
157
158         __pContextMenu->AddItem(L"Item1", ID_CONTEXTMENU_ITEM1);
159         __pContextMenu->AddItem(L"Item2", ID_CONTEXTMENU_ITEM2);
160         __pContextMenu->AddActionEventListener(*this);
161
162         // Creates an instance of Button to show the context menu
163         Button* pButton = new Button();
164         pButton->Construct(Rectangle(50, 50, 400, 100), L"Show ContextMenu");
165         pButton->SetActionId(ID_BTN_SHOW_CONTEXTMENU);
166         pButton->AddActionEventListener(*this);
167
168         // Adds the button to the form
169         AddControl(*pButton);
170
171         return r;
172 }
173
174 // Sets the anchor position of the context menu
175 void
176 ContextMenuSample::ShowContextMenu(bool show)
177 {
178         __pContextMenu->SetPosition(Point(300, 200));
179
180         // Change to desired show state
181         __pContextMenu->SetShowState(show);
182
183         //Calls Show() of the control
184         if (show)
185         {
186                 __pContextMenu->Show();
187         }
188         else
189         {
190                 Invalidate(true);
191         }
192 }
193
194 result
195 ContextMenuSample::OnTerminating(void)
196 {
197         result r = E_SUCCESS;
198
199         // Deallocates the __pContextMenu
200         delete __pContextMenu;
201
202         return r;
203 }
204
205 // IActionEventListener implementation
206 void
207 ContextMenuSample::OnActionPerformed(const Control& source, int actionId)
208 {
209         switch (actionId)
210         {
211         case ID_CONTEXTMENU_ITEM1:
212                 {
213                         // ....
214                 }
215                 break;
216         case ID_CONTEXTMENU_ITEM2:
217                 {
218                         // ....
219                 }
220                 break;
221         case ID_BTN_SHOW_CONTEXTMENU:
222                 {
223                         ShowContextMenu(true);
224                 }
225                 break;
226         default:
227                 break;
228         }
229 }
230  * @endcode
231  *
232  */
233 class _OSP_EXPORT_ ContextMenu
234         : public Tizen::Ui::Window
235 {
236 public:
237 // Lifecycle
238         /**
239          * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
240          *
241          * @since       2.0
242          *
243          */
244         ContextMenu(void);
245
246         /**
247          * This destructor overrides Tizen::Base::Object::~Object().
248          *
249          * @since       2.0
250          *
251          */
252         virtual ~ContextMenu(void);
253
254         /**
255          * Initializes this instance of %ContextMenu with the specified parameters.
256          *
257          * @since               2.0
258          *
259          * @return              An error code
260          * @param[in]   point           The x and y coordinates of the anchor of %ContextMenu
261          * @param[in]   style                   The context menu style
262          * @exception   E_SUCCESS               The method is successful.
263          * @exception   E_INVALID_STATE This instance has already been constructed.
264          * @exception   E_SYSTEM            A system error has occurred.
265          */
266         result Construct(const Tizen::Graphics::Point& point, ContextMenuStyle style);
267
268         /**
269          * Initializes this instance of %ContextMenu with the specified parameters.
270          *
271          * @since               2.0
272          *
273          * @return              An error code
274          * @param[in]   point                   The x and y coordinates of the anchor of the %ContextMenu control
275          * @param[in]   style                   The context menu style
276          * @param[in]   direction               The anchor arrow direction
277          * @exception   E_SUCCESS               The method is successful.
278          * @exception   E_INVALID_STATE This instance has already been constructed.
279          * @exception   E_SYSTEM                A system error has occurred.
280          */
281         result Construct(const Tizen::Graphics::Point& point, ContextMenuStyle style, ContextMenuAnchorDirection direction);
282
283         /**
284          * Adds a listener instance.
285          * The added listener can listen to events on the given context of the event dispatcher when they are fired.
286          *
287          * @since               2.0
288          *
289          * @param[in]   listener        The event listener to be added
290          */
291         void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
292
293         /**
294          * Removes the specified listener instance.
295          * The removed listener cannot listen to events when they are fired.
296          *
297          * @since               2.0
298          *
299          * @param[in]   listener        The event listener to be removed
300          */
301         void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
302
303
304 // Operation
305         /**
306          * Appends the specified item at the end of the %ContextMenu control.
307          *
308          * @since               2.0
309          *
310          * @return              An error code
311          * @param[in]   normalBitmap            The normal bitmap of the item
312          * @param[in]   pPressedBitmap          The pressed bitmap of the item
313          * @param[in]   actionId                    The action ID for this item
314          * @exception   E_SUCCESS                   The method is successful.
315          * @exception   E_MAX_EXCEEDED      The number of items has exceeded the maximum limit.
316          * @exception   E_SYSTEM                    A system error has occurred.
317          * @remarks             This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_GRID.
318          */
319         result AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, int actionId);
320
321     /**
322      * Appends the specified item at the end of the %ContextMenu control.
323      *
324      * @since           2.0
325          *
326      * @return      An error code
327      * @param[in]   normalBitmap        The normal bitmap of the item
328      * @param[in]   pPressedBitmap      The pressed bitmap of the item
329      * @param[in]   pHighlightedBitmap  The highlighted bitmap of the item
330      * @param[in]   actionId            The action ID for this item
331      * @exception   E_SUCCESS           The method is successful.
332      * @exception   E_MAX_EXCEEDED      The number of items has exceeded the maximum limit.
333      * @exception   E_SYSTEM            A system error has occurred.
334      * @remarks     This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_GRID. @n
335      *                          When a user navigates the user interface using the directional keys, the selected UI control is highlighted and the control takes the
336          *                              focus.
337      */
338         result AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, int actionId);
339
340         /**
341          * Appends the specified item at the end of the %ContextMenu control.
342          *
343          * @since               2.0
344          *
345          * @return              An error code
346          * @param[in]   text                    The string of the item to be appended
347          * @param[in]   actionId                The specified action ID for this item
348          * @exception   E_SUCCESS               The method is successful.
349          * @exception   E_MAX_EXCEEDED  The number of items has exceeded the maximum limit.
350          * @exception   E_SYSTEM                A system error has occurred.
351          */
352         result AddItem(const Tizen::Base::String& text, int actionId);
353
354         /**
355          * Appends the specified item at the end of the %ContextMenu control.
356          *
357          * @since               2.0
358          *
359          * @return              An error code
360          * @param[in]   text                            The string of the item to be appended
361          * @param[in]   actionId                        The specified action ID for this item
362          * @param[in]   normalBitmap        The normal bitmap of the item
363      * @param[in]       pPressedBitmap      The pressed bitmap of the item
364      * @param[in]       pHighlightedBitmap  The highlighted bitmap of the item
365          * @exception   E_SUCCESS                       The method is successful.
366          * @exception   E_MAX_EXCEEDED          The total number of items has exceeded the maximum limit.
367          * @exception   E_SYSTEM                        A system error has occurred.
368          * @remarks             This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_LIST.
369          */
370         result AddItem(const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap = null, const Tizen::Graphics::Bitmap* pHighlightedBitmap = null);
371
372         /**
373          * Inserts the specified item at the given index of the %ContextMenu control.
374          *
375          * @since               2.0
376          *
377          * @return              An error code
378          * @param[in]   index                   The location
379          * @param[in]   normalBitmap    The normal bitmap of the item
380          * @param[in]   pPressedBitmap  The pressed bitmap of the item
381          * @param[in]   actionId                The specified action ID for this item
382          * @exception   E_SUCCESS               The method is successful.
383          * @exception   E_MAX_EXCEEDED  The number of items has exceeded the maximum limit.
384          * @exception   E_OUT_OF_RANGE  The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
385          * @exception   E_SYSTEM                A system error has occurred.
386          * @remarks             This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_GRID. @n
387          *                              The %ContextMenu control can have a maximum of 3 icons.
388          */
389         result InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, int actionId);
390
391     /**
392      * Inserts the specified item at the given index of the %ContextMenu control.
393      *
394      * @since           2.0
395          *
396      * @return          An error code
397      * @param[in]       index                      The location
398      * @param[in]       normalBitmap               The normal bitmap of the item
399      * @param[in]       pPressedBitmap             The pressed bitmap of the item
400      * @param[in]       pHighlightedBitmap         The highlighted bitmap of the item
401      * @param[in]       actionId                   The specified action ID for this item
402      * @exception       E_SUCCESS                  The method is successful.
403      * @exception       E_MAX_EXCEEDED             The number of items has exceeded the maximum limit.
404      * @exception       E_OUT_OF_RANGE             The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
405      * @exception       E_SYSTEM                   A system error has occurred.
406      * @remarks         This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_GRID. @n
407      * @remarks         When a user navigates the user interface using the directional keys, the selected UI control is highlighted and the control takes the focus.
408          */
409         result InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, int actionId);
410
411         /**
412          * Inserts the specified item at the given index of the %ContextMenu control.
413          *
414          * @since               2.0
415          *
416          * @return              An error code
417          * @param[in]   index                   The location
418          * @param[in]   text                    The string of the item to set
419          * @param[in]   actionId                The specified action ID for this item
420          * @exception   E_SUCCESS               The method is successful.
421          * @exception   E_MAX_EXCEEDED  The number of items has exceeded the maximum limit.
422          * @exception   E_OUT_OF_RANGE  The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
423          * @exception   E_SYSTEM                A system error has occurred.
424          */
425         result InsertItemAt(int index, const Tizen::Base::String& text, int actionId);
426
427         /**
428          * Inserts the specified item at the given index of the %ContextMenu control.
429          *
430          * @since               2.0
431          *
432          * @return              An error code
433          * @param[in]   index                           The location
434          * @param[in]   text                            The string of the item to set
435          * @param[in]   actionId                        The specified action ID for this item
436          * @param[in]   normalBitmap        The normal bitmap of the item
437      * @param[in]       pPressedBitmap      The pressed bitmap of the item
438      * @param[in]       pHighlightedBitmap  The highlighted bitmap of the item
439          * @exception   E_SUCCESS                       The method is successful.
440          * @exception   E_MAX_EXCEEDED          The number of items has exceeded the maximum limit.
441          * @exception   E_OUT_OF_RANGE          The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
442          * @exception   E_SYSTEM                        A system error has occurred.
443          * @remarks             This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_LIST.
444          */
445         result InsertItemAt(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap = null, const Tizen::Graphics::Bitmap* pHighlightedBitmap = null);
446
447         /**
448          * Sets the specified item at the given index of the %ContextMenu control.
449          *
450          * @since               2.0
451          *
452          * @return              An error code
453          * @param[in]   index                           The location
454          * @param[in]   normalBitmap            The normal bitmap of the item
455          * @param[in]   pPressedBitmap          The pressed bitmap of the item
456          * @param[in]   actionId                    The action ID for this item
457          * @exception   E_SUCCESS                       The method is successful.
458          * @exception   E_OUT_OF_RANGE      The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
459          * @exception   E_SYSTEM                        A system error has occurred.
460          * @remarks     This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_GRID.
461          */
462         result SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, int actionId);
463
464         /**
465          * Sets the specified item at the given index of the %ContextMenu control.
466          *
467          * @since           2.0
468          *
469          * @return        An error code
470      * @param[in]     index                      The location
471      * @param[in]     normalBitmap               The normal bitmap of the item
472      * @param[in]     pPressedBitmap             The pressed bitmap of the item
473      * @param[in]     pHighlightedBitmap         The highlighted bitmap of the item
474      * @param[in]     actionId                   The action ID for this item
475      * @exception     E_SUCCESS                  The method is successful.
476      * @exception     E_OUT_OF_RANGE             The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
477      * @exception     E_SYSTEM                   A system error has occurred.
478      * @remarks       This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_GRID. @n
479      * @remarks       When a user navigates the user interface using the directional keys, @n
480      *                the selected UI control is highlighted and the control takes the focus.
481          */
482         result SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, int actionId);
483
484         /**
485          * Sets the specified item at the given index of the %ContextMenu control.
486          *
487          * @since               2.0
488          *
489          * @return              An error code
490          * @param[in]   index                   The location
491          * @param[in]   text                    The string of the item to set
492          * @param[in]   actionId                The action ID for this item
493          * @exception   E_SUCCESS               The method is successful.
494          * @exception   E_OUT_OF_RANGE  The specified @c index less than @c 0 or greater than the number of items in %ContextMenu.
495          * @exception   E_SYSTEM                A system error has occurred.
496          */
497         result SetItemAt(int index, const Tizen::Base::String& text, int actionId);
498
499         /**
500          * Sets the specified item at the given index of the %ContextMenu control.
501          *
502          * @since               2.0
503          *
504          * @return              An error code
505          * @param[in]   index                           The location
506          * @param[in]   text                            The string of the item to set
507          * @param[in]   actionId                        The action ID for this item
508          * @param[in]   normalBitmap        The normal bitmap of the item
509          * @param[in]   pPressedBitmap      The pressed bitmap of the item
510          * @param[in]   pHighlightedBitmap  The highlighted bitmap of the item
511          * @exception   E_SUCCESS                       The method is successful.
512          * @exception   E_OUT_OF_RANGE          The specified @c index less than @c 0 or greater than the number of items in %ContextMenu.
513          * @exception   E_SYSTEM                        A system error has occurred.
514          * @remarks     This method can only be used when the style of the context menu is CONTEXT_MENU_STYLE_LIST.
515          */
516         result SetItemAt(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap = null, const Tizen::Graphics::Bitmap* pHighlightedBitmap = null);
517
518         /**
519          * Removes the item at the specified index from the %ContextMenu control.
520          *
521          * @since               2.0
522          *
523          * @return              An error code
524          * @param[in]   index                   The location
525          * @exception   E_SUCCESS               The method is successful.
526          * @exception   E_SYSTEM                A system error has occurred.
527          */
528         result RemoveItemAt(int index);
529
530         /**
531          * Removes all items from the %ContextMenu control.
532          *
533          * @since               2.0
534          *
535          * @exception   E_SUCCESS               The method is successful.
536          * @exception   E_SYSTEM                A system error has occurred.
537          */
538         result RemoveAllItems(void);
539
540         /**
541          * Gets the number of items of the %ContextMenu control.
542          *
543          * @since       2.0
544          *
545          * @return      The number of items registered for %ContextMenu, @n
546          *                      else @c -1 if an error occurs
547          */
548         int GetItemCount(void) const;
549
550         /**
551          * Gets the index of the item with the specified action ID.
552          *
553          * @since               2.0
554          *
555          * @return              The index of the item, @n
556          *                              else @c -1 if an error occurs
557          * @param[in]   actionId        The action ID
558          */
559         int GetItemIndexFromActionId(int actionId) const;
560
561         /**
562          * Gets the action ID of the item at the specified index.
563          *
564          * @since               2.0
565          *
566          * @return              The action ID of the item, @n
567          *                              else @c -1 if the specified index is invalid
568          * @param[in]   index           The index of the item
569          */
570         int GetItemActionIdAt(int index) const;
571
572         /**
573          * Gets the item text color of the %ContextMenu control for the specified status.
574          *
575          * @since               2.0
576          *
577          * @return      The item text color, @n
578          *                              else RGBA (0,0,0,0) if an error occurs
579          * @param[in]   status          The item status
580          */
581         Tizen::Graphics::Color GetItemTextColor(ContextMenuItemStatus status) const;
582
583         /**
584          * Sets the item text color of the %ContextMenu control for the specified status.
585          *
586          * @since               2.0
587          *
588          * @return      An error code
589          * @param[in]   status                          The item status
590          * @param[in]   color                           The item text color to be set
591          * @exception   E_SUCCESS                       The method is successful.
592          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
593          * @exception   E_SYSTEM                        A system error has occurred.
594          */
595         result SetItemTextColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color);
596
597         /**
598          * Sets the position of the anchor.
599          *
600          * @since               2.0
601          *
602          * @return              An error code
603          * @param[in]   position                        The new position
604          * @exception   E_SUCCESS                       The method is successful.
605          * @exception   E_INVALID_STATE         This instance is in an invalid state.
606          * @remarks             The x and y coordinates of the anchor are defined in the coordinate space of its parent,
607          *                              which means that @c x and @c y must be defined relative to the top-left corner (0,0) of its parent.
608          */
609         result SetAnchorPosition(const Tizen::Graphics::Point& position);
610
611         /**
612          * Gets the position of the anchor.
613          *
614          * @since               2.0
615          *
616          * @return              The position of the anchor
617          * @remarks             The coordinate of the anchor position is defined from the top-left corner of its parent Container.
618          */
619         Tizen::Graphics::Point GetAnchorPosition(void) const;
620
621         /**
622          * Gets the color of the %ContextMenu control.
623          *
624          * @since               2.0
625          *
626          * @return              The color of %ContextMenu control, @n
627          *                              else RGBA(0, 0, 0, 0) if an error occurs
628          * @see                 SetColor()
629          */
630         Tizen::Graphics::Color GetColor(void) const;
631
632         /**
633          * Sets the color of the %ContextMenu control.
634          *
635          * @since               2.0
636          *
637          * @return              An error code
638          * @param[in]   color                           The color to be set
639          * @exception   E_SUCCESS                       The method is successful.
640          * @exception   E_INVALID_STATE         This instance is in an invalid state.
641          * @exception   E_SYSTEM                        A system error has occurred.
642          * @see                 GetColor()
643          */
644         result SetColor(const Tizen::Graphics::Color& color);
645
646         /**
647          * Gets the item color for the specified status.
648          *
649          * @since               2.0
650          *
651          * @return              The color of %ContextMenu control, @n
652          *                      else RGBA(0, 0, 0, 0) if an error occurs
653          * @param[in]   status                          The menu item status
654          * @exception   E_SUCCESS                       The method is successful.
655          * @exception   E_INVALID_ARG           The specified input parameter is invalid. @n
656          *                                                                      The item color for CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported.
657          * @exception   E_INVALID_STATE         This instance is in an invalid state.
658          * @exception   E_SYSTEM                        A system error has occurred.
659          * @remarks             The specific error code can be accessed using the GetLastResult() method. @n
660          *                              The item color for the CONTEXT_MENU_ITEM_STATUS_NORMAL status is always the same as the color of the %ContextMenu control.
661          * @see                 SetItemColor()
662          */
663         Tizen::Graphics::Color GetItemColor(ContextMenuItemStatus status) const;
664
665         /**
666          * Sets the item color for the specified status.
667          *
668          * @since               2.0
669          *
670          * @return              An error code
671          * @param[in]   status                          The menu item status
672          * @param[in]   color                           The color to be set
673          * @exception   E_SUCCESS                       The method is successful.
674          * @exception   E_INVALID_ARG           The specified input parameter is invalid. @n
675          *                                                                      The item color for CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported.
676          * @exception   E_INVALID_STATE         This instance is in an invalid state.
677          * @exception   E_SYSTEM                        A system error has occurred.
678          * @remarks             The item color for the CONTEXT_MENU_ITEM_STATUS_NORMAL status is always the same as the color of the %ContextMenu control.
679          * @see                 GetItemColor()
680          */
681         result SetItemColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color);
682
683         /**
684          * Gets maximum number of visible items.
685          *
686          * @since               2.0
687          *
688          * @return              The maximum number of visible items, @n
689          *                              else @c -1 if an error occurs
690          * @see                 SetMaxVisibleItemsCount()
691          */
692         int GetMaxVisibleItemsCount(void) const;
693
694         /**
695          * Sets maximum number of visible items.
696          *
697          * @since               2.0
698          *
699          * @return              An error code
700          * @param[in]   maxItemsCount           The maximum number of the visible menu items
701          * @exception   E_SUCCESS                       The method is successful.
702          * @exception   E_OUT_OF_RANGE          The specified @c parameter is out of possible range.
703          * @exception   E_INVALID_STATE         This instance is in an invalid state.
704          * @exception   E_SYSTEM                        A system error has occurred.
705          * @remarks             @c maxItemsCount should be greater than @c 0 and less than @c 8. The default value for
706          *                              the maximum number of the visible menu items is @c 4.
707          * @see                 GetMaxVisibleItemsCount()
708          */
709         result SetMaxVisibleItemsCount(int maxItemsCount);
710
711 protected:
712         friend class _ContextMenuImpl;
713 private:
714         //
715         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
716         //
717         // @since       2.0
718         //
719         //
720         ContextMenu(const ContextMenu& rhs);
721
722         //
723         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
724         //
725         // @since       2.0
726         //
727         //
728         ContextMenu& operator =(const ContextMenu& rhs);
729 }; // ContextMenu
730
731 }}} // Tizen::Ui: Control
732
733 #endif // _FUI_CTRL_CONTEXT_MENU_H_