indexing
	description: "Information about an icon or a cursor."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_ICON_INFO

create 

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

feature -- Access

	color_bitmap: WEL_BITMAP
			-- bitmap representing the image (as opposed to the mask)
			--
			-- Handle to the icon color bitmap. This member can be optional if
			-- this structure defines a black and white icon. The AND bitmask of
			-- hbmMask is applied with the SRCAND flag to the destination;
			-- subsequently, the color bitmap is applied (using XOR) to the
			-- destination by using the SRCINVERT flag.
		require
			initialized: is_initialized
			has_color_bitmap: has_color_bitmap
		ensure
			result_not_void: Result /= void
			result_exists: Result.exists

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

	mask_bitmap: WEL_BITMAP
			-- bitmap representing the mask.
			--
			-- Specifies the icon bitmask bitmap. If this structure defines a black
			-- and white icon, this bitmask is formatted so that the upper half is
			-- the icon AND bitmask and the lower half is the icon XOR bitmask.
			-- Under this condition, the height should be an even multiple of two.
			-- If this structure defines a color icon, this mask only defines the
			-- AND bitmask of the icon.
		require
			initialized: is_initialized
		ensure
			result_not_void: Result /= void
			result_exists: Result.exists
	
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)

	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_item (an_item: POINTER)
			-- Set item with an_item
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			item_set: item = an_item
	
feature -- Removal

	delete
			-- Free allocated C memory and GDI objects.
		require
			not_shared: not shared

	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

	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
	
feature -- Status Report

	has_color_bitmap: BOOLEAN
			-- Is color_bitmap valid?
			--
			-- In the case of a black & white icon/cursor, mask_bitmap is
			-- formatted so that the upper half is the icon AND bitmask and
			-- the lower half is the icon XOR bitmask. In this case,
			-- color_bitmap is not defined.

	is_icon: BOOLEAN
			-- Specifies whether this structure defines and icon or a cursor.
			-- True specifies an icon; False specifies a cursor.

	is_initialized: BOOLEAN
			-- Is the structure initialized (i.e. filled)?

	x_hotspot: INTEGER
			-- Specifies the x-coordinate of a cursor's hotspot.
			-- If this structure defines an icon, the hot spot is
			-- always in the center of the icon, and this member is ignored.

	y_hotspot: INTEGER
			-- Specifies the y-coordinate of a cursor's hotspot.
			-- If this structure defines an icon, the hot spot is
			-- always in the center of the icon, and this member is ignored.
	
feature -- Status Setting

	enable_reference_tracking_on_bitmaps
			-- Enable the tracking of references on mask_bitmap and
			-- color_bitmap.
			--
			-- When Current will be disposed, the reference number of
			-- mask_bitmap and color_bitmap will be decreased.
		require
			initialized: is_initialized

	set_color_bitmap (a_color_bitmap: WEL_BITMAP)
			-- Assign a_color_bitmap to hbmColor

	set_is_icon (a_is_icon: BOOLEAN)
			-- Assign a_is_icon to fIcon.

	set_mask_bitmap (a_mask_bitmap: WEL_BITMAP)
			-- Assign a_mask_bitmap to hbmMask

	set_x_hotspot (xvalue: INTEGER)
			-- Assign xvalue to xHotspot.

	set_y_hotspot (yvalue: INTEGER)
			-- Assign yvalue to yHotspot.
	
invariant

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

end -- class WEL_ICON_INFO