2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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 FUiCtrlCustomItem.h
20 * @brief This is the header file for the %CustomItem class.
22 * This header file contains the declarations of the %CustomItem class and its helper classes.
25 #ifndef _FUI_CTRL_CUSTOM_ITEM_H_
26 #define _FUI_CTRL_CUSTOM_ITEM_H_
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FGrpBitmap.h>
31 #include <FGrpEnrichedText.h>
32 #include <FGrpRectangle.h>
33 #include <FUiCtrlControlsTypes.h>
34 #include <FUiCtrlICustomElement.h>
35 #include <FUiCtrlListItemBase.h>
36 #include <FUiCtrlListViewTypes.h>
38 namespace Tizen { namespace Ui { namespace Controls
41 class _CustomItemImpl;
45 * @brief This class defines the common behavior for %CustomItem.
49 * The %CustomItem class displays a list item, which is the unit of handling a ListView or GroupedListView. It provides customized formatting of specific list items.
51 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
55 class _OSP_EXPORT_ CustomItem
60 * The object is not fully constructed after this constructor is
61 * called. For full construction, the Construct() method must be
62 * called right after calling this constructor.
69 * This destructor overrides Tizen::Base::Object::~Object().
73 virtual ~CustomItem(void);
76 * Initializes this instance of %CustomItem with the specified parameters.
80 * @return An error code
81 * @param[in] itemSize The size of the item
82 * @param[in] style The style of the annex
83 * @exception E_SUCCESS The method is successful.
84 * @exception E_SYSTEM A system error has occurred.
86 result Construct(const Tizen::Graphics::Dimension& itemSize, ListAnnexStyle style);
89 * Adds an instance of EnrichedText as an element to the %CustomItem control.
93 * @return An error code
94 * @param[in] rect The bounds of the element
95 * @param[in] elementId The element ID
96 * @param[in] text The instance of EnrichedText
97 * @exception E_SUCCESS The method is successful.
98 * @exception E_INVALID_ARG A specified input parameter is invalid.
99 * @exception E_SYSTEM A system error has occurred.
101 result AddElement(const Tizen::Graphics::Rectangle& rect, int elementId, const Tizen::Graphics::EnrichedText& text);
104 * Adds the text as an element to the %CustomItem control.
108 * @return An error code
109 * @param[in] rect The bounds of the element
110 * @param[in] elementId The element ID
111 * @param[in] text The text string to add
112 * @param[in] textSliding Set to @c true to allow a long text to slide, @n
114 * @exception E_SUCCESS The method is successful.
115 * @exception E_INVALID_ARG A specified input parameter is invalid.
116 * @exception E_SYSTEM A system error has occurred.
117 * @remarks If the width of the specified @c text exceeds the width of the element and @c textSliding is set to @c true, the text slides
118 * automatically when the user long-presses.
120 result AddElement(const Tizen::Graphics::Rectangle& rect, int elementId, const Tizen::Base::String& text, bool textSliding = true);
123 * Adds the text as an element to the %CustomItem control.
127 * @return An error code
128 * @param[in] rect The bounds of the element
129 * @param[in] elementId The element ID
130 * @param[in] text The text string to add
131 * @param[in] textSize The size of the text
132 * @param[in] normalTextColor The color of the text in the normal status
133 * @param[in] pressedTextColor The color of the text in the pressed status
134 * @param[in] highlightedTextColor The color of the text in the highlighted status
135 * @param[in] textSliding Set to @c true to allow a long text to slide, @n
137 * @exception E_SUCCESS The method is successful.
138 * @exception E_INVALID_ARG A specified input parameter is invalid.
139 * @exception E_SYSTEM A system error has occurred.
140 * @remarks The default size of text is 38 on a WVGA screen, 22 on a HVGA screen and 20 on a WQVGA screen.
142 result AddElement(const Tizen::Graphics::Rectangle& rect, int elementId, const Tizen::Base::String& text, int textSize, const Tizen::Graphics::Color& normalTextColor, const Tizen::Graphics::Color& pressedTextColor, const Tizen::Graphics::Color& highlightedTextColor, bool textSliding = true);
145 * Adds the bitmap image as an element to the %CustomItem control.
149 * @return An error code
150 * @param[in] rect The bounds of the element
151 * @param[in] elementId The element ID
152 * @param[in] normalBitmap The bitmap image displayed when the item is in normal status
153 * @param[in] pPressedBitmap The bitmap image displayed when the item is pressed
154 * @param[in] pHighlightedBitmap The bitmap image displayed when the item is highlighted
155 * @exception E_SUCCESS The method is successful.
156 * @exception E_INVALID_ARG A specified input parameter is invalid.
157 * @exception E_SYSTEM A system error has occurred.
159 result AddElement(const Tizen::Graphics::Rectangle& rect, int elementId, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap = NULL, const Tizen::Graphics::Bitmap* pHighlightedBitmap = NULL);
162 * Adds the custom drawing element to the %CustomItem control.
166 * @return An error code
167 * @param[in] rect The bounds of the element
168 * @param[in] elementId The element ID
169 * @param[in] element The custom element
170 * @exception E_SUCCESS The method is successful.
171 * @exception E_INVALID_ARG A specified input parameter is invalid.
172 * @exception E_SYSTEM A system error has occurred.
174 result AddElement(const Tizen::Graphics::Rectangle& rect, int elementId, const ICustomElement& element);
177 * Removes the element from the %CustomItem control.
181 * @return An error code
182 * @exception E_SUCCESS The method is successful.
183 * @exception E_SYSTEM A system error has occurred.
185 result RemoveAllElements(void);
188 * Removes the element with the specified element ID.
192 * @return An error code
193 * @param[in] elementId The element ID
194 * @exception E_SUCCESS The method is successful.
195 * @exception E_INVALID_ARG A specified input parameter is invalid.
196 * @exception E_SYSTEM A system error has occurred.
198 result RemoveElement(int elementId);
201 * Sets the selection type of an element.
205 * @param[in] elementId The element ID
206 * @param[in] enable Set to @c true to make only the element selected when touched, @n
208 * @exception E_SUCCESS The method is successful.
209 * @exception E_INVALID_ARG A specified input parameter is invalid.
210 * @exception E_SYSTEM A system error has occurred.
211 * @remarks Based on the selection type of an element, the area within which the background color changes is different when an element is touched.
213 result SetElementSelectionEnabled(int elementId, bool enable);
216 * Sets the horizontal alignment of text in the specified element.
220 * @param[in] elementId The element ID
221 * @param[in] alignment The horizontal alignment of text
222 * @exception E_SUCCESS The method is successful.
223 * @exception E_INVALID_ARG A specified input parameter is invalid.
224 * @exception E_INVALID_OPERATION The specified element does not handle text.@n
225 * The specified element does not contain text.
226 * @exception E_SYSTEM A system error has occurred.
228 result SetElementTextHorizontalAlignment(int elementId, HorizontalAlignment alignment);
231 * Sets the vertical alignment of text in the specified element.
235 * @param[in] elementId The element ID
236 * @param[in] alignment The vertical alignment of text
237 * @exception E_SUCCESS The method is successful.
238 * @exception E_INVALID_ARG A specified input parameter is invalid.
239 * @exception E_INVALID_OPERATION The specified element does not handle text.@n
240 * The specified element does not contain text.
241 * @exception E_SYSTEM A system error has occurred.
243 result SetElementTextVerticalAlignment(int elementId, VerticalAlignment alignment);
246 * Sets the auto-link mask.
250 * @return An error code
251 * @param[in] elementId The element ID
252 * @param[in] mask The auto-link mask @n
253 * Multiple link types can be combined using bitwise OR operator (see Tizen::Base::Utility::LinkType). @n
254 * For more information, see <a href="../org.tizen.native.appprogramming/html/guide/ui/auto_link_detection.htm">AutoLink Detection</a>.
255 * @exception E_SUCCESS The method is successful.
256 * @exception E_INVALID_ARG A specified input parameter is invalid.
257 * @exception E_INVALID_OPERATION The specified element does not handle text.
258 * @exception E_SYSTEM A system error has occurred.
259 * @remarks When @c mask is set to @c 0, the auto-link detection is disabled.
260 * @see Tizen::Base::Utility::LinkType
262 result SetElementAutoLinkMask(int elementId, unsigned long mask);
266 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
268 CustomItem(const CustomItem& rhs);
271 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
273 CustomItem& operator =(const CustomItem& rhs);
276 }}} // Tizen::Ui::Controls
278 #endif // _FUI_CTRL_CUSTOM_ITEM_H_