Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.widget

Class EM_COMPONENT


Direct ancestors

EM_INPUT_SENSITIVE, EM_SHARED_SUBSYSTEMS, EM_SHARED_FOCUS, EM_SHARED_COMPONENT_EVENT_QUEUE

Known direct descendants

EM_2D_COMPONENT, EM_3D_COMPONENT, EM_WINDOW_LAYER

Features

Invariants

indexing

description

Base class for all components which are displayed on an EM_COMPNENT_SCENE.

To place a component on a scene call add_component on an EM_COMPONENT_SCENE
and set the position and dimension of Current with set_position and set_dimension.

Components provide:
- Mouse events (See EM_MOUSE_SENSITIVE)
- Keyboard events (See EM_KEYBOARD_SENSITIVE)
- Tooltips (See set_tooltip)
- Drawing

prepare_drawing will be called before each draw. finish_drawing will be called afterwards.

Events:
- move_event: Triggered when position changed. Passes no arguments.
- resize_event: Triggered when dimension changed. Passes no arguments.
- show_event: Triggered when set to visible. Passes no arguments.
- hide_event: Triggered when set to invisible. Passes no arguments.

Subclasses must call make_component at creation.

See EM_2D_COMPONENT, EM_3D_COMPONENT

date

$Date: 2005/10/23 11:07:51 $

revision

$Revision: 1.17 $

deferred class

EM_COMPONENT

inherit

EM_INPUT_SENSITIVE

feature -- Access

tooltip: STRING

-- Tooltip of Current

x: INTEGER

-- X position of Current relative to parent

y: INTEGER

-- Y position of Current relative to parent

feature -- Measurement

height: INTEGER

-- Height of Current

width: INTEGER

-- Width of Current

feature -- Status report

is_enabled: BOOLEAN

-- Is Current enabled?

is_joystick_sensitive: BOOLEAN

-- Does Current handle joystick events?

-- (From EM_INPUT_SENSITIVE)

is_keyboard_sensitive: BOOLEAN

-- Does Current handle keyboard events?

-- (From EM_INPUT_SENSITIVE)

is_mouse_sensitive: BOOLEAN

-- Does Current handle mouse events?

-- (From EM_INPUT_SENSITIVE)

is_visible: BOOLEAN

-- Is Current visible?

feature -- Status setting

disable

-- Disable Current.

ensure
not_enabled: not is_enabled
enable

-- Enable Current.

ensure
enabled: is_enabled
hide

-- Hide Current.
-- This will trigger a hide event.

ensure
not_visible: not is_visible
set_enabled (a_value: like is_enabled)

-- Set is_enabled to a_value.

ensure
is_enabled_set: is_enabled = a_value
set_joystick_sensitive (sensitive: BOOLEAN)

-- Set joystick sensitivity status.

-- (From EM_INPUT_SENSITIVE)

ensure
joystick_sensitivity_set: is_joystick_sensitive = sensitive
set_keyboard_sensitive (sensitive: BOOLEAN)

-- Set keyboard sensitivity status.

-- (From EM_INPUT_SENSITIVE)

ensure
keyboard_sensitivity_set: is_keyboard_sensitive = sensitive
set_mouse_sensitive (sensitive: BOOLEAN)

-- Set mouse sensitivity status.

-- (From EM_INPUT_SENSITIVE)

ensure
mouse_sensitivity_set: is_mouse_sensitive = sensitive
show

-- Show Current.
-- This will trigger a show event.

ensure
visible: is_visible

feature -- Element change

set_position (a_x: like x; a_y: like y)

-- Set position to a_x a_y.
-- This will trigger a move event.

ensure
x_set: x = a_x
y_set: y = a_y
set_tooltip (a_tooltip: like tooltip)

-- Set tooltip to a_tooltip.

ensure
tooltip_set: tooltip = a_tooltip
set_x (a_x: like x)

-- Set x to a_x.

ensure
x_set: x = a_x
set_y (a_y: like y)

-- Set y to a_y.

ensure
y_set: y = a_y

feature -- Resizing

set_dimension (a_width: like width; a_height: like height)

-- Set dimension to a_width a_height.
-- This will trigger a resize event.

require
a_width_not_negative: a_width >= 0
a_height_not_negative: a_height >= 0
ensure
width_set: width = a_width
height_set: height = a_height
set_height (a_height: like height)

-- Set height to a_height.

require
a_height_not_negative: a_height >= 0
ensure
height_set: height = a_height
set_width (a_width: like width)

-- Set width to a_width.

require
a_width_not_negative: a_width >= 0
ensure
width_set: width = a_width

feature -- Drawing

draw

-- Draw Current.

finish_drawing

-- Finish drawing Current.

prepare_drawing

-- Prepare to draw Current.

redraw

-- Redraw Current.

feature -- Events

focus_lost_event: EM_EVENT_TYPE [TUPLE []]

-- Focus lost event

-- (From EM_KEYBOARD_SENSITIVE)

focus_received_event: EM_EVENT_TYPE [TUPLE []]

-- Focus received event

-- (From EM_KEYBOARD_SENSITIVE)

hide_event: EM_EVENT_TYPE [TUPLE []]

-- Component hidden event

joystick_button_down_event: EM_EVENT_TYPE [TUPLE [EM_JOYSTICK_BUTTON_EVENT]]

-- Joystick button down event

