indexing
	description: "Represents structure that is sent to the OS to add,modify, inspect, ... items of a WEL_HEADER_CONTROL"
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_HD_ITEM

create 

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

	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

	bitmap_handle: POINTER
			-- Handle to item bitmap.
		require
			exists: exists
			good_mask: flag_set (mask, hdi_bitmap)

	custom_data: INTEGER
			-- Application-defined item data.
		require
			exists: exists
			good_mask: flag_set (mask, hdi_lparam)

	format: INTEGER
			-- A set of bit flags that specify the item’s format.
			-- Constants are defined in class WEL_HDF_CONSTANTS.
			-- Constants may be combined.
		require
			exists: exists
			good_mask: flag_set (mask, hdi_format)

	height: INTEGER
			-- Height of item (Only availavle when mask contains Hdi_height
		require
			exists: exists
			good_mask: flag_set (mask, hdi_height)
		ensure
			positive_result: Result >= 0

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

	mask: INTEGER
			-- Mask flags that indicate which of the other structure
			-- members contain valid data.
			-- Constants may be combined.
			-- The valid constants can be found in class WEL_HDI_CONSTANTS
		require
			exists: exists

	text: STRING
			-- Text of the button associated with the notification.
		require
			exists: exists

	text_count: INTEGER
			-- Count of characters in the button text.
		require
			exists: exists
		ensure
			positive_result: Result >= 0

	width: INTEGER
			-- Width of item (Only availavle when mask contains Hdi_width
		require
			exists: exists
			good_mask: flag_set (mask, hdi_width)
		ensure
			positive_result: Result >= 0
	
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)

	flag_set (flags, mask: INTEGER): BOOLEAN
			-- Is mask set in flags?
			-- (from WEL_BIT_OPERATIONS)

	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_bitmap (a_bitmap: WEL_BITMAP)
			-- Sets item bitmap.
			-- Also updates mask
		require
			exists: exists
			bitmap_exsits: a_bitmap.exists
		ensure
			mask_set: flag_set (mask, hdi_bitmap)

	set_custom_data (value: INTEGER)
			-- Sets application-defined item data.
			-- Also updates mask
		require
			exists: exists
		ensure
			mask_set: flag_set (mask, hdi_lparam)

	set_format (value: INTEGER)
			-- Sets a set of bit flags that specify the item’s format.
			-- Constants are defined in class WEL_HDF_CONSTANTS.
			-- Constants may be combined.
			-- Also updates mask
		require
			exists: exists
		ensure
			mask_set: flag_set (mask, hdi_format)

	set_height (value: INTEGER)
			-- Sets height of item with value
			-- Also updates mask
			-- Note: You can only specify either the width or the height
		require
			exists: exists
			positive_value: value >= 0
		ensure
			mask_set: flag_set (mask, hdi_height)

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

	set_mask (value: INTEGER)
			-- Sets mask flags that indicate which of the other structure
			-- members contain valid data.
			-- Constants may be combined.
			-- The valid constants can be found in class WEL_HDI_CONSTANTS
		require
			exists: exists

	set_text (a_text: STRING)
			-- Set text with a_text.
			-- Also Updates text_count and mask
		require
			text_not_void: a_text /= void
		ensure
			text_set: text.is_equal (a_text)
			text_count_set: a_text.count = text_count
			mask_set: flag_set (mask, hdi_text)

	set_width (value: INTEGER)
			-- Sets width of item with value
			-- Also updates mask
			-- Note: You can only specify either the width or the height
		require
			exists: exists
			positive_value: value >= 0
		ensure
			mask_set: flag_set (mask, hdi_width)
	
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

	clear_flag (flags, mask: INTEGER): INTEGER
			-- Clear the mask in flags
			-- (from WEL_BIT_OPERATIONS)
		ensure -- from WEL_BIT_OPERATIONS
			flag_unset: not flag_set (Result, mask)

	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

	set_flag (flags, mask: INTEGER): INTEGER
			-- Set the mask in flags
			-- (from WEL_BIT_OPERATIONS)
		ensure -- from WEL_BIT_OPERATIONS
			flag_set: flag_set (Result, mask)
	
invariant

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

end -- class WEL_HD_ITEM