indexing
	description: "[
			Supplies the identifiers and application-supplied data for two 
			items in a sorted, owner-drawn list box or combo box. 
			Whenever an application adds a new item to an owner-drawn 
			list box or combo box created with the CBS_SORT or LBS_SORT 
			style, the system sends the owner a Wm_compareitem message. 
			The `lparam' parameter of the message contains a long pointer 
			to a COMPAREITEMSTRUCT structure. Upon receiving the message, 
			the owner compares the two items and returns a value indicating 
			which item sorts before the other. 
	]"
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_COMPARE_ITEM_STRUCT

create 

	make_by_pointer (a_pointer: POINTER)
			-- Set item with a_pointer.
			-- Since item is shared, it does not need
			-- to be freed.
			-- Caution: a_pointer must be a pointer
			-- coming from Windows.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			item_set: item = a_pointer
			shared: shared

feature -- Access

	ctl_id: INTEGER
			-- Specifies the identifier of the list box or combo box.

	ctl_type: INTEGER
			-- Control type.
			-- See class WEL_ODT_CONSTANTS.
			-- Specifies ODT_LISTBOX or ODT_COMBOBOX.

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

	item_data_1: POINTER
			-- Specifies application-supplied data for the
			-- first item being compared. (This value was
			-- passed as the lParam parameter of the message
			-- that added the item to the list box or combo box.)

	item_data_2: POINTER
			-- Specifies application-supplied data for the
			-- second item being compared. This value was
			-- passed as the lParam parameter of the message
			-- that added the item to the list box or combo box.
			-- This member will be -1 if the item has not been
			-- inserted or when searching for a potential item
			-- in the list box or combo box.

	item_id_1: INTEGER
			-- Specifies the index of the first item in
			-- the list box or combo box being compared.
			-- This member will be -1 if the item has not
			-- been inserted or when searching for a potential
			-- item in the list box or combo box.

	item_id_2: INTEGER
			-- Specifies the index of the second item in the
			-- list box or combo box being compared.

	locale_id: INTEGER
			-- Specifies the locale identifier. To create a
			-- locale identifier, use the MAKELCID macro.

	window_item: WEL_CONTROL
			-- Identifies the control.
	
feature -- Measurement

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

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

	foreground_window: WEL_WINDOW
			-- Foreground window (window with focus)
			-- (from WEL_WINDOWS_ROUTINES)

	is_window (hwnd: POINTER): BOOLEAN
			-- Does hwnd point to a valid Window?
			-- (from WEL_WINDOWS_ROUTINES)

	key_down (virtual_key: INTEGER): BOOLEAN
			--Is 'virtual' key pressed
			-- (from WEL_WINDOWS_ROUTINES)

	key_locked (virtual_key: INTEGER): BOOLEAN
			--Is 'virtual' key locked
			-- (from WEL_WINDOWS_ROUTINES)

	key_to_string (key_data: INTEGER): STRING
			-- Give the string associated with the key given by
			-- virtual_key.
			-- (from WEL_WINDOWS_ROUTINES)

	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)

	system_directory: STRING
			-- Path of the Windows system directory
			-- (from WEL_WINDOWS_ROUTINES)
		ensure -- from WEL_WINDOWS_ROUTINES
			result_not_void: Result /= void

	tick_count: INTEGER
			-- Number of milliseconds that have
			-- elapsed since Windows was started.
			-- (from WEL_WINDOWS_ROUTINES)
		ensure -- from WEL_WINDOWS_ROUTINES
			positive_result: Result >= 0

	window_of_item (hwnd: POINTER): WEL_WINDOW
			-- Retrieve Eiffel object associated with hwnd pointer.
			-- (from WEL_WINDOWS_ROUTINES)
		require -- from WEL_WINDOWS_ROUTINES
			hwnd_not_null: hwnd /= default_pointer
			is_window_pointer: is_window (hwnd)
		ensure -- from WEL_WINDOWS_ROUTINES
			is_wel_window: Result /= void implies (create {INTERNAL}).type_conforms_to ((create {INTERNAL}).dynamic_type (Result), (create {INTERNAL}).dynamic_type_from_string ("WEL_WINDOW"))

	windows_directory: STRING
			-- Path of the Windows directory
			-- (from WEL_WINDOWS_ROUTINES)
		ensure -- from WEL_WINDOWS_ROUTINES
			result_not_void: Result /= void
	
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_item (an_item: POINTER)
			-- Set item with an_item
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			item_set: item = an_item
	
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

	hide_cursor
			-- Hide the cursor.
			-- (from WEL_WINDOWS_ROUTINES)

	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

	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

	message_beep_asterisk
			-- Play the system asterisk waveform sound.
			-- (from WEL_WINDOWS_ROUTINES)

	message_beep_exclamation
			-- Play the system exclamation waveform sound.
			-- (from WEL_WINDOWS_ROUTINES)

	message_beep_hand
			-- Play the system hand waveform sound.
			-- (from WEL_WINDOWS_ROUTINES)

	message_beep_ok
			-- Play the system ok waveform sound.
			-- (from WEL_WINDOWS_ROUTINES)

	message_beep_question
			-- Play the system question waveform sound.
			-- (from WEL_WINDOWS_ROUTINES)

	output_debug_string (s: STRING)
			-- Send a string s to the system debugger.
			-- (from WEL_WINDOWS_ROUTINES)
		require -- from WEL_WINDOWS_ROUTINES
			s_not_void: s /= void

	resource_string_id (an_id: INTEGER): STRING
			-- String identified by an_id in the resource file.
			-- (from WEL_WINDOWS_ROUTINES)
		ensure -- from WEL_WINDOWS_ROUTINES
			result_not_void: Result /= void

	set_cursor_position_absolute (x, y: INTEGER)
			-- Set the cursor position to x, y.
			-- (from WEL_WINDOWS_ROUTINES)

	show_cursor
			-- Show the cursor.
			-- (from WEL_WINDOWS_ROUTINES)
	
invariant

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

end -- class WEL_COMPARE_ITEM_STRUCT