Fix for klockwork minor issues.
[platform/framework/native/uifw.git] / inc / FUiCtrlCustomListItem.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  * @if OSPDEPREC
20  * @file        FUiCtrlCustomListItem.h
21  * @brief       This is the header file for the %CustomListItem class.
22  *
23  * This header file contains the declarations of the %CustomListItem class and its helper classes.
24  * @endif
25  */
26
27 #ifndef _FUI_CTRL_CUSTOM_LIST_ITEM_H_
28 #define _FUI_CTRL_CUSTOM_LIST_ITEM_H_
29
30 #include <FBaseObject.h>
31 #include <FBaseTypes.h>
32 #include <FUiCtrlICustomListElement.h>
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36 class _CustomListItemImpl;
37 class CustomListItemFormat;
38 /**
39  * @if OSPDEPREC
40  * @class         CustomListItem
41  * @brief   <i> [Deprecated] </i> This class defines the common behavior of an item of the CustomList control.
42  *
43  * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class.
44  * @since               2.0
45  *
46  * The %CustomListItem class represents a custom list item which is the unit of
47  * handling of a custom list. A custom list item is composed of one or more elements,
48  * which can be texts and bitmaps. Custom drawable elements are also supported via
49  * ICustomListElement. The value of the elements is set using %CustomListItem.
50  *
51  * Note that %CustomListItem needs to be created on a heap. CustomListItems will be deleted automatically
52  * when the CustomList is destroyed. If you want to remove certain list items, you must use RemoveItemAt().
53  *
54  * Refer to CustomListItemFormat.
55  *
56  * @endif
57  */
58 class _OSP_EXPORT_ CustomListItem
59         : public Tizen::Base::Object
60 {
61 public:
62         /**
63          * @if OSPDEPREC
64          * The object is not fully constructed after this constructor is called. @n
65          * For full construction, the CustomListItem::Construct() method must be called right after calling this constructor.
66          *
67          * @brief   <i> [Deprecated] </i>
68          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
69          *
70          * @since               2.0
71          * @endif
72          */
73         CustomListItem(void);
74
75         /**
76          * @if OSPDEPREC
77          * This polymorphic destructor should be overridden if required. @n
78          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
79          *
80          * @brief   <i> [Deprecated] </i>
81          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
82          * @since               2.0
83          * @endif
84          */
85         virtual ~CustomListItem(void);
86
87 public:
88         /**
89          * @if OSPDEPREC
90          * Initializes this instance of %CustomListItem with the specified parameter.
91          *
92          * @brief   <i> [Deprecated] </i>
93          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
94          * @since                                       2.0
95          *
96          * @return      An error code
97          * @param[in]   itemHeight                      The height of %CustomListItem
98          * @exception   E_SUCCESS                       The method is successful.
99          * @exception   E_SYSTEM                        A system error has occurred.
100          * @endif
101          */
102         result Construct(int itemHeight);
103
104         /**
105          * @if OSPDEPREC
106          * Sets the format of %CustomListItem.
107          *
108          * @brief   <i> [Deprecated] </i>
109          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
110          * @since                       2.0
111          *
112          * @param[in]   itemFormat              An instance of %CustomListItemFormat
113          * @remarks Do not delete @c itemFormat before the associated %CustomListItem is removed from %CustomList,
114          *                      because %CustomListItemFormat is constantly used while %CustomListItem is added to CustomList.
115          * @endif
116          */
117         void SetItemFormat(const CustomListItemFormat& itemFormat);
118
119         /**
120          * Gets the format of %CustomListItem.
121          *
122          * @since                       2.0
123          *
124          * @return      A pointer to CustomListItemFormat, @n
125          *                      else @c null if a system error occurs
126          */
127         const CustomListItemFormat* GetItemFormat(void) const;
128
129         /**
130          * @if OSPDEPREC
131          * Sets the background bitmap image which is displayed when the item is focused.
132          *
133          * @brief   <i> [Deprecated] </i>
134          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
135          * @since                       2.0
136          *
137          * @param[in] bitmap            The background bitmap image
138          * @remarks  The specified bitmap is automatically scaled to the size of an associated item.
139          * @see SetNormalItemBackgroundBitmap()
140          * @endif
141          */
142         void SetFocusedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
143
144         /**
145          * @if OSPDEPREC
146          * Sets the background image of the item which is displayed when the item is in normal state.
147          *
148          * @brief   <i> [Deprecated] </i>
149          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
150          * @since                       2.0
151          *
152          * @param[in] bitmap     The background bitmap image
153          * @remarks The specified bitmap is automatically scaled to the size of an+B6 associated item.
154          * @see SetFocusedItemBackgroudBitmap()
155          * @endif
156          */
157         void SetNormalItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
158
159         /**
160          * @if OSPDEPREC
161          * Sets the highlighted background image on the rectangle of each list item.
162          *
163          * @brief   <i> [Deprecated] </i>
164          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
165          * @since           2.0
166          *
167          * @param[in]   bitmap   The background image
168          * @remarks     When a user navigates the user interface using the directional keys, @n
169          *                  the selected UI control is highlighted and takes the focus.
170          * @endif
171          */
172
173         void SetHighlightedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
174
175         /**
176          * @if OSPDEPREC
177          * Sets the text of the element for %CustomListItem.
178          *
179          * @brief   <i> [Deprecated] </i>
180          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
181          * @since                       2.0
182          *
183          * @return              An error code
184          * @param[in]   elementId       The ID of the element
185          * @param[in] text            The text string to add
186          * @exception   E_SUCCESS               The method is successful.
187          * @exception   E_SYSTEM        A system error has occurred.
188          * @remarks             To display text in multi-lines or to denote the end of line use '\\n'.
189          * @endif
190          */
191         result SetElement(int elementId, const Tizen::Base::String& text);
192
193         /**
194          * @if OSPDEPREC
195          * Sets the bitmap of the element for %CustomListItem.
196          *
197          * @brief   <i> [Deprecated] </i>
198          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
199          * @since                                       2.0
200          *
201          * @return              An error code
202          * @param[in]   elementId       The ID of the element
203          * @param[in]   normalBitmap        The bitmap displayed when the item is in the normal state
204          * @param[in]   pFocusedBitmap  The bitmap displayed when the item is focused
205          * @exception   E_SUCCESS                       The method is successful.
206          * @exception   E_SYSTEM            A system error has occurred.
207          * @endif
208          */
209         result SetElement(int elementId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pFocusedBitmap);
210
211
212         /**
213          * @if OSPDEPREC
214          * Sets the bitmap of the element for %CustomListItem.
215          *
216          * @brief   <i> [Deprecated] </i>
217          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
218          * @since        2.0
219          *
220          * @return     An error code
221          * @param[in]  elementId          The ID of the element
222          * @param[in]   normalBitmap        The bitmap displayed when the item is in the normal state
223          * @param[in]  pFocusedBitmap     The bitmap displayed when the item is selected
224          * @param[in]  pHighlightedBitmap The bitmap displayed when the item is highlighted
225          * @exception   E_SUCCESS           The method is successful.
226          * @exception   E_SYSTEM                        A system error has occurred.
227          * @endif
228          */
229         result SetElement(int elementId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pFocusedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap);
230
231         /**
232          * @if OSPDEPREC
233          * Sets the custom element for %CustomListItem.
234          *
235          * @brief   <i> [Deprecated] </i>
236          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
237          * @since                                       2.0
238          *
239          * @return              An error code
240          * @param[in]   elementId        The ID of the element
241          * @param[in]   element                  The custom element
242          * @exception   E_SUCCESS               The method is successful.
243          * @exception   E_SYSTEM        A system error has occurred.
244          * @remarks     Do not delete @c element before the associated %CustomListItem is removed from CustomList, @n
245          *              as ICustomListElement is constantly used while %CustomListItem is added to %CustomList. @n
246          *            Call RefreshItem() to draw the custom element that has been set with this method.
247          * @endif
248          */
249         result SetElement(int elementId, const ICustomListElement& element);
250
251         /**
252          * @if OSPDEPREC
253          * Sets the element ID of the checkbox of %CustomListItem.
254          *
255          * @brief   <i> [Deprecated] </i>
256          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
257          * @since                       2.0
258          *
259          * @return              An error code
260          * @param[in]   elementId        The ID of the element
261          * @exception   E_SUCCESS               The method is successful.
262          * @exception   E_SYSTEM        A system error has occurred.
263          * @endif
264          */
265         result SetCheckBox(int elementId);
266
267         /**
268          * @if OSPDEPREC
269          * Gets the percentage value of %CustomListItem.
270          *
271          * @brief   <i> [Deprecated] </i>
272          * @deprecated   This class is deprecated. Instead of using this class, use CustomItem class
273          * @since                       2.0
274          *
275          * @return              The percentage value, @n
276          *              else @c -1 if a system error occurs
277          * @endif
278          */
279         int GetValue(void) const;
280
281 private:
282         //
283         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
284         //
285         CustomListItem(const CustomListItem& rhs);
286
287         //
288         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
289         //
290         CustomListItem& operator =(const CustomListItem& rhs);
291
292 private:
293
294         CustomListItemFormat* __pCustomListItemFormat;
295         _CustomListItemImpl* __pCustomListItemImpl;
296
297         friend class _CustomListImpl;
298         friend class _CustomListItemImpl;
299         friend class _ExpandableListImpl;
300         friend class _SlidableListImpl;
301         friend class _GroupedListImpl;
302         friend class _SlidableGroupedListImpl;
303         friend class _ListImpl;
304
305         friend class _CustomListItemDataProvider;
306         friend class _SlidableListItemProvider;
307         friend class _ListBaseImpl;
308         friend class _GroupedListItemDataProvider;
309         friend class _ExpandableListItemDataProvider;
310         friend class _SlidableGroupedListItemProvider;
311         friend class _ListItemDataProvider;
312 }; //CustomListItem
313
314 }}} // Tizen::Ui::Controls
315
316 #endif // _FUI_CTRL_CUSTOM_LIST_ITEM_H_