mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 05:24:12 +00:00

This makes it so the "selected" segment of the groove (towards the slider origin) is drawn with a brighter color than the "empty" segment (opposite from the origin). Since this obviously wouldn't work with RGB #FFFFFF, and the color is too distracting anyway (it was pretty much the only widget using the general *text* color), we now use the standard UI border colors to match buttons, checkboxes and so on. This should hopefully help with harmonizing Wesnoth's UI color scheme across the board. For this purpose we also introduce a macro for a darker/shaded disabled text color, used for the unselected segment of disabled sliders.
125 lines
2.3 KiB
INI
125 lines
2.3 KiB
INI
#textdomain wesnoth-lib
|
|
###
|
|
### Experimental slider variant that does not have a text label since the
|
|
### default variant does have one that takes up more space than is strictly
|
|
### necessary and I (shadowm) can't deal with all the magic numbers in it.
|
|
###
|
|
|
|
#define _GUI_STATE IMAGE_SUFFIX GROOVE_SELECTED_COLOR GROOVE_UNSELECTED_COLOR
|
|
[draw]
|
|
|
|
#
|
|
# Groove
|
|
#
|
|
|
|
[line]
|
|
x1 = 0
|
|
y1 = "(height / 2)"
|
|
x2 = "(positioner_offset - 1)"
|
|
y2 = "(height / 2)"
|
|
|
|
color = {GROOVE_SELECTED_COLOR}
|
|
thickness = 1
|
|
[/line]
|
|
|
|
[line]
|
|
x1 = "(positioner_offset)"
|
|
y1 = "(height / 2)"
|
|
x2 = "(width - 4)"
|
|
y2 = "(height / 2)"
|
|
|
|
color = {GROOVE_UNSELECTED_COLOR}
|
|
thickness = 1
|
|
[/line]
|
|
|
|
#
|
|
# Slider
|
|
#
|
|
|
|
[image]
|
|
x = "(positioner_offset)"
|
|
y = "(if (image_height < height, (height - image_height) / 2, 0))"
|
|
name = "buttons/sliders/slider{IMAGE_SUFFIX}"
|
|
[/image]
|
|
|
|
[/draw]
|
|
#enddef
|
|
|
|
#define _GUI_SLIDER_GROOVE_SELECTED_COLOR
|
|
162, 127, 68, 255
|
|
#enddef
|
|
|
|
#define _GUI_SLIDER_GROOVE_UNSELECTED_COLOR
|
|
114, 79, 46, 255
|
|
#enddef
|
|
|
|
#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT POSITIONER_LENGTH
|
|
|
|
[resolution]
|
|
|
|
{RESOLUTION}
|
|
|
|
min_width = {MIN_WIDTH}
|
|
min_height = {HEIGHT}
|
|
|
|
default_width = {DEFAULT_WIDTH}
|
|
default_height = {HEIGHT}
|
|
|
|
max_width = 0
|
|
max_height = {HEIGHT}
|
|
|
|
minimum_positioner_length = {POSITIONER_LENGTH}
|
|
maximum_positioner_length = {POSITIONER_LENGTH}
|
|
|
|
right_offset = 3
|
|
|
|
#text_font_size = 1 # placeholder
|
|
|
|
[state_enabled]
|
|
{_GUI_STATE
|
|
".png"
|
|
({GUI__BORDER_COLOR})
|
|
({GUI__BORDER_COLOR_DARK})
|
|
}
|
|
[/state_enabled]
|
|
|
|
[state_disabled]
|
|
{_GUI_STATE
|
|
".png~GS()"
|
|
({GUI__FONT_COLOR_DISABLED__DEFAULT})
|
|
({GUI__FONT_COLOR_DISABLED_DARK__DEFAULT})
|
|
}
|
|
[/state_disabled]
|
|
|
|
[state_pressed]
|
|
{_GUI_STATE
|
|
"-pressed.png"
|
|
({GUI__BORDER_COLOR})
|
|
({GUI__BORDER_COLOR_DARK})
|
|
}
|
|
[/state_pressed]
|
|
|
|
[state_focused]
|
|
{_GUI_STATE
|
|
"-active.png"
|
|
({GUI__BORDER_COLOR})
|
|
({GUI__BORDER_COLOR_DARK})
|
|
}
|
|
[/state_focused]
|
|
|
|
[/resolution]
|
|
#enddef
|
|
|
|
[slider_definition]
|
|
id = "minimal"
|
|
description = "A slider without a value label."
|
|
|
|
{_GUI_RESOLUTION () 150 250 22 16 }
|
|
|
|
[/slider_definition]
|
|
|
|
#undef _GUI_STATE
|
|
#undef _GUI_RESOLUTION
|
|
#undef _GUI_SLIDER_GROOVE_SELECTED_COLOR
|
|
#undef _GUI_SLIDER_GROOVE_UNSELECTED_COLOR
|