indexing description: "[ EiffelMedia widget that can be used in a vision application. There can only be one EM_WIDGET because we need an ugly hack to draw into the widget. ]" date: "$Date$" revision: "$Revision$" class EM_EV_WIDGET inherit EV_PRIMITIVE undefine copy redefine is_in_default_state, implementation select dispose end EM_APPLICATION rename dispose as dispose_memory undefine default_create end create make feature -- Status report make is -- creation procedure do default_create set_initialization_procedure (agent make_em_application) end feature -- Commands launch_threaded is -- Launch the application by running `scene'. local pre_launch_thread: WORKER_THREAD do -- prepare window for SDL create pre_launch_thread.make_with_procedure (agent pre_launch) pre_launch_thread.launch end pre_launch is -- prepare application for EiffelMedia (setup environment variables) -- -- we need this because we can only set the environment variable if the -- vision2 widget window is already created, otherwise this app will fail local launch_thread: WORKER_THREAD do em_prepare -- launch SDL thread create launch_thread.make_with_procedure (initialization_procedure) launch_thread.launch end make_em_application is -- Redefine it and use it as it would be a standard -- SDL application creation procedure -- This will be called be the SDL Thread do end feature {EM_EV_WIDGET_SCROLLABLE} -- helpers initialization_procedure: PROCEDURE[ANY, TUPLE[]] -- creation procedure used to setup SDL set_initialization_procedure (a_proc: like initialization_procedure) is -- EM_EV_WIDGET_SCROLLABLE need this to properly set up -- its own `make_em_application'. -- Otherwise the newly created thread will work incorectly do initialization_procedure := a_proc end feature -- EiffelMedia preparation and initialization em_prepare is -- Sets the SDL_WINDOWID and if needed also SDL_VIDEODRIVER to -- the Widget. This hack is needed, because otherwise SDL will -- draw in the wrong client window. -- Call this function not before the widget is extended in a container, -- or it will open a new window do implementation.em_prepare end feature {EV_ANY} -- Contract support is_in_default_state: BOOLEAN is -- Is `Current' in its default state. do Result := True end feature {EV_ANY_I} -- Implementation implementation: EM_EV_WIDGET_I -- Responsible for interaction with native graphics toolkit. feature {NONE} -- Implementation create_implementation is -- See `{EV_ANY}.create_implementation'. do create {EM_EV_WIDGET_IMP} implementation.make (Current) end end