New design for vertical scrollbars (horizontal pending)

This commit is contained in:
Charles Dang 2016-04-03 23:31:09 +11:00
parent 00b571a8e1
commit 0708069cc2
23 changed files with 217 additions and 75 deletions

View file

@ -29,7 +29,7 @@
# If the text is too high it returns the top side.
# Rounding happens to the bottom side.
#define GUI__TEXT_VERTICALLY_CENTRED
"(if(text_height < height, (height - text_height + 1) / 2, 0))"
"(if(text_height < height, (height - text_height - 2) / 2, 0))"
#enddef
#define GUI__CENTERED_TEXT FONT_SIZE FONT_STYLE FONT_COLOR
@ -291,21 +291,21 @@
#enddef
#define GUI_NORMAL__FONT_SIZE__TINY
10
13
#enddef
#define GUI_NORMAL__FONT_SIZE__SMALL
12
15
#enddef
#define GUI_NORMAL__FONT_SIZE__DEFAULT
14
17
#enddef
#define GUI_NORMAL__FONT_SIZE__LARGE
18
20
#enddef
#define GUI_NORMAL__FONT_SIZE__TITLE
20
24
#enddef

View file

@ -13,7 +13,7 @@ vertical_grow = "true"
# note we want a special button definition for this later.
[repeating_button]
id = "_half_page_up"
definition = "up_arrow"
definition = "scrollbar_up_arrow"
[/repeating_button]
[/column]
@ -22,7 +22,8 @@ vertical_grow = "true"
[row]
grow_factor = 1
grow_factor = 1
[column]
vertical_grow = "true"
@ -42,7 +43,7 @@ vertical_grow = "true"
# note we want a special button definition for this later.
[repeating_button]
id = "_half_page_down"
definition = "down_arrow"
definition = "scrollbar_down_arrow"
[/repeating_button]
[/column]

View file

@ -157,22 +157,6 @@
# Transparent arrow buttons
{_GUI_DEFINITION
"down_arrow_transparent"
"Down arrow button for a transparent scrollbar."
"buttons/button_square/button_square_25"
"icons/arrows/arrows_ornate_down_25"
"~O(65%)"
}
{_GUI_DEFINITION
"up_arrow_transparent"
"Up arrow button for a transparent scrollbar."
"buttons/button_square/button_square_25"
"icons/arrows/arrows_ornate_up_25"
"~O(65%)"
}
{_GUI_DEFINITION
"left_arrow_transparent"
"Left arrow button for a transparent scrollbar."
@ -191,4 +175,3 @@
#undef _GUI_DEFINITION
#undef _GUI_RESOLUTION

View file

@ -0,0 +1,190 @@
#textdomain wesnoth-lib
###
### Definition of repeating buttons for scrollbar arrows
###
#define _GUI_RESOLUTION RESOLUTION SIZE IMAGE_OVERLAY IPF ALPHA
[resolution]
{RESOLUTION}
min_width = {SIZE}
min_height = {SIZE}
default_width = {SIZE}
default_height = {SIZE}
max_width = {SIZE}
max_height = {SIZE}
[state_enabled]
[draw]
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
fill_color = "4, 4, 4, {ALPHA}"
[/rectangle]
[image]
w = {SIZE}
h = {SIZE}
name = {IMAGE_OVERLAY} + ".png{IPF}"
[/image]
[/draw]
[/state_enabled]
[state_disabled]
[draw]
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
fill_color = "4, 4, 4, {ALPHA}"
[/rectangle]
[image]
w = {SIZE}
h = {SIZE}
name = {IMAGE_OVERLAY} + ".png~GS(){IPF}"
[/image]
[/draw]
[/state_disabled]
[state_pressed]
[draw]
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
fill_color = "4, 4, 4, {ALPHA}"
[/rectangle]
[image]
w = {SIZE}
h = {SIZE}
name = {IMAGE_OVERLAY} + "-pressed.png{IPF}"
[/image]
[/draw]
[/state_pressed]
[state_focused]
[draw]
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
fill_color = "4, 4, 4, {ALPHA}"
[/rectangle]
[image]
w = {SIZE}
h = {SIZE}
name = {IMAGE_OVERLAY} + "-active.png{IPF}"
[/image]
[/draw]
[/state_focused]
[/resolution]
#enddef
#define _GUI_DEFINITION ID DESCRIPTION IMAGE_OVERLAY IPF ALPHA
[repeating_button_definition]
id = {ID}
description = {DESCRIPTION}
{_GUI_RESOLUTION () 15 ({IMAGE_OVERLAY}) ({IPF}) ({ALPHA})}
[/repeating_button_definition]
#enddef
{_GUI_DEFINITION
"scrollbar_up_arrow"
"Up arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)~ROTATE(-90)")
"255"
}
{_GUI_DEFINITION
"scrollbar_down_arrow"
"Down arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)~ROTATE(90)")
"255"
}
{_GUI_DEFINITION
"scrollbar_left_arrow"
"Up arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)~ROTATE(180)")
"255"
}
{_GUI_DEFINITION
"scrollbar_right_arrow"
"Down arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)")
"255"
}
#
# Transparent versions
#
{_GUI_DEFINITION
"scrollbar_up_arrow_transparent"
"Up arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)~ROTATE(-90)~O(65%)")
"165"
}
{_GUI_DEFINITION
"scrollbar_down_arrow_transparent"
"Down arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)~ROTATE(90)~O(65%)")
"165"
}
{_GUI_DEFINITION
"scrollbar_left_arrow_transparent"
"Up arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)~ROTATE(180)~O(65%)")
"165"
}
{_GUI_DEFINITION
"scrollbar_right_arrow_transparent"
"Down arrow button for a scrollbar."
"icons/arrows/short_arrow_right_25"
("~CROP(4,4,17,17)~O(65%)")
"165"
}
#undef _GUI_DEFINITION
#undef _GUI_RESOLUTION

