diff --git a/editor/doc/editor_help.cpp b/editor/doc/editor_help.cpp index ee6f8c033c3..b20e9ccee8a 100644 --- a/editor/doc/editor_help.cpp +++ b/editor/doc/editor_help.cpp @@ -4588,11 +4588,11 @@ void EditorHelpBit::update_content_height() { content->set_custom_minimum_size(Size2(content->get_custom_minimum_size().x, CLAMP(content_height, content_min_height, content_max_height))); } -EditorHelpBit::EditorHelpBit(const String &p_symbol, const String &p_prologue, bool p_use_class_prefix, bool p_allow_selection) { +EditorHelpBit::EditorHelpBit(const String &p_symbol, const String &p_prologue, bool p_use_class_prefix, bool p_allow_selection, bool p_in_tooltip) { add_theme_constant_override("separation", 0); title = memnew(RichTextLabel); - title->set_theme_type_variation("EditorHelpBitTitle"); + title->set_theme_type_variation(p_in_tooltip ? "EditorHelpBitTooltipTitle" : "EditorHelpBitTitle"); title->set_custom_minimum_size(Size2(640 * EDSCALE, 0)); // GH-93031. Set the minimum width even if `fit_content` is true. title->set_fit_content(true); title->set_selection_enabled(p_allow_selection); @@ -4606,7 +4606,7 @@ EditorHelpBit::EditorHelpBit(const String &p_symbol, const String &p_prologue, b content_max_height = 360 * EDSCALE; content = memnew(RichTextLabel); - content->set_theme_type_variation("EditorHelpBitContent"); + content->set_theme_type_variation(p_in_tooltip ? "EditorHelpBitTooltipContent" : "EditorHelpBitContent"); content->set_custom_minimum_size(Size2(640 * EDSCALE, content_min_height)); content->set_v_size_flags(Control::SIZE_EXPAND_FILL); content->set_selection_enabled(p_allow_selection); @@ -4707,7 +4707,7 @@ Control *EditorHelpBitTooltip::make_tooltip(Control *p_target, const String &p_s return _make_invisible_control(); } - EditorHelpBit *help_bit = memnew(EditorHelpBit(p_symbol, p_prologue, p_use_class_prefix, false)); + EditorHelpBit *help_bit = memnew(EditorHelpBit(p_symbol, p_prologue, p_use_class_prefix, false, true)); EditorHelpBitTooltip *tooltip = memnew(EditorHelpBitTooltip(p_target)); help_bit->connect("request_hide", callable_mp(static_cast(tooltip), &Node::queue_free)); diff --git a/editor/doc/editor_help.h b/editor/doc/editor_help.h index b7c92e20129..b90e012d1ef 100644 --- a/editor/doc/editor_help.h +++ b/editor/doc/editor_help.h @@ -354,7 +354,7 @@ public: void set_content_height_limits(float p_min, float p_max); void update_content_height(); - EditorHelpBit(const String &p_symbol = String(), const String &p_prologue = String(), bool p_use_class_prefix = false, bool p_allow_selection = true); + EditorHelpBit(const String &p_symbol = String(), const String &p_prologue = String(), bool p_use_class_prefix = false, bool p_allow_selection = true, bool p_in_tooltip = false); }; // Standard tooltips do not allow you to hover over them. diff --git a/editor/themes/theme_classic.cpp b/editor/themes/theme_classic.cpp index 1380bce40e5..59e201e56ee 100644 --- a/editor/themes/theme_classic.cpp +++ b/editor/themes/theme_classic.cpp @@ -2349,6 +2349,12 @@ void ThemeClassic::populate_editor_styles(const Ref &p_theme, Edito p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitContent", style); } + // EditorHelpBit tooltip type variations. + { + p_theme->set_type_variation("EditorHelpBitTooltipTitle", "EditorHelpBitTitle"); + p_theme->set_type_variation("EditorHelpBitTooltipContent", "EditorHelpBitContent"); + } + // Asset Library. p_theme->set_stylebox("bg", "AssetLib", p_config.base_empty_style); p_theme->set_stylebox(SceneStringName(panel), "AssetLib", p_config.content_panel_style); diff --git a/editor/themes/theme_modern.cpp b/editor/themes/theme_modern.cpp index 2ba77e1a024..d6226ffee55 100644 --- a/editor/themes/theme_modern.cpp +++ b/editor/themes/theme_modern.cpp @@ -2535,6 +2535,35 @@ void ThemeModern::populate_editor_styles(const Ref &p_theme, Editor p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitContent", editor_help_content_style); } + // EditorHelpBitTooltipTitle. + { + Ref style = p_theme->get_stylebox(CoreStringName(normal), "EditorHelpBitTitle")->duplicate(); + style->set_bg_color(style->get_bg_color().lerp(p_config.mono_color_inv, 0.25)); + if (!p_config.dark_theme) { + style->set_border_width_all(Math::round(2 * EDSCALE)); + style->set_border_color(p_config.mono_color * Color(1, 1, 1, 0.15)); + } + style->set_corner_radius_all(0); + + p_theme->set_type_variation("EditorHelpBitTooltipTitle", "EditorHelpBitTitle"); + p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitTooltipTitle", style); + } + + // EditorHelpBitTooltipContent. + { + Ref style = p_theme->get_stylebox(CoreStringName(normal), "EditorHelpBitContent")->duplicate(); + style->set_bg_color(style->get_bg_color().lerp(p_config.mono_color_inv, 0.25)); + if (!p_config.dark_theme) { + style->set_border_width_all(Math::round(2 * EDSCALE)); + style->set_border_width(SIDE_TOP, 0); + style->set_border_color(p_config.mono_color * Color(1, 1, 1, 0.15)); + } + style->set_corner_radius_all(0); + + p_theme->set_type_variation("EditorHelpBitTooltipContent", "EditorHelpBitContent"); + p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitTooltipContent", style); + } + // Asset Library. p_theme->set_stylebox("bg", "AssetLib", EditorThemeManager::make_empty_stylebox(p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin)); p_theme->set_stylebox(SceneStringName(panel), "AssetLib", p_config.foreground_panel);