resources_dock.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*************************************************************************/
  2. /* resources_dock.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef RESOURCES_DOCK_H
  30. #define RESOURCES_DOCK_H
  31. #include "scene/gui/control.h"
  32. #include "scene/gui/tree.h"
  33. #include "scene/gui/label.h"
  34. #include "scene/gui/button.h"
  35. #include "scene/gui/tool_button.h"
  36. #include "scene/gui/box_container.h"
  37. #include "scene/gui/menu_button.h"
  38. #include "scene/gui/file_dialog.h"
  39. #include "create_dialog.h"
  40. class EditorNode;
  41. class ResourcesDock : public VBoxContainer {
  42. OBJ_TYPE( ResourcesDock, VBoxContainer );
  43. enum {
  44. TOOL_NEW,
  45. TOOL_OPEN,
  46. TOOL_SAVE,
  47. TOOL_SAVE_AS,
  48. TOOL_MAKE_LOCAL,
  49. TOOL_COPY,
  50. TOOL_PASTE,
  51. TOOL_MAX
  52. };
  53. EditorNode *editor;
  54. Button *button_new;
  55. Button *button_open;
  56. Button *button_save;
  57. Button *button_tools;
  58. CreateDialog *create_dialog;
  59. AcceptDialog *accept;
  60. FileDialog *file;
  61. Tree *resources;
  62. bool block_add;
  63. int current_action;
  64. void _file_action(const String& p_action);
  65. void _delete(Object* p_item, int p_column, int p_id);
  66. void _resource_selected();
  67. void _update_name(TreeItem *item);
  68. void _tool_selected(int p_tool);
  69. void _create();
  70. protected:
  71. void _notification(int p_what);
  72. static void _bind_methods();
  73. public:
  74. void add_resource(const Ref<Resource>& p_resource);
  75. void remove_resource(const Ref<Resource>& p_resource);
  76. void save_resource(const String& p_path,const Ref<Resource>& p_resource);
  77. void save_resource_as(const Ref<Resource>& p_resource);
  78. void cleanup();
  79. ResourcesDock(EditorNode *p_editor);
  80. };
  81. #endif // RESOURCES_DOCK_H