1 // Copyright 2022 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_INPUT_PICKER_INPUT_PICKER_BASE_H_
6 #define CONTENT_BROWSER_INPUT_PICKER_INPUT_PICKER_BASE_H_
11 #include "build/build_config.h"
12 #include "ui/base/ime/text_input_type.h"
14 #if BUILDFLAG(IS_TIZEN)
15 #include <efl_extension.h>
20 class DateTimeChooserEfl;
23 class InputPickerBase {
25 InputPickerBase(WebContents* web_contents,
26 Evas_Object* evas_object,
27 DateTimeChooserEfl* date_time_chooser);
28 InputPickerBase() = default;
29 virtual ~InputPickerBase() = default;
31 InputPickerBase(const InputPickerBase&) = delete;
32 InputPickerBase& operator=(const InputPickerBase&) = delete;
34 void ShowColorPicker(int r, int g, int b, int a);
35 void ShowDatePicker(ui::TextInputType input_type, double input_date);
40 static Layout* CreateAndShowColorPickerLayout(InputPickerBase* parent,
44 static Layout* CreateAndShowDateLayout(InputPickerBase* parent,
45 struct tm* currentTime,
46 ui::TextInputType type);
47 static Layout* CreateAndShowDateTimeLayout(InputPickerBase* parent,
48 struct tm* currentTime,
49 ui::TextInputType type);
50 static Layout* CreateAndShowTimeLayout(InputPickerBase* parent,
51 struct tm* currentTime);
56 explicit Layout(InputPickerBase* parent);
58 Layout(const Layout&) = delete;
59 Layout& operator=(const Layout&) = delete;
61 bool AddBaseLayout(const char* title, const char* layout_group);
63 bool AddColorSelector(int r, int g, int b);
64 void AddColorPickerCallbacks();
65 void DeleteColorPickerCallbacks();
66 void AddDatePickerCallbacks();
67 void DeleteDatePickerCallbacks();
69 bool SetDatetimePicker(Evas_Object* picker, const char* style);
71 static void ColorPickerSelectFinishedCallback(void* data,
74 static void ColorPickerItemSelectedCallback(void* data,
77 static void DatePickerSelectFinishedCallback(void* data,
80 static void DatePickerItemChangedCallback(void* data,
84 static void ColorPickerBackKeyCallback(void* data,
87 static void DatePickerBackKeyCallback(void* data,
91 InputPickerBase* parent_;
93 Evas_Object* conformant_ = nullptr;
94 Evas_Object* popup_ = nullptr;
95 Evas_Object* layout_ = nullptr;
96 Evas_Object* set_button_ = nullptr;
97 Evas_Object* cancel_button_ = nullptr;
98 Evas_Object* color_picker_ = nullptr;
99 Evas_Object* color_rect_ = nullptr;
100 Evas_Object* date_picker_ = nullptr;
101 Evas_Object* time_picker_ = nullptr;
102 #if BUILDFLAG(IS_TIZEN) && !BUILDFLAG(IS_TIZEN_TV)
103 Eext_Circle_Surface* circle_surface_ = nullptr;
105 ui::TextInputType input_type_ = ui::TEXT_INPUT_TYPE_NONE;
106 bool is_color_picker_ = false;
112 void RemoveColorPicker();
113 void RemoveDatePicker(bool cancel);
114 Evas_Object* GetElmWindow() const;
116 virtual void ExecuteEditCommand(const char*, const char*) = 0;
118 std::unique_ptr<Layout> picker_layout_;
119 WebContents* web_contents_;
120 Evas_Object* evas_object_;
121 DateTimeChooserEfl* date_time_chooser_;
124 } // namespace content
126 #endif // CONTENT_BROWSER_INPUT_PICKER_INPUT_PICKER_BASE_H_