Skip to content
0.2.0-dev Download ZIP
90 lines ·3.5 KB Raw
1/**************************************************************************/
2/* editor_locale_dialog.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#pragma once
32
33#include "scene/gui/dialogs.h"
34
35class Button;
36class HBoxContainer;
37class VBoxContainer;
38class LineEdit;
39class Tree;
40class OptionButton;
41
42class EditorLocaleDialog : public ConfirmationDialog {
43 GDCLASS(EditorLocaleDialog, ConfirmationDialog);
44
45 enum LocaleFilter {
46 SHOW_ALL_LOCALES,
47 SHOW_ONLY_SELECTED_LOCALES,
48 };
49
50 HBoxContainer *hb_locale = nullptr;
51 VBoxContainer *vb_script_list = nullptr;
52 OptionButton *filter_mode = nullptr;
53 Button *edit_filters = nullptr;
54 Button *advanced = nullptr;
55 LineEdit *lang_code = nullptr;
56 LineEdit *script_code = nullptr;
57 LineEdit *country_code = nullptr;
58 LineEdit *variant_code = nullptr;
59 Tree *lang_list = nullptr;
60 Tree *script_list = nullptr;
61 Tree *cnt_list = nullptr;
62
63 Label *script_label1 = nullptr;
64 Label *script_label2 = nullptr;
65
66 bool locale_set = false;
67 bool updating_lists = false;
68
69protected:
70 void _notification(int p_what);
71 static void _bind_methods();
72 virtual void _post_popup() override;
73 virtual void ok_pressed() override;
74
75 void _item_selected();
76 void _filter_lang_option_changed();
77 void _filter_script_option_changed();
78 void _filter_cnt_option_changed();
79 void _filter_mode_changed(int p_mode);
80 void _edit_filters(bool p_checked);
81 void _toggle_advanced(bool p_checked);
82
83 void _update_tree();
84
85public:
86 EditorLocaleDialog();
87
88 void set_locale(const String &p_locale);
89 void popup_locale_dialog();
90};