mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-21 15:56:40 +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.
149 lines
2.7 KiB
INI
149 lines
2.7 KiB
INI
#textdomain wesnoth-lib
|
|
###
|
|
### Definition of a slider.
|
|
###
|
|
|
|
#define _GUI_STATE IMAGE_SUFFIX GROOVE_SELECTED_COLOR GROOVE_UNSELECTED_COLOR TEXT_COLOR RIGHT_OFFSET FONT_SIZE
|
|
[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 - ({RIGHT_OFFSET} + 1))"
|
|
y2 = "(height / 2)"
|
|
|
|
color = {GROOVE_UNSELECTED_COLOR}
|
|
thickness = 1
|
|
[/line]
|
|
|
|
#
|
|
# Text
|
|
#
|
|
|
|
[text]
|
|
x = "(width - {RIGHT_OFFSET} + 7)"
|
|
y = {GUI__TEXT_VERTICALLY_CENTRED}
|
|
w = "{RIGHT_OFFSET}"
|
|
h = "(height)"
|
|
|
|
font_size = {FONT_SIZE}
|
|
color = {TEXT_COLOR}
|
|
text = "(text)"
|
|
[/text]
|
|
|
|
#
|
|
# 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_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT POSITIONER_LENGTH RIGHT_OFFSET FONT_SIZE
|
|
|
|
[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}
|
|
|
|
left_offset = 0
|
|
right_offset = {RIGHT_OFFSET}
|
|
|
|
text_font_size = {FONT_SIZE}
|
|
|
|
[state_enabled]
|
|
{_GUI_STATE
|
|
".png"
|
|
({GUI__BORDER_COLOR})
|
|
({GUI__BORDER_COLOR_DARK})
|
|
({GUI__FONT_COLOR_ENABLED__DEFAULT})
|
|
({RIGHT_OFFSET})
|
|
({FONT_SIZE})
|
|
}
|
|
[/state_enabled]
|
|
|
|
[state_disabled]
|
|
{_GUI_STATE
|
|
".png~GS()"
|
|
({GUI__FONT_COLOR_DISABLED__DEFAULT})
|
|
({GUI__FONT_COLOR_DISABLED_DARK__DEFAULT})
|
|
({GUI__FONT_COLOR_DISABLED__DEFAULT})
|
|
({RIGHT_OFFSET})
|
|
({FONT_SIZE})
|
|
}
|
|
[/state_disabled]
|
|
|
|
[state_pressed]
|
|
{_GUI_STATE
|
|
"-pressed.png"
|
|
({GUI__BORDER_COLOR})
|
|
({GUI__BORDER_COLOR_DARK})
|
|
({GUI__FONT_COLOR_ENABLED__DEFAULT})
|
|
({RIGHT_OFFSET})
|
|
({FONT_SIZE})
|
|
}
|
|
[/state_pressed]
|
|
|
|
[state_focused]
|
|
{_GUI_STATE
|
|
"-active.png"
|
|
({GUI__BORDER_COLOR})
|
|
({GUI__BORDER_COLOR_DARK})
|
|
({GUI__FONT_COLOR_ENABLED__DEFAULT})
|
|
({RIGHT_OFFSET})
|
|
({FONT_SIZE})
|
|
}
|
|
[/state_focused]
|
|
|
|
[/resolution]
|
|
#enddef
|
|
|
|
[slider_definition]
|
|
id = "default"
|
|
description = "A slider with it's value on the right hand side."
|
|
|
|
{_GUI_RESOLUTION () 150 250 22 16 50 ({GUI_NORMAL__FONT_SIZE__DEFAULT}) }
|
|
|
|
[/slider_definition]
|
|
|
|
[slider_definition]
|
|
id = "short"
|
|
description = "A slider with it's value on the right hand side."
|
|
|
|
{_GUI_RESOLUTION () 50 150 22 16 50 ({GUI_NORMAL__FONT_SIZE__SMALL}) }
|
|
|
|
[/slider_definition]
|
|
|
|
#undef _GUI_STATE
|
|
#undef _GUI_RESOLUTION
|