| 47 | #include "scene/gui/button.h" |
| 48 | |
| 49 | void EditorMainScreen::_notification(int p_what) { |
| 50 | switch (p_what) { |
| 51 | case NOTIFICATION_READY: { |
| 52 | if (EDITOR_3D < buttons.size() && buttons[EDITOR_3D]->is_visible()) { |
| 53 | // If the 3D editor is enabled, use this as the default. |
| 54 | select(EDITOR_3D); |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | // Switch to the first main screen plugin that is enabled. Usually this is |
| 59 | // 2D, but may be subsequent ones if 2D is disabled in the feature profile. |
| 60 | for (int i = 0; i < buttons.size(); i++) { |
| 61 | Button *editor_button = buttons[i]; |
| 62 | if (editor_button->is_visible()) { |
| 63 | select(i); |
| 64 | return; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | select(-1); |
| 69 | } break; |
| 70 | case NOTIFICATION_THEME_CHANGED: { |
| 71 | for (int i = 0; i < buttons.size(); i++) { |
| 72 | Button *tb = buttons[i]; |
| 73 | EditorPlugin *p_editor = editor_table[i]; |
| 74 | Ref<Texture2D> icon = p_editor->get_plugin_icon(); |
| 75 | |
| 76 | if (icon.is_valid()) { |
| 77 | tb->set_button_icon(icon); |
| 78 | } else if (has_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))) { |
| 79 | tb->set_button_icon(get_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))); |
| 80 | } |
| 81 | } |
| 82 | } break; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | void EditorMainScreen::set_button_container(HBoxContainer *p_button_hb) { |
| 87 | button_hb = p_button_hb; |
nothing calls this directly
no test coverage detected