editor_autoload_settings.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*************************************************************************/
  2. /* editor_autoload_settings.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  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 EDITOR_AUTOLOAD_SETTINGS_H
  31. #define EDITOR_AUTOLOAD_SETTINGS_H
  32. #include "scene/gui/tree.h"
  33. #include "editor_file_dialog.h"
  34. class EditorAutoloadSettings : public VBoxContainer {
  35. OBJ_TYPE(EditorAutoloadSettings, VBoxContainer);
  36. enum {
  37. BUTTON_OPEN,
  38. BUTTON_MOVE_UP,
  39. BUTTON_MOVE_DOWN,
  40. BUTTON_DELETE
  41. };
  42. String autoload_changed;
  43. struct AutoLoadInfo {
  44. String name;
  45. int order;
  46. bool operator==(const AutoLoadInfo &p_info) {
  47. return order == p_info.order;
  48. }
  49. };
  50. List<AutoLoadInfo> autoload_cache;
  51. bool updating_autoload;
  52. int number_of_autoloads;
  53. String selected_autoload;
  54. Tree *tree;
  55. EditorLineEditFileChooser *autoload_add_path;
  56. LineEdit *autoload_add_name;
  57. bool _autoload_name_is_valid(const String &p_string, String *r_error = NULL);
  58. void _autoload_add();
  59. void _autoload_selected();
  60. void _autoload_edited();
  61. void _autoload_button_pressed(Object *p_item, int p_column, int p_button);
  62. void _autoload_file_callback(const String &p_path);
  63. void _autoload_activated();
  64. void _autoload_open(const String &fpath);
  65. Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
  66. bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
  67. void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
  68. protected:
  69. void _notification(int p_what);
  70. static void _bind_methods();
  71. public:
  72. void update_autoload();
  73. EditorAutoloadSettings();
  74. };
  75. #endif