Use ewkView as parent object of picker popup
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / InputPicker.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef InputPicker_h
21 #define InputPicker_h
22
23 #if OS(TIZEN) && ENABLE(TIZEN_INPUT_TAG_EXTENSION)
24 #include <ctime>
25
26 #include "ewk_view.h"
27
28 #if ENABLE(TIZEN_DATALIST_ELEMENT)
29 #include "ewk_view_private.h"
30 #endif
31
32 typedef struct _Evas_Object Evas_Object;
33
34 class Input_Picker_Layout {
35 public:
36     Input_Picker_Layout(Evas_Object*);
37     ~Input_Picker_Layout();
38
39     Evas_Object* m_ewkView;
40     Evas_Object* popup;
41     Evas_Object* layout;
42     Evas_Object* datePicker;
43     Evas_Object* colorRect;
44     Evas_Object* okButton;
45     Evas_Object* dataListEditField;
46 #if ENABLE(TIZEN_HW_MORE_BACK_KEY)
47     int initial_r;
48     int initial_g;
49     int initial_b;
50 #endif
51     bool datetimeLocal;
52 };
53
54 namespace WebKit {
55
56 class InputPicker;
57 struct ColorPopupUserData {
58     InputPicker* inputPicker;
59     Evas_Object* colorRect;
60     Evas_Object* color;
61     Evas_Object* colorAccessObject;
62 };
63
64 class InputPicker {
65 public:
66     InputPicker(Evas_Object*);
67     ~InputPicker();
68
69     void show(Ewk_Input_Type, const char*);
70
71 #if ENABLE(TIZEN_DATALIST_ELEMENT)
72     void showDataList(Ewk_Input_Type inputType, Eina_List* optionList);
73     void hideDataList(Ewk_Input_Type inputType);
74 #endif
75
76 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
77     void showColorPicker(int, int, int, int);
78     void hideColorPicker();
79     bool isColorPickerShown() { return m_isColorPickerShown; }
80 #endif
81
82     void ewk_date_popup(const char*);
83     void ewk_time_popup(const char*);
84     void ewk_month_popup(const char*);
85     void ewk_week_popup(const char*);
86     void ewk_datetime_popup(const char*, bool);
87     void ewk_color_popup(int, int, int);
88
89 private:
90     void createDatetimePopup(const char*, struct tm*);
91     void deletePopupLayout();
92     void addColorRect(const char*, int, int, int, ColorPopupUserData*);
93
94     static void _date_popup_response_cb(void*, Evas_Object*, void*);
95     static void _time_popup_response_cb(void*, Evas_Object*, void*);
96     static void _month_popup_response_cb(void*, Evas_Object*, void*);
97     static void _week_popup_response_cb(void*, Evas_Object*, void*);
98     static void _datetime_popup_response_cb(void*, Evas_Object*, void*);
99     static void _color_popup_response_cb(void*, Evas_Object*, void*);
100     static void _data_list_popup_response_cb(void*, Evas_Object*, void*);
101     static void _data_list_popup_response_cancel_cb(void*, Evas_Object*, void*);
102     static void _data_list_selected_cb(void*, Evas_Object*, void*);
103     static void _color_selected_cb(void*, Evas*, Evas_Object*, void*);
104     static void colorKeyDownCallback(void*, Evas*, Evas_Object*, void*);
105
106 #if ENABLE(TIZEN_HW_MORE_BACK_KEY)
107     static void _color_back_cb(void*, Evas_Object*, void*);
108     static void _popup_back_cb(void*, Evas_Object*, void*);
109 #endif
110
111     Evas_Object* m_ewkView;
112     Input_Picker_Layout* m_pickerLayout;
113     Eina_List* m_dataList;
114 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
115     bool m_isColorPickerShown;
116 #endif
117 };
118
119 } // namespace WebKit
120
121 #endif // OS(TIZEN) && ENABLE(TIZEN_INPUT_TAG_EXTENSION)
122
123 #endif // InputPicker_h