PageRenderTime 15ms CodeModel.GetById 5ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/src/wrappers/gtk/library/gtk_allocation.e

http://github.com/tybor/Liberty
Specman e | 154 lines | 109 code | 31 blank | 14 comment | 2 complexity | 2f14f84a0c7330a8d62e5e46c09ebd54 MD5 | raw file
  1indexing
  2	description: "GTK_ALLOCATION, a region which has been allocated to the widget by its parent."
  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_ALLOCATION
 25		-- A GtkAllocation of a widget represents
 26		-- region which has been allocated to the widget by its parent. It is a
 27		-- subregion of its parents allocation. See the section called ?Size
 28		-- Allocation? for more information.
 29
 30		-- gint x; 	the X position of the widget's area relative to its parents allocation.
 31		-- gint y; 	the Y position of the widget's area relative to its parents allocation.
 32		-- gint width; 	the width of the widget's allocated area.
 33		-- gint height; 	the height of the widget's allocated area.
 34
 35inherit
 36	G_STRUCT redefine is_equal end
 37
 38creation copy, copy_from_pointer
 39
 40feature {} -- Creation
 41
 42	copy_from_pointer (a_ptr: POINTER) is
 43		require
 44			a_ptr.is_not_null
 45		do
 46			dispose
 47			allocate
 48			handle := memcpy (handle, a_ptr, struct_size)
 49		end
 50
 51feature
 52
 53	is_equal (other: like Current): BOOLEAN is
 54		do
 55			Result := width = other.width and height = other.height and
 56			          x = other.x and y = other.y
 57		end
 58
 59	width: INTEGER is
 60			-- the width of the widget's allocated area
 61		do
 62			Result := get_width_external (handle)
 63		end
 64
 65	set_width (a_width: INTEGER) is
 66		do
 67			set_width_external (handle, a_width)
 68		end
 69
 70	height: INTEGER is
 71			-- the widget's desired height
 72		do
 73			Result := get_height_external (handle)
 74		end
 75
 76	set_height (an_height: INTEGER) is
 77		do
 78			set_height_external (handle, an_height)
 79		end
 80
 81	x: INTEGER is
 82			-- the X position of the widget's area relative
 83			-- to its parents allocation
 84		do
 85			Result := get_x_external (handle)
 86		end
 87
 88	set_x (a_x: INTEGER) is
 89		do
 90			set_x_external (handle, a_x)
 91		end
 92
 93	y: INTEGER is
 94			-- the X position of the widget's area relative
 95			-- to its parents allocation
 96		do
 97			Result := get_y_external (handle)
 98		end
 99
100	set_y (a_y: INTEGER) is
101		do
102			set_y_external (handle, a_y)
103		end
104
105feature {} -- External
106
107	get_width_external (ptr: POINTER): INTEGER is
108		require valid_ptr: ptr.is_not_null
109		external "C struct GtkAllocation get width use <gtk/gtk.h>"
110		end
111
112	set_width_external (ptr: POINTER; a_width:INTEGER) is
113		require valid_ptr: ptr.is_not_null
114		external "C struct GtkAllocation set width use <gtk/gtk.h>"
115		end
116
117	get_height_external (ptr: POINTER): INTEGER is
118		require valid_ptr: ptr.is_not_null
119		external "C struct GtkAllocation get height use <gtk/gtk.h>"
120		end
121
122	set_height_external (ptr: POINTER; an_height:INTEGER) is
123		require valid_ptr: ptr.is_not_null
124		external "C struct GtkAllocation set height use <gtk/gtk.h>"
125		end
126
127	get_x_external (ptr: POINTER): INTEGER is
128		require valid_ptr: ptr.is_not_null
129		external "C struct GtkAllocation get x use <gtk/gtk.h>"
130		end
131
132	set_x_external (ptr: POINTER; a_x:INTEGER) is
133		require valid_ptr: ptr.is_not_null
134		external "C struct GtkAllocation set x use <gtk/gtk.h>"
135		end
136
137	get_y_external (ptr: POINTER): INTEGER is
138		require valid_ptr: ptr.is_not_null
139		external "C struct GtkAllocation get y use <gtk/gtk.h>"
140		end
141
142	set_y_external (ptr: POINTER; a_y:INTEGER) is
143		require valid_ptr: ptr.is_not_null
144		external "C struct GtkAllocation set y use <gtk/gtk.h>"
145		end
146
147feature  -- struct size
148
149	struct_size: INTEGER is
150		external "C inline use <gtk/gtk.h>"
151		alias "sizeof (GtkAllocation)"
152		end
153
154end -- class GTK_ALLOCATION