indexing
	description: "Standard dialog box to choose a font."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_CHOOSE_FONT_DIALOG

create 

	make
			-- Make and setup the structure.
			-- By default the dialog will show the screen fonts.

feature -- Access

	color: WEL_COLOR_REF
			-- Font color
		require
			exits: exists
		ensure
			result_not_void: Result /= void

	flags: INTEGER
			-- Dialog box creation flags.
			-- Can be a combination of the values defined in
			-- class WEL_CF_CONSTANTS.

	font_type: INTEGER
			-- Type of the selected font.
			-- See class WEL_FONT_TYPE_CONSTANTS for values.
		require
			selected: selected
		ensure
			valid_font_type: valid_font_type_constant (Result)

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

	log_font: WEL_LOG_FONT
			-- Information about the selected font

	maximum_size: INTEGER
			-- Maximum point size a user can select

	minimum_size: INTEGER
			-- Minimum point size a user can select

	point_size: INTEGER
			-- Size of the selected font (in units of 1/10 of
			-- a point)
		require
			selected: selected
	
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)

	has_flag (a_flags: INTEGER): BOOLEAN
			-- Is a_flags set in flags?
			-- See class WEL_CF_CONSTANTS for a_flags values.

	selected: BOOLEAN
			-- Has the user selected something (file, color, etc.)?
			-- If True, the Ok button has been chosen. If False,
			-- the Cancel button has been chosen.
			-- (from WEL_STANDARD_DIALOG)

	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 report

	valid_font_type_constant (c: INTEGER): BOOLEAN
			-- Is c a valid font type constant?
			-- (from WEL_FONT_TYPE_CONSTANTS)
	
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_flag (a_flags: INTEGER)
			-- Add a_flags to flags.
			-- See class WEL_CF_CONSTANTS for a_flags values.
		ensure
			has_flag: has_flag (a_flags)

	remove_flag (a_flags: INTEGER)
			-- Remove a_flags from flags.
			-- See class WEL_CF_CONSTANTS for a_flags values.
		ensure
			has_not_flag: not has_flag (a_flags)

	set_color (a_color: WEL_COLOR_REF)
			-- Set color with a_color.
		ensure
			color_set: color.is_equal (a_color)

	set_dc (a_dc: WEL_DC)
			-- Set a device context a_dc of the printer whose
			-- fonts will be listed in the dialog box.
		require
			a_dc_not_void: a_dc /= void
			a_dc_exists: a_dc.exists

	set_flags (a_flags: INTEGER)
			-- Set flags with a_flags.
			-- See class WEL_CF_CONSTANTS for a_flags values.
		ensure
			flags_set: flags = a_flags

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

	set_log_font (a_log_font: WEL_LOG_FONT)
			-- Set log_font with a_log_font.
		require
			a_log_font_not_void: a_log_font /= void
		ensure
			log_font_set: log_font.item = a_log_font.item

	set_maximum_size (size: INTEGER)
			-- Set maximum_size with size.
		ensure
			maximum_size_set: maximum_size = size

	set_minimum_size (size: INTEGER)
			-- Set minimum_size with size.
		ensure
			minimum_size_set: minimum_size = size
	
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

	activate (a_parent: WEL_COMPOSITE_WINDOW)
			-- Activate the dialog box (modal mode) with
			-- a_parent as owner.
		require -- from WEL_STANDARD_DIALOG
			a_parent_not_void: a_parent /= void
			a_parent_exists: a_parent.exists

	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_CHOOSE_FONT_DIALOG