Merge "Fix Ime Rotation" into tizen_2.1
[platform/framework/native/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 enum value 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         __pContextMenu->Destroy();
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.1
272          *
273          * @return              An error code
274          * @param[in]   point           The x and y coordinates of the anchor of %ContextMenu
275          * @param[in]   style                   The context menu style
276          * @exception   E_SUCCESS               The method is successful.
277          * @exception   E_INVALID_STATE This instance has already been constructed.
278          * @exception   E_SYSTEM            A system error has occurred.
279          */
280         result Construct(const Tizen::Graphics::FloatPoint& point, ContextMenuStyle style);
281
282         /**
283          * Initializes this instance of %ContextMenu with the specified parameters.
284          *
285          * @since               2.0
286          *
287          * @return              An error code
288          * @param[in]   point                   The x and y coordinates of the anchor of the %ContextMenu control
289          * @param[in]   style                   The context menu style
290          * @param[in]   direction               The anchor arrow direction
291          * @exception   E_SUCCESS               The method is successful.
292          * @exception   E_INVALID_STATE This instance has already been constructed.
293          * @exception   E_SYSTEM                A system error has occurred.
294          */
295         result Construct(const Tizen::Graphics::Point& point, ContextMenuStyle style, ContextMenuAnchorDirection direction);
296
297         /**
298          * Initializes this instance of %ContextMenu with the specified parameters.
299          *
300          * @since               2.1
301          *
302          * @return              An error code
303          * @param[in]   point                   The x and y coordinates of the anchor of the %ContextMenu control
304          * @param[in]   style                   The context menu style
305          * @param[in]   direction               The anchor arrow direction
306          * @exception   E_SUCCESS               The method is successful.
307          * @exception   E_INVALID_STATE This instance has already been constructed.
308          * @exception   E_SYSTEM                A system error has occurred.
309          */
310         result Construct(const Tizen::Graphics::FloatPoint& point, ContextMenuStyle style, ContextMenuAnchorDirection direction);
311
312         /**
313          * Adds a listener instance.
314          * The added listener can listen to events on the given context of the event dispatcher when they are fired.
315          *
316          * @since               2.0
317          *
318          * @param[in]   listener        The event listener to add
319          */
320         void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
321
322         /**
323          * Removes the specified listener instance.
324          * The removed listener cannot listen to events when they are fired.
325          *
326          * @since               2.0
327          *
328          * @param[in]   listener        The event listener to remove
329          */
330         void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
331
332
333 // Operation
334         /**
335          * Appends the specified item at the end of the %ContextMenu control.
336          *
337          * @since               2.0
338          *
339          * @return              An error code
340          * @param[in]   normalBitmap            The normal bitmap of the item
341          * @param[in]   pPressedBitmap          The pressed bitmap of the item
342          * @param[in]   actionId                    The action ID for this item
343          * @exception   E_SUCCESS                   The method is successful.
344          * @exception   E_MAX_EXCEEDED      The number of items has exceeded the maximum limit.
345          * @exception   E_SYSTEM                    A system error has occurred.
346          * @remarks             This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_GRID.
347          */
348         result AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, int actionId);
349
350     /**
351      * Appends the specified item at the end of the %ContextMenu control.
352      *
353      * @since           2.0
354          *
355      * @return      An error code
356      * @param[in]   normalBitmap        The normal bitmap of the item
357      * @param[in]   pPressedBitmap      The pressed bitmap of the item
358      * @param[in]   pHighlightedBitmap  The highlighted bitmap of the item
359      * @param[in]   actionId            The action ID for this item
360      * @exception   E_SUCCESS           The method is successful.
361      * @exception   E_MAX_EXCEEDED      The number of items has exceeded the maximum limit.
362      * @exception   E_SYSTEM            A system error has occurred.
363      * @remarks     This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_GRID. @n
364      *                          When a user navigates the user interface using the directional keys, the selected UI control is highlighted and the control takes the
365          *                              focus.
366      */
367         result AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, int actionId);
368
369         /**
370          * Appends the specified item at the end of the %ContextMenu control.
371          *
372          * @since               2.0
373          *
374          * @return              An error code
375          * @param[in]   text                    The string of the item to append
376          * @param[in]   actionId                The specified action ID for this item
377          * @exception   E_SUCCESS               The method is successful.
378          * @exception   E_MAX_EXCEEDED  The number of items has exceeded the maximum limit.
379          * @exception   E_SYSTEM                A system error has occurred.
380          */
381         result AddItem(const Tizen::Base::String& text, int actionId);
382
383         /**
384          * Appends the specified item at the end of the %ContextMenu control.
385          *
386          * @since               2.0
387          *
388          * @return              An error code
389          * @param[in]   text                            The string of the item to append
390          * @param[in]   actionId                        The specified action ID for this item
391          * @param[in]   normalBitmap        The normal bitmap of the item
392      * @param[in]       pPressedBitmap      The pressed bitmap of the item
393      * @param[in]       pHighlightedBitmap  The highlighted bitmap of the item
394          * @exception   E_SUCCESS                       The method is successful.
395          * @exception   E_MAX_EXCEEDED          The total number of items has exceeded the maximum limit.
396          * @exception   E_SYSTEM                        A system error has occurred.
397          * @remarks             This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_LIST.
398          */
399         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);
400
401         /**
402          * Inserts the specified item at the given index of the %ContextMenu control.
403          *
404          * @since               2.0
405          *
406          * @return              An error code
407          * @param[in]   index                   The location
408          * @param[in]   normalBitmap    The normal bitmap of the item
409          * @param[in]   pPressedBitmap  The pressed bitmap of the item
410          * @param[in]   actionId                The specified action ID for this item
411          * @exception   E_SUCCESS               The method is successful.
412          * @exception   E_MAX_EXCEEDED  The number of items has exceeded the maximum limit.
413          * @exception   E_OUT_OF_RANGE  The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
414          * @exception   E_SYSTEM                A system error has occurred.
415          * @remarks             This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_GRID. @n
416          *                              The %ContextMenu control can have a maximum of 3 icons.
417          */
418         result InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, int actionId);
419
420     /**
421      * Inserts the specified item at the given index of the %ContextMenu control.
422      *
423      * @since           2.0
424          *
425      * @return          An error code
426      * @param[in]       index                      The location
427      * @param[in]       normalBitmap               The normal bitmap of the item
428      * @param[in]       pPressedBitmap             The pressed bitmap of the item
429      * @param[in]       pHighlightedBitmap         The highlighted bitmap of the item
430      * @param[in]       actionId                   The specified action ID for this item
431      * @exception       E_SUCCESS                  The method is successful.
432      * @exception       E_MAX_EXCEEDED             The number of items has exceeded the maximum limit.
433      * @exception       E_OUT_OF_RANGE             The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
434      * @exception       E_SYSTEM                   A system error has occurred.
435      * @remarks         This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_GRID. @n
436      * @remarks         When a user navigates the user interface using the directional keys, the selected UI control is highlighted and the control takes the focus.
437          */
438         result InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, int actionId);
439
440         /**
441          * Inserts the specified item at the given index of the %ContextMenu control.
442          *
443          * @since               2.0
444          *
445          * @return              An error code
446          * @param[in]   index                   The location
447          * @param[in]   text                    The string of the item to set
448          * @param[in]   actionId                The specified action ID for this item
449          * @exception   E_SUCCESS               The method is successful.
450          * @exception   E_MAX_EXCEEDED  The number of items has exceeded the maximum limit.
451          * @exception   E_OUT_OF_RANGE  The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
452          * @exception   E_SYSTEM                A system error has occurred.
453          */
454         result InsertItemAt(int index, const Tizen::Base::String& text, int actionId);
455
456         /**
457          * Inserts the specified item at the given index of the %ContextMenu control.
458          *
459          * @since               2.0
460          *
461          * @return              An error code
462          * @param[in]   index                           The location
463          * @param[in]   text                            The string of the item to set
464          * @param[in]   actionId                        The specified action ID for this item
465          * @param[in]   normalBitmap        The normal bitmap of the item
466      * @param[in]       pPressedBitmap      The pressed bitmap of the item
467      * @param[in]       pHighlightedBitmap  The highlighted bitmap of the item
468          * @exception   E_SUCCESS                       The method is successful.
469          * @exception   E_MAX_EXCEEDED          The number of items has exceeded the maximum limit.
470          * @exception   E_OUT_OF_RANGE          The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
471          * @exception   E_SYSTEM                        A system error has occurred.
472          * @remarks             This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_LIST.
473          */
474         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);
475
476         /**
477          * Sets the specified item at the given index of the %ContextMenu control.
478          *
479          * @since               2.0
480          *
481          * @return              An error code
482          * @param[in]   index                           The location
483          * @param[in]   normalBitmap            The normal bitmap of the item
484          * @param[in]   pPressedBitmap          The pressed bitmap of the item
485          * @param[in]   actionId                    The action ID for this item
486          * @exception   E_SUCCESS                       The method is successful.
487          * @exception   E_OUT_OF_RANGE      The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
488          * @exception   E_SYSTEM                        A system error has occurred.
489          * @remarks     This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_GRID.
490          */
491         result SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, int actionId);
492
493         /**
494          * Sets the specified item at the given index of the %ContextMenu control.
495          *
496          * @since           2.0
497          *
498          * @return        An error code
499      * @param[in]     index                      The location
500      * @param[in]     normalBitmap               The normal bitmap of the item
501      * @param[in]     pPressedBitmap             The pressed bitmap of the item
502      * @param[in]     pHighlightedBitmap         The highlighted bitmap of the item
503      * @param[in]     actionId                   The action ID for this item
504      * @exception     E_SUCCESS                  The method is successful.
505      * @exception     E_OUT_OF_RANGE             The specified @c index is less than @c 0 or greater than the number of items in %ContextMenu.
506      * @exception     E_SYSTEM                   A system error has occurred.
507      * @remarks       This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_GRID. @n
508      * @remarks       When a user navigates the user interface using the directional keys, @n
509      *                the selected UI control is highlighted and the control takes the focus.
510          */
511         result SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, int actionId);
512
513         /**
514          * Sets the specified item at the given index of the %ContextMenu control.
515          *
516          * @since               2.0
517          *
518          * @return              An error code
519          * @param[in]   index                   The location
520          * @param[in]   text                    The string of the item to set
521          * @param[in]   actionId                The action ID for this item
522          * @exception   E_SUCCESS               The method is successful.
523          * @exception   E_OUT_OF_RANGE  The specified @c index less than @c 0 or greater than the number of items in %ContextMenu.
524          * @exception   E_SYSTEM                A system error has occurred.
525          */
526         result SetItemAt(int index, const Tizen::Base::String& text, int actionId);
527
528         /**
529          * Sets the specified item at the given index of the %ContextMenu control.
530          *
531          * @since               2.0
532          *
533          * @return              An error code
534          * @param[in]   index                           The location
535          * @param[in]   text                            The string of the item to set
536          * @param[in]   actionId                        The action ID for this item
537          * @param[in]   normalBitmap        The normal bitmap of the item
538          * @param[in]   pPressedBitmap      The pressed bitmap of the item
539          * @param[in]   pHighlightedBitmap  The highlighted bitmap of the item
540          * @exception   E_SUCCESS                       The method is successful.
541          * @exception   E_OUT_OF_RANGE          The specified @c index less than @c 0 or greater than the number of items in %ContextMenu.
542          * @exception   E_SYSTEM                        A system error has occurred.
543          * @remarks     This method can only be used when the style of the context menu is @c CONTEXT_MENU_STYLE_LIST.
544          */
545         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);
546
547         /**
548          * Removes the item at the specified index from the %ContextMenu control.
549          *
550          * @since               2.0
551          *
552          * @return              An error code
553          * @param[in]   index                   The location
554          * @exception   E_SUCCESS               The method is successful.
555          * @exception   E_OUT_OF_RANGE  The specified @c index less than @c 0 or greater than the number of items in %ContextMenu.
556          * @exception   E_SYSTEM                A system error has occurred.
557          */
558         result RemoveItemAt(int index);
559
560         /**
561          * Removes all items from the %ContextMenu control.
562          *
563          * @since               2.0
564          *
565          * @exception   E_SUCCESS               The method is successful.
566          * @exception   E_SYSTEM                A system error has occurred.
567          */
568         result RemoveAllItems(void);
569
570         /**
571          * Gets the number of items of the %ContextMenu control.
572          *
573          * @since       2.0
574          *
575          * @return      The number of items registered for %ContextMenu, @n
576          *                      else @c -1 if an error occurs
577          */
578         int GetItemCount(void) const;
579
580         /**
581          * Gets the index of the item with the specified action ID.
582          *
583          * @since               2.0
584          *
585          * @return              The index of the item, @n
586          *                              else @c -1 if an error occurs
587          * @param[in]   actionId        The action ID
588          */
589         int GetItemIndexFromActionId(int actionId) const;
590
591         /**
592          * Gets the action ID of the item at the specified index.
593          *
594          * @since               2.0
595          *
596          * @return              The action ID of the item, @n
597          *                              else @c -1 if the specified index is invalid
598          * @param[in]   index           The index of the item
599          */
600         int GetItemActionIdAt(int index) const;
601
602         /**
603          * Gets the item text color of the %ContextMenu control for the specified status.
604          *
605          * @since               2.0
606          *
607          * @return      The item text color, @n
608          *                              else RGBA (0,0,0,0) if an error occurs
609          * @param[in]   status          The item status
610          */
611         Tizen::Graphics::Color GetItemTextColor(ContextMenuItemStatus status) const;
612
613         /**
614          * Sets the item text color of the %ContextMenu control for the specified status.
615          *
616          * @since               2.0
617          *
618          * @return      An error code
619          * @param[in]   status                          The item status
620          * @param[in]   color                           The item text color to set
621          * @exception   E_SUCCESS                       The method is successful.
622          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
623          * @exception   E_SYSTEM                        A system error has occurred.
624          */
625         result SetItemTextColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color);
626
627         /**
628          * Sets the position of the anchor.
629          *
630          * @since               2.0
631          *
632          * @return              An error code
633          * @param[in]   position                        The new position
634          * @exception   E_SUCCESS                       The method is successful.
635          * @exception   E_INVALID_STATE         This instance is in an invalid state.
636          * @remarks             The x and y coordinates of the anchor are defined in the coordinate space of its parent,
637          *                              which means that @c x and @c y must be defined relative to the top-left corner (0,0) of its parent.
638          */
639         result SetAnchorPosition(const Tizen::Graphics::Point& position);
640
641         /**
642          * Sets the position of the anchor.
643          *
644          * @since               2.1
645          *
646          * @return              An error code
647          * @param[in]   position                        The new position
648          * @exception   E_SUCCESS                       The method is successful.
649          * @exception   E_INVALID_STATE         This instance is in an invalid state.
650          * @remarks             The x and y coordinates of the anchor are defined in the coordinate space of its parent,
651          *                              which means that @c x and @c y must be defined relative to the top-left corner (0,0) of its parent.
652          */
653         result SetAnchorPosition(const Tizen::Graphics::FloatPoint& position);
654
655         /**
656          * Gets the position of the anchor.
657          *
658          * @since               2.0
659          *
660          * @return              The position of the anchor
661          * @remarks             The coordinate of the anchor position is defined from the top-left corner of its parent Container.
662          */
663         Tizen::Graphics::Point GetAnchorPosition(void) const;
664
665         /**
666          * Gets the position of the anchor.
667          *
668          * @since               2.1
669          *
670          * @return              The position of the anchor
671          * @remarks             The coordinate of the anchor position is defined from the top-left corner of its parent Container.
672          */
673         Tizen::Graphics::FloatPoint GetAnchorPositionF(void) const;
674
675         /**
676          * Gets the color of the %ContextMenu control.
677          *
678          * @since               2.0
679          *
680          * @return              The color of %ContextMenu control, @n
681          *                              else RGBA(0, 0, 0, 0) if an error occurs
682          * @see                 SetColor()
683          */
684         Tizen::Graphics::Color GetColor(void) const;
685
686         /**
687          * Sets the color of the %ContextMenu control.
688          *
689          * @since               2.0
690          *
691          * @return              An error code
692          * @param[in]   color                           The color to set
693          * @exception   E_SUCCESS                       The method is successful.
694          * @exception   E_INVALID_STATE         This instance is in an invalid state.
695          * @exception   E_SYSTEM                        A system error has occurred.
696          * @see                 GetColor()
697          */
698         result SetColor(const Tizen::Graphics::Color& color);
699
700         /**
701          * Gets the item color for the specified status.
702          *
703          * @since               2.0
704          *
705          * @return              The color of %ContextMenu control, @n
706          *                      else RGBA(0, 0, 0, 0) if an error occurs
707          * @param[in]   status                          The menu item status
708          * @exception   E_SUCCESS                       The method is successful.
709          * @exception   E_INVALID_ARG           The specified input parameter is invalid. @n
710          *                                                                      The item color for @c CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported.
711          * @exception   E_INVALID_STATE         This instance is in an invalid state.
712          * @exception   E_SYSTEM                        A system error has occurred.
713          * @remarks             The specific error code can be accessed using the GetLastResult() method. @n
714          *                              The item color for the @c CONTEXT_MENU_ITEM_STATUS_NORMAL status is always the same as the color of the %ContextMenu control.
715          * @see                 SetItemColor()
716          */
717         Tizen::Graphics::Color GetItemColor(ContextMenuItemStatus status) const;
718
719         /**
720          * Sets the item color for the specified status.
721          *
722          * @since               2.0
723          *
724          * @return              An error code
725          * @param[in]   status                          The menu item status
726          * @param[in]   color                           The color to set
727          * @exception   E_SUCCESS                       The method is successful.
728          * @exception   E_INVALID_ARG           The specified input parameter is invalid. @n
729          *                                                                      The item color for @c CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported.
730          * @exception   E_INVALID_STATE         This instance is in an invalid state.
731          * @exception   E_SYSTEM                        A system error has occurred.
732          * @remarks             The item color for the @c CONTEXT_MENU_ITEM_STATUS_NORMAL status is always the same as the color of the %ContextMenu control.
733          * @see                 GetItemColor()
734          */
735         result SetItemColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color);
736
737         /**
738          * Gets maximum number of visible items.
739          *
740          * @since               2.0
741          *
742          * @return              The maximum number of visible items, @n
743          *                              else @c -1 if an error occurs
744          * @see                 SetMaxVisibleItemsCount()
745          */
746         int GetMaxVisibleItemsCount(void) const;
747
748         /**
749          * Sets maximum number of visible items.
750          *
751          * @since               2.0
752          *
753          * @return              An error code
754          * @param[in]   maxItemsCount           The maximum number of the visible menu items
755          * @exception   E_SUCCESS                       The method is successful.
756          * @exception   E_OUT_OF_RANGE          The specified @c parameter is out of possible range.
757          * @exception   E_INVALID_STATE         This instance is in an invalid state.
758          * @exception   E_SYSTEM                        A system error has occurred.
759          * @remarks             @c maxItemsCount should be greater than @c 0 and less than @c 8. The default value for
760          *                              the maximum number of the visible menu items is @c 4.
761          * @see                 GetMaxVisibleItemsCount()
762          */
763         result SetMaxVisibleItemsCount(int maxItemsCount);
764
765 protected:
766         friend class _ContextMenuImpl;
767 private:
768         //
769         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
770         //
771         // @since       2.0
772         //
773         //
774         ContextMenu(const ContextMenu& rhs);
775
776         //
777         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
778         //
779         // @since       2.0
780         //
781         //
782         ContextMenu& operator =(const ContextMenu& rhs);
783 }; // ContextMenu
784
785 }}} // Tizen::Ui: Control
786
787 #endif // _FUI_CTRL_CONTEXT_MENU_H_