PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/src/wrappers/gdk/library/gdk_rectangle.e

http://github.com/tybor/Liberty
Specman e | 117 lines | 84 code | 24 blank | 9 comment | 2 complexity | 07b36df12c0359ce6ecad12b20ad5dcf MD5 | raw file
  1indexing
  2	description: "GdkRectangle."
  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
 22class GDK_RECTANGLE
 23
 24inherit G_STRUCT
 25
 26creation from_external_pointer, from_external_copy, make
 27
 28feature --Creation
 29
 30	make is
 31		do
 32			allocate
 33		end
 34
 35feature
 36	x: INTEGER is
 37			-- the x coordinate of the left edge of the rectangle.
 38		do
 39			Result:=get_x(handle)
 40		end
 41
 42	y: INTEGER is
 43			-- the y coordinate of the top of the rectangle.
 44		do
 45			Result:=get_y(handle)
 46		end
 47
 48	width: INTEGER is
 49			-- the width of the rectangle.
 50		do
 51			Result:=get_width(handle)
 52		end
 53
 54	height: INTEGER is
 55			-- the height of the rectangle.
 56		do
 57			Result:=get_height(handle)
 58		end
 59	
 60feature -- Union and intersection
 61
 62	intersection (a_rectangle, another_rectangle: GDK_RECTANGLE): BOOLEAN is
 63			-- Makes Current the intersection of two rectangles; Result
 64			-- is True if they actually intersect.
 65		require
 66			a_rectangle_not_void: a_rectangle /= Void
 67			another_rectangle_not_void: another_rectangle /= Void
 68		do
 69			Result := (gdk_rectangle_intersect (a_rectangle.handle, another_rectangle.handle,
 70															handle).to_boolean)
 71		end
 72	
 73	union (a_rectangle, another_rectangle: GDK_RECTANGLE) is
 74			-- Makes Current the union of two rectangles. The union of
 75			-- `a_rectangle' and `another_rectangle' is the smallest
 76			-- rectangle which includes both within it.
 77		require
 78			a_rectangle_not_void: a_rectangle /= Void
 79			another_rectangle_not_void: another_rectangle /= Void
 80		do
 81			gdk_rectangle_union (a_rectangle.handle, another_rectangle.handle, handle)
 82		end
 83	
 84feature -- size
 85	struct_size: INTEGER is
 86		external "C inline use <gdk/gdk.h>"
 87		alias "sizeof(GdkRectangle)"
 88		end
 89
 90feature {} -- Struct accesing
 91
 92	get_x (span: POINTER): INTEGER is
 93		external "C struct GdkRectangle get x use <gdk/gdk.h>"
 94		end
 95
 96	get_y (span: POINTER): INTEGER is
 97		external "C struct GdkRectangle get y use <gdk/gdk.h>"
 98		end
 99	
100	get_width (span: POINTER): INTEGER is
101		external "C struct GdkRectangle get width use <gdk/gdk.h>"
102		end
103
104	get_height (span: POINTER): INTEGER is
105		external "C struct GdkRectangle get height use <gdk/gdk.h>"
106		end
107
108feature {} -- External features
109
110	gdk_rectangle_intersect (a_src1_rectangle, a_src2_rectangle, a_dest_gdk_rectangle: POINTER): INTEGER is -- gboolean
111		external "C use  <gdk/gdk.h>"
112		end
113	
114	gdk_rectangle_union (a_src1_rectangle, a_src2_rectangle, a_dest_rectangle: POINTER) is
115		external "C use  <gdk/gdk.h>"
116		end
117end