summaryrefslogtreecommitdiff
path: root/modules/gdnative/gdnative_library_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative/gdnative_library_editor_plugin.cpp')
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index e2a69b1635..e6660971a7 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -66,10 +66,13 @@ void GDNativeLibraryEditor::_update_tree() {
tree->clear();
TreeItem *root = tree->create_item();
- for (Map<String, NativePlatformConfig>::Element *E = platforms.front(); E; E = E->next()) {
+ PopupMenu *filter_list = filter->get_popup();
+ for (int i = 0; i < filter_list->get_item_count(); i++) {
- if (showing_platform != E->key() && showing_platform != "All")
+ if (!filter_list->is_item_checked(i)) {
continue;
+ }
+ Map<String, NativePlatformConfig>::Element *E = platforms.find(filter_list->get_item_metadata(i));
TreeItem *platform = tree->create_item(root);
platform->set_text(0, E->get().name);
@@ -162,9 +165,10 @@ void GDNativeLibraryEditor::_on_dependencies_selected(const PoolStringArray &fil
_set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), files);
}
-void GDNativeLibraryEditor::_on_filter_selected(int id) {
+void GDNativeLibraryEditor::_on_filter_selected(int index) {
- showing_platform = filter->get_item_metadata(id);
+ PopupMenu *filter_list = filter->get_popup();
+ filter_list->set_item_checked(index, !filter_list->is_item_checked(index));
_update_tree();
}
@@ -265,8 +269,6 @@ void GDNativeLibraryEditor::_translate_to_config_file() {
GDNativeLibraryEditor::GDNativeLibraryEditor() {
- showing_platform = "All";
-
{ // Define platforms
NativePlatformConfig platform_windows;
platform_windows.name = "Windows";
@@ -336,20 +338,21 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
Label *label = memnew(Label);
label->set_text(TTR("Platform:"));
hbox->add_child(label);
- filter = memnew(OptionButton);
+ filter = memnew(MenuButton);
+ filter->set_text(TTR("Choose platform"));
hbox->add_child(filter);
- filter->set_h_size_flags(SIZE_EXPAND_FILL);
+ PopupMenu *filter_list = filter->get_popup();
+ filter_list->set_hide_on_checkable_item_selection(false);
+ filter_list->set_h_size_flags(SIZE_EXPAND_FILL);
int idx = 0;
- filter->add_item(TTR("All"), idx);
- filter->set_item_metadata(idx, "All");
- idx += 1;
for (Map<String, NativePlatformConfig>::Element *E = platforms.front(); E; E = E->next()) {
- filter->add_item(E->get().name, idx);
- filter->set_item_metadata(idx, E->key());
+ filter_list->add_check_item(E->get().name, idx);
+ filter_list->set_item_metadata(idx, E->key());
+ filter_list->set_item_checked(idx, true);
idx += 1;
}
- filter->connect("item_selected", this, "_on_filter_selected");
+ filter_list->connect("index_pressed", this, "_on_filter_selected");
tree = memnew(Tree);
container->add_child(tree);