indexing
	description: "Contains information about the window class."
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2006-03-22 23:29:03 -0800 (Wed, 22 Mar 2006) $"
	revision: "$Revision: 57641 $"

class interface
	WEL_WND_CLASS

create 
	make (a_class_name: STRING_GENERAL)
			-- Make a window class named `a_class_name'.
		require
			class_name_not_void: a_class_name /= Void
			class_name_not_empty: not a_class_name.is_empty
		ensure
			style_set: style = 0
			window_procedure_unset: not window_procedure_set
			class_extra_set: class_extra = 0
			window_extra_set: window_extra = 0
			instance_set: instance.item = main_args.current_instance.item
			icon_unset: not icon_set
			cursor_unset: not cursor_set
			background_unset: not background_set
			menu_nameunset: not menu_name_set
			class_name_set: class_name.is_equal (a_class_name)
			atom_set: atom = 0

feature -- Access

	atom: INTEGER_32
			-- Class atom that uniquely identifies class being registered.

	background: WEL_BRUSH
			-- Background color of the window
		require
			background_set: background_set
		ensure
			result_not_void: Result /= Void
			result_exists: Result.exists

	class_extra: INTEGER_32
			-- Class extra information size
		ensure
			positive_result: Result >= 0

	class_name: STRING_32
			-- Class name
		ensure
			result_not_void: Result /= Void
			result_not_empty: not Result.is_empty

	cursor: WEL_CURSOR
			-- Cursor to use when the mouse is into the window.
		require
			cursor_set: cursor_set
		ensure
			result_not_void: Result /= Void
			result_exists: Result.exists

	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)

	icon: WEL_ICON
			-- Icon to draw when the window is minimized.
		require
			icon_set: icon_set
		ensure
			result_not_void: Result /= Void
			result_exists: Result.exists

	instance: WEL_INSTANCE
			-- Instance of the class.
		require
			instance_set: instance_set
		ensure
			result_not_void: Result /= Void

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

	menu_name: STRING_32
			-- Menu name to load from the resource
		require
			menu_name_set: menu_name_set
		ensure
			result_not_void: Result /= Void

	style: INTEGER_32
			-- Class style

	window_extra: INTEGER_32
			-- Window extra information size
		ensure
			positive_result: Result >= 0

	window_procedure: POINTER
			-- Window procedure to call
		require
			window_procedure_set: window_procedure_set
		ensure
			Result /= default_pointer
	
feature -- Measurement

	structure_size: INTEGER_32
			-- Size to allocate (in bytes)
		ensure -- from WEL_STRUCTURE
			positive_result: Result > 0
	
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))

	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

	background_set: BOOLEAN
			-- Is the background set?

	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

	cursor_set: BOOLEAN
			-- Is the cursor set?

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

	icon_set: BOOLEAN
			-- Is the icon set?

	instance_set: BOOLEAN
			-- Is the instance set?

	menu_name_set: BOOLEAN
			-- Is the menu name set?

	registered: BOOLEAN
			-- Is the class registered?

	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)

	window_procedure_set: BOOLEAN
			-- Is the window procedure set?
	
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_background (a_background: WEL_BRUSH)
			-- Set background with `a_background'.
		require
			a_background_not_void: a_background /= Void
		ensure
			background_equal: background.item = a_background.item

	set_class_extra (a_class_extra: INTEGER_32)
			-- Set class_extra with `a_class_extra'.
		require
			positive_extra: a_class_extra >= 0
		ensure
			class_extra = a_class_extra

	set_class_name (a_class_name: STRING_GENERAL)
			-- Set class_name with `a_class_name'.
		require
			a_class_name_valid: a_class_name /= Void
			a_class_name_not_empty: not a_class_name.is_empty
		ensure
			class_name_set: class_name.is_equal (a_class_name)

	set_cursor (a_cursor: WEL_CURSOR)
			-- Set cursor with `a_cursor'.
		require
			a_cursor_not_void: a_cursor /= Void
			a_cursor_exists: a_cursor.exists
		ensure
			cursor_equal: cursor.item = a_cursor.item

	set_icon (an_icon: WEL_ICON)
			-- Set icon with `an_icon'.
		require
			an_icon_not_void: an_icon /= Void
			an_icon_exists: an_icon.exists
		ensure
			icon_equal: icon.item = an_icon.item

	set_instance (an_instance: WEL_INSTANCE)
			-- Set instance with `an_instance'.
		require
			an_instance_not_void: an_instance /= Void
			an_instance_exists: an_instance.exists
		ensure
			instance_equal: instance.item = an_instance.item

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

	set_menu_name (a_menu_name: STRING_GENERAL)
			-- Set menu_name with `a_menu_name'.
		require
			a_menu_name_valid: a_menu_name /= Void
		ensure
			menu_name_equal: menu_name.is_equal (a_menu_name)

	set_style (a_style: INTEGER_32)
			-- Set style with `a_style'.
		ensure
			style = a_style

	set_window_extra (a_window_extra: INTEGER_32)
			-- Set window_extra with `a_window_extra'.
		require
			positive_extra: a_window_extra >= 0
		ensure
			window_extra = a_window_extra

	set_window_procedure (a_window_procedure: POINTER)
			-- Set window_procedure with `a_window_procedure'.
		ensure
			window_procedure_equal: window_procedure = a_window_procedure

	unset_background
			-- Unset the background (becomes null).
		ensure
			background_unset: not background_set

	unset_cursor
			-- Unset the cursor (becomes null).
		ensure
			cursor_unset: not cursor_set

	unset_icon
			-- Unset the icon (becomes null).
		ensure
			icon_unset: not icon_set

	unset_menu_name
			-- Unset the menu (becomes null).
		ensure
			menu_name_unset: not menu_name_set

	unset_window_procedure
			-- Unset the window procedure (becomes null).
		ensure
			window_procedure_unset: not window_procedure_set
	
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 -- Duplication

	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

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

	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)

	initialize
			-- Fill Current with zeros.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			exists: exists

	initialize_with_character (a_character: CHARACTER_8)
			-- Fill current with `a_character'.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			exists: exists

	is_equal (other: like Current): BOOLEAN
			-- Is `other' attached to an object considered
			-- equal to current object?
			-- (from WEL_STRUCTURE)
		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

	memory_copy (source_pointer: POINTER; length: INTEGER_32)
			-- 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

	register
			-- Register the window class.
		ensure
			registered: registered

	unregister
			-- Unregister the window class.
			-- All windows using this class must be destroyed.
		require
			registered: registered
		ensure
			no_registered: not registered
	
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_WND_CLASS