2 * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef BROWSER_POPUP_H_
18 #define BROWSER_POPUP_H_
20 #include <Elementary.h>
24 #include "base/functional/callback.h"
30 enum class ButtonType {
37 enum class EntryType {
42 static std::unique_ptr<Popup> CreatePopup(Evas_Object* window);
43 static void Show(std::unique_ptr<Popup> popup);
44 static void ForceCloseAllPopup();
48 virtual void SetButtonType(ButtonType type);
49 virtual void SetCheckBox(const std::string& id);
51 void SetFirstEntry(const std::string& id, EntryType type);
52 void SetSecondEntry(const std::string& id, EntryType type);
53 void SetTitle(const std::string& id);
54 void SetBody(const std::string& id);
56 typedef base::OnceCallback<void(
57 bool is_positive, bool is_checked,
58 const std::string& entry1, const std::string& entry2)>
61 void SetResultHandler(ResultHandler handler);
64 Popup(Evas_Object* popup, Evas_Object* box);
66 virtual Evas_Object* AddEntry(const char* id, Popup::EntryType type);
67 virtual void ShowInternal(std::unique_ptr<Popup> popup);
70 Evas_Object* button2_ = nullptr;
71 Evas_Object* button1_ = nullptr;
73 std::string edjeFilePath_ = std::string();
74 std::string checkStyle_ = std::string();
76 static std::vector<std::unique_ptr<Popup>> opened_popups_;
79 Evas_Object* AddButton(const char* id, const char* content,
80 const char* button_style);
82 void HandleButtonClickEvent(Evas_Object* button);
87 Evas_Object* entry1_ = nullptr;
88 Evas_Object* entry2_ = nullptr;
89 Evas_Object* check_box_ = nullptr;
91 ResultHandler handler_;
96 #endif // BROWSER_POPUP_H_