#textdomain wesnoth-lib
###
### Definition of the listbox text toggle button.
### It's meant as line of text in a listbox note this 
### version doesn't support icons.
###

#define _GUI_RECT FILL_COLOUR
	[rectangle]
		x = 0
		y = 0
		w = "(width)"
		h = "(height)"
		fill_colour = {FILL_COLOUR}
	[/rectangle]
#enddef

#define _GUI_DRAW_TEXT FONT_SIZE FONT_COLOUR
	[text]
		x = 3
		y = {GUI__TEXT_VERTICALLY_CENTRED}
		w = "(width - 6)"
		h =  "(text_height)"
		maximum_width = "(width - 6)"
		font_size = {FONT_SIZE}
		colour = {FONT_COLOUR}
		text = "(text)"
	[/text]
#enddef


#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT EXTRA_WIDTH FONT_SIZE 
	[resolution]

		{RESOLUTION}

		min_width = {MIN_WIDTH}
		min_height = {HEIGHT}

		default_width = {DEFAULT_WIDTH}
		default_height = {HEIGHT}

		max_width = 0
		max_height = {HEIGHT}

		text_extra_width = {EXTRA_WIDTH}
		text_font_size = {FONT_SIZE}

		[state_enabled]

			[draw]

				{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_enabled]

		[state_disabled]

			[draw]

				{_GUI_RECT ({GUI__BACKGROUND_COLOUR_DISABLED}) }
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_DISABLED__DEFAULT}) }

			[/draw]

		[/state_disabled]

		[state_focussed]

			[draw]

				{_GUI_RECT ({GUI__BACKGROUND_COLOUR_ENABLED}) }
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_focussed]

###
### Selected
###

		[state_enabled_selected]

			[draw]

				{GUI__LISTBOX_SELECTED_CELL}
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_enabled_selected]

		[state_disabled_selected]

			[draw]

				{GUI__LISTBOX_SELECTED_CELL}
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_disabled_selected]

		[state_focussed_selected]

			[draw]

				{GUI__LISTBOX_SELECTED_CELL}
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_focussed_selected]

	[/resolution]
#enddef

[toggle_button_definition]

	id = "listbox_text"
	description = "This toggle button is meant to be used in a listbox and as list box with only text."

	# Tiny gui sizes haven't been tested yet so might need some tuning.
	{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 15 30 15 4 ({GUI_TINY__FONT_SIZE__DEFAULT})   }
	{_GUI_RESOLUTION ()                       30 30 25 6 ({GUI_NORMAL__FONT_SIZE__DEFAULT}) }

[/toggle_button_definition]

#undef _GUI_RECT
#undef _GUI_DRAW_TEXT
#undef _GUI_RESOLUTION
