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

/src/wrappers/gdk/library/gdk_gc.e

http://github.com/tybor/Liberty
Specman e | 87 lines | 43 code | 16 blank | 28 comment | 2 complexity | 620082b81d2f4a7b2778b5bd6b02551d MD5 | raw file
 1indexing
 2	description: "Graphics Contexts -- Objects to encapsulate drawing properties"
 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
22	-- All drawing operations in GDK take a graphics context (GC) argument.
23	-- A graphics context encapsulates information about the way things are drawn,
24	-- such as the foreground color or line width. By using graphics contexts, the
25	-- number of arguments to each drawing call is greatly reduced, and
26	-- communication overhead is minimized, since identical arguments do not need
27	-- to be passed repeatedly.
28	--
29	-- Most values of a graphics context can be set at creation time by using
30	-- create gc.with_values() (NOT IMPLEMENTED), or can be set one-by-one using
31	-- functions such as gc.set_foreground(). A few of the values in the GC,
32	-- such as the dash pattern, can only be set by the latter method. 
33
34class GDK_GC
35
36inherit
37	G_OBJECT
38
39insert
40	GDK_GC_EXTERNALS
41
42creation from_external_pointer, make
43
44feature {} -- Creation
45
46	make (a_drawable: GDK_DRAWABLE) is
47			-- Create a new graphics context with default values.
48		do
49			from_external_pointer (gdk_gc_new (a_drawable.handle))
50		end
51
52feature -- size
53
54	struct_size: INTEGER is
55		external "C inline use <gtk/gtk.h>"
56		alias "sizeof(GdkGc)"
57		end
58
59feature -- Operations
60
61	set_rgb_fg_color (a_color: GDK_COLOR) is
62			-- Set the foreground color of a GC using an unallocated color.
63			-- The pixel value for the color will be determined using GdkRGB.
64			-- If the colormap for the GC has not previously been initialized
65			-- for GdkRGB, then for pseudo-color colormaps (colormaps with a
66			-- small modifiable number of colors), a colorcube will be
67			-- allocated in the colormap.
68			--
69			-- Calling this function for a GC without a colormap is an error.
70		do
71			gdk_gc_set_rgb_fg_color (handle, a_color.handle)
72		end
73
74	set_rgb_bg_color (a_color: GDK_COLOR) is
75			-- Set the background color of a GC using an unallocated color.
76			-- The pixel value for the color will be determined using GdkRGB.
77			-- If the colormap for the GC has not previously been initialized
78			-- for GdkRGB, then for pseudo-color colormaps (colormaps with a
79			-- small modifiable number of colors), a colorcube will be
80			-- allocated in the colormap.
81			--
82			-- Calling this function for a GC without a colormap is an error.
83		do
84			gdk_gc_set_rgb_bg_color (handle, a_color.handle)
85		end
86
87end