Merge "Modify doxygen" into tizen_2.1
[framework/osp/uifw.git] / inc / FUiCtrlEditTime.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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                 FUiCtrlEditTime.h
20 * @brief                This is the header file for the %EditTime class.
21 *
22 * This header file contains the declarations of the %EditTime class.
23 */
24 #ifndef _FUI_CTRL_EDIT_TIME_H_
25 #define _FUI_CTRL_EDIT_TIME_H_
26
27 #include <FUiControl.h>
28 #include <FUiITimeChangeEventListener.h>
29 #include <FUiIOrientationEventListener.h>
30
31 namespace Tizen { namespace Ui { namespace Controls
32 {
33
34 /**
35 * @class        EditTime
36 * @brief    This class defines the common behavior of an %EditTime control.
37 *
38 * @since        2.0
39 *
40 * The %EditTime class displays a small, fixed-size selector that allows the user to select a time.
41 * Unlike TimePicker, %EditTime can be placed in a container.
42 *
43 * For more information on the class features, see
44 * <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_edittime_editdate.htm">EditDate and EditTime</a>.
45 *
46 * The following example demonstrates how to use the %EditTime class.
47 *
48 * @code
49 // Sample code for EditTimeSample.h
50 #include <FUi.h>
51
52 class EditTimeSample
53         : public Tizen::Ui::Controls::Form
54         , public Tizen::Ui::ITimeChangeEventListener
55 {
56 public:
57         EditTimeSample(void)
58         : __pEditTime(null){}
59
60         bool Initialize(void);
61         virtual result OnInitializing(void);
62
63         // ITimeChangeEventListener
64         virtual void OnTimeChanged(const Tizen::Ui::Control& source, int hour, int minute);
65         virtual void OnTimeChangeCanceled(const Tizen::Ui::Control& source);
66
67 private:
68         Tizen::Ui::Controls::EditTime* __pEditTime;
69 };
70  *      @endcode
71  *
72  *      @code
73 // Sample code for EditTimeSample.cpp
74 #include <FGraphics.h>
75
76 #include "EditTimeSample.h"
77
78 using namespace Tizen::Graphics;
79 using namespace Tizen::Ui::Controls;
80
81 bool
82 EditTimeSample::Initialize(void)
83 {
84         Construct(FORM_STYLE_NORMAL);
85         return true;
86 }
87
88 result
89 EditTimeSample::OnInitializing(void)
90 {
91         result r = E_SUCCESS;
92
93         // Creates an instance of EditTime
94         __pEditTime = new EditTime();
95         __pEditTime->Construct(Point(100, 100));
96         __pEditTime->AddTimeChangeEventListener(*this);
97
98         //Adds the edit time to the form
99         AddControl(__pEditTime);
100
101         return r;
102 }
103
104 // ITimeChangeEventListener implementation
105 void
106 EditTimeSample::OnTimeChanged(const Control& source, int hour, int minute)
107 {
108         // ....
109 }
110
111 void
112 EditTimeSample::OnTimeChangeCanceled(const Control& source)
113 {
114         // ....
115 }
116 * @endcode
117 **/
118 class _OSP_EXPORT_ EditTime
119         : public Tizen::Ui::Control
120 {
121 public:
122         /**
123          * The object is not fully constructed after this constructor is called. @n
124          * For full construction, the %Construct() method must be called right after calling this constructor.
125          *
126          * @since               2.0
127          */
128         EditTime(void);
129
130         /**
131          * This polymorphic destructor should be overridden if required.@n
132          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
133          *
134          * @since               2.0
135          */
136         virtual ~EditTime(void);
137
138         /**
139          * Adds a time changed event listener instance.
140          *
141          * @since                       2.0
142          *
143          * @param[in]   listener    The listener to add
144          * @see                         ITimeChangeEventListener::OnTimeChanged()
145          * @see                         ITimeChangeEventListener::OnTimeChangeCanceled()
146          * @see                         RemoveTimeChangeEventListener()
147          */
148         void AddTimeChangeEventListener(Tizen::Ui::ITimeChangeEventListener& listener);
149
150         /**
151          * Removes a listener instance. @n
152          * The removed listener cannot listen to events when they are fired.
153          *
154          * @since                       2.0
155          *
156          * @param[in]   listener    The listener to remove
157          * @see                         AddTimeChangeEventListener()
158          */
159         void RemoveTimeChangeEventListener(Tizen::Ui::ITimeChangeEventListener& listener);
160
161         /**
162          * Initializes this instance of %EditTime with the specified parameters.
163          *
164          * @since                       2.0
165          *
166          * @return              An error code
167          * @param[in]   point                           The position of %EditTime in container @n
168          *                                                                      The optimal size of the control is defined in
169          *                                                                      <a href="../org.tizen.native.appprogramming/html/guide/ui/control_optimalsize.htm">Optimal Size of UI Controls</a>.
170          * @param[in]   title                           The title
171          * @exception   E_SUCCESS           The method is successful.
172          * @exception   E_SYSTEM                        A system error has occurred.
173          */
174         result Construct(const Tizen::Graphics::Point& point, const Tizen::Base::String& title = L"");
175
176         /**
177          * Initializes this instance of %EditTime with the specified parameters.
178          *
179          * @since                       2.1
180          *
181          * @return              An error code
182          * @param[in]   point                           The position of %EditTime in container @n
183          *                                                                      The optimal size of the control is defined in
184          *                                                                      <a href="../org.tizen.native.appprogramming/html/guide/ui/control_optimalsize.htm">Optimal Size of UI Controls</a>.
185          * @param[in]   title                           The title
186          * @exception   E_SUCCESS           The method is successful.
187          * @exception   E_SYSTEM                        A system error has occurred.
188          */
189         result Construct(const Tizen::Graphics::FloatPoint& point, const Tizen::Base::String& title = L"");
190
191         /**
192          * Gets the current hour value of the %EditTime control.
193          *
194          * @since               2.0
195          *
196          * @return      The current hour value. @n
197          *                      The hour value is between @c 0 to @c 23.
198          *
199          * @remarks     The default hour value is the current system hour.
200          */
201         int GetHour(void) const;
202
203         /**
204          * Gets the current minute value of the %EditTime control.
205          *
206          * @since       2.0
207          *
208          * @return      The current minute value
209          *
210          * @remarks     The default minute value is the current system minute.
211          */
212         int GetMinute(void) const;
213
214         /**
215          * Gets the current time value of the %EditTime control.
216          *
217          * @since                       2.0
218          *
219          * @return              The time value
220          */
221         Tizen::Base::DateTime GetTime(void) const;
222
223         /**
224          * Sets the 12-hour or 24-hour display type of the %EditTime. @n
225          * This can be 12-hour or 24-hour type.
226          *
227          * @since                       2.0
228          *
229          * @param[in]   enable  Set to @c true to set the 24-hour notation, @n
230          *                                              else @c false to set the 12-hour notation
231          */
232         void Set24HourNotationEnabled(bool enable);
233
234         /**
235          * Sets the hour value of the %EditTime control. @n
236          * The hour value should be between @c 0 and @c 23.
237          *
238          * @since                       2.0
239          *
240          * @param[in]   hour                    The hour value to set
241          * @exception   E_SUCCESS       The method is successful.
242          * @exception   E_INVALID_ARG   The specified hour value is invalid.
243          * @exception   E_SYSTEM        A system error has occurred.
244          *
245          */
246         result SetHour(int hour);
247
248         /**
249          * Sets the minute value of the %EditTime control. @n
250          * The minute value should be between @c 0 and @c 59.
251          *
252          * @since                       2.0
253          *
254          * @param[in]   minute                  The minute value to set
255          * @exception   E_SUCCESS       The method is successful.
256          * @exception   E_INVALID_ARG   The specified minute value is invalid.
257          * @exception   E_SYSTEM        A system error has occurred.
258          *
259          */
260         result SetMinute(int minute);
261
262         /**
263          * Sets the designated time value of the %EditTime control.
264          *
265          * @since                       2.0
266          *
267          * @param[in]   time    The time to set
268          */
269         void SetTime(const Tizen::Base::DateTime& time);
270
271         /**
272          * Sets the value of the %EditTime control using the current system time.
273          *
274          * @since               2.0
275          */
276         void SetCurrentTime(void);
277
278         /**
279          * Enables TimePicker.
280          *
281          * @since                               2.0
282          *
283          * @param[in]   enable          Set to @c true to enable %TimePicker, @n
284          *                                                      else @c false
285          */
286         void SetTimePickerEnabled(bool enable);
287
288         /**
289          * Checks whether TimePicker is enabled.
290          *
291          * @since               2.0
292          *
293          * @return      @c true if TimePicker is enabled, @n
294          *                      else @c false
295          */
296         bool IsTimePickerEnabled(void) const;
297
298 private:
299         //
300         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
301         //
302         EditTime(const EditTime& rhs);
303
304         //
305         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
306         //
307         EditTime& operator =(const EditTime& rhs);
308
309         friend class _EditTimeImpl;
310 }; // EditTime
311
312 }}} //Tizen::Ui::Controls
313
314 #endif      // _FUI_CTRL_EDIT_TIME_H_