group_settings_editor.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #ifndef GROUP_SETTINGS_EDITOR_H
  31. #define GROUP_SETTINGS_EDITOR_H
  32. #include "scene/gui/dialogs.h"
  33. class CheckBox;
  34. class EditorFileSystemDirectory;
  35. class EditorValidationPanel;
  36. class FileSystemDock;
  37. class Label;
  38. class Tree;
  39. class GroupSettingsEditor : public VBoxContainer {
  40. GDCLASS(GroupSettingsEditor, VBoxContainer);
  41. const String GLOBAL_GROUP_PREFIX = "global_group/";
  42. const StringName group_changed = "group_changed";
  43. HashMap<StringName, String> groups_cache;
  44. bool updating_groups = false;
  45. AcceptDialog *message = nullptr;
  46. Tree *tree = nullptr;
  47. LineEdit *group_name = nullptr;
  48. LineEdit *group_description = nullptr;
  49. Button *add_button = nullptr;
  50. ConfirmationDialog *remove_dialog = nullptr;
  51. CheckBox *remove_check_box = nullptr;
  52. Label *remove_label = nullptr;
  53. ConfirmationDialog *rename_group_dialog = nullptr;
  54. LineEdit *rename_group = nullptr;
  55. CheckBox *rename_check_box = nullptr;
  56. EditorValidationPanel *rename_validation_panel = nullptr;
  57. void _show_remove_dialog();
  58. void _show_rename_dialog();
  59. String _check_new_group_name(const String &p_name);
  60. void _check_rename();
  61. void _add_group();
  62. void _add_group(const String &p_name, const String &p_description);
  63. void _modify_references(const StringName &p_name, const StringName &p_new_name, bool p_is_rename);
  64. void _confirm_rename();
  65. void _confirm_delete();
  66. void _text_submitted(const String &p_text);
  67. void _group_name_text_changed(const String &p_name);
  68. void _item_edited();
  69. void _item_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);
  70. protected:
  71. void _notification(int p_what);
  72. static void _bind_methods();
  73. public:
  74. LineEdit *get_name_box() const;
  75. void show_message(const String &p_message);
  76. void remove_references(const StringName &p_name);
  77. void rename_references(const StringName &p_old_name, const StringName &p_new_name);
  78. bool remove_node_references(Node *p_node, const StringName &p_name);
  79. bool rename_node_references(Node *p_node, const StringName &p_old_name, const StringName &p_new_name);
  80. void update_groups();
  81. void connect_filesystem_dock_signals(FileSystemDock *p_fs_dock);
  82. GroupSettingsEditor();
  83. };
  84. #endif // GROUP_SETTINGS_EDITOR_H