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