PageRenderTime 27ms CodeModel.GetById 22ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gdk/library/gdk_event_button.e

http://github.com/tybor/Liberty
Specman e | 109 lines | 68 code | 20 blank | 21 comment | 4 complexity | 039e1136d314a00d31ca75c9f07e4f64 MD5 | raw file
  1indexing
  2	description: "Used for button press and button release events."
  3	copyright: "[
  4					Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5					
  6					This library is free software; you can redistribute it and/or
  7					modify it under the terms of the GNU Lesser General Public License
  8					as published by the Free Software Foundation; either version 2.1 of
  9					the License, or (at your option) any later version.
 10					
 11					This library is distributed in the hope that it will be useful, but
 12					WITHOUT ANY WARRANTY; without even the implied warranty of
 13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14					Lesser General Public License for more details.
 15
 16					You should have received a copy of the GNU Lesser General Public
 17					License along with this library; if not, write to the Free Software
 18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 19					02110-1301 USA
 20			]"
 21
 22class GDK_EVENT_BUTTON
 23
 24inherit 
 25	GDK_EVENT
 26
 27insert
 28	GDK_EVENT_BUTTON_EXTERNALS
 29	GDK_MODIFIER_TYPE
 30
 31creation from_external_pointer
 32
 33feature -- access
 34
 35	time: INTEGER is
 36			-- the time of the event in milliseconds.
 37		do
 38			Result := gdk_event_button_get_time (handle)
 39		end
 40
 41	x: REAL_64 is
 42			-- the x coordinate of the pointer relative to the window.
 43		do
 44			Result := gdk_event_button_get_x (handle)
 45		end
 46
 47	y: REAL_64 is
 48			-- the y coordinate of the pointer relative to the window.
 49		do
 50			Result := gdk_event_button_get_y (handle)
 51		end
 52
 53	axes: TUPLE [REAL_64, REAL_64] is
 54			-- x, y translated to the axes of device, or Void if device is the mouse.
 55		local
 56			device_axes: NATIVE_ARRAY [REAL_64]
 57		do
 58			device_axes := device_axes.from_pointer (gdk_event_button_get_axes (handle))
 59			if device_axes.is_not_null then
 60				Result := [device_axes.item (0), device_axes.item (1)]
 61			end
 62		end
 63
 64	state: INTEGER is
 65			-- a bit-mask representing the state of the modifier keys
 66			-- (e.g. Control, Shift and Alt) and the pointer buttons.
 67			-- See GDK_MODIFIER_TYPE.
 68		do
 69			Result := gdk_event_button_get_state (handle)
 70		ensure
 71			is_valid_gdk_modifier_type (Result)
 72		end
 73
 74	button: INTEGER is
 75			-- the button which was pressed or released, numbered from 1 to 5.
 76			-- Normally button 1 is the left mouse button, 2 is the middle
 77			-- button, and 3 is the right button. On 2-button mice, the middle
 78			-- button can often be simulated by pressing both mouse buttons
 79			-- together.
 80		do
 81			Result := gdk_event_button_get_button (handle)
 82		ensure
 83			Result.in_range (1, 5)
 84		end
 85
 86-- Not implemented: GdkDevice *device; 	the device where the event originated.
 87
 88	x_root: REAL_64 is
 89			-- the x coordinate of the pointer relative to the root of the screen.
 90		do
 91			Result := gdk_event_button_get_x_root (handle)
 92		end
 93
 94	y_root: REAL_64 is
 95			-- the y coordinate of the pointer relative to the root of the screen.
 96		do
 97			Result := gdk_event_button_get_y_root (handle)
 98		end
 99
100-- feature -- size
101-- 
102-- 	struct_size: INTEGER is
103-- 		external "C inline use <gdk/gdk.h>"
104-- 		alias "sizeof(GdkEventButton)"
105-- 		end
106
107invariant is_event_button
108
109end -- class GDK_EVENT_BUTTON