/src/wrappers/gtk/library/gtk_alignment.e

http://github.com/tybor/Liberty · Specman e · 161 lines · 63 code · 32 blank · 66 comment · 0 complexity · 8e49815bd417c9df2a5b29b9bd7aa21b MD5 · raw file

  1. indexing
  2. description: "The GtkAlignment widget controls the alignment and size of its child widget. It has four settings: xscale, yscale, xalign, and yalign."
  3. copyright: "(C) 2006 Paolo Redaelli "
  4. license: "LGPL v2 or later"
  5. date: "$Date:$"
  6. revision: "$REvision:$"
  7. class GTK_ALIGNMENT
  8. -- The GtkAlignment widget controls the alignment and size of its
  9. -- child widget. It has four settings: xscale, yscale, xalign, and
  10. -- yalign.
  11. -- The scale settings are used to specify how much the child widget
  12. -- should expand to fill the space allocated to the
  13. -- GtkAlignment. The values can range from 0 (meaning the child
  14. -- doesn't expand at all) to 1 (meaning the child expands to fill
  15. -- all of the available space).
  16. -- The align settings are used to place the child widget within the
  17. -- available area. The values range from 0 (top or left) to 1
  18. -- (bottom or right). Of course, if the scale settings are both set
  19. -- to 1, the alignment settings have no effect.
  20. inherit
  21. GTK_BIN
  22. -- TODO: GtkAlignment implements AtkImplementorIface.
  23. insert
  24. GTK_ALIGNMENT_EXTERNALS
  25. creation make, from_external_pointer
  26. feature {} -- size
  27. struct_size: INTEGER is
  28. external "C inline use <gtk/gtk.h>"
  29. alias "sizeof(GtkAlignment)"
  30. end
  31. feature {} -- Creation
  32. make (xalign, yalign, xscale, yscale: REAL_32) is
  33. -- Creates a new GtkAlignment. `xalign' : the horizontal
  34. -- alignment of the child widget, from 0 (left) to 1 (right).
  35. -- `yalign' : the vertical alignment of the child widget,
  36. -- from 0 (top) to 1 (bottom). `xscale' : the amount that
  37. -- the child widget expands horizontally to fill up unused
  38. -- space, from 0 to 1. A value of 0 indicates that the child
  39. -- widget should never expand. A value of 1 indicates that
  40. -- the child widget will expand to fill all of the space
  41. -- allocated for the GtkAlignment. `yscale' : the amount
  42. -- that the child widget expands vertically to fill up unused
  43. -- space, from 0 to 1. The values are similar to xscale.
  44. do
  45. from_external_pointer(gtk_alignment_new (xalign,yalign,xscale,yscale))
  46. end
  47. feature -- Scaling and alignment
  48. set (xalign, yalign, xscale, yscale: REAL_32) is
  49. -- Sets the GtkAlignment values. `xalign' : the horizontal
  50. -- alignment of the child widget, from 0 (left) to 1 (right).
  51. -- `yalign' : the vertical alignment of the child widget, from
  52. -- 0 (top) to 1 (bottom). `xscale' : the amount that the child
  53. -- widget expands horizontally to fill up unused space, from
  54. -- 0 to 1. A value of 0 indicates that the child widget
  55. -- should never expand. A value of 1 indicates that the child
  56. -- widget will expand to fill all of the space allocated for
  57. -- the GtkAlignment. yscale : the amount that the child
  58. -- widget expands vertically to fill up unused space, from 0
  59. -- to 1. The values are similar to xscale.
  60. do
  61. gtk_alignment_set (handle,xalign,yalign,xscale,yscale)
  62. end
  63. -- The "xalign" property
  64. -- "xalign" gfloat : Read / Write
  65. -- Horizontal position of child in available space. 0.0 is left aligned, 1.0 is right aligned.
  66. -- Allowed values: [0,1]
  67. -- Default value: 0.5
  68. -- The "xscale" property
  69. -- "xscale" gfloat : Read / Write
  70. -- If available horizontal space is bigger than needed for the child, how much of it to use for the child. 0.0 means none, 1.0 means all.
  71. -- Allowed values: [0,1]
  72. -- Default value: 1
  73. -- The "yalign" property
  74. -- "yalign" gfloat : Read / Write
  75. -- Vertical position of child in available space. 0.0 is top aligned, 1.0 is bottom aligned.
  76. -- Allowed values: [0,1]
  77. -- Default value: 0.5
  78. -- The "yscale" property
  79. -- "yscale" gfloat : Read / Write
  80. -- If available vertical space is bigger than needed for the child, how much of it to use for the child. 0.0 means none, 1.0 means all.
  81. -- Allowed values: [0,1]
  82. -- Default value: 1
  83. feature -- paddings
  84. paddings: TUPLE[INTEGER,INTEGER,INTEGER,INTEGER] is
  85. -- Top, bottom, left and right padding. TODO shall be NATURAL
  86. local
  87. guint_padding_top,guint_padding_bottom,guint_padding_left,guint_padding_right: INTEGER
  88. do
  89. gtk_alignment_get_padding (handle,
  90. $guint_padding_top, $guint_padding_bottom,
  91. $guint_padding_left, $guint_padding_right)
  92. create Result.make_4 (guint_padding_top,guint_padding_bottom,
  93. guint_padding_left,guint_padding_right)
  94. end
  95. top_padding: INTEGER is
  96. -- Top padding
  97. do
  98. gtk_alignment_get_padding (handle,$Result, default_pointer, default_pointer, default_pointer)
  99. ensure positive: Result>=0
  100. end
  101. bottom_padding: INTEGER is
  102. -- Bottom padding
  103. do
  104. gtk_alignment_get_padding (handle, default_pointer,$Result, default_pointer, default_pointer)
  105. ensure positive: Result>=0
  106. end
  107. left_padding: INTEGER is
  108. -- Left padding
  109. do
  110. gtk_alignment_get_padding (handle, default_pointer, default_pointer,$Result, default_pointer)
  111. ensure positive: Result>=0
  112. end
  113. right_padding: INTEGER is
  114. -- Right padding
  115. do
  116. gtk_alignment_get_padding (handle, default_pointer, default_pointer, default_pointer, $Result)
  117. ensure positive: Result>=0
  118. end
  119. set_paddings (padding_top,padding_bottom,padding_left,padding_right: INTEGER) is
  120. -- Sets the padding on the different sides of the widget. The
  121. -- padding adds blank space to the sides of the widget. For
  122. -- instance, this can be used to indent the child widget towards
  123. -- the right by adding padding on the left. TODO
  124. -- padding_top,padding_bottom,padding_left,padding_right are
  125. -- guint therefore shall be NATURAL
  126. do
  127. gtk_alignment_set_padding (handle, padding_top,padding_bottom,padding_left,padding_right)
  128. end
  129. end