#textdomain wesnoth-lib
###
### Definition of a vertical scrollbar.
###

#define _GUI_STATE GROOVE_TOP GROOVE_BOTTOM POSITIONER_TOP POSITIONER_BOTTOM IMAGE_SUFFIX IMAGE_MIDDLE
	[draw]

		#
		# Groove
		#

		[image]
			# 4 pixels high
			x = 0
			y = 0
			name = "buttons/scrollgroove{IMAGE_MIDDLE}-top.png"
		[/image]

		[image]
			x = 0
			y = {GROOVE_TOP}
			h = "(if(height - {GROOVE_TOP} - {GROOVE_BOTTOM} < 0
					, 0, height - {GROOVE_TOP} - {GROOVE_BOTTOM}))"
			stretch = true
			name = "buttons/scrollgroove{IMAGE_MIDDLE}-mid.png"
		[/image]

		[image]
			# 5 pixels high
			x = 0
			y = "(height - {GROOVE_BOTTOM})"
			name = "buttons/scrollgroove{IMAGE_MIDDLE}-bottom.png"
		[/image]

		#
		# Positioner
		#

		[image]
			# 5 pixels high
			x = 0
			y = "(positioner_offset)"
			name = "buttons/scrolltop{IMAGE_MIDDLE}{IMAGE_SUFFIX}"
		[/image]

		[image]
			x = 0
			y = "(positioner_offset + {POSITIONER_TOP})"
			h = "(
if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0
	, 0, positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM}))"
			stretch = true
			name = "buttons/scrollmid{IMAGE_MIDDLE}{IMAGE_SUFFIX}"
		[/image]

		[image]
			# 5 pixels high
			x = 0
			y = "(positioner_offset + positioner_length - {POSITIONER_BOTTOM})"
			name = "buttons/scrollbottom{IMAGE_MIDDLE}{IMAGE_SUFFIX}"
		[/image]

	[/draw]
#enddef

#define _GUI_RESOLUTION RESOLUTION WIDTH HEIGHT POSITIONER_LENGHT GROOVE_TOP GROOVE_BOTTOM POSITIONER_TOP POSITIONER_BOTTOM IMAGE_MIDDLE
	[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" ({IMAGE_MIDDLE}) }
		[/state_enabled]

		[state_disabled]
			{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-disabled.png" ({IMAGE_MIDDLE}) }
		[/state_disabled]

		[state_pressed]
			{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-pressed.png" ({IMAGE_MIDDLE}) }
		[/state_pressed]
		
		[state_focussed]
			{_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-active.png" ({IMAGE_MIDDLE}) }
		[/state_focussed]
	[/resolution]
#enddef

[vertical_scrollbar_definition]
	id = "default"
	description = "a vertical scrollbar"

	# Note a scrollbar is normally sized by the item that "masters" it
	# that's why the default height is rather low.

	# 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]

[vertical_scrollbar_definition]
	id = "transparent"
	description = "a transparent vertical scrollbar"

	# Note a scrollbar is normally sized by the item that "masters" it
	# that's why the default height is rather low.

	# 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 "_transparent"}
	{_GUI_RESOLUTION ()                       25 20 11 4 5 5 5 "_transparent"}

[/vertical_scrollbar_definition]

#undef _GUI_STATE
#undef _GUI_RESOLUTION
