| 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/panel_container.h" |
| 34 |
|
| 35 |
class Button; |
| 36 |
class ConfigFile; |
| 37 |
class EditorPlugin; |
| 38 |
class HBoxContainer; |
| 39 |
class VBoxContainer; |
| 40 |
|
| 41 |
class EditorMainScreen : public PanelContainer { |
| 42 |
GDCLASS(EditorMainScreen, PanelContainer); |
| 43 |
|
| 44 |
public: |
| 45 |
enum EditorTable { |
| 46 |
EDITOR_2D = 0, |
| 47 |
EDITOR_3D, |
| 48 |
EDITOR_SCRIPT, |
| 49 |
EDITOR_GAME, |
| 50 |
EDITOR_ASSETLIB, |
| 51 |
}; |
| 52 |
|
| 53 |
private: |
| 54 |
VBoxContainer *main_screen_vbox = nullptr; |
| 55 |
EditorPlugin *selected_plugin = nullptr; |
| 56 |
|
| 57 |
HBoxContainer *button_hb = nullptr; |
| 58 |
Vector<Button *> buttons; |
| 59 |
Vector<EditorPlugin *> editor_table; |
| 60 |
HashMap<String, EditorPlugin *> main_editor_plugins; |
| 61 |
|
| 62 |
int _get_current_main_editor() const; |
| 63 |
|
| 64 |
protected: |
| 65 |
void _notification(int p_what); |
| 66 |
|
| 67 |
public: |
| 68 |
void set_button_container(HBoxContainer *p_button_hb); |
| 69 |
|
| 70 |
void save_layout_to_config(Ref<ConfigFile> p_config_file, const String &p_section) const; |
| 71 |
void load_layout_from_config(Ref<ConfigFile> p_config_file, const String &p_section); |
| 72 |
|
| 73 |
void set_button_enabled(int p_index, bool p_enabled); |
| 74 |
bool is_button_enabled(int p_index) const; |
| 75 |
|
| 76 |
void select_next(); |
| 77 |
void select_prev(); |
| 78 |
void select_by_name(const String &p_name); |
| 79 |
void select(int p_index); |
| 80 |
int get_selected_index() const; |
| 81 |
int get_plugin_index(EditorPlugin *p_editor) const; |
| 82 |
EditorPlugin *get_selected_plugin() const; |
| 83 |
EditorPlugin *get_plugin_by_name(const String &p_plugin_name) const; |
| 84 |
bool can_auto_switch_screens() const; |
| 85 |
|
| 86 |
VBoxContainer *get_control() const; |
| 87 |
|
| 88 |
void add_main_plugin(EditorPlugin *p_editor); |
| 89 |
void remove_main_plugin(EditorPlugin *p_editor); |
| 90 |
|
| 91 |
EditorMainScreen(); |
| 92 |
}; |