#textdomain wesnoth-lib
###
### Definition of the default toggle button.
### Since for this class 'default' is a bit hard we now use the checkbox as default.
###

#define _GUI_TEXT X_OFFSET FONT_SIZE FONT_COLOUR
	[text]
		x = {X_OFFSET}
		y = {GUI__TEXT_VERTICALLY_CENTRED}
		w = "(if(width < {X_OFFSET}, 0, width - {X_OFFSET}))"
		h =  "(text_height)"
		font_size = {FONT_SIZE}
		colour = {FONT_COLOUR}
		text = "(text)"
	[/text]
#enddef

#define _GUI_RESOLUTION RESOLUTION WIDTH HEIGHT EXTRA_WIDTH FONT_SIZE 
	[resolution]

		{RESOLUTION}

		min_width = {WIDTH}
		min_height = {HEIGHT}

		default_width = {WIDTH}
		default_height = {HEIGHT}

		max_width = 0
		max_height = {HEIGHT}

		text_extra_width = {EXTRA_WIDTH}
		text_font_size = {FONT_SIZE}

		[state_enabled]

			[draw]

				[image]
					name = "buttons/checkbox.png"
				[/image]

				{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__TITLE}) }

			[/draw]

		[/state_enabled]

		[state_disabled]

			[draw]

				[image]
					name = "buttons/checkbox.png"
				[/image]

				{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_DISABLED__TITLE}) }

			[/draw]

		[/state_disabled]

		[state_focussed]

			[draw]

				[image]
					name = "buttons/checkbox-active.png"
				[/image]

				{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__TITLE}) }

			[/draw]

		[/state_focussed]

###
### Selected
###

		[state_enabled_selected]

			[draw]

				[image]
					name = "buttons/checkbox-pressed.png"
				[/image]

				{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__TITLE}) }

			[/draw]

		[/state_enabled_selected]

		[state_disabled_selected]

			[draw]

				[image]
					name = "buttons/checkbox-pressed.png"
				[/image]

				{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_DISABLED__TITLE}) }

			[/draw]

		[/state_disabled_selected]

		[state_focussed_selected]

			[draw]

				[image]
					name = "buttons/checkbox-active-pressed.png"
				[/image]

				{_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOUR_ENABLED__TITLE}) }

			[/draw]

		[/state_focussed_selected]

	[/resolution]
#enddef	

[toggle_button_definition]

	id = "default"
	description = "Checkbox."

	# Tiny gui sizes haven't been tested yet so might need some tuning.
	{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 20 11 14 ({GUI_TINY__FONT_SIZE__SMALL})   }
	{_GUI_RESOLUTION ()                       30 18 25 ({GUI_NORMAL__FONT_SIZE__SMALL}) }

[/toggle_button_definition]

#undef _GUI_TEXT
#undef _GUI_RESOLUTION
