Add style for highlighted Slider grab area
(cherry picked from commit 4c8173af0f
)
This commit is contained in:
parent
6fa871027c
commit
18c5ef5473
3 changed files with 7 additions and 2 deletions
|
@ -958,12 +958,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||||
theme->set_icon("grabber", "HSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons"));
|
theme->set_icon("grabber", "HSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons"));
|
||||||
theme->set_stylebox("slider", "HSlider", make_flat_stylebox(dark_color_3, 0, default_margin_size / 2, 0, default_margin_size / 2));
|
theme->set_stylebox("slider", "HSlider", make_flat_stylebox(dark_color_3, 0, default_margin_size / 2, 0, default_margin_size / 2));
|
||||||
theme->set_stylebox("grabber_area", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2));
|
theme->set_stylebox("grabber_area", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2));
|
||||||
|
theme->set_stylebox("grabber_area_highlight", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2));
|
||||||
|
|
||||||
// VSlider
|
// VSlider
|
||||||
theme->set_icon("grabber", "VSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons"));
|
theme->set_icon("grabber", "VSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons"));
|
||||||
theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons"));
|
theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons"));
|
||||||
theme->set_stylebox("slider", "VSlider", make_flat_stylebox(dark_color_3, default_margin_size / 2, 0, default_margin_size / 2, 0));
|
theme->set_stylebox("slider", "VSlider", make_flat_stylebox(dark_color_3, default_margin_size / 2, 0, default_margin_size / 2, 0));
|
||||||
theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0));
|
theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0));
|
||||||
|
theme->set_stylebox("grabber_area_highlight", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0));
|
||||||
|
|
||||||
//RichTextLabel
|
//RichTextLabel
|
||||||
theme->set_color("default_color", "RichTextLabel", font_color);
|
theme->set_color("default_color", "RichTextLabel", font_color);
|
||||||
|
|
|
@ -166,8 +166,9 @@ void Slider::_notification(int p_what) {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
Size2i size = get_size();
|
Size2i size = get_size();
|
||||||
Ref<StyleBox> style = get_stylebox("slider");
|
Ref<StyleBox> style = get_stylebox("slider");
|
||||||
Ref<StyleBox> grabber_area = get_stylebox("grabber_area");
|
bool highlighted = mouse_inside || has_focus();
|
||||||
Ref<Texture> grabber = get_icon(editable ? ((mouse_inside || has_focus()) ? "grabber_highlight" : "grabber") : "grabber_disabled");
|
Ref<StyleBox> grabber_area = get_stylebox(highlighted ? "grabber_area_highlight" : "grabber_area");
|
||||||
|
Ref<Texture> grabber = get_icon(editable ? (highlighted ? "grabber_highlight" : "grabber") : "grabber_disabled");
|
||||||
Ref<Texture> tick = get_icon("tick");
|
Ref<Texture> tick = get_icon("tick");
|
||||||
double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();
|
double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();
|
||||||
|
|
||||||
|
|
|
@ -496,6 +496,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
|
||||||
|
|
||||||
theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
|
theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
|
||||||
theme->set_stylebox("grabber_area", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
|
theme->set_stylebox("grabber_area", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
|
||||||
|
theme->set_stylebox("grabber_area_highlight", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
|
||||||
|
|
||||||
theme->set_icon("grabber", "HSlider", make_icon(hslider_grabber_png));
|
theme->set_icon("grabber", "HSlider", make_icon(hslider_grabber_png));
|
||||||
theme->set_icon("grabber_highlight", "HSlider", make_icon(hslider_grabber_hl_png));
|
theme->set_icon("grabber_highlight", "HSlider", make_icon(hslider_grabber_hl_png));
|
||||||
|
@ -506,6 +507,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
|
||||||
|
|
||||||
theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
|
theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
|
||||||
theme->set_stylebox("grabber_area", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
|
theme->set_stylebox("grabber_area", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
|
||||||
|
theme->set_stylebox("grabber_area_highlight", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
|
||||||
|
|
||||||
theme->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png));
|
theme->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png));
|
||||||
theme->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png));
|
theme->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png));
|
||||||
|
|
Loading…
Reference in a new issue