View file

@ -3,35 +3,20 @@
### Definition of a vertical scrollbar.
###
#define _GUI_STATE GROOVE_TOP GROOVE_BOTTOM POSITIONER_TOP POSITIONER_BOTTOM IMAGE_SUFFIX IPF
#define _GUI_STATE POSITIONER_TOP IMAGE_SUFFIX IPF
[draw]
#
# Groove
#
[image]
# 4 pixels high
[rectangle]
x = 0
y = 0
name = "buttons/scrollbars/scrollgroove-top.png{IPF}"
[/image]
[image]
x = 0
y = {GROOVE_TOP}
h = "(if(height - {GROOVE_TOP} - {GROOVE_BOTTOM} < 0
, 0, height - {GROOVE_TOP} - {GROOVE_BOTTOM}))"
resize_mode = "stretch"
name = "buttons/scrollbars/scrollgroove-mid.png{IPF}"
[/image]
[image]
# 5 pixels high
x = 0
y = "(height - {GROOVE_BOTTOM})"
name = "buttons/scrollbars/scrollgroove-bottom.png{IPF}"
[/image]
w = "(width)"
h = "(height)"
fill_color = "4, 4, 4, 255"
[/rectangle]
#
# Positioner
@ -48,8 +33,8 @@
x = 0
y = "(positioner_offset + {POSITIONER_TOP})"
h = "(
if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
, 0, positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM}))"
if(positioner_length - {POSITIONER_TOP} < 0
, 0, positioner_length - {POSITIONER_TOP}))"
resize_mode = "stretch"
name = "buttons/scrollbars/scrollmid{IMAGE_SUFFIX}{IPF}"
[/image]
@ -57,14 +42,14 @@ if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
[image]
# 5 pixels high
x = 0
y = "(positioner_offset + positioner_length - {POSITIONER_BOTTOM})"
y = "(positioner_offset + positioner_length)"
name = "buttons/scrollbars/scrollbottom{IMAGE_SUFFIX}{IPF}"
[/image]
[/draw]
#enddef
#define _GUI_RESOLUTION RESOLUTION WIDTH HEIGHT POSITIONER_LENGHT GROOVE_TOP GROOVE_BOTTOM POSITIONER_TOP POSITIONER_BOTTOM IPF
#define _GUI_RESOLUTION RESOLUTION WIDTH HEIGHT POSITIONER_LENGHT POSITIONER_TOP IPF
[resolution]
{RESOLUTION}
@ -72,7 +57,7 @@ if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
min_width = {WIDTH}
min_height = {HEIGHT}
default_width = {WIDTH}
default_width = 15
default_height = {HEIGHT}
max_width = {WIDTH}
@ -84,19 +69,19 @@ if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
bottom_offset = 0
[state_enabled]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) ".png" ({IPF}) }
{_GUI_STATE ({POSITIONER_TOP}) ".png" ({IPF}) }
[/state_enabled]
[state_disabled]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) ".png~GS()" ({IPF}) }
{_GUI_STATE ({POSITIONER_TOP}) ".png~GS()" ({IPF}) }
[/state_disabled]
[state_pressed]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-pressed.png" ({IPF}) }
{_GUI_STATE ({POSITIONER_TOP}) "-pressed.png" ({IPF}) }
[/state_pressed]
[state_focused]
{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-active.png" ({IPF}) }
{_GUI_STATE ({POSITIONER_TOP}) "-active.png" ({IPF}) }
[/state_focused]
[/resolution]
#enddef
@ -108,27 +93,10 @@ if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
# Note a scrollbar is normally sized by the item that "masters" it
# that's why the default height is rather low.
{_GUI_RESOLUTION () 25 20 11 4 5 5 5 ()}
{_GUI_RESOLUTION () 25 20 11 2 ()}
[/vertical_scrollbar_definition]
#
# This is meant to be used for a minimal scrollbar definition, removing the
# up/down toggle buttons and reducing the width of the bar by 8 px.
# However, since the toggle buttons on a scrollbar panel aren't definition-
# dependent, this is commented out for now.
#
#[vertical_scrollbar_definition]
# id = "minimal"
# description = "a minimal vertical scrollbar"
#
# # Note a scrollbar is normally sized by the item that "masters" it
# # that's why the default height is rather low.
# {_GUI_RESOLUTION () 17 20 11 4 5 4 4 ()}
#
#[/vertical_scrollbar_definition]
[vertical_scrollbar_definition]
id = "transparent"
description = "a transparent vertical scrollbar"
@ -136,7 +104,7 @@ if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
# Note a scrollbar is normally sized by the item that "masters" it
# that's why the default height is rather low.
{_GUI_RESOLUTION () 25 20 11 4 5 5 5 "~O(65%)"}
{_GUI_RESOLUTION () 25 20 11 5 "~O(65%)"}
[/vertical_scrollbar_definition]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 158 B