/src/wrappers/gtk/library/gtk_requisition.e

http://github.com/tybor/Liberty · Specman e · 120 lines · 80 code · 25 blank · 15 comment · 3 complexity · fb46d43b342a073ad5ae5c4de8d74169 MD5 · raw file

  1. indexing
  2. description: "A GtkRequisition represents the desired size of a widget. See the section called `Siz Requisition' in GTK_WIDGET for more informations."
  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_REQUISITION
  21. -- The size requisition of a widget is it's desired width and
  22. -- height. This is represented by a GtkRequisition.
  23. -- How a widget determines its desired size depends on the
  24. -- widget. A GtkLabel, for example, requests enough space to
  25. -- display all its text. Container widgets generally base their
  26. -- size request on the requisitions of their children.
  27. -- The size requisition phase of the widget layout process operates
  28. -- top-down. It starts at a top-level widget, typically a
  29. -- GtkWindow. The top-level widget asks its child for its size
  30. -- requisition by calling gtk_widget_size_request(). To determine
  31. -- its requisition, the child asks its own children for their
  32. -- requisitions and so on. Finally, the top-level widget will get a
  33. -- requisition back from its child.
  34. inherit
  35. G_STRUCT redefine is_equal end
  36. creation make, copy, copy_from_pointer, from_external_pointer
  37. feature {} -- Creation
  38. make is
  39. do
  40. allocate
  41. end
  42. copy_from_pointer (a_ptr: POINTER) is
  43. require
  44. a_ptr.is_not_null
  45. do
  46. dispose
  47. allocate
  48. handle := memcpy (handle, a_ptr, struct_size)
  49. end
  50. feature -- size
  51. struct_size: INTEGER is
  52. external "C inline use <gtk/gtk.h>"
  53. alias "sizeof(GtkRequisition)"
  54. end
  55. feature
  56. is_equal (other: like Current): BOOLEAN is
  57. do
  58. Result := width = other.width and height = other.height
  59. end
  60. width: INTEGER is
  61. -- the widget's desired width
  62. do
  63. Result := get_width_external (handle)
  64. end
  65. set_width (a_width: INTEGER) is
  66. do
  67. set_width_external (handle, a_width)
  68. end
  69. height: INTEGER is
  70. -- the widget's desired height
  71. do
  72. Result := get_height_external (handle)
  73. end
  74. set_height (an_height: INTEGER) is
  75. do
  76. set_height_external (handle, an_height)
  77. end
  78. feature {} -- External
  79. get_width_external (ptr: POINTER): INTEGER is
  80. require valid_ptr: ptr.is_not_null
  81. external "C struct GtkRequisition get width use <gtk/gtk.h>"
  82. end
  83. set_width_external (ptr: POINTER; a_width:INTEGER) is
  84. require valid_ptr: ptr.is_not_null
  85. external "C struct GtkRequisition set width use <gtk/gtk.h>"
  86. end
  87. get_height_external (ptr: POINTER): INTEGER is
  88. require valid_ptr: ptr.is_not_null
  89. external "C struct GtkRequisition get height use <gtk/gtk.h>"
  90. end
  91. set_height_external (ptr: POINTER; an_height:INTEGER) is
  92. require valid_ptr: ptr.is_not_null
  93. external "C struct GtkRequisition set height use <gtk/gtk.h>"
  94. end
  95. end