/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

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