Change the vertical scrollbar to use more macros...

...and be usable with tiny-gui.
This commit is contained in:
Mark de Wever 2008-08-23 16:54:18 +00:00
parent 948d239017
commit 56c14b6372

View file

@ -2,7 +2,7 @@
### Definition of a vertical scrollbar.
###
#define STATE IMAGE_SUFFIX
#define _GUI_STATE GROOVE_TOP GROOVE_BOTTOM POSITIONER_TOP POSITIONER_BOTTOM IMAGE_SUFFIX
full_redraw = "true"
[draw]
@ -20,8 +20,8 @@ full_redraw = "true"
[image]
x = 0
y = 4
h = "(height - 9)"
y = {GROOVE_TOP}
h = "(height - " + {GROOVE_TOP} + " - " + {GROOVE_BOTTOM} + ")"
stretch = true
name = "buttons/scrollgroove-mid.png"
[/image]
@ -29,10 +29,14 @@ full_redraw = "true"
[image]
# 5 pixels high
x = 0
y = "(height - 5)"
y = "(height - " + {GROOVE_BOTTOM} + ")"
name = "buttons/scrollgroove-bottom.png"
[/image]
#
# Positioner
#
[image]
# 5 pixels high
x = 0
@ -40,14 +44,10 @@ full_redraw = "true"
name = "buttons/scrolltop" + {IMAGE_SUFFIX}
[/image]
#
# Positioner
#
[image]
x = 0
y = "(positioner_offset + 5)"
h = "(positioner_length - 10)"
y = "(positioner_offset + " + {POSITIONER_TOP} + ")"
h = "(positioner_length - " + {POSITIONER_TOP} + " - " + {POSITIONER_BOTTOM} + ")"
stretch = true
name = "buttons/scrollmid"+ {IMAGE_SUFFIX}
[/image]
@ -55,53 +55,62 @@ full_redraw = "true"
[image]
# 5 pixels high
x = 0
y = "(positioner_offset + positioner_length - 5)"
y = "(positioner_offset + positioner_length - " + {POSITIONER_BOTTOM} + ")"
name = "buttons/scrollbottom" + {IMAGE_SUFFIX}
[/image]
[/draw]
#enddef
#define _GUI_RESOLUTION RESOLUTION WIDTH HEIGHT POSITIONER_LENGHT GROOVE_TOP GROOVE_BOTTOM POSITIONER_TOP POSITIONER_BOTTOM
[resolution]
{RESOLUTION}
min_width = {WIDTH}
min_height = {HEIGHT}
default_width = {WIDTH}
default_height = {HEIGHT}
max_width = {WIDTH}
max_height = 0
minimum_positioner_length = {POSITIONER_LENGHT}
top_offset = 0
bottom_offset = 0
[state_enabled]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) ".png"}
[/state_enabled]
[state_disabled]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-disabled.png"}
[/state_disabled]
[state_pressed]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-pressed.png"}
[/state_pressed]
[state_focussed]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-active.png"}
[/state_focussed]
[/resolution]
#enddef
[vertical_scrollbar_definition]
id = "default"
description = "a vertical scrollbar"
[resolution]
# Note a scrollbar is normally sized by the item that "masters" it
# that's why the default height is rather low.
min_width = 25
min_height = 20
# Note a scrollbar is normally sized by the item that "masters" it
# that's why the default height is rather low.
default_width = 25
default_height = 20
max_width = 25
max_height = 0
minimum_positioner_length = 11
top_offset = 0
bottom_offset = 0
[state_enabled]
{STATE ".png"}
[/state_enabled]
[state_disabled]
{STATE "-disabled.png"}
[/state_disabled]
[state_pressed]
{STATE "-pressed.png"}
[/state_pressed]
[state_focussed]
{STATE "-active.png"}
[/state_focussed]
[/resolution]
# Tiny gui sizes haven't been tested yet so might need some tuning.
{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 12 20 11 2 2 2 2}
{_GUI_RESOLUTION () 25 20 11 4 5 5 5}
[/vertical_scrollbar_definition]
#undef STATE
#undef _GUI_STATE
#undef _GUI_RESOLUTION