/src/wrappers/gtk/library/gtk_frame.e

http://github.com/tybor/Liberty · Specman e · 180 lines · 91 code · 41 blank · 48 comment · 3 complexity · d62ffd0edd2159910ffe7e0d8abbc156 MD5 · raw file

  1. indexing
  2. description: "."
  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. class GTK_FRAME
  21. inherit
  22. GTK_BIN
  23. insert
  24. GTK_FRAME_EXTERNALS
  25. creation from_label, from_external_pointer
  26. feature {WRAPPER, WRAPPER_HANDLER} -- size
  27. struct_size: INTEGER is
  28. external "C inline use <gtk/gtk.h>"
  29. alias "sizeof(GtkFrame)"
  30. end
  31. feature {} -- Creation
  32. from_label (a_label: STRING) is
  33. -- Creates a new GtkFrame, with optional `a_label' (if Void,
  34. -- the label is omitted).
  35. require gtk_initialized: gtk.is_initialized
  36. do
  37. from_external_pointer (gtk_frame_new (a_label.to_external))
  38. end
  39. feature -- label
  40. label: STRING is
  41. -- the text to use as the label of the frame
  42. local ptr: POINTER
  43. do
  44. ptr:=gtk_frame_get_label (handle)
  45. if ptr.is_not_null
  46. then create Result.from_external_copy (ptr)
  47. end
  48. end
  49. remove_label is
  50. do
  51. gtk_frame_set_label (handle, default_pointer)
  52. end
  53. set_label (a_label: STRING) is
  54. -- Sets the text of the label.
  55. do
  56. gtk_frame_set_label (handle,a_label.to_external)
  57. end
  58. feature -- label widget
  59. -- TODO label_widget: GTK_WIDGET is -- The label widget for the frame.
  60. set_label_widget (a_widget: GTK_WIDGET) is
  61. -- Sets the label widget for the frame. This is the widget
  62. -- that will appear embedded in the top edge of the frame as
  63. -- a title.
  64. require valid_widget: a_widget /= Void
  65. do
  66. gtk_frame_set_label_widget (handle,a_widget.handle)
  67. end
  68. set_label_align (an_xalign, an_yalign: REAL) is
  69. -- Sets the alignment of the frame widget's label. The
  70. -- default values for a newly created frame are 0.0 and 0.5.
  71. -- `an_xalign' : The position of the label along the top edge
  72. -- of the widget. A value of 0.0 represents left alignment;
  73. -- 1.0 represents right alignment. `an_yalign': The y
  74. -- alignment of the label. A value of 0.0 aligns under the
  75. -- frame; 1.0 aligns above the frame.
  76. do
  77. gtk_frame_set_label_align (handle,an_xalign,an_yalign)
  78. end
  79. feature -- shadow
  80. shadow_type: INTEGER is
  81. do
  82. Result := gtk_frame_get_shadow_type (handle)
  83. ensure valid: is_valid_gtk_shadow_type (Result)
  84. end
  85. set_shadow_type (a_shadow_type: INTEGER) is
  86. -- Sets the shadow type for frame.
  87. require is_valid_gtk_shadow_type (a_shadow_type)
  88. do
  89. gtk_frame_set_shadow_type (handle,a_shadow_type)
  90. end
  91. feature -- Alignments
  92. alignments: TUPLE[REAL,REAL] is
  93. -- the X and Y alignment of the frame's label.
  94. local xal,yal: REAL_32
  95. do
  96. -- TODO clean this types uglyness
  97. gtk_frame_get_label_align (handle, $xal,$yal)
  98. create Result.make_2 (xal, yal)
  99. -- TODO postconditions
  100. end
  101. x_alignment: REAL is
  102. -- the X alignement
  103. do
  104. gtk_frame_get_label_align (handle, $Result, default_pointer)
  105. -- TODO postcondition
  106. end
  107. y_alignment: REAL is
  108. -- the Y alignement
  109. do
  110. gtk_frame_get_label_align (handle, $Result, default_pointer)
  111. -- TODO postcondition
  112. end
  113. feature -- TODO Property Details
  114. -- The "label" property
  115. -- "label" gchararray : Read / Write
  116. -- Text of the frame's label.
  117. -- Default value: NULL
  118. -- The "label-widget" property
  119. -- "label-widget" GtkWidget : Read / Write
  120. -- A widget to display in place of the usual frame label.
  121. -- The "label-xalign" property
  122. -- "label-xalign" gfloat : Read / Write
  123. -- The horizontal alignment of the label.
  124. -- Allowed values: [0,1]
  125. -- Default value: 0.5
  126. -- The "label-yalign" property
  127. -- "label-yalign" gfloat : Read / Write
  128. -- The vertical alignment of the label.
  129. -- Allowed values: [0,1]
  130. -- Default value: 0.5
  131. -- The "shadow" property
  132. -- "shadow" GtkShadowType : Read / Write
  133. -- Deprecated property, use shadow_type instead.
  134. -- Default value: GTK_SHADOW_ETCHED_IN
  135. -- The "shadow-type" property
  136. -- "shadow-type" GtkShadowType : Read / Write
  137. -- Appearance of the frame border.
  138. -- Default value: GTK_SHADOW_ETCHED_IN
  139. end