diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index 47f715ba48b..f3459a218b5 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -525,6 +525,9 @@ [Color] of the guideline. The guideline is a line drawn between each row of items. + + [Color] used to modulate the [theme_item scroll_hint] texture. + The horizontal spacing between items. diff --git a/doc/classes/ScrollContainer.xml b/doc/classes/ScrollContainer.xml index 988748b398a..515cf300d8e 100644 --- a/doc/classes/ScrollContainer.xml +++ b/doc/classes/ScrollContainer.xml @@ -129,6 +129,12 @@ + + [Color] used to modulate the [theme_item scroll_hint_horizontal] texture. + + + [Color] used to modulate the [theme_item scroll_hint_vertical] texture. + The space between the ScrollContainer's vertical scroll bar and its content, in pixels. No space will be added when the content's minimum size is larger than the ScrollContainer's size. diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index 5faa3bda683..12a663b61e0 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -573,6 +573,9 @@ The default [Color] of the relationship lines. + + [Color] used to modulate the [theme_item scroll_hint] texture. + Default text [Color] of the title button. diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index bf121bd2610..6d66d3f6a86 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1711,10 +1711,10 @@ void ItemList::_notification(int p_what) { if (v_scroll_value > 1 || v_scroll_below_max) { int hint_height = theme_cache.scroll_hint->get_height(); if ((scroll_hint_mode == SCROLL_HINT_MODE_BOTH || scroll_hint_mode == SCROLL_HINT_MODE_TOP) && v_scroll_value > 1) { - draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(), Size2(control_size.width, hint_height)), tile_scroll_hint); + draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(), Size2(control_size.width, hint_height)), tile_scroll_hint, theme_cache.scroll_hint_color); } if ((scroll_hint_mode == SCROLL_HINT_MODE_BOTH || scroll_hint_mode == SCROLL_HINT_MODE_BOTTOM) && v_scroll_below_max) { - draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(0, control_size.height - hint_height), Size2(control_size.width, -hint_height)), tile_scroll_hint); + draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(0, control_size.height - hint_height), Size2(control_size.width, -hint_height)), tile_scroll_hint, theme_cache.scroll_hint_color); } } } @@ -2442,6 +2442,7 @@ void ItemList::_bind_methods() { BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_CONSTANT, ItemList, font_outline_size, "outline_size"); BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ItemList, font_outline_color); BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, ItemList, scroll_hint); + BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ItemList, scroll_hint_color); BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, ItemList, line_separation); BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, ItemList, icon_margin); diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 2a06e5c306f..6259bb1e374 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -188,6 +188,7 @@ protected: Color guide_color; Ref scroll_hint; + Color scroll_hint_color; } theme_cache; void _notification(int p_what); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 4d712e3007e..7794443daf6 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -619,6 +619,7 @@ void ScrollContainer::_update_scroll_hints() { bool rtl = is_layout_rtl(); if (show_vertical_hints) { scroll_hint_top_left->set_texture(theme_cache.scroll_hint_vertical); + scroll_hint_top_left->set_modulate(theme_cache.scroll_hint_vertical_color); scroll_hint_top_left->set_visible(!show_horizontal_hints && (scroll_hint_mode == SCROLL_HINT_MODE_ALL || scroll_hint_mode == SCROLL_HINT_MODE_TOP_AND_LEFT) && v_scroll_value > 1); scroll_hint_top_left->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, rtl ? -size.x : 0); scroll_hint_top_left->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, rtl ? 0 : size.x); @@ -628,6 +629,7 @@ void ScrollContainer::_update_scroll_hints() { scroll_hint_bottom_right->set_flip_h(false); scroll_hint_bottom_right->set_flip_v(true); scroll_hint_bottom_right->set_texture(theme_cache.scroll_hint_vertical); + scroll_hint_bottom_right->set_modulate(theme_cache.scroll_hint_vertical_color); scroll_hint_bottom_right->set_visible(!show_horizontal_hints && (scroll_hint_mode == SCROLL_HINT_MODE_ALL || scroll_hint_mode == SCROLL_HINT_MODE_BOTTOM_AND_RIGHT) && v_scroll_below_max); scroll_hint_bottom_right->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, rtl ? -size.x : 0); scroll_hint_bottom_right->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, rtl ? 0 : size.x); @@ -635,6 +637,7 @@ void ScrollContainer::_update_scroll_hints() { scroll_hint_bottom_right->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0); } else { scroll_hint_top_left->set_texture(theme_cache.scroll_hint_horizontal); + scroll_hint_top_left->set_modulate(theme_cache.scroll_hint_horizontal_color); scroll_hint_top_left->set_visible(!show_vertical_hints && (scroll_hint_mode == SCROLL_HINT_MODE_ALL || (rtl ? scroll_hint_mode == SCROLL_HINT_MODE_BOTTOM_AND_RIGHT : scroll_hint_mode == SCROLL_HINT_MODE_TOP_AND_LEFT)) && h_scroll_value > 1); scroll_hint_top_left->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, rtl ? (size.x - theme_cache.scroll_hint_horizontal->get_width()) : 0); scroll_hint_top_left->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_BEGIN, rtl ? size.x : theme_cache.scroll_hint_horizontal->get_width()); @@ -644,6 +647,7 @@ void ScrollContainer::_update_scroll_hints() { scroll_hint_bottom_right->set_flip_h(true); scroll_hint_bottom_right->set_flip_v(false); scroll_hint_bottom_right->set_texture(theme_cache.scroll_hint_horizontal); + scroll_hint_bottom_right->set_modulate(theme_cache.scroll_hint_horizontal_color); scroll_hint_bottom_right->set_visible(!show_vertical_hints && (scroll_hint_mode == SCROLL_HINT_MODE_ALL || (rtl ? scroll_hint_mode == SCROLL_HINT_MODE_TOP_AND_LEFT : scroll_hint_mode == SCROLL_HINT_MODE_BOTTOM_AND_RIGHT)) && h_scroll_below_max); scroll_hint_bottom_right->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, rtl ? -size.x : -theme_cache.scroll_hint_horizontal->get_width()); scroll_hint_bottom_right->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, rtl ? (-size.x + theme_cache.scroll_hint_horizontal->get_width()) : 0); @@ -872,6 +876,9 @@ void ScrollContainer::_bind_methods() { BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, ScrollContainer, scroll_hint_vertical); BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, ScrollContainer, scroll_hint_horizontal); + BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ScrollContainer, scroll_hint_vertical_color); + BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ScrollContainer, scroll_hint_horizontal_color); + GLOBAL_DEF("gui/common/default_scroll_deadzone", 0); } diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h index 6f1f9fd9c0b..6ef12617e21 100644 --- a/scene/gui/scroll_container.h +++ b/scene/gui/scroll_container.h @@ -98,6 +98,9 @@ private: Ref scroll_hint_vertical; Ref scroll_hint_horizontal; + Color scroll_hint_vertical_color; + Color scroll_hint_horizontal_color; + int scrollbar_h_separation = 0; int scrollbar_v_separation = 0; } theme_cache; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index fd8e963aaee..3efd6bc8e0b 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -5140,10 +5140,10 @@ void Tree::_notification(int p_what) { if (v_scroll_value > 1 || v_scroll_below_max) { int hint_height = theme_cache.scroll_hint->get_height(); if ((scroll_hint_mode == SCROLL_HINT_MODE_BOTH || scroll_hint_mode == SCROLL_HINT_MODE_TOP) && v_scroll_value > 1) { - draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(), Size2(size.width, hint_height)), tile_scroll_hint); + draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(), Size2(size.width, hint_height)), tile_scroll_hint, theme_cache.scroll_hint_color); } if ((scroll_hint_mode == SCROLL_HINT_MODE_BOTH || scroll_hint_mode == SCROLL_HINT_MODE_BOTTOM) && v_scroll_below_max) { - draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(0, size.height - hint_height), Size2(size.width, -hint_height)), tile_scroll_hint); + draw_texture_rect(theme_cache.scroll_hint, Rect2(Point2(0, size.height - hint_height), Size2(size.width, -hint_height)), tile_scroll_hint, theme_cache.scroll_hint_color); } } } @@ -6815,6 +6815,7 @@ void Tree::_bind_methods() { BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, Tree, select_arrow); BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, Tree, updown); BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, Tree, scroll_hint); + BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, Tree, scroll_hint_color); BIND_THEME_ITEM(Theme::DATA_TYPE_STYLEBOX, Tree, custom_button); BIND_THEME_ITEM(Theme::DATA_TYPE_STYLEBOX, Tree, custom_button_hover); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 301a98263ad..fe527f93457 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -644,6 +644,7 @@ private: Color children_hl_line_color; Color custom_button_font_highlight; Color font_outline_color; + Color scroll_hint_color; float base_scale = 1.0; int font_outline_size = 0; diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cpp index aae90f29f92..7422c866b54 100644 --- a/scene/theme/default_theme.cpp +++ b/scene/theme/default_theme.cpp @@ -666,6 +666,8 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_icon("scroll_hint_vertical", "ScrollContainer", icons["scroll_hint_vertical"]); theme->set_icon("scroll_hint_horizontal", "ScrollContainer", icons["scroll_hint_horizontal"]); + theme->set_color("scroll_hint_vertical_color", "ScrollContainer", Color(0, 0, 0)); + theme->set_color("scroll_hint_horizontal_color", "ScrollContainer", Color(0, 0, 0)); // Window @@ -907,6 +909,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("parent_hl_line_color", "Tree", Color(0.27, 0.27, 0.27)); theme->set_color("children_hl_line_color", "Tree", Color(0.27, 0.27, 0.27)); theme->set_color("custom_button_font_highlight", "Tree", control_font_hover_color); + theme->set_color("scroll_hint_color", "Tree", Color(0, 0, 0)); theme->set_constant("h_separation", "Tree", Math::round(4 * scale)); theme->set_constant("v_separation", "Tree", Math::round(4 * scale)); @@ -952,6 +955,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("font_selected_color", "ItemList", control_font_pressed_color); theme->set_color("font_outline_color", "ItemList", Color(0, 0, 0)); theme->set_color("guide_color", "ItemList", Color(0.7, 0.7, 0.7, 0.25)); + theme->set_color("scroll_hint_color", "ItemList", Color(0, 0, 0)); theme->set_stylebox("hovered", "ItemList", make_flat_stylebox(Color(1, 1, 1, 0.07))); theme->set_stylebox("hovered_selected", "ItemList", make_flat_stylebox(style_hover_selected_color)); theme->set_stylebox("hovered_selected_focus", "ItemList", make_flat_stylebox(style_hover_selected_color)); diff --git a/scene/theme/icons/scroll_hint_horizontal.svg b/scene/theme/icons/scroll_hint_horizontal.svg index 04e9c01fa0e..7953e0883fe 100644 --- a/scene/theme/icons/scroll_hint_horizontal.svg +++ b/scene/theme/icons/scroll_hint_horizontal.svg @@ -1 +1 @@ - + diff --git a/scene/theme/icons/scroll_hint_vertical.svg b/scene/theme/icons/scroll_hint_vertical.svg index e504619b8d9..6e408e01ec8 100644 --- a/scene/theme/icons/scroll_hint_vertical.svg +++ b/scene/theme/icons/scroll_hint_vertical.svg @@ -1 +1 @@ - +