indexing
	description: "Eiffel Vision Simple application.Base for root class in a simple application.Inherit and define `prepare'."
	status: "See notice at end of class"
	keywords: "application, accelerator, event loop"
	date: "$Date$"
	revision: "$Revision$"

deferred class interface
	EV_SIMPLE_APPLICATION

feature -- Initialization

	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
	
feature -- Access

	clipboard: EV_CLIPBOARD
			-- Native platform clipboard access.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed

	contextual_help_accelerator: EV_ACCELERATOR
			-- Accelerator that enables contextual help mode
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
		ensure -- from EV_APPLICATION
			bridge_ok: Result.is_equal (implementation.contextual_help_accelerator)

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

	help_accelerator: EV_ACCELERATOR
			-- Accelerator that displays contextual help
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
		ensure -- from EV_APPLICATION
			bridge_ok: Result.is_equal (implementation.help_accelerator)

	help_engine: EV_HELP_ENGINE
			-- Object that handles contextual help display requests
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
		ensure -- from EV_APPLICATION
			bridge_ok: Result.is_equal (implementation.help_engine)

	locked_window: EV_WINDOW
			-- Window currently locked. Void if no window
			-- is currently locked.
			--
			-- See `{EV_WINDOW}.lock_update' for more details
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed

	windows: LINEAR [EV_WINDOW]
			-- All of the application's windows.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
		ensure -- from EV_APPLICATION
			bridge_ok: Result.is_equal (implementation.windows)
	
feature -- Status report

	alt_pressed: BOOLEAN
			-- Is alt key currently pressed?
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed

	ctrl_pressed: BOOLEAN
			-- Is ctrl key currently pressed?
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed

	Default_tooltip_delay: INTEGER is 500
			-- Default delay in milleseconds of tool tips.
			-- (from EV_APPLICATION)

	focused_widget: EV_WIDGET
			-- Widget that has keyboard focus.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
		ensure -- from EV_APPLICATION
			bridge_ok: Result = implementation.focused_widget

	is_launched: BOOLEAN
			-- Has launch been called?
			-- (from EV_APPLICATION)

	shift_pressed: BOOLEAN
			-- Is shift key currently pressed?
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed

	tooltip_delay: INTEGER
			-- Time in milliseconds which the pointer must be stationary over
			-- a widget before a tooltips apears.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
		ensure -- from EV_APPLICATION
			bridge_ok: Result = implementation.tooltip_delay
	
feature -- Status setting

	set_tooltip_delay (a_delay: INTEGER)
			-- Assign a_delay to tooltip_delay.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			a_delay_non_negative: a_delay >= 0
		ensure -- from EV_APPLICATION
			assigned: tooltip_delay = a_delay
	
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 -- Basic operation

	display_help_for_widget (a_widget: EV_WIDGET)
			-- Display contextual help for a_widget, if any.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			a_widget_not_void: a_widget /= void

	enable_contextual_help
			-- Change mouse cursor to help cursor.
			-- Capture mouse input.
			-- Send help context of widget being clicked to help engine for
			-- Processing.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed

	launch
			-- Start the application.
			-- Call prepare the Begin event processing.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			not_already_launched: not is_launched
		ensure -- from EV_APPLICATION
			is_launched: is_launched

	process_events
			-- Process any pending events.
			-- Pass control to the underlying native toolkit so that it can
			-- handle any events that may be in its queue.
			-- (Should be called from time to time during extended computation.)
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			is_launched: is_launched

	sleep (msec: INTEGER)
			-- Wait for msec milliseconds and return.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			msec_non_negative: msec >= 0
	
feature -- Command

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

	set_contextual_help_accelerator (an_accelerator: EV_ACCELERATOR)
			-- Assign an_accelerator to contextual_help_accelerator
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			an_accelerator_not_void: an_accelerator /= void
		ensure -- from EV_APPLICATION
			contextual_help_accelerator_assigned: contextual_help_accelerator = an_accelerator

	set_help_accelerator (an_accelerator: EV_ACCELERATOR)
			-- Assign an_accelerator to help_accelerator
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			an_accelerator_not_void: an_accelerator /= void
		ensure -- from EV_APPLICATION
			help_accelerator_assigned: help_accelerator = an_accelerator

	set_help_engine (an_engine: EV_HELP_ENGINE)
			-- Assign an_engine to help_engine
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed
			an_engine_not_void: an_engine /= void
		ensure -- from EV_APPLICATION
			help_engine_set: help_engine = an_engine
	
feature -- Event handling

	do_once_on_idle (an_action: PROCEDURE [ANY, TUPLE])
			-- Perform an_action one time when the application is next idle.
			-- (from EV_APPLICATION)
		require -- from EV_APPLICATION
			not_destroyed: not is_destroyed

	drop_actions: EV_PND_ACTION_SEQUENCE
			-- Actions to be performed when any "drop" occurs.
			-- (from EV_APPLICATION_ACTION_SEQUENCES)
		ensure -- from EV_APPLICATION_ACTION_SEQUENCES
			not_void: Result /= void

	idle_actions: EV_NOTIFY_ACTION_SEQUENCE
			-- Actions to be performed when the application is otherwise idle.
			-- (from EV_APPLICATION_ACTION_SEQUENCES)
		ensure -- from EV_APPLICATION_ACTION_SEQUENCES
			not_void: Result /= void

	pick_actions: EV_PND_ACTION_SEQUENCE
			-- Actions to be performed when any "pick" occurs.
			-- (from EV_APPLICATION_ACTION_SEQUENCES)
		ensure -- from EV_APPLICATION_ACTION_SEQUENCES
			not_void: Result /= void

	post_launch_actions: EV_NOTIFY_ACTION_SEQUENCE
			-- Actions to be performed just after application launch.
			-- (from EV_APPLICATION_ACTION_SEQUENCES)
		ensure -- from EV_APPLICATION_ACTION_SEQUENCES
			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

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)
		-- from EV_APPLICATION
	tooltip_delay_not_negative: tooltip_delay >= 0
	windows_not_void: windows /= void
		-- 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_SIMPLE_APPLICATION