2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
18 * @file FUiCtrl_DateTimePresenter.h
19 * @brief This is the header file for the _DateTimePresenter class.
22 #ifndef _FUI_CTRL_INTERNAL_DATETIME_PRESENTER_H_
23 #define _FUI_CTRL_INTERNAL_DATETIME_PRESENTER_H_
25 #include <FBaseObject.h>
26 #include "FUi_Control.h"
27 #include "FUiCtrl_DateTimeDefine.h"
28 #include "FUiCtrl_IInputPadEventListener.h"
30 namespace Tizen { namespace Ui { namespace Controls
32 class _DateTimePicker;
33 class _DateTimeDisplayBox;
36 }}} // Tizen::Ui::Controls
38 namespace Tizen { namespace Ui { namespace Controls
41 class _DateTimePresenter
42 : public _IInputPadEventListener
43 , virtual public Tizen::Base::Runtime::IEventListener
46 _DateTimePresenter(int pickerStyle, const Tizen::Base::String& title = L"");
48 virtual ~_DateTimePresenter(void);
50 result Construct(_DateTimePicker& view);
52 result SetYear(int year);
54 result SetMonth(int month);
56 result SetDay(int day);
58 result SetHour(int hour);
60 result SetMinute(int minute);
62 result SetYearRange(int minYear, int maxYear);
64 int GetYear(void) const;
66 int GetMonth(void) const;
68 int GetDay(void) const;
70 int GetHour(void) const;
72 int GetMinute(void) const;
74 result GetYearRange(int& minYear, int& maxYear) const;
76 void Set24HourNotationEnabled(bool enable);
78 bool Is24HourNotationEnabled(void) const;
80 void SetCurrentDateTime(void);
82 void SetDateTime(const Tizen::Base::DateTime& dateTime);
84 Tizen::Base::DateTime GetDateTime(void) const;
86 void SetFocusBoxId(int boxId);
88 const _DateTimeDisplayBox* GetDisplayBox(int index) const;
90 const _DateTimeDisplayBox* GetAmPmBox(void) const;
94 result SetFont(Tizen::Graphics::Font* pFont);
96 virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
98 virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
99 virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
100 virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
101 virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
103 virtual void OnInputPadValueChanged(const Tizen::Ui::_Control& source, int inputPadReturnValue);
105 virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
108 void UpdateDateTimeOutputConfig(void);
110 void LoadResource(void);
112 void DrawColon(Tizen::Graphics::Canvas& canvas);
114 void DrawDateTimeDisplayBox(Tizen::Graphics::Canvas& canvas, int index);
116 void DrawPm(Tizen::Graphics::Canvas& canvas);
118 void DrawDividers(Tizen::Graphics::Canvas& canvas);
120 void ChangeInputPadStyle(int boxId);
122 Tizen::Graphics::Rectangle GetOutputArea(void);
124 int CalculateTouchArea(int posX, int posY);
126 int CalculateTouchOutputArea(int posX, int posY);
128 int CalculateTwoDigit(int originalNumber, int number);
130 int CalculateFourDigit(int originalNumber, int number);
132 int SetTwoDigit(int originalNumber, int number);
134 int SetFourDigit(int originalNumber, int number);
136 void SetNumberInBox(int boxId, int number);
138 int GetNumberInBox(int boxId) const;
140 void SetFocusBox(int index);
142 void LoadPickerData(void);
144 void SavePickerData(void);
146 void UpdateDisplayData(int boxId);
148 void AdjustDisplayValue(int index);
150 void AdjustValue(int& value, int minValue, int maxValue);
152 void ChangeFocusBox(void);
154 int GetLocaleDateFormat(void) const;
156 void SetAccessibilityElementText(void);
159 _DateTimePresenter(const _DateTimePresenter&);
161 _DateTimePresenter& operator =(const _DateTimePresenter&);
166 _DateTimePicker* __pView;
168 _DateTimeModel* __pModel;
170 int __selectedBoxIndex;
172 int __focusedBoxIndex;
174 _InputPad* __pInputPad;
176 _InputPadStyle __inputPadType;
180 bool __inputPadEnabled;
182 int __outputBoxMaxCount;
194 bool __is24HourNotation;
198 bool __isPmButtonPressed;
200 bool __isFocusBoxChanged;
202 int __inputComposing;
204 int __changeFocusCounter;
206 Tizen::Graphics::Bitmap* __pPmBoxNormalBitmap;
207 Tizen::Graphics::Bitmap* __pPmBoxEffectBitmap;
208 Tizen::Graphics::Bitmap* __pPmBoxPressedEffectBitmap;
209 Tizen::Graphics::Bitmap* __pPmBoxDisabledEffectBitmap;
210 Tizen::Graphics::Bitmap* __pColonBitmap;
212 Tizen::Graphics::Font* __pFont;
214 _DateTimeDisplayBox* __pDisplayBox[DATETIME_ID_MAX];
216 _DateTimeDisplayBox* __pPmBox;
217 }; // _DateTimePresenter
219 }}} // Tizen::Ui::Controls
221 #endif // _FUI_CTRL_INTERNAL_DATETIME_PRESENTER_H_