indexing
	description: "Small picture whose location on the screen is controlled by a pointing device."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_CURSOR

create 

	make_by_id (id: INTEGER)
			-- Load the resource by an id
			-- (from WEL_GRAPHICAL_RESOURCE)
		require -- from WEL_RESOURCE
			valid_id: id > 0
		ensure -- from WEL_RESOURCE
			not_shared: not shared

	make_by_name (name: STRING)
			-- Load the resource by a name
			-- (from WEL_GRAPHICAL_RESOURCE)
		require -- from WEL_RESOURCE
			name_not_void: name /= void
			name_not_empty: not name.is_empty
		ensure -- from WEL_RESOURCE
			not_shared: not shared

	make_by_file (file_name: STRING)
			-- Load an icon file named file_name.
			-- (from WEL_GRAPHICAL_RESOURCE)
		require -- from WEL_GRAPHICAL_RESOURCE
			file_name_not_void: file_name /= void

	make_by_bitmask (x_hot_spot, y_hot_spot: INTEGER; and_plane, xor_plane: ARRAY [CHARACTER])
			-- Make a cursor using bitmask arrays.
			-- and_plane and xor_plane points to an array of
			-- byte that contains the bit values for the AND and XOR
			-- bitmasks of the cursor, as in a device-dependent
			-- monochrome bitmap. x_hot_spot, and y_hot_spot
			-- specify the horizontal and vertical position of
			-- the cursor's hot spot.
		require
			x_hot_spot_large_enough: x_hot_spot >= 0
			x_hot_spot_small_enough: x_hot_spot < cursor_width
			y_hot_spot_large_enough: y_hot_spot >= 0
			y_hot_spot_small_enough: y_hot_spot < cursor_height
			and_plane_not_void: and_plane /= void
			xor_plane_not_void: xor_plane /= void
			and_plane_not_empty: not and_plane.is_empty
			xor_plane_not_empty: not xor_plane.is_empty

	make_by_predefined_id (id: POINTER)
			-- Load the resource by an id, predefined by Windows
			-- (from WEL_GRAPHICAL_RESOURCE)
		ensure -- from WEL_RESOURCE
			shared: 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_GDI_ANY)
		ensure -- from WEL_ANY
			item_set: item = a_pointer
			shared: shared

	make_by_icon_info (icon_info: WEL_ICON_INFO)
			-- Create an icon from an icon_info structure
			-- (from WEL_GRAPHICAL_RESOURCE)
		ensure -- from WEL_GRAPHICAL_RESOURCE
			item_not_void: item /= void

feature -- Access

	gdi_objects_count: INTEGER
			-- Number of GDI object currently allocated by the
			-- program.
			--
			-- Note: debug option "WEL_GDI_COUNT" should be enabled, otherwise
			-- this function will return zero.
			-- (from WEL_GDI_ANY)

	get_icon_info: WEL_ICON_INFO
			-- Retrieve information about a icon/cusor
			--
			-- Return Void if an error occurred while retrieving
			-- the information.
			-- (from WEL_GRAPHICAL_RESOURCE)
		ensure -- from WEL_GRAPHICAL_RESOURCE
			result_void_or_valid: Result = void or else Result.is_initialized

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

	previous_cursor: WEL_CURSOR
			-- Previously assigned cursor

	x_hotspot: INTEGER
			-- X-coordinate of Currents hot spot.

	y_hotspot: INTEGER
			-- Y-coordinate of a Currents hot spot.
	
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
			-- Delete the current gdi object
			-- (from WEL_GRAPHICAL_RESOURCE)
		require -- from WEL_REFERENCE_TRACKABLE
			reference_not_tracked: not reference_tracked
		ensure -- from WEL_REFERENCE_TRACKABLE
			destroyed: not shared implies not exists

	delete_gdi_object
			-- Delete the current gdi object
			-- (from WEL_GRAPHICAL_RESOURCE)
		ensure -- from WEL_GDI_ANY
			not_exists: not exists

	dispose
			-- Destroy the inner structure of Current.
			--
			-- This function is called by the GC when the
			-- object is collected, the developer should
			-- use delete.
			-- (from WEL_REFERENCE_TRACKABLE)
	
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

	restore_previous
			-- Restore previous_cursor.
		require
			previous_cursor_not_void: previous_cursor /= void
		ensure
			previous_cursor_void: previous_cursor = void

	set
			-- Set current cursor for entire application and
			-- save old one in previous_cursor if there was
			-- one.
		require
			exists: exists
	
feature -- Status Report

	reference_tracked: BOOLEAN
			-- Are the number references of Current tracked?
			-- (from WEL_REFERENCE_TRACKABLE)

	references_count: INTEGER
			-- Number of object referring this object.
			-- (from WEL_REFERENCE_TRACKABLE)
	
feature -- Status Setting

	decrement_reference
			-- Decrement the number of references to this object.
			--
			-- When the number of references reach zero,
			-- delete is called if the object is not protected.
			-- (from WEL_REFERENCE_TRACKABLE)
		require -- from WEL_REFERENCE_TRACKABLE
			exists: exists
			tracking_references_started: reference_tracked

	enable_reference_tracking
			-- Set references_tracked to True.
			--
			-- (from WEL_REFERENCE_TRACKABLE)
		require -- from WEL_REFERENCE_TRACKABLE
			exists: exists
			tracking_reference_not_started: not reference_tracked

	increment_reference
			-- Increment the number of references to this object.
			-- (from WEL_REFERENCE_TRACKABLE)
		require -- from WEL_REFERENCE_TRACKABLE
			exists: exists
			tracking_references_started: reference_tracked

	object_id: INTEGER
			-- Runtime Id of Current.
			-- (from WEL_REFERENCE_TRACKABLE)
	
invariant

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

end -- class WEL_CURSOR