indexing
	description: "A keyboard accelerator defines `actions' to be performed when a`key' is pressed. See `{EV_TITLED_WINDOW}.accelerators'"
	status: "See notice at end of class"
	keywords: "accelerator, keyboard, key, shortcut, hotkey"
	date: "$Date$"
	revision: "$Revision$"

class interface
	EV_ACCELERATOR

create 

	frozen default_create
			-- Standard creation procedure.
			-- (from EV_ANY)
		ensure then -- from EV_ANY
			is_coupled: implementation /= void
			is_initialized: is_initialized
			default_create_called_set: default_create_called
			is_in_default_state: is_in_default_state

	make_with_key_combination (a_key: EV_KEY; require_control, require_alt, require_shift: BOOLEAN)
			-- Create with a_key and modifiers.
		require
			a_key_not_void: a_key /= void

feature -- Access

	alt_required: BOOLEAN
			-- Must the alt key be pressed to trigger actions?
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.alt_required

	control_required: BOOLEAN
			-- Must the control key be pressed to trigger actions?
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.control_required

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

	key: EV_KEY
			-- Key that will trigger actions.
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: equal (Result, implementation.key)

	parented: BOOLEAN
			-- Does Current have a parent?
			-- Current is parented if it has been placed in the
			-- accelerator list of a window.
			-- key combination of Current can not be modified if True.
		require
			not_destroyed: not is_destroyed

	shift_required: BOOLEAN
			-- Must the shift key be pressed to trigger actions?
		require
			not_destroyed: not is_destroyed
		ensure
			bridge_ok: Result = implementation.shift_required
	
feature -- Status report

	is_equal (other: like Current): BOOLEAN
			-- Does other have the same key combination as Current?
		require -- from ANY
			other_not_void: other /= void
		ensure -- from ANY
			symmetric: Result implies other.is_equal (Current)
			consistent: standard_is_equal (other) implies Result

	out: STRING
			-- String representation of key combination.
	
feature -- Status setting

	disable_alt_required
			-- Make alt_required False.
		require
			not_destroyed: not is_destroyed
			not_parented: not parented
		ensure
			not_alt_required: not alt_required

	disable_control_required
			-- Make control_required False.
		require
			not_destroyed: not is_destroyed
			not_parented: not parented
		ensure
			not_control_required: not control_required

	disable_shift_required
			-- Make shift_required False.
		require
			not_destroyed: not is_destroyed
			not_parented: not parented
		ensure
			not_shift_required: not shift_required

	enable_alt_required
			-- Make alt_required True.
		require
			not_destroyed: not is_destroyed
			not_parented: not parented
		ensure
			alt_required: alt_required

	enable_control_required
			-- Make control_required True.
		require
			not_destroyed: not is_destroyed
			not_parented: not parented
		ensure
			control_required: control_required

	enable_shift_required
			-- Make shift_required True.
		require
			not_destroyed: not is_destroyed
			not_parented: not parented
		ensure
			shift_required: shift_required

	set_key (a_key: EV_KEY)
			-- Assign a_key to key.
		require
			not_destroyed: not is_destroyed
			a_key_not_void: a_key /= void
			not_parented: not parented
		ensure
			a_key_assigned: key.is_equal (a_key)
	
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 -- Events

	actions: EV_NOTIFY_ACTION_SEQUENCE
			-- Actions to be performed when key combination is recieved by the window within which
			-- Current is parented.
		require
			not_destroyed: not is_destroyed
		ensure
			result_not_void: Result /= void
	
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

	key_not_void: key /= void
		-- 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_ACCELERATOR