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