indexing
	description: "General notions of a Windows application. All WEL applications must define its own descendant of WEL_APPLICATION."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

deferred class interface
	WEL_APPLICATION

feature -- Access

	accelerators: WEL_ACCELERATORS
			-- Application's accelerators
			-- May be redefined (in once) to associate accelerators.

	application: WEL_APPLICATION
			-- Current application
			-- (from WEL_APPLICATION_MAIN_WINDOW)

	application_main_window: WEL_COMPOSITE_WINDOW
			-- Application's main window
			-- (from WEL_APPLICATION_MAIN_WINDOW)

	default_show_command: INTEGER
			-- Default command used to show main_window.
			-- May be redefined to have a maximized window for
			-- instance.
			-- See class WEL_SW_CONSTANTS for values.

	main_window: WEL_COMPOSITE_WINDOW
			-- Must be defined as a once funtion to create the
			-- application's main_window.
		require
			once_declaration: application_main_window = void
		ensure
			result_not_void: Result /= void
			parent_main_window_is_void: Result.parent = void
	
feature -- Status report

	idle_action_enabled: BOOLEAN
			-- Is the idle action enabled?
			-- (False by default)

	is_application_main_window (window: WEL_COMPOSITE_WINDOW): BOOLEAN
			-- Is window the application's main window?
			-- (from WEL_APPLICATION_MAIN_WINDOW)
		require -- from WEL_APPLICATION_MAIN_WINDOW
			window_not_void: window /= void
		ensure -- from WEL_APPLICATION_MAIN_WINDOW
			Result = (window = application_main_window)

	is_dialog (hwnd: POINTER): BOOLEAN
			-- Is the window corresponding to hwnd a dialog box?
			-- We call the function with a dialog box option,
			-- if it is indeed a dialog, the result will always
			-- be non zero, otherwise it is zero.

	runable: BOOLEAN
			-- Can the application be run?
			-- (True by default)
			-- The user may want to return False if the application
			-- cannot be executed for any reason.
	
feature -- Status setting

	disable_idle_action
			-- Disable the call to idle_action when the message
			-- queue is empty.
		ensure
			idle_action_disabled: not idle_action_enabled

	enable_idle_action
			-- Enable the call to idle_action when the message
			-- queue is empty.
		ensure
			idle_action_enabled: idle_action_enabled
	
feature -- Basic operations

	idle_action
			-- Called when the message queue is empty.
			-- Useful to perform background operations.
		require
			idle_action_enabled: idle_action_enabled

	run
			-- Create main_window and start the message loop.
		require
			runable: runable
			main_window_not_void: application_main_window /= void
			parent_main_window_is_void: application_main_window.parent = void
	
invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

end -- class WEL_APPLICATION