indexing description: "[ Window without a title bar. ]" date: "$Date$" revision: "$Revision$" class EM_WINDOW inherit EM_WIDGET redefine make_void_surface, hide, show, mouse_button_down end EM_SHARED_SCENE export {NONE} all end create make_from_dimension, make_from_surface, make_void_surface feature {NONE} -- Initialisation make_void_surface is -- Initialise default values. do create window_layer.make_from_window (Current) Precursor {EM_WIDGET} end delegate_factory: FUNCTION [ANY, TUPLE [], like delegate] is -- Factory to create default delegate do Result := theme_delegates.window_delegate_factory end feature -- Status report is_modal: BOOLEAN -- Is window modal? -- A modal window receives all input events until it is closed. -- This has an effect only if it is set before the window is displayed. feature -- Status setting show is -- Show `Current'. do if parent_scene /= Void then parent_scene.remove_component (Current) end parent_scene ?= running_scene if parent_scene /= Void then if is_modal then parent_scene.add_component (window_layer) parent_scene.set_mouse_focus (window_layer) end parent_scene.add_component (Current) Keyboard_focus.set_current_focus (Current) else if running_scene = Void then Error_handler.raise_warning (Error_handler.Em_error_show_window_scene_void, []) else Error_handler.raise_warning (Error_handler.Em_error_show_window_scene_invalid, []) end end Precursor {EM_WIDGET} end hide is -- Hide `Current'. do if parent_scene /= Void then parent_scene.remove_component (window_layer) parent_scene.remove_component (Current) parent_scene := Void end Precursor {EM_WIDGET} end set_modal (a_value: BOOLEAN) is -- Set `is_modal' to `a_value'. do is_modal := a_value ensure is_modal_set: is_modal = a_value end feature -- Basic operations move_to_front is -- Move to front of displayed windows. do if parent_scene /= Void then if parent_scene.has_component (window_layer) then parent_scene.remove_component (window_layer) parent_scene.add_component (window_layer) end parent_scene.remove_component (Current) parent_scene.add_component (Current) end end center_on_screen is -- Center window on screen. do set_position ((Video_subsystem.video_surface_width-width)//2, (Video_subsystem.video_surface_height-height)//2) end feature {NONE} -- Mouse management mouse_button_down (event: EM_MOUSEBUTTON_EVENT) is -- Handle mouse button down event. do move_to_front Precursor {EM_WIDGET} (event) end feature {NONE} -- Implementation parent_scene: EM_COMPONENT_SCENE -- Scene that `Current' is displayed on window_layer: EM_WINDOW_LAYER -- Window layer to implement modal mode invariant window_layer_not_void: window_layer /= Void end