indexing
	description: "Contains information about a button in a toolbar."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_TOOL_BAR_BUTTON

create 

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

	make_button (a_bitmap_index, a_command_id: INTEGER)
			-- Make a button using a_bitmap_index and
			-- a_command_id.
		ensure
			bitmap_index_set: bitmap_index = a_bitmap_index
			command_id_set: command_id = a_command_id

	make_check (a_bitmap_index, a_command_id: INTEGER)
			-- Make a check button using a_bitmap_index and
			-- a_command_id.
		ensure
			bitmap_index_set: bitmap_index = a_bitmap_index
			command_id_set: command_id = a_command_id

	make_check_group (a_bitmap_index, a_command_id: INTEGER)
			-- Make a check group using a_bitmap_index and
			-- a_command_id.
		ensure
			bitmap_index_set: bitmap_index = a_bitmap_index
			command_id_set: command_id = a_command_id

	make_group (a_bitmap_index, a_command_id: INTEGER)
			-- Make an enabled check group using a_bitmap_index
			-- and a_command_id.
		ensure
			bitmap_index_set: bitmap_index = a_bitmap_index
			command_id_set: command_id = a_command_id

	make_separator
			-- Make a separator providing a small gap between
			-- groups.

	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_index: INTEGER
			-- Zero-based index of button image

	command_id: INTEGER
			-- Command identifier associated with the button. This
			-- identifer is used in a Wm_command message when the
			-- button is chosen.

	data: INTEGER
			-- Application-defined value

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

	state: INTEGER
			-- Button state flags.
			-- See class WEL_TB_STATE_CONSTANTS for values

	string_index: INTEGER
			-- Zero-based index of button string.
		ensure
			positive_result: Result >= 0

	style: INTEGER
			-- Button style flags.
			-- See class WEL_TB_STYLE_CONSTANTS for values
	
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_bitmap_index (a_bitmap_index: INTEGER)
			-- Set bitmap_index with a_bitmap_index.
		ensure
			bitmap_index_set: bitmap_index = a_bitmap_index

	set_command_id (a_command_id: INTEGER)
			-- Set command_id with a_command_id.
		ensure
			command_id_set: command_id = a_command_id

	set_data (a_data: INTEGER)
			-- Set data with a_data.
		ensure
			data_set: data = a_data

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

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

	set_string_index (a_string_index: INTEGER)
			-- Set string_index with a_string_index.
		require
			positive_index: a_string_index >= 0
		ensure
			string_index_set: string_index = a_string_index

	set_style (a_style: INTEGER)
			-- Set style with a_style.
		ensure
			style_set: style = a_style
	
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

	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_TOOL_BAR_BUTTON