/**************************************************************************/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 MenuButton;37class Panel;38class PanelContainer;39class PopupMenu;40class TabBar;41class TextureRect;4243class EditorSceneTabs : public MarginContainer {44GDCLASS(EditorSceneTabs, MarginContainer);4546inline static EditorSceneTabs *singleton = nullptr;4748public:49enum {50SCENE_SHOW_IN_FILESYSTEM = 1000, // Prevents conflicts with EditorNode options.51SCENE_RUN,52SCENE_CLOSE_OTHERS,53SCENE_CLOSE_RIGHT,54};5556private:57PanelContainer *tabbar_panel = nullptr;58HBoxContainer *tabbar_container = nullptr;5960TabBar *scene_tabs = nullptr;61PopupMenu *scene_tabs_context_menu = nullptr;62MenuButton *scene_list = nullptr;63Button *scene_tab_add = nullptr;64Control *scene_tab_add_ph = nullptr;6566Panel *tab_preview_panel = nullptr;67TextureRect *tab_preview = nullptr;6869int last_hovered_tab = -1;7071void _scene_tab_changed(int p_tab);72void _scene_tab_script_edited(int p_tab);73void _scene_tab_closed(int p_tab);74void _scene_tab_hovered(int p_tab);75void _scene_tab_exit();76void _scene_tab_input(const Ref<InputEvent> &p_input);77void _scene_tabs_resized();7879void _update_tab_titles();80void _reposition_active_tab(int p_to_index);81void _update_context_menu();82void _custom_menu_option(int p_option);83void _update_scene_list();8485void _tab_preview_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, int p_tab);8687void _global_menu_scene(const Variant &p_tag);88void _global_menu_new_window(const Variant &p_tag);8990virtual void shortcut_input(const Ref<InputEvent> &p_event) override;9192protected:93void _notification(int p_what);94virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;95static void _bind_methods();9697public:98static EditorSceneTabs *get_singleton() { return singleton; }99100void add_extra_button(Button *p_button);101102void set_current_tab(int p_tab);103int get_current_tab() const;104105void update_scene_tabs();106107EditorSceneTabs();108};109110111