class EL_BOOLEAN_ITEM_RADIO_BUTTON_GROUP

(source code)

Client examples: PANGO_CAIRO_TEST_MAIN_WINDOW

description

Binary options represented as 2 radio buttons. If the the first option is selected, the value_change_action agent is called with the value False.

note
	description: "[
		Binary options represented as 2 radio buttons. If the the first option is selected, the `value_change_action'
		agent is called with the value `False'.
	]"

	author: "Finnian Reilly"
	copyright: "Copyright (c) 2001-2022 Finnian Reilly"
	contact: "finnian at eiffel hyphen loop dot com"

	license: "MIT license (See: en.wikipedia.org/wiki/MIT_License)"
	date: "2022-11-15 19:56:05 GMT (Tuesday 15th November 2022)"
	revision: "4"

class
	EL_BOOLEAN_ITEM_RADIO_BUTTON_GROUP

inherit
	EL_RADIO_BUTTON_GROUP [BOOLEAN]
		rename
			make as make_button_group,
			less_than as boolean_less_than
		redefine
			boolean_less_than
		end

create
	make

feature {NONE} -- Initialization

	make (
		initial_value: BOOLEAN; false_option, true_option: READABLE_STRING_GENERAL
		a_value_change_action: like value_change_action
	)
		do
			create option_list.make_from_general (<< false_option, true_option >>)
			make_button_group (initial_value, << False, True >>, a_value_change_action)
		end

feature {NONE} -- Implementation

	boolean_less_than (a, b: EL_WIDGET_VALUE [BOOLEAN]): BOOLEAN
		do
			Result := a.value.to_integer < b.value.to_integer
		end

	displayed_value (value: BOOLEAN): ZSTRING
		do
			Result := option_list [value.to_integer + 1]
		end

feature {NONE} -- Internal attributes

	option_list: EL_ZSTRING_LIST
end