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 FUiCtrlButtonItem.h
20 * @brief This is the header file for the %ButtonItem class.
22 * This header file contains the declarations of the %ButtonItem class.
24 #ifndef _FUI_CTRL_BUTTON_ITEM_H_
25 #define _FUI_CTRL_BUTTON_ITEM_H_
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FBaseTypes.h>
30 #include <FGrpBitmap.h>
32 namespace Tizen { namespace Ui { namespace Controls
35 * @enum ButtonItemStatus
37 * Defines the possible states of the button item.
43 BUTTON_ITEM_STATUS_NORMAL, /**< The normal status */
44 BUTTON_ITEM_STATUS_PRESSED, /**< The selected status */
45 BUTTON_ITEM_STATUS_HIGHLIGHTED, /**< The highlighted status */
46 BUTTON_ITEM_STATUS_DISABLED /**< The disabled status */
50 * @enum ButtonPosition
52 * Defines the possible positions of the button item.
58 BUTTON_POSITION_LEFT = 0, /**< The position of the button is towards the left of the object */
59 BUTTON_POSITION_RIGHT /**< The position of the button is towards the right of the object */
63 * @enum ButtonItemStyle
65 * Defines the possible styles of the button item.
71 BUTTON_ITEM_STYLE_TEXT = 0, /**< The text %ButtonItem style */
72 BUTTON_ITEM_STYLE_ICON /**< The icon %ButtonItem style */
77 * @brief This class is an implementation of %ButtonItem.
81 * The %ButtonItem class is a helper class that specifies the
82 * properties of button items in a Footer or Header.
84 class _OSP_EXPORT_ ButtonItem
85 : public Tizen::Base::Object
90 * This is the default constructor for this class.
98 * This is the destructor for this class.
102 virtual ~ButtonItem(void);
106 * Initializes this instance of %ButtonItem with the specified parameters.
110 * @return An error code
111 * @param[in] style The style of the button item
112 * @param[in] actionId The action ID of the button item
113 * @exception E_SUCCESS The method is successful.
114 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
115 * The specified @c actionId of the specified item must be a positive integer.
117 result Construct(ButtonItemStyle style, int actionId);
121 * Gets the action ID of the button item.
125 * @return The action ID, @n
126 * else @c -1 if an error occurs
127 * @exception E_SUCCESS The method is successful.
128 * @remarks The specific error code can be accessed using the GetLastResult() method.
130 int GetActionId(void) const;
134 * Gets the text of the button item.
138 * @return The item text, @n
139 * else an empty string if an error occurs
140 * @exception E_SUCCESS The method is successful.
141 * @remarks The specific error code can be accessed using the GetLastResult() method.
143 Tizen::Base::String GetText(void) const;
147 * Sets the action ID of the button item.
150 * @return An error code
151 * @param[in] actionId The action ID of the button item
152 * @exception E_SUCCESS The method is successful.
153 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
154 * The specified @c actionId of the specified item must be a positive integer.
156 result SetActionId(int actionId);
160 * Sets the background bitmap image of the button item.
164 * @return An error code
165 * @param[in] status The item status
166 * @param[in] pBitmap The background bitmap image to set, @n
167 * else @c null if no bitmap image is displayed
168 * @exception E_SUCCESS The method is successful.
169 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
170 * @remarks If the size is greater than the default size, the bitmap image is scaled accordingly.
172 result SetBackgroundBitmap(ButtonItemStatus status, const Tizen::Graphics::Bitmap* pBitmap);
176 * Sets the icon of the button item for the specified state.
180 * @return An error code
181 * @param[in] status The item status
182 * @param[in] pIcon The icon to set, @n
183 * else @c null if no icon is displayed
184 * @exception E_SUCCESS The method is successful.
185 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
187 * - If the style of %ButtonItem is @c BUTTON_ITEM_STYLE_TEXT, the method returns @c E_INVALID_OPERATION.
188 * - If an icon is not set for a state, the icon for @c BUTTON_ITEM_STATUS_NORMAL is used.
190 result SetIcon(ButtonItemStatus status, const Tizen::Graphics::Bitmap* pIcon);
194 * Sets the text of %ButtonItem.
198 * @return An error code
199 * @param[in] text The text to set
200 * @exception E_SUCCESS The method is successful.
201 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
202 * The style of %ButtonItem is ::BUTTON_ITEM_STYLE_ICON.
204 * - If the text cannot be displayed in a line, then the text is automatically displayed in two lines and the ellipsis is applied if the text
205 * is longer than two lines.
206 * - Use @htmlonly '\n' @endhtmlonly to denote the end of the first line.
208 result SetText(const Tizen::Base::String& text);
212 ButtonItem(const ButtonItem& rhs);
213 ButtonItem& operator =(const ButtonItem& rhs);
216 friend class _FooterImpl;
217 friend class _HeaderImpl;
218 friend class _ButtonItemImpl;
220 class _ButtonItemImpl* __pImpl;
223 }}} //Tizen::Ui::Controls
225 #endif // _FUI_CTRL_BUTTON_ITEM_H_