/src/wrappers/gtk/library/gtk_allocation.e

http://github.com/tybor/Liberty · Specman e · 154 lines · 109 code · 31 blank · 14 comment · 2 complexity · 2f14f84a0c7330a8d62e5e46c09ebd54 MD5 · raw file

  1. indexing
  2. description: "GTK_ALLOCATION, a region which has been allocated to the widget by its parent."
  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. date: "$Date:$"
  19. revision: "$Revision:$"
  20. class GTK_ALLOCATION
  21. -- A GtkAllocation of a widget represents
  22. -- region which has been allocated to the widget by its parent. It is a
  23. -- subregion of its parents allocation. See the section called ?Size
  24. -- Allocation? for more information.
  25. -- gint x; the X position of the widget's area relative to its parents allocation.
  26. -- gint y; the Y position of the widget's area relative to its parents allocation.
  27. -- gint width; the width of the widget's allocated area.
  28. -- gint height; the height of the widget's allocated area.
  29. inherit
  30. G_STRUCT redefine is_equal end
  31. creation copy, copy_from_pointer
  32. feature {} -- Creation
  33. copy_from_pointer (a_ptr: POINTER) is
  34. require
  35. a_ptr.is_not_null
  36. do
  37. dispose
  38. allocate
  39. handle := memcpy (handle, a_ptr, struct_size)
  40. end
  41. feature
  42. is_equal (other: like Current): BOOLEAN is
  43. do
  44. Result := width = other.width and height = other.height and
  45. x = other.x and y = other.y
  46. end
  47. width: INTEGER is
  48. -- the width of the widget's allocated area
  49. do
  50. Result := get_width_external (handle)
  51. end
  52. set_width (a_width: INTEGER) is
  53. do
  54. set_width_external (handle, a_width)
  55. end
  56. height: INTEGER is
  57. -- the widget's desired height
  58. do
  59. Result := get_height_external (handle)
  60. end
  61. set_height (an_height: INTEGER) is
  62. do
  63. set_height_external (handle, an_height)
  64. end
  65. x: INTEGER is
  66. -- the X position of the widget's area relative
  67. -- to its parents allocation
  68. do
  69. Result := get_x_external (handle)
  70. end
  71. set_x (a_x: INTEGER) is
  72. do
  73. set_x_external (handle, a_x)
  74. end
  75. y: INTEGER is
  76. -- the X position of the widget's area relative
  77. -- to its parents allocation
  78. do
  79. Result := get_y_external (handle)
  80. end
  81. set_y (a_y: INTEGER) is
  82. do
  83. set_y_external (handle, a_y)
  84. end
  85. feature {} -- External
  86. get_width_external (ptr: POINTER): INTEGER is
  87. require valid_ptr: ptr.is_not_null
  88. external "C struct GtkAllocation get width use <gtk/gtk.h>"
  89. end
  90. set_width_external (ptr: POINTER; a_width:INTEGER) is
  91. require valid_ptr: ptr.is_not_null
  92. external "C struct GtkAllocation set width use <gtk/gtk.h>"
  93. end
  94. get_height_external (ptr: POINTER): INTEGER is
  95. require valid_ptr: ptr.is_not_null
  96. external "C struct GtkAllocation get height use <gtk/gtk.h>"
  97. end
  98. set_height_external (ptr: POINTER; an_height:INTEGER) is
  99. require valid_ptr: ptr.is_not_null
  100. external "C struct GtkAllocation set height use <gtk/gtk.h>"
  101. end
  102. get_x_external (ptr: POINTER): INTEGER is
  103. require valid_ptr: ptr.is_not_null
  104. external "C struct GtkAllocation get x use <gtk/gtk.h>"
  105. end
  106. set_x_external (ptr: POINTER; a_x:INTEGER) is
  107. require valid_ptr: ptr.is_not_null
  108. external "C struct GtkAllocation set x use <gtk/gtk.h>"
  109. end
  110. get_y_external (ptr: POINTER): INTEGER is
  111. require valid_ptr: ptr.is_not_null
  112. external "C struct GtkAllocation get y use <gtk/gtk.h>"
  113. end
  114. set_y_external (ptr: POINTER; a_y:INTEGER) is
  115. require valid_ptr: ptr.is_not_null
  116. external "C struct GtkAllocation set y use <gtk/gtk.h>"
  117. end
  118. feature -- struct size
  119. struct_size: INTEGER is
  120. external "C inline use <gtk/gtk.h>"
  121. alias "sizeof (GtkAllocation)"
  122. end
  123. end -- class GTK_ALLOCATION