ANY NONE SENSITIVE VISION_LOOP_STACK WINDOW
class interface VISION
   -- VISION object is singleton, accessible via vision from GRAPHIC
   -- This object is responsible of "graphic mode" initialisation and
   -- graphic events management.
   -- This class give access to the events' loop (see also start)
   -- and to the display size.

creation
   graphic_init
      -- Initialize graphic using default values.

feature(s) from VISION
   display_width: INTEGER

   display_height: INTEGER

   loop_stack: LOOP_STACK
      -- The loop_stack gives possibility to add some JOB, break
      -- current events loop...

   start
      -- Start to run current events loop. This call returns only
      -- when you break this loop.

   new_loop
      -- You need new loop if you want modal window.
      -- When you create this new loop, existing windows will be
      -- insensitive and jobs will be suspended. Then you create
      -- your new window and all it's widgets and finally call start.
      -- The state is "restored" when you break this loop.
      -- NOTE: loops may be reused (restared) when you need to
      -- reuse the same modal window.

   default_draw_kit: DRAW_KIT

   font_manager: FONT_MANAGER

   last_character: INTEGER
      -- retrun unicode character.
      -- NOTE: only access this information if last event is key event.
      require
         current_event_type.in_range(2,3)

   pointer_x: INTEGER
      -- retrun pointer x coordinate relative to the window who
      -- received the event.
      -- NOTE: only access this information if last event is button
      -- or wheel event.
      require
         current_event_type.in_range(40,59)

   pointer_y: INTEGER
      -- retrun pointer y coordinate relative to the window who
      -- received the event.
      -- NOTE: only access this information if last event is button
      -- or wheel event.
      require
         current_event_type.in_range(40,59)

   pointer_x_root: INTEGER
      -- retrun pointer x coordinate relative to the screen.
      -- NOTE: only access this information if last event is mouse
      -- event (button/wheel/move).
      require
         current_event_type = 100 or else current_event_type.in_range(40,59)

   pointer_y_root: INTEGER
      -- retrun pointer y coordinate relative to the screen.
      -- NOTE: only access this information if last event is mouse
      -- event (button/wheel/move).
      require
         current_event_type = 100 or else current_event_type.in_range(40,59)

   event_time: INTEGER
      -- return the date the event occured. Origin is undefined,
      -- unit is millisecond. Difference give delay.
      -- NOTE: only access this information if last event is button
      -- or wheel event.
      require
         current_event_type.in_range(40,59)

   expose_area: RECT
      -- return the rectangular area the expose event is relative to.
      -- Coordinates are relative to the window who received the event.
      -- NOTE: only access this information if last event is expose_event.
      require
         current_event_type = 12

   border_width: INTEGER
      --TODO: suppress ?
      require
         current_event_type = 101

   is_left_down: BOOLEAN
      -- Is mouse left button down ?
      -- NOTE: only access this information if last event is pointer_enter
      -- or pointer_leave.
      require
         current_event_type = 7 or else current_event_type = 8

   is_middle_down: BOOLEAN
      -- Is mouse middle button down ?
      -- NOTE: only access this information if last event is pointer_enter
      -- or pointer_leave.
      require
         current_event_type = 7 or else current_event_type = 8

   is_right_down: BOOLEAN
      -- Is mouse right button down ?
      -- NOTE: only access this information if last event is pointer_enter
      -- or pointer_leave.
      require
         current_event_type = 7 or else current_event_type = 8

   current_event_type: INTEGER
      -- Needed for some assertion. This is the number associated
      -- with the last event.

   when_focus_in (p: PROCEDURE[ANY,TUPLE])

   when_focus_in_signal: SIGNAL_0

   when_focus_out (p: PROCEDURE[ANY,TUPLE])

   when_focus_out_signal: SIGNAL_0

   preprocess_left_down (p: PROCEDURE[ANY,TUPLE])

feature(s) from VISION
   root_window: ROOT_WINDOW

feature(s) from VISION
   register (s: SENSITIVE)
      -- Each widget who need to receive events has to be registred.
      -- NOTE: Register only once. Only widows need this, so don't
      -- care because precursor register your window for you when
      -- it is created.
      require
         not widget.fast_has(s.widget)
      ensure
         widget.fast_has(s.widget)

   unregister (s: SENSITIVE)
      --TODO: how to manage destroy ?
      require
         widget.fast_has(s.widget)
      ensure
         not widget.fast_has(s.widget)

feature(s) from VISION
   -- All *_connect functions, used only in WHEN_* classes.

   key_down_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   key_up_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   pointer_enter_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   pointer_leave_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   expose_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   unmapped_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   mapped_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   left_down_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   left_up_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   middle_down_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   middle_up_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   right_down_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   right_up_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   wheel_up_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   wheel_down_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   fully_visible_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   partially_visible_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   not_visible_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   close_requested_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE])

   pointer_move_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE[INTEGER, INTEGER]])

   geometry_change_event_connect (s: SENSITIVE; p: PROCEDURE[ANY,TUPLE[INTEGER, INTEGER, INTEGER, INTEGER]])

feature(s) from VISION
   -- All *_signal functions, used only in WHEN_* classes.

   key_down_signal (s: SENSITIVE): SIGNAL_0

   key_up_signal (s: SENSITIVE): SIGNAL_0

   pointer_enter_signal (s: SENSITIVE): SIGNAL_0

   pointer_leave_signal (s: SENSITIVE): SIGNAL_0

   expose_signal (s: SENSITIVE): SIGNAL_0

   unmapped_signal (s: SENSITIVE): SIGNAL_0

   mapped_signal (s: SENSITIVE): SIGNAL_0

   left_down_signal (s: SENSITIVE): SIGNAL_0

   left_up_signal (s: SENSITIVE): SIGNAL_0

   middle_down_signal (s: SENSITIVE): SIGNAL_0

   middle_up_signal (s: SENSITIVE): SIGNAL_0

   right_down_signal (s: SENSITIVE): SIGNAL_0

   right_up_signal (s: SENSITIVE): SIGNAL_0

   wheel_up_signal (s: SENSITIVE): SIGNAL_0

   wheel_down_signal (s: SENSITIVE): SIGNAL_0

   fully_visible_signal (s: SENSITIVE): SIGNAL_0

   partially_visible_signal (s: SENSITIVE): SIGNAL_0

   not_visible_signal (s: SENSITIVE): SIGNAL_0

   close_requested_signal (s: SENSITIVE): SIGNAL_0

   pointer_move_signal (s: SENSITIVE): SIGNAL_2[INTEGER, INTEGER]

   geometry_change_signal (s: SENSITIVE): SIGNAL_4[INTEGER, INTEGER, INTEGER, INTEGER]



end of VISION