/**************************************************************************/1/* editor_scene_tabs.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */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/**************************************************************************/2930#pragma once3132#include "scene/gui/margin_container.h"3334class Button;35class HBoxContainer;36class Panel;37class PanelContainer;38class PopupMenu;39class TabBar;40class TextureRect;4142class EditorSceneTabs : public MarginContainer {43GDCLASS(EditorSceneTabs, MarginContainer);4445inline static EditorSceneTabs *singleton = nullptr;4647public:48enum {49SCENE_SHOW_IN_FILESYSTEM = 1000, // Prevents conflicts with EditorNode options.50SCENE_RUN,51SCENE_CLOSE_OTHERS,52SCENE_CLOSE_RIGHT,53SCENE_CLOSE_ALL,54};5556private:57PanelContainer *tabbar_panel = nullptr;58HBoxContainer *tabbar_container = nullptr;5960TabBar *scene_tabs = nullptr;61PopupMenu *scene_tabs_context_menu = nullptr;62Button *scene_tab_add = nullptr;63Control *scene_tab_add_ph = nullptr;6465Panel *tab_preview_panel = nullptr;66TextureRect *tab_preview = nullptr;6768int last_hovered_tab = -1;6970void _scene_tab_changed(int p_tab);71void _scene_tab_script_edited(int p_tab);72void _scene_tab_closed(int p_tab);73void _scene_tab_hovered(int p_tab);74void _scene_tab_exit();75void _scene_tab_input(const Ref<InputEvent> &p_input);76void _scene_tabs_resized();7778void _update_tab_titles();79void _reposition_active_tab(int p_to_index);80void _update_context_menu();81void _custom_menu_option(int p_option);8283void _tab_preview_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata);8485void _global_menu_scene(const Variant &p_tag);86void _global_menu_new_window(const Variant &p_tag);8788virtual void shortcut_input(const Ref<InputEvent> &p_event) override;8990protected:91void _notification(int p_what);92virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;93static void _bind_methods();9495public:96static EditorSceneTabs *get_singleton() { return singleton; }9798void add_extra_button(Button *p_button);99100void set_current_tab(int p_tab);101int get_current_tab() const;102103void update_scene_tabs();104105EditorSceneTabs();106};107108109