indexing
	description: "Abstraction for objects that may be selected/unselected."
	status: "See notice at end of class"
	keywords: "deselect, deselectable, select, selected, selectable"
	date: "$Date$"
	revision: "$Revision$"

deferred class interface
	EV_DESELECTABLE

feature -- Access

	data: ANY
			-- Arbitrary user data may be stored here.
			-- (from EV_ANY)
	
feature -- Status report

	is_selectable: BOOLEAN
			-- May enable_select be called.
			-- (from EV_SELECTABLE)
		require -- from EV_SELECTABLE
			not_destroyed: not is_destroyed

	is_selected: BOOLEAN
			-- Is selected.
			-- (from EV_SELECTABLE)
		require -- from EV_SELECTABLE
			not_destroyed: not is_destroyed
		ensure -- from EV_SELECTABLE
			bridge_ok: Result = implementation.is_selected
	
feature -- Status setting

	disable_select
			-- Deselect the object.
		require
			not_destroyed: not is_destroyed
		ensure
			unselected: not is_selected

	enable_select
			-- Make is_selected True.
			-- (from EV_SELECTABLE)
		require -- from EV_SELECTABLE
			not_destroyed: not is_destroyed
			is_selectable: is_selectable
		ensure -- from EV_SELECTABLE
			is_selected: is_selected

	toggle
			-- Change is_selected.
		require
			not_is_destroyed: not is_destroyed
			can_be_selected: not is_selected implies is_selectable
		ensure
			is_selected_changed: is_selected /= old is_selected
	
feature -- Element change

	set_data (some_data: like data)
			-- Assign some_data to data.
			-- (from EV_ANY)
		require -- from EV_ANY
			not_destroyed: not is_destroyed
		ensure -- from EV_ANY
			data_assigned: data = some_data
	
feature -- Duplication

	copy (other: like Current)
			-- Update current object using fields of object attached
			-- to other, so as to yield equal objects.
			-- (from EV_ANY)
		require -- from ANY
			other_not_void: other /= void
			type_identity: same_type (other)
		ensure -- from ANY
			is_equal: is_equal (other)
	
feature -- Command

	destroy
			-- Destroy underlying native toolkit object.
			-- Render Current unusable.
			-- (from EV_ANY)
		ensure -- from EV_ANY
			is_destroyed: is_destroyed
	
feature -- Status Report

	is_destroyed: BOOLEAN
			-- Is Current no longer usable?
			-- (from EV_ANY)
		ensure -- from EV_ANY
			bridge_ok: Result = implementation.is_destroyed
	
invariant

	not_selectable_therefore_not_selected: not is_selectable implies not is_selected
		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)
		-- from EV_ANY
	is_initialized: is_initialized
	is_coupled: implementation /= void and then implementation.interface = Current
	default_create_called: default_create_called

end -- class EV_DESELECTABLE