/src/wrappers/gtk/library/gtk_aspect_frame.e

http://github.com/tybor/Liberty · Specman e · 104 lines · 41 code · 26 blank · 37 comment · 0 complexity · 49d35b32c770ed51624d86b5b1c42e33 MD5 · raw file

  1. indexing
  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. class GTK_ASPECT_FRAME
  8. -- The GtkAspectFrame is useful when you want pack a widget so that
  9. -- it can resize but always retains the same aspect ratio. For
  10. -- instance, one might be drawing a small preview of a larger
  11. -- image. GtkAspectFrame derives from GtkFrame, so it can draw a
  12. -- label and a frame around the child. The frame will be
  13. -- "shrink-wrapped" to the size of the child.
  14. inherit
  15. GTK_FRAME
  16. redefine struct_size end
  17. -- GtkAspectFrame implements AtkImplementorIface.
  18. insert
  19. GTK_ASPECT_FRAME_EXTERNALS
  20. creation make, from_external_pointer
  21. feature
  22. struct_size: INTEGER is
  23. external "C inline use <gtk/gtk.h>"
  24. alias "sizeof(GtkAspectFrame)"
  25. end
  26. feature {} -- Creation
  27. make (a_label: STRING; an_xalign, an_yalign, a_ratio: REAL_32; obey_child: BOOLEAN) is
  28. -- Create a new GtkAspectFrame. `an_xalign' ranges from 0.0
  29. -- (left aligned) to 1.0 (right aligned); `an_yalign' ranges
  30. -- from 0.0 (top aligned) to 1.0 (bottom aligned). When
  31. -- `obey_child' is True ratio is ignored, and the aspect
  32. -- ratio is taken from the requistion of the child.
  33. require
  34. valid_label: a_label/=Void
  35. valid_xalign: an_xalign.in_range ({REAL_32 0.0}, {REAL_32 1.0})
  36. valid_yalign: an_yalign.in_range ({REAL_32 0.0}, {REAL_32 1.0})
  37. valid_ratio: a_ratio.in_range ({REAL_32 1.0e-04},{REAL_32 10000.0})
  38. do
  39. from_external_pointer(gtk_aspect_frame_new (a_label.to_external,
  40. an_xalign, an_yalign, a_ratio,
  41. obey_child.to_integer))
  42. end
  43. set (an_xalign, an_yalign, a_ratio: REAL_32; obey_child: BOOLEAN) is
  44. -- Set parameters for an existing GtkAspectFrame. `an_xalign'
  45. -- ranges from 0.0 (left aligned) to 1.0 (right aligned);
  46. -- `an_yalign' ranges from 0.0 (top aligned) to 1.0 (bottom
  47. -- aligned). When `obey_child' is True ratio is ignored, and
  48. -- the aspect ratio is taken from the requistion of the
  49. -- child.
  50. require
  51. valid_xalign: an_xalign.in_range ({REAL_32 0.0}, {REAL_32 1.0})
  52. valid_yalign: an_yalign.in_range ({REAL_32 0.0}, {REAL_32 1.0})
  53. valid_ratio: a_ratio.in_range ({REAL_32 1.0e-04},{REAL_32 10000.0})
  54. do
  55. gtk_aspect_frame_set (handle, an_xalign, an_yalign, a_ratio,
  56. obey_child.to_integer)
  57. end
  58. feature -- Property Details TODO
  59. -- The "obey-child" property
  60. -- "obey-child" gboolean : Read / Write
  61. -- Force aspect ratio to match that of the frame's child.
  62. -- Default value: TRUE
  63. -- The "ratio" property
  64. -- "ratio" gfloat : Read / Write
  65. -- Aspect ratio if obey_child is FALSE.
  66. -- Allowed values: [1e-04,10000]
  67. -- Default value: 0.5
  68. -- The "xalign" property
  69. -- "xalign" gfloat : Read / Write
  70. -- X alignment of the child.
  71. -- Allowed values: [0,1]
  72. -- Default value: 0.5
  73. -- The "yalign" property
  74. -- "yalign" gfloat : Read / Write
  75. -- Y alignment of the child.
  76. -- Allowed values: [0,1]
  77. -- Default value: 0.5
  78. end