editor_run_bar.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /**************************************************************************/
  2. /* editor_run_bar.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_RUN_BAR_H
  31. #define EDITOR_RUN_BAR_H
  32. #include "editor/editor_run.h"
  33. #include "editor/export/editor_export.h"
  34. #include "scene/gui/margin_container.h"
  35. class Button;
  36. class EditorRunNative;
  37. class PanelContainer;
  38. class HBoxContainer;
  39. class AcceptDialog;
  40. class EditorRunBar : public MarginContainer {
  41. GDCLASS(EditorRunBar, MarginContainer);
  42. static EditorRunBar *singleton;
  43. enum RunMode {
  44. STOPPED = 0,
  45. RUN_MAIN,
  46. RUN_CURRENT,
  47. RUN_CUSTOM,
  48. };
  49. PanelContainer *main_panel = nullptr;
  50. HBoxContainer *main_hbox = nullptr;
  51. HBoxContainer *outer_hbox = nullptr;
  52. Button *profiler_autostart_indicator = nullptr;
  53. PanelContainer *recovery_mode_panel = nullptr;
  54. Button *recovery_mode_button = nullptr;
  55. Button *recovery_mode_reload_button = nullptr;
  56. AcceptDialog *recovery_mode_popup = nullptr;
  57. Button *play_button = nullptr;
  58. Button *pause_button = nullptr;
  59. Button *stop_button = nullptr;
  60. Button *play_scene_button = nullptr;
  61. Button *play_custom_scene_button = nullptr;
  62. EditorRun editor_run;
  63. EditorRunNative *run_native = nullptr;
  64. PanelContainer *write_movie_panel = nullptr;
  65. Button *write_movie_button = nullptr;
  66. RunMode current_mode = RunMode::STOPPED;
  67. String run_custom_filename;
  68. String run_current_filename;
  69. void _reset_play_buttons();
  70. void _update_play_buttons();
  71. void _write_movie_toggled(bool p_enabled);
  72. void _quick_run_selected(const String &p_file_path);
  73. void _play_current_pressed();
  74. void _play_custom_pressed();
  75. void _run_scene(const String &p_scene_path = "");
  76. void _run_native(const Ref<EditorExportPreset> &p_preset);
  77. void _profiler_autostart_indicator_pressed();
  78. protected:
  79. void _notification(int p_what);
  80. static void _bind_methods();
  81. public:
  82. static EditorRunBar *get_singleton() { return singleton; }
  83. void recovery_mode_show_dialog();
  84. void recovery_mode_reload_project();
  85. void play_main_scene(bool p_from_native = false);
  86. void play_current_scene(bool p_reload = false);
  87. void play_custom_scene(const String &p_custom);
  88. void stop_playing();
  89. bool is_playing() const;
  90. String get_playing_scene() const;
  91. Error start_native_device(int p_device_id);
  92. OS::ProcessID has_child_process(OS::ProcessID p_pid) const;
  93. void stop_child_process(OS::ProcessID p_pid);
  94. OS::ProcessID get_current_process() const;
  95. void set_movie_maker_enabled(bool p_enabled);
  96. bool is_movie_maker_enabled() const;
  97. void update_profiler_autostart_indicator();
  98. Button *get_pause_button() { return pause_button; }
  99. HBoxContainer *get_buttons_container();
  100. EditorRunBar();
  101. };
  102. #endif // EDITOR_RUN_BAR_H