editor_main_screen.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #ifndef EDITOR_MAIN_SCREEN_H
  31. #define EDITOR_MAIN_SCREEN_H
  32. #include "scene/gui/panel_container.h"
  33. class Button;
  34. class ConfigFile;
  35. class EditorPlugin;
  36. class HBoxContainer;
  37. class VBoxContainer;
  38. class EditorMainScreen : public PanelContainer {
  39. GDCLASS(EditorMainScreen, PanelContainer);
  40. public:
  41. enum EditorTable {
  42. EDITOR_2D = 0,
  43. EDITOR_3D,
  44. EDITOR_SCRIPT,
  45. EDITOR_GAME,
  46. EDITOR_ASSETLIB,
  47. };
  48. private:
  49. VBoxContainer *main_screen_vbox = nullptr;
  50. EditorPlugin *selected_plugin = nullptr;
  51. HBoxContainer *button_hb = nullptr;
  52. Vector<Button *> buttons;
  53. Vector<EditorPlugin *> editor_table;
  54. int _get_current_main_editor() const;
  55. protected:
  56. void _notification(int p_what);
  57. public:
  58. void set_button_container(HBoxContainer *p_button_hb);
  59. void save_layout_to_config(Ref<ConfigFile> p_config_file, const String &p_section) const;
  60. void load_layout_from_config(Ref<ConfigFile> p_config_file, const String &p_section);
  61. void set_button_enabled(int p_index, bool p_enabled);
  62. bool is_button_enabled(int p_index) const;
  63. void select_next();
  64. void select_prev();
  65. void select_by_name(const String &p_name);
  66. void select(int p_index);
  67. int get_selected_index() const;
  68. int get_plugin_index(EditorPlugin *p_editor) const;
  69. EditorPlugin *get_selected_plugin() const;
  70. VBoxContainer *get_control() const;
  71. void add_main_plugin(EditorPlugin *p_editor);
  72. void remove_main_plugin(EditorPlugin *p_editor);
  73. EditorMainScreen();
  74. };
  75. #endif // EDITOR_MAIN_SCREEN_H