-- (From EM_JOYSTICK_SENSITIVE)

key_down_event: EM_EVENT_TYPE [TUPLE [EM_KEYBOARD_EVENT]]

-- Key down event

-- (From EM_KEYBOARD_SENSITIVE)

key_up_event: EM_EVENT_TYPE [TUPLE [EM_KEYBOARD_EVENT]]

-- Key up event

-- (From EM_KEYBOARD_SENSITIVE)

mouse_button_down_event: EM_EVENT_TYPE [TUPLE[EM_MOUSEBUTTON_EVENT]]

-- Mouse button down event

-- (From EM_MOUSE_SENSITIVE)

mouse_button_up_event: EM_EVENT_TYPE [TUPLE[EM_MOUSEBUTTON_EVENT]]

-- Mouse button up event

-- (From EM_MOUSE_SENSITIVE)

mouse_clicked_event: EM_EVENT_TYPE [TUPLE[EM_MOUSEBUTTON_EVENT]]

-- Mouse clicked event

-- (From EM_MOUSE_SENSITIVE)

mouse_drag_start_event: EM_EVENT_TYPE [TUPLE[EM_MOUSE_EVENT]]

-- Mouse drag start event

-- (From EM_MOUSE_SENSITIVE)

mouse_drag_stop_event: EM_EVENT_TYPE [TUPLE[EM_MOUSE_EVENT]]

-- Mouse drag stop event

-- (From EM_MOUSE_SENSITIVE)

mouse_dragged_event: EM_EVENT_TYPE [TUPLE[EM_MOUSEMOTION_EVENT]]

-- Mouse dragged event

-- (From EM_MOUSE_SENSITIVE)

mouse_entered_event: EM_EVENT_TYPE [TUPLE []]

-- Mouse entered event

-- (From EM_MOUSE_SENSITIVE)

mouse_exited_event: EM_EVENT_TYPE [TUPLE []]

-- Mouse exited event

-- (From EM_MOUSE_SENSITIVE)

mouse_moved_event: EM_EVENT_TYPE [TUPLE[EM_MOUSEMOTION_EVENT]]

-- Mouse moved event

-- (From EM_MOUSE_SENSITIVE)

mouse_wheel_down_event: EM_EVENT_TYPE [TUPLE []]

-- Mouse wheel down event

-- (From EM_MOUSE_SENSITIVE)

mouse_wheel_up_event: EM_EVENT_TYPE [TUPLE []]

-- Mouse wheel up event

-- (From EM_MOUSE_SENSITIVE)

move_event: EM_EVENT_TYPE [TUPLE []]

-- Component moved event

resize_event: EM_EVENT_TYPE [TUPLE []]

-- Component resized event

show_event: EM_EVENT_TYPE [TUPLE []]

-- Component shown event

feature {EM_COMPONENT_SCENE, EM_COMPONENT} -- Mouse management

mouse_button_down (event: EM_MOUSEBUTTON_EVENT)

-- Handle mouse button down event.

mouse_button_up (event: EM_MOUSEBUTTON_EVENT)

-- Handle mouse button down event.

mouse_clicked (event: EM_MOUSEBUTTON_EVENT)

-- Handle mouse clicked event.

mouse_drag_start (event: EM_MOUSE_EVENT)

-- Handle mouse drag start event.

mouse_drag_stop (event: EM_MOUSE_EVENT)

-- Handle mouse drag stop event.

mouse_dragged (event: EM_MOUSEMOTION_EVENT)

-- Handle mouse dragging event.

mouse_entered

-- Handle mouse entered event.

mouse_exited

-- Handle mouse exited event.

mouse_moved (event: EM_MOUSEMOTION_EVENT)

-- Handle mouse motion event.

mouse_wheel_down

-- Handle mouse wheel down event.

mouse_wheel_up

-- Handle mouse wheel up event.

invariant

make_component_called: is_make_component_called
resize_event_not_void: resize_event /= Void
move_event_not_void: move_event /= Void
hide_event_not_void: hide_event /= Void
show_event_not_void: show_event /= Void

key_down_event_not_void: key_down_event /= Void
key_up_event_not_void: key_up_event /= Void
focus_received_event_not_void: focus_received_event /= Void
focus_lost_event_not_void: focus_lost_event /= Void

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

mouse_button_down_event_not_void: mouse_button_down_event /= Void
mouse_button_up_event_not_void: mouse_button_up_event /= Void
mouse_clicked_event_not_void: mouse_clicked_event /= Void
mouse_moved_event_not_void: mouse_moved_event /= Void
mouse_dragged_event_not_void: mouse_dragged_event /= Void
mouse_drag_start_event_not_void: mouse_drag_start_event /= Void
mouse_drag_stop_event_not_void: mouse_drag_stop_event /= Void
mouse_wheel_up_event_not_void: mouse_wheel_up_event /= Void
mouse_wheel_down_event_not_void: mouse_wheel_down_event /= Void
mouse_entered_event_not_void: mouse_entered_event /= Void
mouse_exited_event_not_void: mouse_exited_event /= Void

joystick_axis_event_not_void: joystick_axis_event /= Void
joystick_ball_event_not_void: joystick_ball_event /= Void
joystick_button_down_event_not_void: joystick_button_down_event /= Void
joystick_button_up_event_not_void: joystick_button_up_event /= Void
joystick_hat_event_not_void: joystick_hat_event /= Void

end