PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/library/gtk_requisition.e

http://github.com/tybor/Liberty
Specman e | 120 lines | 80 code | 25 blank | 15 comment | 3 complexity | fb46d43b342a073ad5ae5c4de8d74169 MD5 | raw file
  1indexing
  2	description: "A GtkRequisition represents the desired size of a widget. See the section called `Siz Requisition' in GTK_WIDGET for more informations."
  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_REQUISITION
 25	-- The size requisition of a widget is it's desired width and
 26	-- height. This is represented by a GtkRequisition.
 27
 28	-- How a widget determines its desired size depends on the
 29	-- widget. A GtkLabel, for example, requests enough space to
 30	-- display all its text. Container widgets generally base their
 31	-- size request on the requisitions of their children.
 32
 33	-- The size requisition phase of the widget layout process operates
 34	-- top-down. It starts at a top-level widget, typically a
 35	-- GtkWindow. The top-level widget asks its child for its size
 36	-- requisition by calling gtk_widget_size_request(). To determine
 37	-- its requisition, the child asks its own children for their
 38	-- requisitions and so on. Finally, the top-level widget will get a
 39	-- requisition back from its child.
 40
 41inherit
 42	G_STRUCT redefine is_equal end
 43
 44creation make, copy, copy_from_pointer, from_external_pointer
 45
 46feature {} -- Creation
 47
 48	make is
 49		do
 50			allocate
 51		end
 52
 53	copy_from_pointer (a_ptr: POINTER) is
 54		require
 55			a_ptr.is_not_null
 56		do
 57			dispose
 58			allocate
 59			handle := memcpy (handle, a_ptr, struct_size)
 60		end
 61
 62feature -- size
 63
 64	struct_size: INTEGER is
 65		external "C inline use <gtk/gtk.h>"
 66		alias "sizeof(GtkRequisition)"
 67		end
 68
 69feature
 70
 71	is_equal (other: like Current): BOOLEAN is
 72		do
 73			Result := width = other.width and height = other.height
 74		end
 75
 76	width: INTEGER is
 77			-- the widget's desired width
 78		do
 79			Result := get_width_external (handle)
 80		end
 81
 82	set_width (a_width: INTEGER) is
 83		do
 84			set_width_external (handle, a_width)
 85		end
 86
 87	height: INTEGER is
 88			-- the widget's desired height
 89		do
 90			Result := get_height_external (handle)
 91		end
 92
 93	set_height (an_height: INTEGER) is
 94		do
 95			set_height_external (handle, an_height)
 96		end
 97
 98feature {} -- External
 99
100	get_width_external (ptr: POINTER): INTEGER is
101		require valid_ptr: ptr.is_not_null
102		external "C struct GtkRequisition get width use <gtk/gtk.h>"
103		end
104
105	set_width_external (ptr: POINTER; a_width:INTEGER) is
106		require valid_ptr: ptr.is_not_null
107		external "C struct GtkRequisition set width use <gtk/gtk.h>"
108		end
109
110	get_height_external (ptr: POINTER): INTEGER is
111		require valid_ptr: ptr.is_not_null
112		external "C struct GtkRequisition get height use <gtk/gtk.h>"
113		end
114
115	set_height_external (ptr: POINTER; an_height:INTEGER) is
116		require valid_ptr: ptr.is_not_null
117		external "C struct GtkRequisition set height use <gtk/gtk.h>"
118		end
119
120end