Listbox cell refactoring.

The cells in a listbox now share some more macros and the background of
the selected cell now looks like the version in the older gui.
This commit is contained in:
Mark de Wever 2008-09-02 18:03:53 +00:00
parent 011cbdf919
commit 289aaa9f0b
4 changed files with 101 additions and 37 deletions

View file

@ -70,6 +70,85 @@
{GUI__FONT_COLOUR_DISABLED__DEFAULT}
#enddef
# This colour is used as background in the listbox.
#define GUI__BACKGROUND_COLOUR_ENABLED
"21, 19, 19, 255"
#enddef
#define GUI__BACKGROUND_COLOUR_DISABLED
"64, 64, 64, 255"
#enddef
# Draws the background for a selected cell in a listbox. For now there's one
# version for both tiny and normal gui.
#define GUI__LISTBOX_SELECTED_CELL
# corners are 10x10
[image]
x = 0
y = 0
name = "misc/selection2-border-topleft.png"
[/image]
[image]
x = "(width - 10)"
y = 0
name = "misc/selection2-border-topright.png"
[/image]
[image]
x = 0
y = "(height - 10)"
name = "misc/selection2-border-botleft.png"
[/image]
[image]
x = "(width - 10)"
y = "(height - 10)"
name = "misc/selection2-border-botright.png"
[/image]
# since the lines are already quite long scale them instead of stretching
# the height of the lines is 3 pixels.
[image]
x = 10
y = 0
w = "(width - 20)"
name = "misc/selection2-border-top.png"
[/image]
[image]
x = 10
y = "(height - 3)"
w = "(width - 20)"
name = "misc/selection2-border-bottom.png"
[/image]
[image]
x = 0
y = 10
h= "(height - 20)"
name = "misc/selection2-border-left.png"
[/image]
[image]
x = "(width - 3)"
y = 10
h = "(height - 20)"
name = "misc/selection2-border-right.png"
[/image]
#main background 320 x 67
[image]
x = 3
y = 3
w = "(width - 6)"
h = "(height - 6)"
name = "misc/selection2-background.png"
[/image]
#enddef
###############################################################################
### ###
### Macros for the tiny gui. ###

View file

@ -4,15 +4,12 @@
### version doesn't support icons.
###
# FIXME we should use a background image instead of a filled rect.
#define _GUI_DRAW_RECT BORDER_COLOUR FILL_COLOUR
#define _GUI_RECT FILL_COLOUR
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
border_thickness = 1
border_colour = {BORDER_COLOUR}
fill_colour = {FILL_COLOUR}
[/rectangle]
#enddef
@ -52,8 +49,7 @@
[draw]
{_GUI_DRAW_RECT "" "0, 0, 0, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
[/draw]
@ -65,8 +61,7 @@
[draw]
{_GUI_DRAW_RECT "" "64, 64, 64, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_DISABLED}) }
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_DISABLED__DEFAULT}) }
[/draw]
@ -78,8 +73,7 @@
[draw]
{_GUI_DRAW_RECT "" "0, 0, 0, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
[/draw]
@ -95,8 +89,7 @@
[draw]
{_GUI_DRAW_RECT "170, 136, 67, 255" "9, 33, 54, 255"}
{GUI__LISTBOX_SELECTED_CELL}
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
[/draw]
@ -108,8 +101,7 @@
[draw]
{_GUI_DRAW_RECT "170, 136, 67, 255" "128, 128, 128, 255"}
{GUI__LISTBOX_SELECTED_CELL}
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
[/draw]
@ -121,8 +113,7 @@
[draw]
{_GUI_DRAW_RECT "170, 136, 67, 255" "9, 33, 54, 255"}
{GUI__LISTBOX_SELECTED_CELL}
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
[/draw]
@ -143,6 +134,6 @@
[/toggle_button_definition]
#undef _GUI_DRAW_RECT
#undef _GUI_RECT
#undef _GUI_DRAW_TEXT
#undef _GUI_RESOLUTION

View file

@ -4,15 +4,12 @@
### version supports icons with size 72 x 72.
###
# FIXME we should use a background image instead of a filled rect.
#define _GUI_RECT BORDER_COLOUR FILL_COLOUR
#define _GUI_RECT FILL_COLOUR
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
border_thickness = 1
border_colour = {BORDER_COLOUR}
fill_colour = {FILL_COLOUR}
[/rectangle]
#enddef
@ -60,7 +57,7 @@
[draw]
{_GUI_RECT "" "0, 0, 0, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
{_GUI_ICON ({ICON_OFFSET}) }
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
@ -73,7 +70,7 @@
[draw]
{_GUI_RECT "" "128, 128, 128, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_DISABLED}) }
{_GUI_ICON ({ICON_OFFSET}) }
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_DISABLED__DEFAULT}) }
@ -86,7 +83,7 @@
[draw]
{_GUI_RECT "" "0, 0, 0, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
{_GUI_ICON ({ICON_OFFSET}) }
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
@ -103,7 +100,7 @@
[draw]
{_GUI_RECT "170, 136, 67, 255" "9, 33, 54, 255"}
{GUI__LISTBOX_SELECTED_CELL}
{_GUI_ICON ({ICON_OFFSET}) }
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }
@ -116,7 +113,7 @@
[draw]
{_GUI_RECT "170, 136, 67, 255" "128, 128, 128, 255"}
{GUI__LISTBOX_SELECTED_CELL}
{_GUI_ICON ({ICON_OFFSET}) }
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_DISABLED__DEFAULT}) }
@ -129,7 +126,7 @@
[draw]
{_GUI_RECT "170, 136, 67, 255" "9, 33, 54, 255"}
{GUI__LISTBOX_SELECTED_CELL}
{_GUI_ICON ({ICON_OFFSET}) }
{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }

View file

@ -2,15 +2,12 @@
### Definition of the default toggle panel.
###
# FIXME we should use a background image instead of a filled rect.
#define _GUI_RECT BORDER_COLOUR FILL_COLOUR
#define _GUI_RECT FILL_COLOUR
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
border_thickness = 1
border_colour = {BORDER_COLOUR}
fill_colour = {FILL_COLOUR}
[/rectangle]
#enddef
@ -35,7 +32,7 @@
full_redraw = "true"
[draw]
{_GUI_RECT "" "0, 0, 0, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
[/draw]
[/state_enabled]
@ -44,7 +41,7 @@
full_redraw = "true"
[draw]
{_GUI_RECT "" "128, 128, 128, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_DISABLED}) }
[/draw]
[/state_disabled]
@ -53,7 +50,7 @@
full_redraw = "true"
[draw]
{_GUI_RECT "" "0, 0, 0, 255"}
{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
[/draw]
[/state_focussed]
@ -66,7 +63,7 @@
full_redraw = "true"
[draw]
{_GUI_RECT "170, 136, 67, 255" "9, 33, 54, 255"}
{GUI__LISTBOX_SELECTED_CELL}
[/draw]
[/state_enabled_selected]
@ -75,7 +72,7 @@
full_redraw = "true"
[draw]
{_GUI_RECT "170, 136, 67, 255" "128, 128, 128, 255"}
{GUI__LISTBOX_SELECTED_CELL}
[/draw]
[/state_disabled_selected]
@ -84,7 +81,7 @@
full_redraw = "true"
[draw]
{_GUI_RECT "170, 136, 67, 255" "9, 33, 54, 255"}
{GUI__LISTBOX_SELECTED_CELL}
[/draw]
[/state_focussed_selected]