2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
19 * @file FUiCtrlListContextItem.h
20 * @brief This is the header file for the %ListContextItem class.
22 * This header file contains the declarations of the %ListContextItem class and its helper classes.
25 #ifndef _FUI_CTRL_LIST_CONTEXT_ITEM_H_
26 #define _FUI_CTRL_LIST_CONTEXT_ITEM_H_
28 #include <FGrpBitmap.h>
29 #include <FUiCtrlListViewTypes.h>
31 namespace Tizen { namespace Ui { namespace Controls
34 class _ListContextItemImpl;
37 * @class ListContextItem
38 * @brief This class defines common behavior for %ListContextItem.
42 * The %ListContextItem class displays the context item for a ListView or GroupedListView.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
47 class _OSP_EXPORT_ ListContextItem
48 : public Tizen::Base::Object
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.
58 ListContextItem(void);
61 * This destructor overrides Tizen::Base::Object::~Object().
65 virtual ~ListContextItem(void);
68 * Initializes this instance of %ListContextItem with the specified parameter.
72 * @return An error code
73 * @exception E_SUCCESS The method is successful.
74 * @exception E_SYSTEM A system error has occurred.
76 result Construct(void);
79 * Adds the text element to the context item.
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
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.
92 result AddElement(int elementId, const Tizen::Base::String& text, bool enable = true);
95 * Adds the bitmap element to the context item.
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
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.
109 result AddElement(int elementId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap& pressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap = null, bool enable = true);
112 * Adds the text and the bitmap element to the context item.
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
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.
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);
131 * Sets the background image of a context item.
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.
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.
144 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap* pBitmap);
147 * Sets the background color of a context item.
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.
158 result SetBackgroundColor(const Tizen::Graphics::Color& color);
161 * Gets the background color of a context item.
165 * @return The background color of a context item
167 Tizen::Graphics::Color GetBackgroundColor(void) const;
170 * Sets the background color of the context item element.
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()
184 result SetElementBackgroundColor(int elementId, ListContextItemElementStatus status, const Tizen::Graphics::Color& backgroundColor);
187 * Gets the background color of the context item element.
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()
200 Tizen::Graphics::Color GetElementBackgroundColor(int elementId, ListContextItemElementStatus status) const;
203 * Sets the text color of the context item element.
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()
217 result SetElementTextColor(int elementId, ListContextItemElementStatus status, const Tizen::Graphics::Color& textColor);
220 * Gets the text color of the context item element.
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()
233 Tizen::Graphics::Color GetElementTextColor(int elementId, ListContextItemElementStatus status) const;
236 friend class _ListContextItemImpl;
240 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
242 ListContextItem(const ListContextItem& rhs);
245 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
247 ListContextItem& operator =(const ListContextItem& rhs);
250 _ListContextItemImpl* __pImpl;
251 }; // ListContextItem
253 }}} // Tizen::Ui::Controls
255 #endif // _FUI_CTRL_LIST_CONTEXT_ITEM_H_