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 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.
151 * @return An error code
152 * @param[in] actionId The action ID of the button item
153 * @exception E_SUCCESS The method is successful.
154 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
155 * The specified @c actionId of the specified item must be a positive integer.
157 result SetActionId(int actionId);
161 * Sets the background bitmap image of the button item.
165 * @return An error code
166 * @param[in] status The item status
167 * @param[in] pBitmap The background bitmap image to set, @n
168 * else @c null if no bitmap image is displayed
169 * @exception E_SUCCESS The method is successful.
170 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
171 * @remarks If the size is greater than the default size, the bitmap image is scaled accordingly.
173 result SetBackgroundBitmap(ButtonItemStatus status, const Tizen::Graphics::Bitmap* pBitmap);
177 * Sets the icon of the button item for the specified state.
181 * @return An error code
182 * @param[in] status The item status
183 * @param[in] pIcon The icon to set, @n
184 * else @c null if no icon is displayed
185 * @exception E_SUCCESS The method is successful.
186 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
187 * @remarks If the style of %ButtonItem is @c BUTTON_ITEM_STYLE_TEXT, the method returns @c E_INVALID_OPERATION. @n
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 @c BUTTON_ITEM_STYLE_ICON.
203 * @remarks 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
204 * is longer than two lines. @n
205 * Use @htmlonly '\n' @endhtmlonly to denote the end of the first line.
207 result SetText(const Tizen::Base::String& text);
211 ButtonItem(const ButtonItem& rhs);
212 ButtonItem& operator =(const ButtonItem& rhs);
215 friend class _FooterImpl;
216 friend class _HeaderImpl;
217 friend class _ButtonItemImpl;
219 class _ButtonItemImpl* __pImpl;
222 }}} //Tizen::Ui::Controls
224 #endif // _FUI_CTRL_BUTTON_ITEM_H_