editor_scene_tabs.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**************************************************************************/
  2. /* editor_scene_tabs.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 EDITOR_SCENE_TABS_H
  31. #define EDITOR_SCENE_TABS_H
  32. #include "scene/gui/margin_container.h"
  33. class Button;
  34. class HBoxContainer;
  35. class Panel;
  36. class PanelContainer;
  37. class PopupMenu;
  38. class TabBar;
  39. class TextureRect;
  40. class EditorSceneTabs : public MarginContainer {
  41. GDCLASS(EditorSceneTabs, MarginContainer);
  42. static EditorSceneTabs *singleton;
  43. PanelContainer *tabbar_panel = nullptr;
  44. HBoxContainer *tabbar_container = nullptr;
  45. TabBar *scene_tabs = nullptr;
  46. PopupMenu *scene_tabs_context_menu = nullptr;
  47. Button *scene_tab_add = nullptr;
  48. Control *scene_tab_add_ph = nullptr;
  49. Panel *tab_preview_panel = nullptr;
  50. TextureRect *tab_preview = nullptr;
  51. void _scene_tab_changed(int p_tab);
  52. void _scene_tab_script_edited(int p_tab);
  53. void _scene_tab_closed(int p_tab);
  54. void _scene_tab_hovered(int p_tab);
  55. void _scene_tab_exit();
  56. void _scene_tab_input(const Ref<InputEvent> &p_input);
  57. void _reposition_active_tab(int p_to_index);
  58. void _update_context_menu();
  59. void _disable_menu_option_if(int p_option, bool p_condition);
  60. void _tab_preview_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata);
  61. void _global_menu_scene(const Variant &p_tag);
  62. void _global_menu_new_window(const Variant &p_tag);
  63. virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
  64. protected:
  65. void _notification(int p_what);
  66. static void _bind_methods();
  67. public:
  68. static EditorSceneTabs *get_singleton() { return singleton; }
  69. void add_extra_button(Button *p_button);
  70. void set_current_tab(int p_tab);
  71. int get_current_tab() const;
  72. void update_scene_tabs();
  73. EditorSceneTabs();
  74. };
  75. #endif // EDITOR_SCENE_TABS_H