/src/wrappers/gtk/library/gtk_misc.e

http://github.com/tybor/Liberty · Specman e · 143 lines · 56 code · 35 blank · 52 comment · 2 complexity · 073d54ef220f4447d9742c34bbe597f9 MD5 · raw file

  1. indexing
  2. description: "GtkMisc -- Base class for widgets with alignments and padding."
  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. deferred class GTK_MISC
  21. -- The GtkMisc widget is an abstract widget which is not useful
  22. -- itself, but is used to derive subclasses which have alignment
  23. -- and padding attributes.
  24. -- The horizontal and vertical padding attributes allows extra
  25. -- space to be added around the widget.
  26. -- The horizontal and vertical alignment attributes enable the
  27. -- widget to be positioned within its allocated area. Note that if
  28. -- the widget is added to a container in such a way that it expands
  29. -- automatically to fill its allocated area, the alignment settings
  30. -- will not alter the widgets position.
  31. inherit
  32. GTK_WIDGET
  33. -- Implemented Interfaces: GtkMisc implements
  34. -- AtkImplementorIface.
  35. insert GTK_MISC_EXTERNALS
  36. -- feature {} -- size size: INTEGER is external "C inline use
  37. -- <gtk/gtk.h>" alias "sizeof(GtkMisc)" end
  38. feature --
  39. xalign: REAL is
  40. -- the horizontal alignment, from 0 (left) to 1 (right).
  41. do
  42. Result:=get_xalign(handle)
  43. ensure valid: Result.in_range (0.0,1.0)
  44. end
  45. yalign: REAL is
  46. -- the vertical alignment, from 0 (top) to 1 (bottom).
  47. do
  48. Result:=get_yalign(handle)
  49. ensure valid: Result.in_range (0.0,1.0)
  50. end
  51. xpad: INTEGER is
  52. -- the amount of space to add on the left and right of the
  53. -- widget, in pixels. TODO: shall be NATURAL_16
  54. do
  55. Result:=get_xpad(handle)
  56. ensure valid: Result>0
  57. end
  58. ypad: INTEGER is
  59. -- the amount of space to add on the top and bottom of the widget, in pixels. TODO shall be NATURAL_16
  60. do
  61. Result:=get_ypad(handle)
  62. ensure valid: Result>0
  63. end
  64. set_alignment (an_xalign, an_yalign: REAL) is
  65. -- Sets the alignment of the widget. `an_xalign0' is the
  66. -- horizontal alignment, from 0 (left) to 1 (right),
  67. -- `an_yalign' is the vertical alignment, from 0 (top) to 1
  68. -- (bottom).
  69. require
  70. valid_x_align: an_xalign.in_range (0.0,1.0)
  71. valid_y_align: an_yalign.in_range (0.0,1.0)
  72. do
  73. gtk_misc_set_alignment (handle, an_xalign, an_yalign);
  74. end
  75. set_padding (an_xpad, an_ypad: INTEGER) is
  76. -- Sets the amount of space to add around the widget.
  77. -- `an_xpad' is the amount of space to add on the left and
  78. -- right of the widget, in pixels. `an_ypad' is the amount of
  79. -- space to add on the top and bottom of the widget, in
  80. -- pixels.
  81. do
  82. gtk_misc_set_padding (handle, an_xpad, an_ypad)
  83. end
  84. -- TODO: are gtk_misc_get_alignment and gtk_misc_get_padding to be
  85. -- wrapped? they seems to be another way to implement
  86. -- xalign,yalign, xpad and ypad. Idem for properties
  87. -- Property Details
  88. -- The "xalign" property
  89. -- "xalign" gfloat : Read / Write
  90. -- The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts.
  91. -- Allowed values: [0,1]
  92. -- Default value: 0.5
  93. -- The "xpad" property
  94. -- "xpad" gint : Read / Write
  95. -- The amount of space to add on the left and right of the widget, in pixels.
  96. -- Allowed values: >= 0
  97. -- Default value: 0
  98. -- The "yalign" property
  99. -- "yalign" gfloat : Read / Write
  100. -- The vertical alignment, from 0 (top) to 1 (bottom).
  101. -- Allowed values: [0,1]
  102. -- Default value: 0.5
  103. -- The "ypad" property
  104. -- "ypad" gint : Read / Write
  105. -- The amount of space to add on the top and bottom of the widget, in pixels.
  106. -- Allowed values: >= 0
  107. -- Default value: 0
  108. end