| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "scene/gui/margin_container.h" |
| 34 |
|
| 35 |
class Button; |
| 36 |
class HBoxContainer; |
| 37 |
class MenuButton; |
| 38 |
class Panel; |
| 39 |
class PanelContainer; |
| 40 |
class PopupMenu; |
| 41 |
class TabBar; |
| 42 |
class TextureRect; |
| 43 |
|
| 44 |
class EditorSceneTabs : public MarginContainer { |
| 45 |
GDCLASS(EditorSceneTabs, MarginContainer); |
| 46 |
|
| 47 |
inline static EditorSceneTabs *singleton = nullptr; |
| 48 |
|
| 49 |
public: |
| 50 |
enum { |
| 51 |
SCENE_SHOW_IN_FILESYSTEM = 1000, |
| 52 |
SCENE_RUN, |
| 53 |
SCENE_CLOSE_OTHERS, |
| 54 |
SCENE_CLOSE_RIGHT, |
| 55 |
}; |
| 56 |
|
| 57 |
private: |
| 58 |
PanelContainer *tabbar_panel = nullptr; |
| 59 |
HBoxContainer *tabbar_container = nullptr; |
| 60 |
|
| 61 |
TabBar *scene_tabs = nullptr; |
| 62 |
PopupMenu *scene_tabs_context_menu = nullptr; |
| 63 |
MenuButton *scene_list = nullptr; |
| 64 |
Button *scene_tab_add = nullptr; |
| 65 |
Control *scene_tab_add_ph = nullptr; |
| 66 |
|
| 67 |
Panel *tab_preview_panel = nullptr; |
| 68 |
TextureRect *tab_preview = nullptr; |
| 69 |
|
| 70 |
int last_hovered_tab = -1; |
| 71 |
|
| 72 |
void _scene_tab_changed(int p_tab); |
| 73 |
void _scene_tab_script_edited(int p_tab); |
| 74 |
void _scene_tab_closed(int p_tab); |
| 75 |
void _scene_tab_hovered(int p_tab); |
| 76 |
void _scene_tab_exit(); |
| 77 |
void _scene_tab_input(const Ref<InputEvent> &p_input); |
| 78 |
void _scene_tabs_resized(); |
| 79 |
|
| 80 |
void _update_tab_titles(); |
| 81 |
void _reposition_active_tab(int p_to_index); |
| 82 |
void _update_context_menu(); |
| 83 |
void _custom_menu_option(int p_option); |
| 84 |
void _update_scene_list(); |
| 85 |
|
| 86 |
void _tab_preview_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, int p_tab); |
| 87 |
|
| 88 |
void _global_menu_scene(const Variant &p_tag); |
| 89 |
void _global_menu_new_window(const Variant &p_tag); |
| 90 |
|
| 91 |
virtual void shortcut_input(const Ref<InputEvent> &p_event) override; |
| 92 |
|
| 93 |
protected: |
| 94 |
void _notification(int p_what); |
| 95 |
virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override; |
| 96 |
static void _bind_methods(); |
| 97 |
|
| 98 |
public: |
| 99 |
static EditorSceneTabs *get_singleton() { return singleton; } |
| 100 |
|
| 101 |
void add_extra_button(Button *p_button); |
| 102 |
|
| 103 |
void set_current_tab(int p_tab); |
| 104 |
int get_current_tab() const; |
| 105 |
|
| 106 |
void update_scene_tabs(); |
| 107 |
|
| 108 |
EditorSceneTabs(); |
| 109 |
}; |