Merge "Fix Ime Rotation" into tizen_2.1
[platform/framework/native/uifw.git] / inc / FUiCtrlButtonItem.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        FUiCtrlButtonItem.h
20  * @brief       This is the header file for the %ButtonItem class.
21  *
22  * This header file contains the declarations of the %ButtonItem class.
23  */
24 #ifndef _FUI_CTRL_BUTTON_ITEM_H_
25 #define _FUI_CTRL_BUTTON_ITEM_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FBaseTypes.h>
30 #include <FGrpBitmap.h>
31
32 namespace Tizen { namespace Ui { namespace Controls
33 {
34 /**
35  * @enum        ButtonItemStatus
36  *
37  * Defines the possible states of the button item.
38  *
39  * @since       2.0
40  */
41 enum ButtonItemStatus
42 {
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 */
47 };
48
49 /**
50  * @enum        ButtonPosition
51  *
52  * Defines the possible positions of the button item.
53  *
54  * @since       2.0
55  */
56 enum ButtonPosition
57 {
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 */
60 };
61
62 /**
63  * @enum        ButtonItemStyle
64  *
65  * Defines the possible styles of the button item.
66  *
67  * @since       2.0
68  */
69 enum ButtonItemStyle
70 {
71         BUTTON_ITEM_STYLE_TEXT = 0,     /**< The text %ButtonItem style */
72         BUTTON_ITEM_STYLE_ICON          /**< The icon %ButtonItem style */
73 };
74
75 /**
76  * @class       ButtonItem
77  * @brief       This class is an implementation of %ButtonItem.
78  *
79  * @since       2.0
80  *
81  * The %ButtonItem class is a helper class that specifies the
82  * properties of button items in a Footer or Header.
83  */
84 class _OSP_EXPORT_ ButtonItem
85         : public Tizen::Base::Object
86 {
87
88 public:
89         /**
90          * This is the default constructor for this class.
91          *
92          * @since               2.0
93          */
94         ButtonItem(void);
95
96
97         /**
98          * This is the destructor for this class.
99          *
100          * @since               2.0
101          */
102         virtual ~ButtonItem(void);
103
104
105         /**
106          * Initializes this instance of %ButtonItem with the specified parameters.
107          *
108          * @since               2.0
109          *
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.
116          */
117         result Construct(ButtonItemStyle style, int actionId);
118
119
120         /**
121          * Gets the action ID of the button item.
122          *
123          * @since               2.0
124          *
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.
129          */
130         int GetActionId(void) const;
131
132
133         /**
134          * Gets the text of the button item.
135          *
136          * @since               2.0
137          *
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.
142          */
143         Tizen::Base::String GetText(void) const;
144
145
146         /**
147          * Sets the action ID of the button item.
148          *
149          * @since               2.0
150      *
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.
156          */
157         result SetActionId(int actionId);
158
159
160         /**
161          * Sets the background bitmap image of the button item.
162          *
163          * @since       2.0
164          *
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.
172          */
173         result SetBackgroundBitmap(ButtonItemStatus status, const Tizen::Graphics::Bitmap* pBitmap);
174
175
176         /**
177          * Sets the icon of the button item for the specified state.
178          *
179          * @since               2.0
180          *
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.
189          */
190         result SetIcon(ButtonItemStatus status, const Tizen::Graphics::Bitmap* pIcon);
191
192
193         /**
194          * Sets the text of %ButtonItem.
195          *
196          * @since               2.0
197          *
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.
206          */
207         result SetText(const Tizen::Base::String& text);
208
209
210 private:
211         ButtonItem(const ButtonItem& rhs);
212         ButtonItem& operator =(const ButtonItem& rhs);
213
214 private:
215         friend class _FooterImpl;
216         friend class _HeaderImpl;
217         friend class _ButtonItemImpl;
218
219         class _ButtonItemImpl* __pImpl;
220 };
221
222 }}} //Tizen::Ui::Controls
223
224 #endif // _FUI_CTRL_BUTTON_ITEM_H_