Modified popup setOwner()
[framework/osp/web.git] / src / controls / FWebCtrl_InputPickerPopup.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 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        FWebCtrl_InputPickerPopup.h
20  * @brief       The file contains the definition of _InputPickerPopup class.
21  */
22
23 #ifndef _FWEB_CTRL_INTERNAL_INPUT_POPUP_H_
24 #define _FWEB_CTRL_INTERNAL_INPUT_POPUP_H_
25
26 #include <unique_ptr.h>
27 #include <ewk_view.h>
28 #include <FBase.h>
29 #include <FBaseString.h>
30 #include <FGrpColor.h>
31 #include <FUi.h>
32 #include <FUiIActionEventListener.h>
33 #include <FUi_ControlManager.h>
34
35 namespace Tizen { namespace Ui
36 {
37 class IActionEventListener;
38 }} // Tizen::Ui
39
40 namespace Tizen { namespace Ui { namespace Controls
41 {
42 class Popup;
43 class EditDate;
44 class EditTime;
45 }}} // Tizen::Ui::Controls
46
47 namespace Tizen { namespace Web { namespace Controls
48 {
49
50 enum _InputPickerButtonId
51 {
52         ID_BUTTON_INPUT_DATE_SELECTION,
53         ID_BUTTON_INPUT_COLOR_SELECTION
54 };
55
56 enum _InputPickerMode
57 {
58         INPUT_MODE_DATE,
59         INPUT_MODE_COLOR
60 };
61
62
63 class _InputPickerPopup
64         : public Tizen::Base::Object
65         , virtual public Tizen::Ui::IActionEventListener
66 {
67
68 public:
69         /**
70          * Constructor
71          */
72         _InputPickerPopup(void);
73
74         /**
75          * Destructor
76          */
77         virtual ~_InputPickerPopup(void);
78
79         result Construct(const Tizen::Base::String& strDate, Ewk_Input_Type inputType, Tizen::Web::Controls::_WebImpl* pImpl);
80
81         result Construct(const Tizen::Graphics::Color& color, Tizen::Web::Controls::_WebImpl* pImpl);
82
83         void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
84
85         result ChangeLayout(Tizen::Ui::_ControlOrientation orientation);
86
87         Tizen::Base::String GetDate(void) const;
88         Tizen::Graphics::Color GetColor(void) const;
89
90         result ShowPopup(void);
91         result HidePopup(void);
92
93 private:
94         _InputPickerPopup(const _InputPickerPopup& rhs);
95
96         _InputPickerPopup& operator =(const _InputPickerPopup& rhs);
97
98         result CreatePopup(void);
99
100         result AddButton(_InputPickerButtonId buttonId);
101
102         void CalculateColorPickerPopupSize(Tizen::Ui::_ControlOrientation orientation);
103
104         result UpdateDate(void);
105         void UpdateColor(void);
106
107         result Parse(const Tizen::Base::String& strDateTime, Tizen::Base::DateTime& dateTime);
108
109         void GetDateTimeForWeek(int year, int totalDays, Tizen::Base::DateTime& dateTime);
110
111 private:
112
113         std::unique_ptr<Tizen::Ui::Controls::Popup> __pPopup;
114         Tizen::Ui::Controls::EditDate* __pEditDate;
115         Tizen::Ui::Controls::EditTime* __pEditTime;
116         Tizen::Ui::Controls::Button* __pSelectionBtn;
117         Tizen::Ui::Controls::ColorPicker* __pColorPicker;
118
119         int __modal;
120         int __popupHeight;
121         int __popupWidth;
122         int __btnHeight;
123
124         Ewk_Input_Type __inputType;
125         Tizen::Base::String __dateStr;
126         Tizen::Graphics::Color __Color;
127
128         _InputPickerMode __inputPickerMode;
129 }; // _InputPickerPopup
130
131 }}} // Tizen::Web::Controls
132 #endif // _FWEB_CTRL_INTERNAL_INPUT_POPUP_H_