2 * Copyright (c) 2015 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.
18 #ifndef XWALK_RUNTIME_BROWSER_POPUP_H_
19 #define XWALK_RUNTIME_BROWSER_POPUP_H_
21 #include <Elementary.h>
35 enum class ButtonType {
42 enum class EntryType {
47 static Popup* CreatePopup(NativeWindow* window);
48 static void ForceCloseAllPopup();
51 void SetButtonType(ButtonType type);
52 bool IsPositiveButton(Evas_Object* button);
53 bool GetButtonResult() const; // yes/allow/ok: true, the others: false
55 void SetFirstEntry(const std::string& str_id, EntryType type);
56 void SetSecondEntry(const std::string& str_id, EntryType type);
57 std::string GetFirstEntryResult() const;
58 std::string GetSecondEntryResult() const;
61 void SetCheckBox(const std::string& str_id = std::string());
62 bool GetCheckBoxResult() const;
65 void SetTitle(const std::string& str_id);
66 void SetBody(const std::string& str_id);
67 void SetResultHandler(std::function
68 <void(Popup* popup, void* user_data)> handler, void* user_data);
73 void Result(bool is_positive);
76 Evas_Object* popup() { return popup_; }
79 Popup(Evas_Object* popup, Evas_Object* layout, Evas_Object* box);
85 Evas_Object* button1_;
86 Evas_Object* button2_;
89 Evas_Object* check_box_;
91 std::function<void(Popup* popup, void* user_data)> handler_;
97 std::string result_entry1_;
98 std::string result_entry2_;
99 bool enable_check_box_;
100 bool result_check_box_;
101 static std::set<Popup*> opened_popups_;
104 } // namespace runtime
106 #endif // XWALK_RUNTIME_BROWSER_POPUP_H_