Fix crash when the app is terminated while color picker is shown
[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 "ewk_view.h"
25
26 #if ENABLE(TIZEN_DATALIST_ELEMENT)
27 #include "ewk_view_private.h"
28 #endif
29
30 typedef struct _Evas_Object Evas_Object;
31
32 struct Input_Date {
33     int year;
34     int mon;
35     int day;
36     int hour;
37     int min;
38     int sec;
39 };
40 struct Input_Date_Str {
41     char year[10];
42     char mon[10];
43     char day[10];
44     char hour[10];
45     char min[10];
46     char sec[10];
47 };
48 class Input_Picker_Layout {
49 public:
50     Input_Picker_Layout(Evas_Object*);
51     ~Input_Picker_Layout();
52
53     Evas_Object* m_ewkView;
54     Evas_Object* popup;
55     Evas_Object* layout;
56     Evas_Object* timePicker;
57     Evas_Object* datePicker;
58     Evas_Object* colorRect;
59     Evas_Object* okButton;
60     Evas_Object* dataListEditField;
61     bool datetimeLocal;
62 };
63
64 namespace WebKit {
65
66     class InputPicker {
67     public:
68         InputPicker(Evas_Object*);
69         ~InputPicker();
70
71         void show(Ewk_Input_Type, const char*);
72
73 #if ENABLE(TIZEN_DATALIST_ELEMENT)
74         void showDataList(Ewk_Input_Type inputType, Eina_List* optionList);
75         void hideDataList(Ewk_Input_Type inputType);
76 #endif
77
78 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
79         void showColorPicker(int, int, int, int);
80         void hideColorPicker();
81         bool isColorPickerShown() { return m_isColorPickerShown; }
82 #endif
83
84         void ewk_date_popup(const char*);
85         void ewk_time_popup(const char*);
86         void ewk_month_popup(const char*);
87         void ewk_week_popup(const char*);
88         void ewk_datetime_popup(const char*, bool);
89         void ewk_color_popup(int, int, int);
90     private:
91         static void _date_popup_response_cb(void*, Evas_Object*, void*);
92         static void _time_popup_response_cb(void*, Evas_Object*, void*);
93         static void _month_popup_response_cb(void*, Evas_Object*, void*);
94         static void _week_popup_response_cb(void*, Evas_Object*, void*);
95         static void _datetime_popup_response_cb(void*, Evas_Object*, void*);
96         static void _color_popup_response_cb(void*, Evas_Object*, void*);
97         static void _data_list_popup_response_cb(void*, Evas_Object*, void*);
98         static void _data_list_popup_response_cancel_cb(void*, Evas_Object*, void*);
99         static void _data_list_selected_cb(void*, Evas_Object*, void*);
100         static void _color_selected_cb(void*, Evas*, Evas_Object*, void*);
101
102         Evas_Object* m_ewkView;
103         Input_Picker_Layout* m_pickerLayout;
104         Eina_List* m_dataList;
105 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
106         bool m_isColorPickerShown;
107 #endif
108     };
109 } // namespace WebKit
110
111
112 #endif // OS(TIZEN) && ENABLE(TIZEN_INPUT_TAG_EXTENSION)
113
114 #endif // InputPicker_h