#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_COLOR
	[rectangle]
		x = 0
		y = 0
		w = "(width)"
		h = "(height)"
		fill_color = {FILL_COLOR}
	[/rectangle]
#enddef

#define _GUI_DRAW_TEXT FONT_SIZE FONT_COLOR
	[text]
		x = 3
		y = {GUI__TEXT_VERTICALLY_CENTRED}
		w = "(if(width < 6, 0, width - 6))"
		h =  "(text_height)"
		maximum_width = "(if(width < 6, 0, width - 6))"
		font_size = {FONT_SIZE}
		color = {FONT_COLOR}
		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_COLOR_ENABLED}) }
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_enabled]

		[state_disabled]

			[draw]

				{_GUI_RECT ({GUI__BACKGROUND_COLOR_DISABLED}) }
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__DEFAULT}) }

			[/draw]

		[/state_disabled]

		[state_focussed]

			[draw]

				{_GUI_RECT ({GUI__BACKGROUND_COLOR_ENABLED}) }
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_focussed]

###
### Selected
###

		[state_enabled_selected]

			[draw]

				{GUI__LISTBOX_SELECTED_CELL}
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_enabled_selected]

		[state_disabled_selected]

			[draw]

				{GUI__LISTBOX_SELECTED_CELL}
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__DEFAULT}) }

			[/draw]

		[/state_disabled_selected]

		[state_focussed_selected]

			[draw]

				{GUI__LISTBOX_SELECTED_CELL}
				{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_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
