Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/scene/group_settings_editor.h
9902 views
1
/**************************************************************************/
2
/* group_settings_editor.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
35
class CheckBox;
36
class EditorFileSystemDirectory;
37
class EditorValidationPanel;
38
class FileSystemDock;
39
class Label;
40
class Tree;
41
42
class GroupSettingsEditor : public VBoxContainer {
43
GDCLASS(GroupSettingsEditor, VBoxContainer);
44
45
const String GLOBAL_GROUP_PREFIX = "global_group/";
46
const StringName group_changed = "group_changed";
47
48
HashMap<StringName, String> groups_cache;
49
50
bool updating_groups = false;
51
52
AcceptDialog *message = nullptr;
53
Tree *tree = nullptr;
54
LineEdit *group_name = nullptr;
55
LineEdit *group_description = nullptr;
56
Button *add_button = nullptr;
57
58
ConfirmationDialog *remove_dialog = nullptr;
59
CheckBox *remove_check_box = nullptr;
60
Label *remove_label = nullptr;
61
62
ConfirmationDialog *rename_group_dialog = nullptr;
63
LineEdit *rename_group = nullptr;
64
CheckBox *rename_check_box = nullptr;
65
EditorValidationPanel *rename_validation_panel = nullptr;
66
67
void _show_remove_dialog();
68
void _show_rename_dialog();
69
70
String _check_new_group_name(const String &p_name);
71
void _check_rename();
72
73
void _add_group();
74
void _add_group(const String &p_name, const String &p_description);
75
76
void _modify_references(const StringName &p_name, const StringName &p_new_name, bool p_is_rename);
77
78
void _confirm_rename();
79
void _confirm_delete();
80
81
void _text_submitted(const String &p_text);
82
void _group_name_text_changed(const String &p_name);
83
84
void _item_edited();
85
void _item_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);
86
87
protected:
88
void _notification(int p_what);
89
static void _bind_methods();
90
91
public:
92
LineEdit *get_name_box() const;
93
void show_message(const String &p_message);
94
95
void remove_references(const StringName &p_name);
96
void rename_references(const StringName &p_old_name, const StringName &p_new_name);
97
98
bool remove_node_references(Node *p_node, const StringName &p_name);
99
bool rename_node_references(Node *p_node, const StringName &p_old_name, const StringName &p_new_name);
100
101
void update_groups();
102
void connect_filesystem_dock_signals(FileSystemDock *p_fs_dock);
103
104
GroupSettingsEditor();
105
};
106
107