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