indexing description: "[ Store and manage the joystick focus. The joystick focus has to be set manually and thus to be cleared manually. Also it can be shared by multiple objects. Use EM_SHARED_FOCUS to access the singleton instance. ]" date: "$Date$" revision: "$Revision$" class EM_JOYSTICK_FOCUS create make feature {NONE} -- Initialisation make is -- Initialise default values. do create focus_list_impl.make end feature -- Access focus_list: DS_LINEAR [EM_JOYSTICK_SENSITIVE] is -- List of joystick foci do Result := focus_list_impl ensure focus_list_not_void: Result /= Void end feature -- Status report has_focus: BOOLEAN is -- Is any focus present? do Result := not focus_list.is_empty end feature -- Element change add_focus (a_focus: EM_JOYSTICK_SENSITIVE) is -- Add `a_focus' to `focus_list'. require a_focus_not_void: a_focus /= Void do focus_list_impl.put_last (a_focus) ensure a_focus_added: focus_list_impl.has (a_focus) end feature -- Removal remove_focus (a_focus: EM_JOYSTICK_SENSITIVE) is -- Remove `a_focus' from `focus_list'. require a_focus_not_void: a_focus /= Void do focus_list_impl.delete (a_focus) ensure a_focus_removed: not focus_list_impl.has (a_focus) end clear_foci is -- Clear focus_list. do focus_list_impl.wipe_out ensure not has_focus end feature {EM_COMPONENT_SCENE} -- Basic operations publish_axis_event (an_event: EM_JOYSTICK_AXIS_EVENT) is -- Publish `an_event' to all joystick foci. require an_event_not_void: an_event /= Void do from focus_list_impl.start until focus_list_impl.after loop focus_list_impl.item_for_iteration.joystick_axis_event.publish ([an_event]) focus_list_impl.forth end end publish_ball_event (an_event: EM_JOYSTICK_BALL_EVENT) is -- Publish `an_event' to all joystick foci. require an_event_not_void: an_event /= Void do from focus_list_impl.start until focus_list_impl.after loop focus_list_impl.item_for_iteration.joystick_ball_event.publish ([an_event]) focus_list_impl.forth end end publish_button_down_event (an_event: EM_JOYSTICK_BUTTON_EVENT) is -- Publish `an_event' to all joystick foci. require an_event_not_void: an_event /= Void do from focus_list_impl.start until focus_list_impl.after loop focus_list_impl.item_for_iteration.joystick_button_down_event.publish ([an_event]) focus_list_impl.forth end end publish_button_up_event (an_event: EM_JOYSTICK_BUTTON_EVENT) is -- Publish `an_event' to all joystick foci. require an_event_not_void: an_event /= Void do from focus_list_impl.start until focus_list_impl.after loop focus_list_impl.item_for_iteration.joystick_button_up_event.publish ([an_event]) focus_list_impl.forth end end publish_hat_event (an_event: EM_JOYSTICK_HAT_EVENT) is -- Publish `an_event' to all joystick foci. require an_event_not_void: an_event /= Void do from focus_list_impl.start until focus_list_impl.after loop focus_list_impl.item_for_iteration.joystick_hat_event.publish ([an_event]) focus_list_impl.forth end end feature {NONE} -- Implementation focus_list_impl: DS_LINKED_LIST [EM_JOYSTICK_SENSITIVE] -- List of joystick foci invariant focus_list_impl_not_void: focus_list_impl /= Void end