indexing
	description: "[
		Object that holds a list of images (Bitmaps or Icons).
		
		Note: The common controls dll (WEL_COMMON_CONTROLS_DLL) needs to be loaded to use this control.
	]"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
	revision: "$Revision: 56675 $"

class interface
	WEL_IMAGE_LIST

create 
	make (given_width: INTEGER_32; given_height: INTEGER_32; color_depth: INTEGER_32; masked_bitmap: BOOLEAN)
			-- Initialization with an empty image list. Images located
			-- in this imageList must have the a width equal to `given_width'
			-- and a height equal to `given_height'. 
			--
			-- The flag `color_depth' determines the color depth of the bitmaps.
			-- (bitmaps with a different color depth than indicated in
			-- `image_type' will automatically be converted)
			-- See Ilc_colorXXXX in WEL_ILC_CONSTANTS for possible values
			--
			-- The flag `masked_bitmap' specify whether we are using Bitmaps with mask, or plain
			-- bitmaps.
		require
			valid_width: given_width > 0
			valid_height: given_height > 0

	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 -- Initialization

	make (given_width: INTEGER_32; given_height: INTEGER_32; color_depth: INTEGER_32; masked_bitmap: BOOLEAN)
			-- Initialization with an empty image list. Images located
			-- in this imageList must have the a width equal to `given_width'
			-- and a height equal to `given_height'. 
			--
			-- The flag `color_depth' determines the color depth of the bitmaps.
			-- (bitmaps with a different color depth than indicated in
			-- `image_type' will automatically be converted)
			-- See Ilc_colorXXXX in WEL_ILC_CONSTANTS for possible values
			--
			-- The flag `masked_bitmap' specify whether we are using Bitmaps with mask, or plain
			-- bitmaps.
		require
			valid_width: given_width > 0
			valid_height: given_height > 0
	
feature -- Access

	count: INTEGER_32
			-- Retrieves the number of images in the image list.

	generating_type: STRING_8
			-- Name of current object's generating type
			-- (type of which it is a direct instance)
			-- (from ANY)

	generator: STRING_8
			-- Name of current object's generating class
			-- (base class of the type of which it is a direct instance)
			-- (from ANY)

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

	last_position: INTEGER_32
			-- Position of last image inserted/deleted.
			-- updated by `add_image'.

	use_masked_bitmap: BOOLEAN
			-- Does the ImageList contains 'Bitmap+Mask' or
			-- only 'Bitmap'
			--
			-- Note: to use masked bitmap, create the ImageList
			--       using `Ilc_mask + Ilc_colorXXXX' as `image_type'
	
feature -- Comparison

	frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
			-- Are `some' and `other' either both void
			-- or attached to isomorphic object structures?
			-- (from ANY)
		ensure -- from ANY
			shallow_implies_deep: standard_equal (some, other) implies Result
			both_or_none_void: (some = Void) implies (Result = (other = Void))
			same_type: (Result and (some /= Void)) implies some.same_type (other)
			symmetric: Result implies deep_equal (other, some)

	frozen equal (some: ANY; other: like arg #1): BOOLEAN
			-- Are `some' and `other' either both void or attached
			-- to objects considered equal?
			-- (from ANY)
		ensure -- from ANY
			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))

	is_equal (other: like Current): BOOLEAN
			-- Is `other' attached to an object considered
			-- equal to current object?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			symmetric: Result implies other.is_equal (Current)
			consistent: standard_is_equal (other) implies Result

	frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
			-- Are `some' and `other' either both void or attached to
			-- field-by-field identical objects of the same type?
			-- Always uses default object comparison criterion.
			-- (from ANY)
		ensure -- from ANY
			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))

	frozen standard_is_equal (other: like Current): BOOLEAN
			-- Is `other' attached to an object of the same type
			-- as current object, and field-by-field identical to it?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			same_type: Result implies same_type (other)
			symmetric: Result implies other.standard_is_equal (Current)
	
feature -- Status report

	bitmaps_height: INTEGER_32
			-- height of all bitmaps located in this imageList

	bitmaps_width: INTEGER_32
			-- width of all bitmaps located in this imageList

	conforms_to (other: ANY): BOOLEAN
			-- Does type of current object conform to type
			-- of `other' (as per Eiffel: The Language, chapter 13)?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void

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

	get_background_color: WEL_COLOR_REF
			-- Retrieves the current background color for this image list. 
		require
			exists: exists
		ensure
			result_not_void: Result /= Void

	same_type (other: ANY): BOOLEAN
			-- Is type of current object identical to type of `other'?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			definition: Result = (conforms_to (other) and other.conforms_to (Current))

	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

	destroy
			-- destroy item by calling the
			-- corresponding Windows function and
			-- set item to default_pointer.

	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 -- Duplication

	copy (other: like Current)
			-- Update current object using fields of object attached
			-- to `other', so as to yield equal objects.
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
			type_identity: same_type (other)
		ensure -- from ANY
			is_equal: is_equal (other)

	frozen deep_copy (other: like Current)
			-- Effect equivalent to that of:
			--		copy (`other' . deep_twin)
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			deep_equal: deep_equal (Current, other)

	frozen deep_twin: like Current
			-- New object structure recursively duplicated from Current.
			-- (from ANY)
		ensure -- from ANY
			deep_equal: deep_equal (Current, Result)

	frozen standard_copy (other: like Current)
			-- Copy every field of `other' onto corresponding field
			-- of current object.
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
			type_identity: same_type (other)
		ensure -- from ANY
			is_standard_equal: standard_is_equal (other)

	frozen standard_twin: like Current
			-- New object field-by-field identical to `other'.
			-- Always uses default copying semantics.
			-- (from ANY)
		ensure -- from ANY
			standard_twin_not_void: Result /= Void
			equal: standard_equal (Result, Current)

	frozen twin: like Current
			-- New object equal to `Current'
			-- twin calls copy; to change copying/twining semantics, redefine copy.
			-- (from ANY)
		ensure -- from ANY
			twin_not_void: Result /= Void
			is_equal: Result.is_equal (Current)
	
feature -- Basic operations

	add_bitmap (bitmap_to_add: WEL_BITMAP)
			-- Add the bitmap `bitmap_to_add' into the image list.
		require
			bitmap_not_void: bitmap_to_add /= Void
			compatible_width_for_bitmap: bitmap_to_add.width = bitmaps_width
			compatible_height_for_bitmap: bitmap_to_add.height = bitmaps_height
			exists: exists

	add_color_masked_bitmap (bitmap_to_add: WEL_BITMAP; mask_color: WEL_COLOR_REF)
			-- Add the bitmap `bitmap_to_add' into the image list.
			-- `mask_color' represents the color used to generate the mask. 
			-- Each pixel of this color in the specified bitmap is changed to black
			-- and the corresponding bit in the mask is set to 1.
			--
			-- Note: Bitmaps with color depth greater than 8bpp are not supported
		require
			bitmap_not_void: bitmap_to_add /= Void
			mask_color_not_void: mask_color /= Void
			compatible_width_for_bitmap: bitmap_to_add.width = bitmaps_width
			compatible_height_for_bitmap: bitmap_to_add.height = bitmaps_height
			exists: exists

	add_icon (icon_to_add: WEL_GRAPHICAL_RESOURCE)
			-- Adds the icon or cursor `icon_to_add' to this image list
		require
			icon_not_void: icon_to_add /= Void
			exists: exists

	add_masked_bitmap (bitmap_to_add: WEL_BITMAP; bitmap_mask: WEL_BITMAP)
			-- Add the bitmap `bitmap_to_add' into the image list.
			-- `bitmap_mask' represents the mask for the bitmap.
		require
			bitmap_not_void: bitmap_to_add /= Void
			mask_not_void: bitmap_mask /= Void
			compatible_width_for_bitmap: bitmap_to_add.width = bitmaps_width
			compatible_height_for_bitmap: bitmap_to_add.height = bitmaps_height
			compatible_width_for_mask: bitmap_mask.width = bitmaps_width
			compatible_height_for_mask: bitmap_mask.height = bitmaps_height
			masked_bitmap_in_use: use_masked_bitmap
			exists: exists

	frozen default: like Current
			-- Default value of object's type
			-- (from ANY)

	frozen default_pointer: POINTER
			-- Default value of type `POINTER'
			-- (Avoid the need to write `p'.default for
			-- some `p' of type `POINTER'.)
			-- (from ANY)

	default_rescue
			-- Process exception for routines with no Rescue clause.
			-- (Default: do nothing.)
			-- (from ANY)

	frozen do_nothing
			-- Execute a null action.
			-- (from ANY)

	get_icon (index, flags: INTEGER_32): WEL_ICON
		require
			index_not_too_small: index >= 0
			index_not_too_big: index < count
			exists: exists

	remove_all_images (index: INTEGER_32)
			-- Remove all images from the image list.
		require
			exists: exists

	remove_image (index: INTEGER_32)
			-- Remove the image at index `index' from the image list.
			--
			-- When an image is removed, the indexes of the remaining images are 
			-- adjusted so that the image indexes always range from zero to one
			-- less than the number of images in the image list. 
			-- For example, if you remove the image at index 0, then image 1 becomes 
			-- image 0, image 2 becomes image 1, and so on. 
		require
			index_not_too_small: index >= 0
			index_not_too_big: index < count
			exists: exists

	replace_bitmap (bitmap_to_add: WEL_BITMAP; index: INTEGER_32)
			-- Replace the bitmap at position `index' in the imageList by
			-- `bitmap_to_add'.
		require
			bitmap_not_void: bitmap_to_add /= Void
			not_use_masked_bitmap: not use_masked_bitmap
			index_not_too_small: index >= 0
			index_not_too_big: index < count
			exists: exists

	replace_icon (icon_to_add: WEL_GRAPHICAL_RESOURCE; index: INTEGER_32)
			-- Replace the bitmap at position `index' in the imageList by
			-- the cursor or icon `icon_to_add'.
		require
			icon_not_void: icon_to_add /= Void
			index_not_too_small: index >= 0
			index_not_too_big: index < count
			exists: exists

	replace_masked_bitmap (bitmap_to_add: WEL_BITMAP; bitmap_mask: WEL_BITMAP; index: INTEGER_32)
			-- Replace the bitmap at position `index' in the imageList by
			-- `bitmap_to_add'.
			-- `bitmap_mask' represents the mask for the bitmap.
		require
			bitmap_not_void: bitmap_to_add /= Void
			mask_not_void: bitmap_mask /= Void
			compatible_width_for_bitmap: bitmap_to_add.width = bitmaps_width
			compatible_height_for_bitmap: bitmap_to_add.height = bitmaps_height
			compatible_width_for_mask: bitmap_mask.width = bitmaps_width
			compatible_height_for_mask: bitmap_mask.height = bitmaps_height
			masked_bitmap_in_use: use_masked_bitmap
			index_not_too_small: index >= 0
			index_not_too_big: index < count
			exists: exists

	set_background_color (new_color: WEL_COLOR_REF)
			-- Sets the background color for this image list.
		require
			new_color_not_void: new_color /= Void
			exists: exists
	
feature -- Output

	io: STD_FILES
			-- Handle to standard file setup
			-- (from ANY)

	out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- Was declared in ANY as synonym of tagged_out.
			-- (from ANY)

	print (some: ANY)
			-- Write terse external representation of `some'
			-- on standard output.
			-- (from ANY)

	frozen tagged_out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- Was declared in ANY as synonym of out.
			-- (from ANY)
	
feature -- Platform

	operating_environment: OPERATING_ENVIRONMENT
			-- Objects available from the operating system
			-- (from ANY)
	
invariant
		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

indexing
	copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		356 Storke Road, Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class WEL_IMAGE_LIST