fixed hover line for menu button

This commit is contained in:
toger5 2017-09-02 03:25:40 +02:00
parent e85f025771
commit 45d57ccf28
3 changed files with 24 additions and 8 deletions

View file

@ -283,13 +283,22 @@ void EditorNode::_notification(int p_what) {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY)); scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true))); property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
Ref<Theme> theme = create_editor_theme(theme_base->get_theme()); Ref<Theme> theme = create_editor_theme(theme_base->get_theme());
theme_base->set_theme(theme); theme_base->set_theme(theme);
gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles")); gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles")); play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles")); scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
scene_tabs->add_style_override("tab_fg", gui_base->get_stylebox("SceneTabFG", "EditorStyles")); scene_tabs->add_style_override("tab_fg", gui_base->get_stylebox("SceneTabFG", "EditorStyles"));
scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles")); scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles"));
file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
if (bool(EDITOR_DEF("interface/scene_tabs/resize_if_many_tabs", true))) { if (bool(EDITOR_DEF("interface/scene_tabs/resize_if_many_tabs", true))) {
scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE); scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
} else { } else {
@ -4829,9 +4838,10 @@ EditorNode::EditorNode() {
} }
file_menu = memnew(MenuButton); file_menu = memnew(MenuButton);
file_menu->set_flat(false);
file_menu->set_text(TTR("Scene")); file_menu->set_text(TTR("Scene"));
left_menu_hb->add_child(file_menu);
file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(file_menu);
prev_scene = memnew(ToolButton); prev_scene = memnew(ToolButton);
prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons")); prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons"));
@ -4919,6 +4929,7 @@ EditorNode::EditorNode() {
p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q); p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
project_menu = memnew(MenuButton); project_menu = memnew(MenuButton);
project_menu->set_flat(false);
project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools.")); project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
project_menu->set_text(TTR("Project")); project_menu->set_text(TTR("Project"));
project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
@ -4952,9 +4963,11 @@ EditorNode::EditorNode() {
menu_hb->add_child(editor_region); menu_hb->add_child(editor_region);
debug_menu = memnew(MenuButton); debug_menu = memnew(MenuButton);
debug_menu->set_flat(false);
debug_menu->set_text(TTR("Debug")); debug_menu->set_text(TTR("Debug"));
debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(debug_menu); left_menu_hb->add_child(debug_menu);
p = debug_menu->get_popup(); p = debug_menu->get_popup();
p->set_hide_on_item_selection(false); p->set_hide_on_item_selection(false);
p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG); p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
@ -4976,9 +4989,10 @@ EditorNode::EditorNode() {
menu_hb->add_spacer(); menu_hb->add_spacer();
settings_menu = memnew(MenuButton); settings_menu = memnew(MenuButton);
left_menu_hb->add_child(settings_menu); settings_menu->set_flat(false);
settings_menu->set_text(TTR("Editor")); settings_menu->set_text(TTR("Editor"));
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(settings_menu);
p = settings_menu->get_popup(); p = settings_menu->get_popup();
p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES); p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
@ -4993,10 +5007,12 @@ EditorNode::EditorNode() {
p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES); p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
// Help Menu // Help Menu
MenuButton *help_menu = memnew(MenuButton); help_menu = memnew(MenuButton);
left_menu_hb->add_child(help_menu); help_menu->set_flat(false);
help_menu->set_text(TTR("Help")); help_menu->set_text(TTR("Help"));
help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(help_menu);
p = help_menu->get_popup(); p = help_menu->get_popup();
p->connect("id_pressed", this, "_menu_option"); p->connect("id_pressed", this, "_menu_option");
p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES); p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES);

View file

@ -236,11 +236,12 @@ private:
MenuButton *file_menu; MenuButton *file_menu;
MenuButton *project_menu; MenuButton *project_menu;
MenuButton *debug_menu; MenuButton *debug_menu;
MenuButton *settings_menu;
MenuButton *help_menu;
PopupMenu *tool_menu; PopupMenu *tool_menu;
ToolButton *export_button; ToolButton *export_button;
ToolButton *prev_scene; ToolButton *prev_scene;
MenuButton *object_menu; MenuButton *object_menu;
MenuButton *settings_menu;
ToolButton *play_button; ToolButton *play_button;
MenuButton *native_play_button; MenuButton *native_play_button;
ToolButton *pause_button; ToolButton *pause_button;

View file

@ -303,12 +303,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_menu_hover_bg = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); Ref<StyleBoxFlat> style_menu_hover_bg = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
style_menu_hover_border->set_draw_center(false); style_menu_hover_border->set_draw_center(false);
style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width); style_menu_hover_border->set_border_width(MARGIN_BOTTOM, 2 * EDSCALE);
style_menu_hover_border->set_border_color_all(highlight_color); style_menu_hover_border->set_border_color_all(highlight_color);
style_menu_hover_border->set_expand_margin_size(MARGIN_BOTTOM, border_width);
theme->set_stylebox("normal", "MenuButton", style_menu); theme->set_stylebox("normal", "MenuButton", style_menu);
theme->set_stylebox("hover", "MenuButton", style_menu_hover_border); theme->set_stylebox("hover", "MenuButton", style_menu);
theme->set_stylebox("pressed", "MenuButton", style_menu); theme->set_stylebox("pressed", "MenuButton", style_menu);
theme->set_stylebox("focus", "MenuButton", style_menu); theme->set_stylebox("focus", "MenuButton", style_menu);
theme->set_stylebox("disabled", "MenuButton", style_menu); theme->set_stylebox("disabled", "MenuButton", style_menu);