indexing
	description: "Contains message information about thread's message queue."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_MSG

create 

	make
			-- Allocate item
			-- (from WEL_STRUCTURE)
		ensure -- from WEL_STRUCTURE
			not_shared: not shared

feature -- Access

	hwnd: POINTER
			-- Window which has received the message

	item: POINTER
			-- Generic Windows handle or structure pointer.
			-- Can be a HWND, HICON, RECT *, WNDCLASS *, etc...
			-- (from WEL_ANY)

	lparam: INTEGER
			-- Additional information about message

	message: INTEGER
			-- Message identifier

	wparam: INTEGER
			-- Additional information about message
	
feature -- Measurement

	structure_size: INTEGER
			-- Size to allocate (in bytes)
		ensure -- from WEL_STRUCTURE
			positive_result: Result > 0
	
feature -- Status report

	dispatch_result: INTEGER
			-- Last result of dispatch routine.

	exists: BOOLEAN
			-- Does the item exist?
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			Result = (item /= default_pointer)

	last_boolean_result: BOOLEAN
			-- Last result of get, get_all, translate,
			-- translate_accelerator, dispatch, and
			-- peek_result routines.

	quit: BOOLEAN
			-- Is message equal to Wm_quit?

	shared: BOOLEAN
			-- Is item shared by another object?
			-- If False (by default), item will
			-- be destroyed by destroy_item.
			-- If True, item will not be destroyed.
			-- (from WEL_ANY)
	
feature -- Status setting

	set_shared
			-- Set shared to True.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			shared: shared

	set_unshared
			-- Set shared to False.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			unshared: not shared
	
feature -- Element change

	set_hwnd (a_hwnd: POINTER)
			-- Set hwnd with a_hwnd.
		ensure
			hwnd_set: hwnd = a_hwnd

	set_item (an_item: POINTER)
			-- Set item with an_item
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			item_set: item = an_item

	set_lparam (a_lparam: INTEGER)
			-- Set lparam with a_lparam.
		ensure
			lparam_set: lparam = a_lparam

	set_message (a_message: INTEGER)
			-- Set message with a_message.
		ensure
			message_set: message = a_message

	set_wparam (a_wparam: INTEGER)
			-- Set wparam with a_wparam.
		ensure
			wparam_set: wparam = a_wparam
	
feature -- Removal

	dispose
			-- Destroy the inner structure of Current.
			--
			-- This function should be called by the GC when the
			-- object is collected or by the user if Current is
			-- no more usefull.
			-- (from WEL_ANY)
	
feature -- Conversion

	to_integer: INTEGER
			-- Converts item to an integer.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			Result = cwel_pointer_to_integer (item)
	
feature -- Basic operations

	dispatch
			-- Dispatch the message to a window procedure

	get_all
			-- Get all messages.

	initialize
			-- Fill Current with zeros.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			exists: exists

	initialize_with_character (a_character: CHARACTER)
			-- Fill current with a_character.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			exists: exists

	is_dialog_message (dialog: WEL_MODELESS_DIALOG)
			-- Determines whether a message is intended for
			-- dialog and, if it is, processes the message.
		require
			dialog_not_void: dialog /= void
			dialog_exists: dialog.exists

	memory_copy (source_pointer: POINTER; length: INTEGER)
			-- Copy length bytes from source_pointer to item.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			length_small_enough: length <= structure_size
			length_large_enough: length > 0
			exists: exists

	peek_all
			-- Peek all messages.

	process_dialog_message (dialog: POINTER)
			-- Process a dialog message for dialog.

	translate
			-- Translate virtual-key messages
			-- into character messages.

	translate_accelerator (window: WEL_WINDOW; accelerators: WEL_ACCELERATORS)
			-- Process accelerator keys for menu commands
		require
			window_not_void: window /= void
			window_exists: window.exists
			accelerators_not_void: accelerators /= void
			accelerators_exists: accelerators.exists

	translate_mdi_accelarator (window: WEL_WINDOW)
			-- Process accelerator keys for system menu commands
			-- of MDI interface child windows.
		require
			window_not_void: window /= void
			window_exists: window.exists

	wait
			-- Wait for a message.
	
invariant

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

end -- class WEL_MSG