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

em.widget

Class EM_3D_COMPONENT


Direct ancestors

EM_COMPONENT, EM_CONSTANTS, GL_FUNCTIONS, GLU_FUNCTIONS

Features

Invariants

indexing

description

A component which displays OpenGL content.

Create a subclass of EM_3D_COMPONENT and put the OpenGL code in the
feature draw. If you need custom initialisation of OpenGL overwrite
prepare_drawing but make sure to either call the original version or
to set the OpenGL viewport yourself.

Make sure to enable OpenGL in the video_subsystem.

Subclasses should call make_3d_component at creation.

For an example 3D component see SIERPINSKY_DISPLAY in the widget_browser example.

See EM_COMPONENT

date

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

revision

$Revision: 1.9 $

deferred class

EM_3D_COMPONENT

inherit

EM_COMPONENT

feature -- Access

field_of_view: DOUBLE

-- Field of view in degrees

max_view_distance: DOUBLE

-- Maximum viewing distance

min_view_distance: DOUBLE

-- Minimal viewing distance

tooltip: STRING

-- Tooltip of Current

-- (From EM_COMPONENT)

x: INTEGER

-- X position of Current relative to parent

-- (From EM_COMPONENT)

y: INTEGER

-- Y position of Current relative to parent

-- (From EM_COMPONENT)

feature -- Measurement

height: INTEGER

-- Height of Current

-- (From EM_COMPONENT)

width: INTEGER

-- Width of Current

-- (From EM_COMPONENT)

feature -- Status report

is_enabled: BOOLEAN

-- Is Current enabled?

-- (From EM_COMPONENT)

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?

-- (From EM_COMPONENT)

feature -- Status setting

disable

-- Disable Current.

-- (From EM_COMPONENT)

ensure
not_enabled: not is_enabled
enable

-- Enable Current.

-- (From EM_COMPONENT)

ensure
enabled: is_enabled
hide

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

-- (From EM_COMPONENT)

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

-- Set is_enabled to a_value.

-- (From EM_COMPONENT)

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.

-- (From EM_COMPONENT)

ensure
visible: is_visible

feature -- Element change

set_field_of_view (a_fov: like field_of_view)

-- Set field_of_view to a_fov.

ensure
field_of_view_set: field_of_view = a_fov
set_max_view_distance (a_distance: like max_view_distance)

-- Set max_view_distance to a_distance.

require
a_distance_positive: a_distance > 0
a_distance_bigger_min: a_distance > min_view_distance
ensure
max_view_distance_set: max_view_distance = a_distance
set_min_view_distance (a_distance: like min_view_distance)

-- Set min_view_distance to a_distance.

require
a_distance_positive: a_distance > 0
a_distance_smaller_max: a_distance < max_view_distance
ensure
min_view_distance_set: min_view_distance = a_distance
set_position (a_x: like x; a_y: like y)

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

-- (From EM_COMPONENT)

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

-- Set tooltip to a_tooltip.

-- (From EM_COMPONENT)

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

-- Set x to a_x.

-- (From EM_COMPONENT)

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

-- Set y to a_y.

-- (From EM_COMPONENT)

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.

-- (From EM_COMPONENT)

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.

-- (From EM_COMPONENT)

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.

-- (From EM_COMPONENT)

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

feature -- Drawing

draw

-- Draw Current.

-- (From EM_COMPONENT)

finish_drawing

-- Finish drawing Current.

-- (From EM_COMPONENT)

prepare_drawing

-- Prepare for drawing Current.

-- (From EM_COMPONENT)

redraw

-- Redraw Current.

-- (From EM_COMPONENT)

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

-- (From EM_COMPONENT)

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

-- (From EM_COMPONENT)

resize_event: EM_EVENT_TYPE [TUPLE []]

-- Component resized event

-- (From EM_COMPONENT)

show_event: EM_EVENT_TYPE [TUPLE []]

-- Component shown event

-- (From EM_COMPONENT)

feature {EM_COMPONENT_SCENE, EM_COMPONENT} -- Mouse management

mouse_button_down (event: EM_MOUSEBUTTON_EVENT)

-- Handle mouse button down event.

-- (From EM_COMPONENT)

mouse_button_up (event: EM_MOUSEBUTTON_EVENT)

-- Handle mouse button down event.

-- (From EM_COMPONENT)

mouse_clicked (event: EM_MOUSEBUTTON_EVENT)

-- Handle mouse clicked event.

-- (From EM_COMPONENT)

mouse_drag_start (event: EM_MOUSE_EVENT)

-- Handle mouse drag start event.

-- (From EM_COMPONENT)

mouse_drag_stop (event: EM_MOUSE_EVENT)

-- Handle mouse drag stop event.

-- (From EM_COMPONENT)

mouse_dragged (event: EM_MOUSEMOTION_EVENT)

-- Handle mouse dragging event.

-- (From EM_COMPONENT)

mouse_entered

-- Handle mouse entered event.

-- (From EM_COMPONENT)

mouse_exited

-- Handle mouse exited event.

-- (From EM_COMPONENT)

mouse_moved (event: EM_MOUSEMOTION_EVENT)

-- Handle mouse motion event.

-- (From EM_COMPONENT)

mouse_wheel_down

-- Handle mouse wheel down event.

-- (From EM_COMPONENT)

mouse_wheel_up

-- Handle mouse wheel up event.

-- (From EM_COMPONENT)

invariant

min_view_distance_positive: min_view_distance > 0
max_view_distance_positive: max_view_distance > 0
min_smaller_max: min_view_distance < max_view_distance

-- From EM_COMPONENT
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