indexing
	description: "Contains information about a tree view control item."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_TREE_VIEW_ITEM

create 

	make
			-- Make a tree item structure.

	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

	children: INTEGER
			-- Information about the children of the item
		require
			valid_member: children_is_valid

	h_item: POINTER
			-- Item to which this structure refers.

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

	lparam: INTEGER
			-- Information about the lparam of the item
		require
			valid_member: lparam_is_valid

	mask: INTEGER
			-- Array of flags that indicate which of the other
			-- structure members contain valid data or which are
			-- to be filled in. This member can be a combination
			-- of the Tvif_* values.
			-- See class WEL_TVIF_CONSTANTS.

	state: INTEGER
			-- Current state of the item.
		require
			valid_member: state_is_valid

	text: STRING
			-- Item text
		require
			valid_member: text_is_valid
		ensure
			result_not_void: Result /= void
	
feature -- Measurement

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

	children_is_valid: BOOLEAN
			-- Is the structure member children valid?

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

	lparam_is_valid: BOOLEAN
			-- Is the structure member lParam valid?

	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)

	state_is_valid: BOOLEAN
			-- Is the structure member state valid?

	text_is_valid: BOOLEAN
			-- Is the structure member text valid?
	
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

	add_mask (a_mask_value: INTEGER)
			-- add a_mask_value to the current mask.

	set_h_item (a_h_item: POINTER)
			-- Set h_item with a_h_item.
		ensure
			h_item_set: h_item = a_h_item

	set_image (image_normal: INTEGER; image_selected: INTEGER)
			-- Set the image for the tree item to image_normal.
			-- and image_selected for the image displayed when this
			-- item is selected.
			-- image_normal and image_selected are the index of
			-- an image in the image list associated with the treeview.

	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 a_lparam as current lparam.
		ensure
			lparam_set: lparam = a_lparam

	set_mask (a_mask_value: INTEGER)
			-- Set mask with a_mask_value.

	set_state (a_state: INTEGER)
			-- Set a_state as current state.
		ensure
			state_set: state = a_state

	set_text (a_text: STRING)
			-- Set text with a_text.
		require
			a_text_not_void: a_text /= void
		ensure
			text_set: text.is_equal (a_text)
	
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

	structure_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
	
invariant

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

end -- class WEL_TREE_VIEW_ITEM