note
	description: "[
		The widget representing this port
		]"
	author: "Jimmy J. Johnson"

class
	TRUK_WIDGET

inherit

--	RED_PORT_WIDGET
--		undefine
--			paint
--		redefine
--			create_interface_objects,
--			initialize,
--			extend_widgets,
--			position_widgets,
--			build_land
--		end

	ISLAND_PORT_WIDGET
		redefine
			create_interface_objects,
--			initialize,
			extend_widgets,
			build_widgets,
			position_widgets,
			build_land
		end

create
	make

feature {NONE} -- Initialization

	create_interface_objects
			-- Initialize attributes
		do
			mainland := mainland_imp
			create not_allowed_text.make_with_text ("(No British Allowed)")
			Precursor {ISLAND_PORT_WIDGET}
--			Precursor {RED_PORT_WIDGET}
			dot.show
		end

	build_widgets
			-- Now that widgets were created in `create_interface_objects'
			-- and added to Current in `extend_widgets', build up the
			-- widgets by adding internal structure to each widget.
		do
			Precursor {ISLAND_PORT_WIDGET}
--			Precursor {RED_PORT_WIDGET}
			hide_arrow
		end

	extend_widgets
			-- Put widgets into Current.  This cannot be done
			-- in `create_interface_object', because cannot call
			-- `extend' feature until all objects [in descendants]
			-- are also created.
		do
			Precursor {ISLAND_PORT_WIDGET}
--			Precursor {RED_PORT_WIDGET}
			extend (not_allowed_text)
		end

	position_widgets
			-- Move Current and contained widgets to correct
			-- location and set their their sizes
		do
			Precursor {ISLAND_PORT_WIDGET}
--			Precursor {RED_PORT_WIDGET}
				-- make adjustments
			translate_widget (Current, 330, 260)
--			marker.set_x_y (dot.x, dot.y)
--			anchor.set_x_y (dot.x, dot.y)

--			translate_widget (name_mt, 0, 4)
--			translate_widget (marker, -6, -6)
--			translate_widget (anchor, -1, -3)
--			translate_widget (not_allowed_text, 48, 72)
		end

	build_land
			-- Add widgets to Current
		do
			Precursor {ISLAND_PORT_WIDGET}
--			land.extend (mainland)
		end

	not_allowed_text: EV_MODEL_TEXT
			-- Extra text on some Red ports (e.g. "No British Allowed").

feature -- Status report

	is_red: BOOLEAN = True
			-- Does Current represent a red (i.e. major) port?

feature {NONE} -- Implementation

	mainland: EV_MODEL_POLYGON

feature {NONE} -- Implementation

	mainland_imp: EV_MODEL_POLYGON
			-- Put something in the `land' so it can be better positioned, otherwise
			-- clicking in unrelated locations seems to pull up this widget.
			-- This triangle is hidden under the port circle.
		do
			create Result
			Result.extend_point (create {EV_COORDINATE}.make_precise (0.0, 0.0))
			Result.extend_point (create {EV_COORDINATE}.make_precise (2.0, 2.0))
			Result.extend_point (create {EV_COORDINATE}.make_precise (-2.0, -2.0))
		end

end
