/src/wrappers/gdk/library/gdk_rectangle.e

http://github.com/tybor/Liberty · Specman e · 117 lines · 84 code · 24 blank · 9 comment · 2 complexity · 07b36df12c0359ce6ecad12b20ad5dcf MD5 · raw file

  1. indexing
  2. description: "GdkRectangle."
  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_RECTANGLE
  19. inherit G_STRUCT
  20. creation from_external_pointer, from_external_copy, make
  21. feature --Creation
  22. make is
  23. do
  24. allocate
  25. end
  26. feature
  27. x: INTEGER is
  28. -- the x coordinate of the left edge of the rectangle.
  29. do
  30. Result:=get_x(handle)
  31. end
  32. y: INTEGER is
  33. -- the y coordinate of the top of the rectangle.
  34. do
  35. Result:=get_y(handle)
  36. end
  37. width: INTEGER is
  38. -- the width of the rectangle.
  39. do
  40. Result:=get_width(handle)
  41. end
  42. height: INTEGER is
  43. -- the height of the rectangle.
  44. do
  45. Result:=get_height(handle)
  46. end
  47. feature -- Union and intersection
  48. intersection (a_rectangle, another_rectangle: GDK_RECTANGLE): BOOLEAN is
  49. -- Makes Current the intersection of two rectangles; Result
  50. -- is True if they actually intersect.
  51. require
  52. a_rectangle_not_void: a_rectangle /= Void
  53. another_rectangle_not_void: another_rectangle /= Void
  54. do
  55. Result := (gdk_rectangle_intersect (a_rectangle.handle, another_rectangle.handle,
  56. handle).to_boolean)
  57. end
  58. union (a_rectangle, another_rectangle: GDK_RECTANGLE) is
  59. -- Makes Current the union of two rectangles. The union of
  60. -- `a_rectangle' and `another_rectangle' is the smallest
  61. -- rectangle which includes both within it.
  62. require
  63. a_rectangle_not_void: a_rectangle /= Void
  64. another_rectangle_not_void: another_rectangle /= Void
  65. do
  66. gdk_rectangle_union (a_rectangle.handle, another_rectangle.handle, handle)
  67. end
  68. feature -- size
  69. struct_size: INTEGER is
  70. external "C inline use <gdk/gdk.h>"
  71. alias "sizeof(GdkRectangle)"
  72. end
  73. feature {} -- Struct accesing
  74. get_x (span: POINTER): INTEGER is
  75. external "C struct GdkRectangle get x use <gdk/gdk.h>"
  76. end
  77. get_y (span: POINTER): INTEGER is
  78. external "C struct GdkRectangle get y use <gdk/gdk.h>"
  79. end
  80. get_width (span: POINTER): INTEGER is
  81. external "C struct GdkRectangle get width use <gdk/gdk.h>"
  82. end
  83. get_height (span: POINTER): INTEGER is
  84. external "C struct GdkRectangle get height use <gdk/gdk.h>"
  85. end
  86. feature {} -- External features
  87. gdk_rectangle_intersect (a_src1_rectangle, a_src2_rectangle, a_dest_gdk_rectangle: POINTER): INTEGER is -- gboolean
  88. external "C use <gdk/gdk.h>"
  89. end
  90. gdk_rectangle_union (a_src1_rectangle, a_src2_rectangle, a_dest_rectangle: POINTER) is
  91. external "C use <gdk/gdk.h>"
  92. end
  93. end