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_DateTimeBar.h
20 * @brief This is the header file for the _DateTimeBar class.
22 * This header file contains the declarations of the %_DateTimeBar class.
24 #ifndef _FUI_CTRL_INTERNAL_DATETIME_BAR_H_
25 #define _FUI_CTRL_INTERNAL_DATETIME_BAR_H_
27 #include <FBaseString.h>
28 #include <FBaseDateTime.h>
29 #include <FUiAnimIVisualElementAnimationStatusEventListener.h>
30 #include <FUiAnimVisualElementAnimationGroup.h>
31 #include "FUi_Window.h"
32 #include "FUi_UiTouchEvent.h"
33 #include "FUi_IAccessibilityListener.h"
34 #include "FUi_AccessibilityContainer.h"
35 #include "FUi_AccessibilityElement.h"
36 #include "FUiCtrl_IActionEventListener.h"
37 #include "FUiCtrl_ActionEvent.h"
38 #include "FUiCtrl_DateTimeDefine.h"
39 #include "FUiCtrl_DateTimeChangeEvent.h"
40 #include "FUiCtrl_IDateTimeChangeEventListener.h"
41 #include "FUi_ITouchFlickGestureEventListener.h"
43 namespace Tizen { namespace Ui
45 class _AccessibilityElement;
48 namespace Tizen { namespace Ui { namespace Controls
50 class _DateTimeBarPresenter;
54 , public _IAccessibilityListener
55 , virtual public Tizen::Ui::_ITouchFlickGestureEventListener
56 , virtual public Tizen::Base::Runtime::IEventListener
57 , virtual public _IUiEventListener
58 , virtual public _IUiEventPreviewer
59 , public Tizen::Ui::Animations::IVisualElementAnimationStatusEventListener
62 virtual ~_DateTimeBar(void);
63 static _DateTimeBar* CreateDateTimeBarN(_Control&);
66 result SetPositionAndAlignment(const Tizen::Graphics::FloatPoint& point, _DateTimeBarAlignment alignment);
68 result SetInitialValue(int minValue, int maxValue, int displayValue, _DateTimeId boxId);
69 result RemoveAllItems(void);
71 _DateTimeId GetSelectedBoxId(void) const;
73 int GetItemCount(void) const;
75 _DateTimeBarAlignment GetAlignment(void) const;
77 result AddActionEventListener(const _IActionEventListener& listener);
78 result RemoveActionEventListener(const _IActionEventListener& listener);
80 result AddDateTimeChangeEventListener(const _IDateTimeChangeEventListener& listener);
81 result RemoveDateTimeChangeEventListener(const _IDateTimeChangeEventListener& listener);
83 result CalculateArrowBounds(const Tizen::Graphics::FloatRectangle& bounds);
85 result FireActionEvent(int actionId);
86 result FireDateTimeChangeEvent(_DateTimeChangeStatus status);
88 virtual void OnDraw(void);
89 virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
90 virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
91 virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
92 virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
93 virtual void OnTouchMoveHandled(const Tizen::Ui::_Control& control);
94 virtual result OnAttachedToMainTree(void);
95 virtual result OnDetachingFromMainTree(void);
96 virtual void OnActivated(void);
97 virtual void OnDeactivated(void);
98 virtual bool OnFlickGestureDetected(_TouchFlickGestureDetector& gesture);
99 virtual bool OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture);
100 void AddAccessibilityElement(const Tizen::Graphics::FloatRectangle& itemBounds, const Tizen::Base::String& itemText);
101 void InsertAccessibilityElementAt(int index, const Tizen::Graphics::FloatRectangle& itemBounds, const Tizen::Base::String& itemText);
102 void RemoveAllAccessibilityElement(void);
103 void RemoveAccessibilityElementAt(int index);
104 const char* GetAccessibilityTraitValue() const;
105 Tizen::Base::String GetMonthValue(int month) const;
106 void SetFont(Tizen::Graphics::Font& pFont);
107 void SetParentWindowBounds(Tizen::Graphics::FloatRectangle& parentWindowBounds);
108 Tizen::Graphics::FloatRectangle GetParentWindowBounds() const;
109 void RefreshItems(void);
110 void RemoveAllAnimations(void);
112 virtual bool OnFocusGained(const _Control &source);
113 virtual bool OnFocusLost(const _Control &source);
114 virtual void OnFocusModeStateChanged(void);
115 void OnDrawFocus(void);
116 bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
117 bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
119 // accessibility listener
120 virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
121 virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
122 virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
123 virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
124 virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element);
125 virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element);
126 virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element);
127 virtual bool OnAccessibilityValueIncreased(const Tizen::Ui::_AccessibilityContainer&, const Tizen::Ui::_AccessibilityElement&);
128 virtual bool OnAccessibilityValueDecreased(const Tizen::Ui::_AccessibilityContainer&, const Tizen::Ui::_AccessibilityElement&);
129 _AccessibilityElement* GetAccessibilityElementAt(int index) const;
130 int GetIndexFromAccessibilityElementPoint(const Tizen::Graphics::FloatPoint& point) const;
132 void CloseDateTimeBar(void);
133 virtual void OnVisualElementAnimationFinished (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, bool completedNormally);
134 virtual void OnVisualElementAnimationRepeated (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, long currentRepeatCount){}
135 virtual void OnVisualElementAnimationStarted (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target){}
140 _DateTimeBar(const _DateTimeBar&);
141 _DateTimeBar& operator =(const _DateTimeBar&);
143 void SetAlignment(_DateTimeBarAlignment alignment);
144 void SetSelectedBoxId(_DateTimeId boxId);
145 void InitializeAccessibilityElement(void);
146 Tizen::Ui::Animations::VisualElementAnimationGroup* CreateAnimationN(Tizen::Ui::Animations::VisualElement& source, bool open);
148 static const int ANIMATION_DURATION = 167;
149 static const int POSITION_ANIMATION_VALUE = 20;
151 _DateTimeBarPresenter* __pDateTimeBarPresenter;
152 _ActionEvent* __pActionEvent;
154 _DateTimeId __selectedBoxId;
155 _DateTimeBarAlignment __alignment;
156 _DateTimeChangeEvent* __pDateTimeChangeEvent;
157 _TouchFlickGestureDetector* __pGestureFlick;
158 Tizen::Base::Collection::LinkedListT<_AccessibilityElement*> __accessibilityElements;
159 Tizen::Graphics::FloatRectangle __parentWindowBounds;
161 int __accessibilityFocusOutIndex;
165 }}} // Tizen::Ui::Controls
167 #endif //_FUI_CTRL_INTERNAL_DATETIME_BAR_H_