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 FUiCtrl_EditTime.h
20 * @brief This is the header file for the _EditTime class.
22 * This header file contains the declarations of the %_EditTime class.
25 #ifndef _FUI_CTRL_INTERNAL_EDITTIME_H_
26 #define _FUI_CTRL_INTERNAL_EDITTIME_H_
28 #include <FSysISettingEventListener.h>
29 #include "FUi_Control.h"
30 #include "FUi_UiTouchEvent.h"
31 #include "FUiCtrl_IDateTimeChangeEventListener.h"
32 #include "FUiCtrl_DateTimeChangeEvent.h"
33 #include "FUiCtrl_IActionEventListener.h"
34 #include "FUi_IAccessibilityListener.h"
35 #include "FUiCtrl_DateTimeBar.h"
37 namespace Tizen { namespace Ui
39 class _AccessibilityElement;
42 namespace Tizen { namespace Ui { namespace Controls
44 class _EditTimePresenter;
46 class _OSP_EXPORT_ _EditTime
48 , public _IDateTimeChangeEventListener
49 , public _IActionEventListener
50 , public _IAccessibilityListener
51 , virtual public Tizen::Base::Runtime::IEventListener
52 , virtual public _IUiEventListener
53 , virtual public _IUiEventPreviewer
54 , virtual public Tizen::System::ISettingEventListener
57 DECLARE_CLASS_BEGIN(_EditTime, _Control);
58 DECLARE_PROPERTY("time", GetPropertyTime, SetPropertyTime);
59 DECLARE_PROPERTY("hour", GetPropertyHour, SetPropertyHour);
60 DECLARE_PROPERTY("minute", GetPropertyMinute, SetPropertyMinute);
61 DECLARE_PROPERTY("timePickerEnabled", GetPropertyTimePickerEnabled, SetPropertyTimePickerEnabled);
64 result SetPropertyTime(const Tizen::Ui::Variant& time);
65 Tizen::Ui::Variant GetPropertyTime(void) const;
67 result SetPropertyHour(const Tizen::Ui::Variant& hour);
68 Tizen::Ui::Variant GetPropertyHour(void) const;
70 result SetPropertyMinute(const Tizen::Ui::Variant& minute);
71 Tizen::Ui::Variant GetPropertyMinute(void) const;
73 result SetPropertyTimePickerEnabled(const Tizen::Ui::Variant& enable);
74 Tizen::Ui::Variant GetPropertyTimePickerEnabled(void) const;
77 virtual ~_EditTime(void);
78 static _EditTime* CreateEditTimeN(const Tizen::Base::String& title);
80 result AddTimeChangeEventListener(const _IDateTimeChangeEventListener& listener);
81 result RemoveTimeChangeEventListener(const _IDateTimeChangeEventListener& listener);
83 void SetTime(const Tizen::Base::DateTime& time);
84 Tizen::Base::DateTime GetTime(void) const;
86 result SetHour(int hour);
87 int GetHour(void) const;
89 result SetMinute(int minute);
90 int GetMinute(void) const;
92 void SetCurrentTime(void);
94 void SetTimePickerEnabled(bool enable);
95 bool IsTimePickerEnabled(void) const;
97 void Set24HourNotationEnabled(bool enable);
98 bool Is24HourNotationEnabled(void) const;
100 result FireTimeChangeEvent(_DateTimeChangeStatus status);
102 _DateTimeBar* GetDateTimeBar(void) const;
104 virtual void OnDraw(void);
105 virtual void OnBoundsChanged(void);
106 virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
107 virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
108 virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
109 virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
110 virtual void OnTouchMoveHandled(const Tizen::Ui::_Control& control);
112 virtual void OnDateTimeChanged(const Tizen::Ui::_Control& source, int year, int month, int day, int hour, int minute);
113 virtual void OnDateTimeChangeCanceled(const Tizen::Ui::_Control& source);
114 virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
115 virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
116 void OnFontChanged(Tizen::Graphics::Font* pFont);
117 void OnFontInfoRequested(unsigned long& style, float& size);
118 virtual void OnSettingChanged(Tizen::Base::String& key);
119 Tizen::Graphics::FloatRectangle GetParentWindowBounds(void) const;
120 void SetXmlBoundsExist(bool isXmlBoundsExist);
122 void CreateAccessibilityElement(void);
123 void UpdateAccessibilityElement(void);
125 // accessibility listener
126 virtual bool OnAccessibilityFocusMovedNext(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
127 virtual bool OnAccessibilityFocusMovedPrevious(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
128 virtual bool OnAccessibilityReadingElement(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
129 virtual bool OnAccessibilityReadElement(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
130 virtual bool OnAccessibilityFocusIn(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
131 virtual bool OnAccessibilityFocusOut(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
132 virtual bool OnAccessibilityActionPerformed(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
133 virtual bool OnAccessibilityValueIncreased(const Tizen::Ui::_AccessibilityContainer&, const Tizen::Ui::_AccessibilityElement&);
134 virtual bool OnAccessibilityValueDecreased(const Tizen::Ui::_AccessibilityContainer&, const Tizen::Ui::_AccessibilityElement&);
138 _EditTime(const _EditTime&);
139 _EditTime& operator =(const _EditTime&);
141 result CreateDateTimeBar(void);
142 result CalculateDateTimeBarPosition(void);
145 _EditTimePresenter* __pEditTimePresenter;
146 _DateTimeChangeEvent* __pTimeChangeEvent;
147 _DateTimeBar* __pDateTimeBar;
148 Tizen::Graphics::FloatRectangle __absoluteBounds;
149 Tizen::Graphics::FloatDimension __previousSize;
150 Tizen::Base::String __title;
151 Tizen::Ui::_AccessibilityElement* __pAccessibilityEditTimeElement;
152 Tizen::Ui::_AccessibilityElement* __pAccessibilityHourElement;
153 Tizen::Ui::_AccessibilityElement* __pAccessibilityMinuteElement;
154 Tizen::Ui::_AccessibilityElement* __pAccessibilityAmPmElement;
155 bool __isCalledBoundsChanged;
156 bool __isXmlBoundsExist;
157 static const float _TOUCH_PRESS_THRESHOLD_INSENSITIVE = 0.08f;
160 }}} // Tizen::Ui::Controls
162 #endif // _FUI_CTRL_INTERNAL_EDITTIME_H_