PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/library/gtk_cell_renderer_progress.e

http://github.com/tybor/Liberty
Specman e | 90 lines | 62 code | 15 blank | 13 comment | 2 complexity | 0e790e4f2c0ce4f9467cc4b6285d4509 MD5 | raw file
 1indexing
 2	description: "GtkCellRendererProgress รข€” Renders numbers as progress bars."
 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_CELL_RENDERER_PROGRESS
25
26inherit GTK_CELL_RENDERER
27
28creation make, from_external_pointer
29
30feature {} -- size
31	struct_size: INTEGER is
32		external "C inline use <gtk/gtk.h>"
33		alias "sizeof(GtkCellRendererProgress)"
34		end
35
36feature {} -- Creation
37	make is
38			-- Creates a new GtkCellRendererProgress.
39		do
40			from_external_pointer (gtk_cell_renderer_progress_new)
41		end 
42
43feature -- Properties
44			
45--   "text"                 gchararray            : Read / Write
46--   "value"                gint                  : Read / Write
47-- Property Details
48feature -- The "text" property
49	text: STRING is
50			-- The "text" property determines the label which will be
51			-- drawn over the progress bar. Setting this property to Void
52			-- causes the default label to be displayed. Setting this
53			-- property to an empty string causes no label to be
54			-- displayed.
55		do
56			Result:= get_string_property(text_property_name)
57		end
58
59	set_text (a_text: STRING) is
60			-- Set text property
61			-- TODO: provide a more direct implementation. Currently there is a temporary G_VALUE object
62		require valid_text: a_text /= Void
63		do
64			set_property (text_property_name, create {G_VALUE}.from_string(a_text))
65		end
66
67feature -- The "value" property
68	value: INTEGER is
69			-- The "value" property determines the percentage to which
70			-- the progress bar will be "filled in".
71		do
72			Result:=integer_property(value_property_name)
73		ensure in_range: Result.in_range(0,100)
74		end
75
76	set_value (a_value: INTEGER) is
77		require in_range: a_value.in_range(0,100)
78		do
79			set_integer_property(value_property_name,a_value)
80		end
81	
82feature {} -- Properties names
83	text_property_name: STRING is "text"
84	value_property_name: STRING is "value"
85
86feature {} -- External calls
87	gtk_cell_renderer_progress_new: POINTER is
88		external "C use <gtk/gtk.h>"
89		end
90end