    indexing
    	description: "[
    		Every figure has a center. The position of the
    		center are the values x and y. It is the position
    		on the screen. The center of the figure can be moved arround
    		and the figure can be rotated around its center and
    		scaled in x and y direction. 2*pi is a full rotation. The
    		direction of a rotation is clockwise.
    	]"
    	legal: "See notice at end of class."
    	status: "See notice at end of class."
    	date: "$Date: 2006-07-12 15:15:52 -0700 (Wed, 12 Jul 2006) $"
    	revision: "$Revision: 61253 $"

    deferred class interface
    	EV_MODEL

    feature -- Access

    	angle: REAL_64
    			-- `Current' has to be rotated around (x,y) for -angle
    			-- to be in upright position. Upright position has to
    			-- be defined for every figure. If a figure is in upright position
    			-- and you scale it to x direction, the figure should be
    			-- scaled in the direction of the x direction of the screen.

    	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)

    	group: EV_MODEL_GROUP
    			-- The group `Current' is part of. Void if `Current' is
    			-- not part of a group.

    	id: INTEGER_32
    			-- Unique id.
    		ensure -- from HASHABLE
    			good_hash_value: Result >= 0

    	frozen id_object (an_id: INTEGER_32): IDENTIFIED
    			-- Object associated with `an_id' (void if no such object)
    			-- (from IDENTIFIED)
    		ensure -- from IDENTIFIED
    			consistent: Result = Void or else Result.object_id = an_id

    	frozen object_id: INTEGER_32
    			-- Unique for current object in any given session
    			-- (from IDENTIFIED)
    		ensure -- from IDENTIFIED
    			valid_id: id_object (Result) = Current

    	pebble: ANY
    			-- Data to be transported by pick and drop mechanism.

    	pebble_function: FUNCTION [ANY, TUPLE, ANY]
    			-- Returns data to be transported by pick and drop mechanism.
    			-- When not `Void', pebble is ignored.

    	point_count: INTEGER_32
    			-- Number of points needed to describe `Current'.
    			-- Without center.
    		ensure
    			correct: Result = point_array.count

    	pointer_style: EV_POINTER_STYLE
    			-- Cursor displayed when pointer is over this figure.

    	target_name: STRING_GENERAL
    			-- Optional textual name describing `Current' pick and drop hole.
    			-- (from EV_ABSTRACT_PICK_AND_DROPABLE)

    	world: EV_MODEL_WORLD
    			-- The world `Current' is part of. Void if `Current' is
    			-- not part of a world

    	x: INTEGER_32
    			-- x position of the center on the screen.

    	y: INTEGER_32
    			-- y position of the center on the screen .

    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

    	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

    	is_hashable: BOOLEAN
    			-- May current object be hashed?
    			-- (True if it is not its type's default.)
    			-- (from HASHABLE)
    		ensure -- from HASHABLE
    			ok_if_not_default: Result implies (Current /= default)

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

    feature -- Status setting

    	set_target_name (a_name: STRING_GENERAL)
    			-- Assign `a_name' to target_name.
    			-- (from EV_ABSTRACT_PICK_AND_DROPABLE)
    		require -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			a_name_not_void: a_name /= Void
    		ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			target_name_assigned: a_name /= target_name and a_name.is_equal (target_name)

    feature -- Element change

    	remove_pebble
    			-- Make pebble `Void' and pebble_function `Void,
    			-- Removing transport.
    		ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			pebble_removed: pebble = Void and pebble_function = Void

    	rotate (an_angle: REAL_64)
    			-- Rotate around the center for `an_angle'.
    		require
    			is_rotatable: is_rotatable
    		ensure
    			center_valid: is_center_valid

    	rotate_around (an_angle: REAL_64; ax, ay: INTEGER_32)
    			-- Rotate around (`ax', `ay') for `an_angle'.
    		require
    			is_rotatable: is_rotatable
    		ensure
    			center_valid: is_center_valid

    	scale (a_scale: REAL_64)
    			-- Scale to x and y direction for `a_scale'.
    		require
    			is_scalable: is_scalable
    			a_scale_bigger_zero: a_scale > 0.0

    	scale_abs (a_scale: REAL_64)
    			-- Scale to x and y direction for `a_scale'.
    			-- Do not rotate around angle first.
    		require
    			is_scalable: is_scalable
    			a_scale_bigger_zero: a_scale > 0.0

    	scale_x (a_scale_x: REAL_64)
    			-- Scale to x direction for `a_scale_x'.
    		require
    			is_scalable: is_scalable
    			a_scale_x_bigger_zero: a_scale_x > 0.0

    	scale_x_abs (a_scale_x: REAL_64)
    			-- Scale absolute to x direction for `a_scale_x'.
    			-- Do not rotate around angle first.
    		require
    			is_scalable: is_scalable
    			a_scale_x_bigger_zero: a_scale_x > 0.0

    	scale_y (a_scale_y: REAL_64)
    			-- Scale to y direction for `a_scale_y'.
    		require
    			is_scalable: is_scalable
    			a_scale_y_bigger_zero: a_scale_y > 0.0

    	scale_y_abs (a_scale_y: REAL_64)
    			-- Scale to y direction for `a_scale_y'.
    			-- Do not rotate around angle first.
    		require
    			is_scalable: is_scalable
    			a_scale_y_bigger_zero: a_scale_y > 0.0

    	set_accept_cursor (a_cursor: EV_POINTER_STYLE)
    			-- Set `a_cursor' to be displayed when the screen pointer is over a
    			-- target that accepts pebble during pick and drop.
    		require -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			a_cursor_not_void: a_cursor /= Void
    		ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			accept_cursor_assigned: accept_cursor.is_equal (a_cursor)

    	set_deny_cursor (a_cursor: EV_POINTER_STYLE)
    			-- Set `a_cursor' to be displayed when the screen pointer is not
    			-- over a valid target.
    		require -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			a_cursor_not_void: a_cursor /= Void
    		ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			deny_cursor_assigned: deny_cursor.is_equal (a_cursor)

    	set_pebble (a_pebble: like pebble)
    			-- Assign `a_pebble' to pebble.
    		require -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			a_pebble_not_void: a_pebble /= Void
    		ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			pebble_assigned: pebble = a_pebble

    	set_pebble_function (a_function: FUNCTION [ANY, TUPLE, ANY])
    			-- Set `a_function' to compute pebble.
    		require -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			a_function_not_void: a_function /= Void
    			a_function_takes_two_integer_open_operands: a_function.valid_operands ([1, 1])
    		ensure -- from EV_ABSTRACT_PICK_AND_DROPABLE
    			pebble_function_assigned: pebble_function = a_function

    	set_pointer_style (a_cursor: like pointer_style)
    			-- Assign `a_cursor' to pointer_style.
    		require
    			a_cursor_not_void: a_cursor /= Void
    		ensure
    			pointer_style_assigned: pointer_style = a_cursor

    	set_x (a_x: INTEGER_32)
    			-- Set x to `an_x'.
    		ensure
    			x_set: a_x = x
    			center_valid: is_center_valid

    	set_x_y (a_x, a_y: INTEGER_32)
    			-- Set x to `a_x' and y to `a_y'.
    		ensure
    			set: a_x = x and a_y = y
    			center_valid: is_center_valid

    	set_y (a_y: INTEGER_32)
    			-- Set y to `an_y'.
    		ensure
    			y_set: a_y = y
    			center_valid: is_center_valid

    	transform (a_transformation: EV_MODEL_TRANSFORMATION)
    			-- Transform all points in point_array using `a_transformation'.
    			-- You can do any transformation you want. You can
    			-- for example rotate `Current' around an other point
    			-- than the center.
    		require
    			a_transformation_not_void: a_transformation /= Void
    			is_transformable: is_transformable

    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

    	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)

    feature -- Action sequences

    	conforming_pick_actions: EV_NOTIFY_ACTION_SEQUENCE
    			-- Actions to be performed when a pebble that fits this hole is
    			-- picked up from another source.
    			-- (when drop_actions.accepts_pebble (pebble))

    	drop_actions: EV_PND_ACTION_SEQUENCE
    			-- Actions to take when pick and drop transport drops on `Current'.

    	pick_actions: EV_PND_START_ACTION_SEQUENCE
    			-- Actions to be performed when pebble is picked up.

    	pointer_button_press_actions: EV_POINTER_BUTTON_ACTION_SEQUENCE
    			-- Actions to be performed when screen pointer button is pressed.

    	pointer_button_release_actions: EV_POINTER_BUTTON_ACTION_SEQUENCE
    			-- Actions to be performed when screen pointer button is released.

    	pointer_double_press_actions: EV_POINTER_BUTTON_ACTION_SEQUENCE
    			-- Actions to be performed when screen pointer is double clicked.

    	pointer_enter_actions: EV_NOTIFY_ACTION_SEQUENCE
    			-- Actions to be performed when screen pointer enters widget.

    	pointer_leave_actions: EV_NOTIFY_ACTION_SEQUENCE
    			-- Actions to be performed when screen pointer leaves widget.

    	pointer_motion_actions: EV_POINTER_MOTION_ACTION_SEQUENCE
    			-- Actions to be performed when screen pointer moves.

    feature -- Events

    	bounding_box: EV_RECTANGLE
    			-- Smallest orthogonal rectangular area `Current' fits in.
    			-- Every call returns a new instance.
    		ensure
    			result_not_void: Result /= Void
    			internal_is_twin: internal_bounding_box /= Result

    	position_on_figure (a_x, a_y: INTEGER_32): BOOLEAN
    			-- Is the point on (`a_x', `a_y') on this figure?

    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)

    feature -- Status Report

    	accept_cursor: EV_POINTER_STYLE
    			-- Accept cursor set by user.
    			-- To be displayed when the screen pointer is over a target that accepts
    			-- pebble during pick and drop.

    	are_events_sended_to_group: BOOLEAN
    			-- Are events for pointer_motion_actions, pointer_button_press_actions,
    			-- pointer_double_press_actions,  pointer_button_release_actions
    			-- pointer_enter_actions and pointer_leave_actions send to `Current's
    			-- group (if any) even if `Current' catch the event. (Default True).

    	deny_cursor: EV_POINTER_STYLE
    			-- Deny cursor set by user.
    			-- To be displayed when the screen pointer is not over a valid target.

    	has_capture: BOOLEAN
    			-- Are all events sent to `Current'?

    	is_center_valid: BOOLEAN
    			-- Is the position of the center valid?

    	is_in_group: BOOLEAN
    			-- Is `Current' part of a group?
    		ensure
    			group_defines_is_in_group: Result = (group /= Void)

    	is_in_world: BOOLEAN
    			-- Is `Current' part of a world?
    		ensure
    			world_defines_is_in_world: Result = (world /= Void)

    	is_rotatable: BOOLEAN
    			-- Is this figure rotatable?

    	is_scalable: BOOLEAN
    			-- Is this figure scalable?

    	is_sensitive: BOOLEAN
    			-- Is object sensitive to user input?

    	is_show_requested: BOOLEAN
    			-- Will `Current' be displayed when its parent is?

    	is_transformable: BOOLEAN
    			-- Is this figure transformable no matter what kind of transformation?

    feature -- Status settings

    	disable_capture
    			-- Disable grab of all events on world.
    		require
    			in_world: world /= Void
    			has_capture: has_capture
    		ensure
    			capture_released: not has_capture

    	disable_events_sended_to_group
    			-- Set are_events_sended_to_group to False.
    		ensure
    			events_blocked: not are_events_sended_to_group

    	disable_sensitive
    			-- Make object non-sensitive to user input.
    		ensure
    			insensitive_requested: not internal_is_sensitive

    	enable_capture
    			-- Grab all mouse events for world.
    		require
    			in_world: world /= Void
    		ensure
    			capture_set: has_capture

    	enable_events_sended_to_group
    			-- Set are_events_sended_to_group to True.
    		ensure
    			events_sended_to_group: are_events_sended_to_group

    	enable_sensitive
    			-- Make object sensitive to user input.
    		ensure
    			sensitive_requested: internal_is_sensitive

    	hide
    			-- Request that `Current' not be displayed even when its group is.
    		ensure
    			not_is_show_requested: not is_show_requested

    	show
    			-- Request that `Current' be displayed when its group is.
    			-- `True' by default.
    		ensure
    			is_show_requested: is_show_requested

    feature --EV_FIGURE -- Status settings

    	center_invalidate
    			-- The position of the center may have changed.

    invariant
    	point_array_exists: point_array /= Void
    	center_exists: center /= Void
    	x_is_center_x: x = center.x
    	y_is_center_y: y = center.y
    	all_points_exist: all_points_exist (point_array)
    	projection_matrix_not_void: projection_matrix /= Void
    	is_transfomable_implies_rotatable_and_scalable: is_transformable implies (is_rotatable and is_scalable)

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