N_SE-47263 : reset touch cancel when indicator touch released/N_SE-51832 : fix checki...
[platform/framework/native/uifw.git] / inc / FUiCtrlListContextItem.h
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 /**
19  * @file        FUiCtrlListContextItem.h
20  * @brief       This is the header file for the %ListContextItem class.
21  *
22  * This header file contains the declarations of the %ListContextItem class and its helper classes.
23  */
24
25 #ifndef _FUI_CTRL_LIST_CONTEXT_ITEM_H_
26 #define _FUI_CTRL_LIST_CONTEXT_ITEM_H_
27
28 #include <FGrpBitmap.h>
29 #include <FUiCtrlListViewTypes.h>
30
31 namespace Tizen { namespace Ui { namespace Controls
32 {
33
34 class _ListContextItemImpl;
35
36 /**
37  * @class       ListContextItem
38  * @brief    This class defines common behavior for %ListContextItem.
39  *
40  * @since       2.0
41  *
42  * The %ListContextItem class displays the context item for a ListView or GroupedListView.
43  *
44  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
45  */
46
47 class _OSP_EXPORT_ ListContextItem
48         : public Tizen::Base::Object
49 {
50 public:
51         /**
52          * The object is not fully constructed after this constructor is
53          * called. @n For full construction, the ListContextItem::Construct() method must be
54          * called right after calling this constructor.
55          *
56          * @since       2.0
57          */
58         ListContextItem(void);
59
60         /**
61          * This destructor overrides Tizen::Base::Object::~Object().
62          *
63          * @since       2.0
64          */
65         virtual ~ListContextItem(void);
66
67         /**
68          * Initializes this instance of %ListContextItem with the specified parameter.
69          *
70          * @since       2.0
71          *
72          * @return  An error code
73          * @exception E_SUCCESS         The method is successful.
74          * @exception E_SYSTEM          A system error has occurred.
75          */
76         result Construct(void);
77
78         /**
79          * Adds the text element to the context item.
80          *
81          * @since       2.0
82          *
83          * @return  An error code
84          * @param[in] elementId         The ID of the element
85          * @param[in] text              The text to display
86          * @param[in] enable            Set to @c true, to enable this element @n
87          *                              else @c false
88          * @exception E_SUCCESS         The method is successful.
89          * @exception E_INVALID_ARG     A specified input parameter is invalid.
90          * @exception E_SYSTEM          A system error has occurred.
91          */
92         result AddElement(int elementId, const Tizen::Base::String& text, bool enable = true);
93
94         /**
95          * Adds the bitmap element to the context item.
96          *
97          * @since       2.0
98          * @return  An error code
99          * @param[in] elementId           The ID of the element
100          * @param[in] normalBitmap        The bitmap displayed when the item is in normal status
101          * @param[in] pressedBitmap       The bitmap displayed when the item is pressed
102          * @param[in] pHighlightedBitmap  The bitmap displayed when the item is highlighted
103          * @param[in] enable              Set to @c true, to enable this element, @n
104          *                                else @c false
105          * @exception E_SUCCESS         The method is successful.
106          * @exception E_INVALID_ARG     A specified input parameter is invalid.
107          * @exception E_SYSTEM          A system error has occurred.
108          */
109         result AddElement(int elementId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap& pressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap = null, bool enable = true);
110
111         /**
112          * Adds the text and the bitmap element to the context item.
113          *
114          * @since       2.0
115          *
116          * @return  An error code
117          * @param[in] elementId           The ID of the element
118          * @param[in] text                                The text to display
119          * @param[in] normalBitmap        The bitmap displayed when the item is in normal status
120          * @param[in] pressedBitmap       The bitmap displayed when the item is pressed
121          * @param[in] pHighlightedBitmap  The bitmap displayed when the item is highlighted
122          * @param[in] enable              Set to @c true, to enable this element, @n
123          *                                else @c false
124          * @exception E_SUCCESS         The method is successful.
125          * @exception E_INVALID_ARG     A specified input parameter is invalid.
126          * @exception E_SYSTEM          A system error has occurred.
127          */
128         result AddElement(int elementId, const Tizen::Base::String& text, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap& pressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap = null, bool enable = true);
129
130         /**
131          * Sets the background image of a context item.
132          *
133          * @since   2.0
134          *
135          * @return  An error code
136          * @param[in] pBitmap           The background bitmap image
137          * @exception E_SUCCESS         The method is successful.
138          * @exception E_SYSTEM          A system error has occurred.
139          * @remarks
140          *                      - The background bitmap has priority over the background color. When both the background bitmap and the background color are specified, only
141          *                      the bitmap is displayed. @n
142          *                      - When @c pBitmap is set as @c null, the background color of the context item is drawn.
143          */
144         result SetBackgroundBitmap(const Tizen::Graphics::Bitmap* pBitmap);
145
146         /**
147          * Sets the background color of a context item.
148          *
149          * @since   2.0
150          *
151          * @return  An error code
152          * @param[in] color             The background color
153          * @exception E_SUCCESS         The method is successful.
154          * @exception E_SYSTEM          A system error has occurred.
155          * @remarks  The background bitmap has priority over the background color. When both the background bitmap and the background color are specified, only
156          *                      the bitmap is displayed.
157          */
158         result SetBackgroundColor(const Tizen::Graphics::Color& color);
159
160         /**
161          * Gets the background color of a context item.
162          *
163          * @since   2.0
164          *
165          * @return  The background color of a context item
166          */
167         Tizen::Graphics::Color GetBackgroundColor(void) const;
168
169         /**
170          * Sets the background color of the context item element.
171          *
172          * @since   2.1
173          *
174          * @return      An error code
175          * @param[in] elementId                 The ID of the element
176          * @param[in] status                    The status of the context item element
177          * @param[in] backgroundColor                           The background color of the context item element
178          * @exception E_SUCCESS                         The method is successful.
179          * @exception E_INVALID_ARG                     The specified @c elementId is invalid.
180          * @exception E_INVALID_OPERATION       The current state of the instance prohibits the execution of the specified operation.
181          * @remarks     If the specified @c backgroundColor is not set, the default color set by configuration is used.
182          * @see         GetElementBackgroundColor()
183          */
184         result SetElementBackgroundColor(int elementId, ListContextItemElementStatus status, const Tizen::Graphics::Color& backgroundColor);
185
186         /**
187          * Gets the background color of the context item element.
188          *
189          * @since   2.1
190          *
191          * @return      The background color of the element
192          * @param[in] elementId                 The ID of the element
193          * @param[in] status                    The status of the context item element
194          * @exception E_SUCCESS                         The method is successful.
195          * @exception E_INVALID_ARG                     The specified @c elementId is invalid.
196          * @exception E_INVALID_OPERATION       The current state of the instance prohibits the execution of the specified operation.
197          * @remarks     The specific error code can be accessed using the GetLastResult() method.
198          * @see         SetElementBackgroundColor()
199          */
200         Tizen::Graphics::Color GetElementBackgroundColor(int elementId, ListContextItemElementStatus status) const;
201
202         /**
203          * Sets the text color of the context item element.
204          *
205          * @since   2.1
206          *
207          * @return      An error code
208          * @param[in] elementId                 The ID of the element
209          * @param[in] status                    The status of the context item element
210          * @param[in] textColor                         The text color of the context item element
211          * @exception E_SUCCESS                         The method is successful.
212          * @exception E_INVALID_ARG                     The specified @c elementId is invalid.
213          * @exception E_INVALID_OPERATION       The current state of the instance prohibits the execution of the specified operation.
214          * @remarks     If the element text color is not set by the application, the default color is set by theme.
215          * @see         GetElementTextColor()
216          */
217         result SetElementTextColor(int elementId, ListContextItemElementStatus status, const Tizen::Graphics::Color& textColor);
218
219         /**
220          * Gets the text color of the context item element.
221          *
222          * @since   2.1
223          *
224          * @return      The text color of the element
225          * @param[in] elementId                 The ID of the element
226          * @param[in] status                    The status of the context item element
227          * @exception E_SUCCESS                         The method is successful.
228          * @exception E_INVALID_ARG                     The specified @c elementId is invalid.
229          * @exception E_INVALID_OPERATION       The current state of the instance prohibits the execution of the specified operation.
230          * @remarks     The specific error code can be accessed using the GetLastResult() method.
231          * @see         SetElementTextColor()
232          */
233         Tizen::Graphics::Color GetElementTextColor(int elementId, ListContextItemElementStatus status) const;
234
235 protected:
236         friend class _ListContextItemImpl;
237
238 private:
239         //
240         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
241         //
242         ListContextItem(const ListContextItem& rhs);
243
244         //
245         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
246         //
247         ListContextItem& operator =(const ListContextItem& rhs);
248
249 private:
250         _ListContextItemImpl* __pImpl;
251 }; // ListContextItem
252
253 }}} // Tizen::Ui::Controls
254
255 #endif  // _FUI_CTRL_LIST_CONTEXT_ITEM_H_