Debian Codegraph @

editor/editor_main_screen.h

raw symbols SCIP
1 /**************************************************************************/
2 /* editor_main_screen.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 #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 };