/src/wrappers/gtk/library/gtk_aspect_frame.e
Specman e | 104 lines | 41 code | 26 blank | 37 comment | 0 complexity | 49d35b32c770ed51624d86b5b1c42e33 MD5 | raw file
1indexing 2 description: "GtkAspectFrame: A frame that constrains its child to a particular aspect ratio." 3 copyright: "(C) 2006 Paolo Redaelli " 4 license: "LGPL v2 or later" 5 date: "$Date:$" 6 revision: "$Revision:$" 7 8 9class GTK_ASPECT_FRAME 10 -- The GtkAspectFrame is useful when you want pack a widget so that 11 -- it can resize but always retains the same aspect ratio. For 12 -- instance, one might be drawing a small preview of a larger 13 -- image. GtkAspectFrame derives from GtkFrame, so it can draw a 14 -- label and a frame around the child. The frame will be 15 -- "shrink-wrapped" to the size of the child. 16 17inherit 18 GTK_FRAME 19 redefine struct_size end 20 -- GtkAspectFrame implements AtkImplementorIface. 21insert 22 GTK_ASPECT_FRAME_EXTERNALS 23 24creation make, from_external_pointer 25 26feature 27 struct_size: INTEGER is 28 external "C inline use <gtk/gtk.h>" 29 alias "sizeof(GtkAspectFrame)" 30 end 31 32feature {} -- Creation 33 make (a_label: STRING; an_xalign, an_yalign, a_ratio: REAL_32; obey_child: BOOLEAN) is 34 -- Create a new GtkAspectFrame. `an_xalign' ranges from 0.0 35 -- (left aligned) to 1.0 (right aligned); `an_yalign' ranges 36 -- from 0.0 (top aligned) to 1.0 (bottom aligned). When 37 -- `obey_child' is True ratio is ignored, and the aspect 38 -- ratio is taken from the requistion of the child. 39 require 40 valid_label: a_label/=Void 41 valid_xalign: an_xalign.in_range ({REAL_32 0.0}, {REAL_32 1.0}) 42 valid_yalign: an_yalign.in_range ({REAL_32 0.0}, {REAL_32 1.0}) 43 valid_ratio: a_ratio.in_range ({REAL_32 1.0e-04},{REAL_32 10000.0}) 44 do 45 from_external_pointer(gtk_aspect_frame_new (a_label.to_external, 46 an_xalign, an_yalign, a_ratio, 47 obey_child.to_integer)) 48 end 49 50 51 set (an_xalign, an_yalign, a_ratio: REAL_32; obey_child: BOOLEAN) is 52 -- Set parameters for an existing GtkAspectFrame. `an_xalign' 53 -- ranges from 0.0 (left aligned) to 1.0 (right aligned); 54 -- `an_yalign' ranges from 0.0 (top aligned) to 1.0 (bottom 55 -- aligned). When `obey_child' is True ratio is ignored, and 56 -- the aspect ratio is taken from the requistion of the 57 -- child. 58 require 59 valid_xalign: an_xalign.in_range ({REAL_32 0.0}, {REAL_32 1.0}) 60 valid_yalign: an_yalign.in_range ({REAL_32 0.0}, {REAL_32 1.0}) 61 valid_ratio: a_ratio.in_range ({REAL_32 1.0e-04},{REAL_32 10000.0}) 62 do 63 gtk_aspect_frame_set (handle, an_xalign, an_yalign, a_ratio, 64 obey_child.to_integer) 65 end 66 67feature -- Property Details TODO 68 69-- The "obey-child" property 70 71-- "obey-child" gboolean : Read / Write 72 73-- Force aspect ratio to match that of the frame's child. 74 75-- Default value: TRUE 76-- The "ratio" property 77 78-- "ratio" gfloat : Read / Write 79 80-- Aspect ratio if obey_child is FALSE. 81 82-- Allowed values: [1e-04,10000] 83 84-- Default value: 0.5 85-- The "xalign" property 86 87-- "xalign" gfloat : Read / Write 88 89-- X alignment of the child. 90 91-- Allowed values: [0,1] 92 93-- Default value: 0.5 94-- The "yalign" property 95 96-- "yalign" gfloat : Read / Write 97 98-- Y alignment of the child. 99 100-- Allowed values: [0,1] 101 102-- Default value: 0.5 103 104end