PageRenderTime 48ms CodeModel.GetById 38ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/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
  1indexing
  2	description: "."
  3	copyright: "[
  4					Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5					
  6					This library is free software; you can redistribute it and/or
  7					modify it under the terms of the GNU Lesser General Public License
  8					as published by the Free Software Foundation; either version 2.1 of
  9					the License, or (at your option) any later version.
 10					
 11					This library is distributed in the hope that it will be useful, but
 12					WITHOUT ANY WARRANTY; without even the implied warranty of
 13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14					Lesser General Public License for more details.
 15
 16					You should have received a copy of the GNU Lesser General Public
 17					License along with this library; if not, write to the Free Software
 18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 19					02110-1301 USA
 20				]"
 21	date: "$Date:$"
 22	revision: "$Revision:$"
 23
 24class GTK_FRAME
 25inherit
 26	GTK_BIN
 27insert
 28	GTK_FRAME_EXTERNALS
 29	
 30creation from_label, from_external_pointer
 31
 32feature {WRAPPER, WRAPPER_HANDLER} -- size
 33	struct_size: INTEGER is
 34		external "C inline use <gtk/gtk.h>"
 35		alias "sizeof(GtkFrame)"
 36		end
 37
 38feature {} -- Creation
 39	from_label (a_label: STRING) is
 40			-- Creates a new GtkFrame, with optional `a_label' (if Void,
 41			-- the label is omitted).
 42		require gtk_initialized: gtk.is_initialized
 43		do
 44			from_external_pointer (gtk_frame_new (a_label.to_external))
 45		end
 46
 47feature -- label
 48	label: STRING is
 49			-- the text to use as the label of the frame
 50		local ptr: POINTER
 51		do
 52			ptr:=gtk_frame_get_label (handle)
 53			if ptr.is_not_null
 54			then create Result.from_external_copy (ptr)
 55			end
 56		end
 57
 58	remove_label is
 59		do
 60			gtk_frame_set_label (handle, default_pointer)
 61		end
 62	
 63	set_label (a_label: STRING) is
 64			-- Sets the text of the label.
 65		do
 66			gtk_frame_set_label (handle,a_label.to_external)
 67		end
 68
 69
 70feature -- label widget
 71	-- TODO label_widget: GTK_WIDGET is -- The label widget for the frame.
 72	
 73	set_label_widget (a_widget: GTK_WIDGET) is
 74			-- Sets the label widget for the frame. This is the widget
 75			-- that will appear embedded in the top edge of the frame as
 76			-- a title.
 77		require valid_widget: a_widget /= Void
 78		do
 79			gtk_frame_set_label_widget (handle,a_widget.handle)
 80		end
 81
 82
 83	set_label_align (an_xalign, an_yalign: REAL) is
 84			-- Sets the alignment of the frame widget's label. The
 85			-- default values for a newly created frame are 0.0 and 0.5.
 86			-- `an_xalign' : The position of the label along the top edge
 87			-- of the widget. A value of 0.0 represents left alignment;
 88			-- 1.0 represents right alignment.  `an_yalign': The y
 89			-- alignment of the label. A value of 0.0 aligns under the
 90			-- frame; 1.0 aligns above the frame.
 91		do
 92			gtk_frame_set_label_align (handle,an_xalign,an_yalign)
 93		end
 94
 95feature -- shadow
 96	shadow_type: INTEGER is
 97		do
 98			Result := gtk_frame_get_shadow_type (handle)
 99		ensure valid: is_valid_gtk_shadow_type (Result)
100		end
101
102	set_shadow_type (a_shadow_type: INTEGER) is
103			-- Sets the shadow type for frame.
104		require is_valid_gtk_shadow_type (a_shadow_type)
105		do
106			gtk_frame_set_shadow_type (handle,a_shadow_type)
107		end
108
109feature -- Alignments
110	alignments: TUPLE[REAL,REAL] is
111			-- the X and Y alignment of the frame's label.
112		local xal,yal: REAL_32
113		do
114			-- TODO clean this types uglyness
115			gtk_frame_get_label_align (handle, $xal,$yal)
116			create Result.make_2 (xal, yal)
117			-- TODO postconditions
118		end
119
120	x_alignment: REAL is
121			-- the X alignement
122		do
123			gtk_frame_get_label_align (handle, $Result, default_pointer)
124			-- TODO postcondition
125		end
126	
127	y_alignment: REAL is
128			-- the Y alignement
129		do
130			gtk_frame_get_label_align (handle, $Result, default_pointer)
131			-- TODO postcondition
132		end
133
134feature -- TODO Property Details
135-- The "label" property
136
137--   "label"                gchararray            : Read / Write
138
139-- Text of the frame's label.
140
141-- Default value: NULL
142-- The "label-widget" property
143
144--   "label-widget"         GtkWidget             : Read / Write
145
146-- A widget to display in place of the usual frame label.
147-- The "label-xalign" property
148
149--   "label-xalign"         gfloat                : Read / Write
150
151-- The horizontal alignment of the label.
152
153-- Allowed values: [0,1]
154
155-- Default value: 0.5
156-- The "label-yalign" property
157
158--   "label-yalign"         gfloat                : Read / Write
159
160-- The vertical alignment of the label.
161
162-- Allowed values: [0,1]
163
164-- Default value: 0.5
165-- The "shadow" property
166
167--   "shadow"               GtkShadowType         : Read / Write
168
169-- Deprecated property, use shadow_type instead.
170
171-- Default value: GTK_SHADOW_ETCHED_IN
172-- The "shadow-type" property
173
174--   "shadow-type"          GtkShadowType         : Read / Write
175
176-- Appearance of the frame border.
177
178-- Default value: GTK_SHADOW_ETCHED_IN
179
180end