indexing description: "[ Ancestor class for all mouse events. ]" date: "$Date$" revision: "$Revision$" deferred class EM_MOUSE_EVENT inherit EM_EVENT redefine make end feature -- Initialization make (a_pointer: POINTER) is -- do Precursor (a_pointer) create proportional_position.make (screen_x, screen_y) x := screen_x y := screen_y end feature -- Access x: INTEGER -- X-coordinate of pointer position -- where the mouse event has occured -- This is a relative coordinate if used with widgets, otherwise -- it's the same as `screen_x' y: INTEGER -- Y-Coordinate of pointer position -- where the mouse event has occured -- This is a relative coordinate if used with widgets, otherwise -- it's the same as `screen_y' screen_x: INTEGER is -- X-coordinate of pointer on screen -- where the mouse event has occured deferred end screen_y: INTEGER is -- Y-Coordinate of pointer position on screen -- where the mouse event has occured deferred end proportional_position: EM_VECTOR_2D -- Mouse pointer position in possibly transformed coordinates -- inside the publishing container object. feature -- Status report button_state: INTEGER is -- Mouse button state specifying which mouse buttons -- are currently pressed -- (see button_state_xxx_flag features for possible flag values) deferred end button_state_left: BOOLEAN is -- Is left mouse button currently down? do Result := (button_state & button_state_left_flag) = button_state_left_flag end button_state_middle: BOOLEAN is -- Is middle mouse button currently down? do Result := (button_state & button_state_middle_flag) = button_state_middle_flag end button_state_right: BOOLEAN is -- Is right mouse button currently down? do Result := (button_state & button_state_right_flag) = button_state_right_flag end feature -- Element change set_proportional_position (a_position: like proportional_position) is -- Set `proportional_position' to `a_position'. require a_position_not_void: a_position /= Void do proportional_position := a_position ensure proportional_position_set: proportional_position = a_position end set_coordinates (a_x: like x; a_y: like y) is -- Set the relative mouse coordinates to `a_x' `a_y' do x := a_x y := a_y proportional_position.set_x (x) proportional_position.set_y (y) end feature {NONE} -- Implementation button_state_left_flag: INTEGER is 1 button_state_middle_flag: INTEGER is 2 button_state_right_flag: INTEGER is 4 invariant proportional_position_not_void: proportional_position /= Void end