1 // Copyright 2016 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 EWK_EFL_INTEGRATION_BROWSER_SELECT_PICKER_SELECT_PICKER_BASE_H_
6 #define EWK_EFL_INTEGRATION_BROWSER_SELECT_PICKER_SELECT_PICKER_BASE_H_
8 #include <Elementary.h>
11 #include "content/public/common/menu_item.h"
12 #include "ui/gfx/geometry/rect.h"
15 class GenlistCallbackData;
17 class SelectPickerBase {
19 virtual ~SelectPickerBase();
20 static SelectPickerBase* Create(EWebView* web_view,
22 const std::vector<content::MenuItem>& items,
23 bool is_multiple_selection,
24 const gfx::Rect& bounds);
25 virtual void UpdateFormNavigation(int form_element_count,
26 int current_node_index) {}
27 virtual void UpdatePickerData(int selected_index,
28 const std::vector<content::MenuItem>& items,
29 bool is_multiple_selection);
30 virtual gfx::Rect GetGeometryDIP() const;
34 bool IsVisible() const;
37 explicit SelectPickerBase(EWebView* web_view,
39 bool is_multiple_selection);
40 virtual const char* GetItemStyle() const;
41 virtual void Init(const std::vector<content::MenuItem>& items,
42 const gfx::Rect& bounds) = 0;
43 virtual void ClearData();
44 virtual void CreateAndPopulatePopupList(
45 const std::vector<content::MenuItem>& items) = 0;
46 virtual void ItemSelected(GenlistCallbackData* data, void* event_info);
47 void InitializeSelectedPickerData(
48 const std::vector<content::MenuItem>& items);
49 void DidSelectPopupMenuItem();
50 void DidMultipleSelectPopupMenuItem();
53 Evas_Object* popup_list_;
57 bool is_multiple_selection_;
58 Elm_Genlist_Item_Class* item_class_;
59 #if defined(TIZEN_ATK_SUPPORT)
60 Elm_Object_Item* first_item_;
61 Elm_Object_Item* selected_item_;
65 static void ItemSelectedCallback(void*, Evas_Object*, void*);
66 static void MenuItemActivatedCallback(void*, Evas_Object*, void*);
67 static void MenuItemDeactivatedCallback(void*, Evas_Object*, void*);
68 void InitializeItemClass();
69 void InitializeGroupClass();
70 void DestroyPopupList();
72 Elm_Genlist_Item_Class* group_class_;
73 std::vector<GenlistCallbackData*> select_picker_data_;
74 std::vector<int> selected_indexes_;
77 #endif // EWK_EFL_INTEGRATION_BROWSER_SELECT_PICKER_SELECT_PICKER_BASE_H_