Merge "Fixed N_SE-28466 issue" into tizen_2.1
[platform/framework/native/uifw.git] / inc / FUiCtrlListItemBase.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        FUiCtrlListItemBase.h
20  * @brief       This is the header file for the %ListItemBase class.
21  *
22  * This header file contains the declarations of the %ListItemBase class and its helper classes.
23  */
24
25 #ifndef _FUI_CTRL_LIST_ITEM_BASE_H_
26 #define _FUI_CTRL_LIST_ITEM_BASE_H_
27
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FGrpBitmap.h>
31 #include <FGrpRectangle.h>
32 #include <FUiCtrlListContextItem.h>
33 #include <FUiCtrlListViewTypes.h>
34
35 namespace Tizen { namespace Ui { namespace Controls
36 {
37
38 class _ListItemBaseImpl;
39
40 /**
41  * @class   ListItemBase
42  * @brief   This class defines common behavior for a %ListItemBase.
43  *
44  * @since   2.0
45  *
46  * The %ListItemBase class is a base class, which represents a list item which is the unit of handling of the ListView or
47  * GroupedListView classes.
48  *
49  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
50  */
51
52 class _OSP_EXPORT_ ListItemBase
53         : public Tizen::Base::Object
54 {
55 public:
56         /**
57          * This destructor overrides Tizen::Base::Object::~Object().
58          *
59          * @since       2.0
60          */
61         virtual ~ListItemBase(void);
62
63         /**
64          * Sets the background image of the item which is displayed when the item is in specified state.
65          *
66          * @since   2.0
67          *
68          * @return  An error code
69          * @param[in] status            The item drawing state
70          * @param[in] pBitmap           The background bitmap image
71          * @exception E_SUCCESS         The method is successful.
72          * @exception E_SYSTEM          A system error has occurred.
73          * @remarks     The background bitmap has priority over the background color. When both the background bitmap and the background color are specified,
74          *                      only the bitmap is displayed.
75          */
76         result SetBackgroundBitmap(ListItemDrawingStatus status, const Tizen::Graphics::Bitmap* pBitmap);
77
78         /**
79          * Sets the background color of the item which is displayed when the item is in specified state.
80          *
81          * @since   2.0
82          *
83          * @return  An error code
84          * @param[in] status            The item drawing state
85          * @param[in] color             The background color
86          * @exception E_SUCCESS         The method is successful.
87          * @exception E_SYSTEM          A system error has occurred.
88          * @remarks     The background bitmap has priority over the background color. When both the background bitmap and the background color are specified, only the bitmap is displayed. @n
89          *                      The background color of the item is not applied when the item is inserted into the GroupedListView of section style.
90          */
91         result SetBackgroundColor(ListItemDrawingStatus status, const Tizen::Graphics::Color& color);
92
93         /**
94          * Gets the background color of the item that is displayed when the item is in the specified state.
95          *
96          * @since   2.0
97          *
98          * @return  The background color of the item
99          * @param[in] status        The item drawing state, @n
100          *                                                      else RGBA(0, 0, 0, 0) if an error has occurs
101          * @see     SetBackgroundColor()
102          */
103         Tizen::Graphics::Color GetBackgroundColor(ListItemDrawingStatus status) const;
104
105         /**
106          * Sets ContextItem that is displayed when an item is swept.
107          *
108          * @since   2.0
109          *
110          * @return  An error code
111          * @param[in] pItem             The %ListContextItem instance
112          * @exception E_SUCCESS         The method is successful.
113          * @exception E_INVALID_ARG     A specified input parameter is invalid.
114          * @exception E_SYSTEM          A system error has occurred.
115          * @remarks  If the context item is not set, ListView() or GroupedListView() does not display the context item and an item sweep event is generated when an
116          *                      item is swept. @n
117          *          The specified @c pItem should be deleted by the applications when it is no longer used.
118          */
119         result SetContextItem(const ListContextItem* pItem);
120
121         /**
122          * Sets the description text.
123          *
124          * @since   2.0
125          *
126          * @return  An error code
127          * @param[in] text              Description text
128          * @exception E_SUCCESS         The method is successful.
129          * @exception E_SYSTEM          A system error has occurred.
130          */
131         result SetDescriptionText(const Tizen::Base::String& text);
132
133         /**
134          * Sets the color of the description text.
135          *
136          * @since   2.0
137          *
138          * @return  An error code
139          * @param[in] color             The color of the description text
140          * @exception E_SUCCESS         The method is successful.
141          * @exception E_SYSTEM          A system error has occurred.
142          */
143         result SetDescriptionTextColor(const Tizen::Graphics::Color& color);
144
145         /**
146          * Sets the progress value of a list item.
147          *
148          * @since   2.0
149          *
150          * @return  An error code
151          * @param[in] value             The progress value of the list item @n
152          *                              The valid values are integers from @c 0 to @c 100.
153          * @exception E_SUCCESS         The method is successful.
154          * @exception E_SYSTEM          A system error has occurred.
155          */
156         result SetProgressValue(int value);
157
158         /**
159          * Sets the margin of the progress bar.
160          *
161          * @since   2.0
162          *
163          * @return  An error code
164          * @param[in] leftMargin        The left margin of the progress bar
165          * @param[in] rightMargin       The right margin of the progress bar
166          * @exception E_SUCCESS         The method is successful.
167          * @exception E_SYSTEM          A system error has occurred.
168          */
169         result SetProgressMargins(int leftMargin, int rightMargin);
170
171         /**
172          * Sets the margin of the progress bar.
173          *
174          * @since   2.1
175          *
176          * @return  An error code
177          * @param[in] leftMargin        The left margin of the progress bar
178          * @param[in] rightMargin       The right margin of the progress bar
179          * @exception E_SUCCESS         The method is successful.
180          * @exception E_SYSTEM          A system error has occurred.
181          */
182         result SetProgressMargins(float leftMargin, float rightMargin);
183
184         /**
185          * Gets the width of the annex area.
186          *
187          * @since       2.0
188          *
189          * @return  The width of the annex
190          * @param[in] style             The style of the annex
191          * @remarks  The width of the annex area is different among annex styles.
192          */
193         static int GetAnnexWidth(ListAnnexStyle style);
194
195         /**
196          * Gets the width of the annex area.
197          *
198          * @since       2.1
199          *
200          * @return  The width of the annex
201          * @param[in] style             The style of the annex
202          * @remarks  The width of the annex area is different among annex styles.
203          */
204         static float GetAnnexWidthF(ListAnnexStyle style);
205
206 protected:
207         friend class _ListItemBaseImpl;
208
209 protected:
210         //
211         // This default constructor is intentionally declared as private so that only the platform can create an instance.
212         // @since       2.0
213         //
214         ListItemBase(void);
215
216         //
217         // Initializes this instance of ListItem with the specified parameter.
218         //
219         // @since   2.0
220         //
221         // @return  An error code
222         //
223         // @param[in] itemSize          The size of the item
224         // @param[in] style             The style of Annex
225         // @exception E_SUCCESS         The method is successful.
226         // @exception E_SYSTEM          A system error has occurred.
227         //
228         result Construct(const Tizen::Graphics::Dimension& itemSize, ListAnnexStyle style);
229
230         //
231         // Initializes this instance of ListItem with the specified parameter.
232         //
233         // @since   2.1
234         //
235         // @return  An error code
236         //
237         // @param[in] itemSize          The size of the item
238         // @param[in] style             The style of Annex
239         // @exception E_SUCCESS         The method is successful.
240         // @exception E_SYSTEM          A system error has occurred.
241         //
242         result Construct(const Tizen::Graphics::FloatDimension& itemSize, ListAnnexStyle style);
243
244         //
245         // The following methods are reserved and may change its name at any time without prior notice.
246         //
247         virtual void ListItemBase_Reserved1(void) {}
248         virtual void ListItemBase_Reserved2(void) {}
249         virtual void ListItemBase_Reserved3(void) {}
250
251 private:
252         //
253         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
254         //
255         ListItemBase(const ListItemBase& rhs);
256
257         //
258         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
259         //
260         ListItemBase& operator =(const ListItemBase& rhs);
261
262 protected:
263         _ListItemBaseImpl* _pImpl;
264 }; // ListItemBase
265
266 }}} // Tizen::Ui::Controls
267
268 #endif  // _FUI_CTRL_LIST_ITEM_BASE_H_