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

#define _GUI_STATE GROOVE_LEFT GROOVE_RIGHT POSITIONER_LEFT POSITIONER_RIGHT IMAGE_SUFFIX IMAGE_MIDDLE
	[draw]

		#
		# Groove
		#

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

		[image]
			x = {GROOVE_LEFT}
			y = 0
			w = "(if(width - {GROOVE_LEFT} - {GROOVE_RIGHT} < 0
					, 0, width - {GROOVE_LEFT} - {GROOVE_RIGHT}))"
			h = 0
			stretch = true
			name = "buttons/scrollgroove{IMAGE_MIDDLE}-horizontal.png"
		[/image]

		[image]
			# 5 pixels wide
			x = "(width - {GROOVE_RIGHT})"
			y = 0
			name = "buttons/scrollgroove{IMAGE_MIDDLE}-right.png"
		[/image]

		#
		# Positioner
		#

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

		[image]
			x = "(positioner_offset + {POSITIONER_LEFT})"
			y = 0
			w = "(
if(positioner_length - {POSITIONER_LEFT} - {POSITIONER_RIGHT} < 0
		, 0, positioner_length - {POSITIONER_LEFT} - {POSITIONER_RIGHT}))"
			stretch = true
			name = "buttons/scrollhorizontal{IMAGE_MIDDLE}{IMAGE_SUFFIX}"
		[/image]

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

	[/draw]
#enddef

#define _GUI_RESOLUTION RESOLUTION WIDTH HEIGHT POSITIONER_LENGHT GROOVE_LEFT GROOVE_RIGHT POSITIONER_LEFT POSITIONER_RIGHT IMAGE_MIDDLE
	[resolution]

		{RESOLUTION}

		min_width = {WIDTH}
		min_height = {HEIGHT}

		default_width = {WIDTH}
		default_height = {HEIGHT}

		max_width = 0
		max_height = {HEIGHT}

		minimum_positioner_length = {POSITIONER_LENGHT}

		top_offset = 0
		bottom_offset = 0

		[state_enabled]
			{_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) ".png" ({IMAGE_MIDDLE}) }
		[/state_enabled]

		[state_disabled]
			{_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) "-disabled.png" ({IMAGE_MIDDLE}) }
		[/state_disabled]

		[state_pressed]
			{_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) "-pressed.png" ({IMAGE_MIDDLE}) }
		[/state_pressed]
		
		[state_focussed]
			{_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) "-active.png" ({IMAGE_MIDDLE}) }
		[/state_focussed]
	[/resolution]
#enddef

[horizontal_scrollbar_definition]
	id = "default"
	description = "a horizontal 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}) 20 12 11 2 2 2 2 ()}
	{_GUI_RESOLUTION ()                       20 25 11 4 5 5 5 ()}

[/horizontal_scrollbar_definition]

[horizontal_scrollbar_definition]
	id = "transparent"
	description = "a transparent horizontal 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}) 20 12 11 2 2 2 2 "_transparent"}
	{_GUI_RESOLUTION ()                       20 25 11 4 5 5 5 "_transparent"}

[/horizontal_scrollbar_definition]

#undef _GUI_STATE
#undef _GUI_RESOLUTION
