PageRenderTime 485ms CodeModel.GetById 17ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 461ms

/src/wrappers/gtk/library/gtk_store_setters.e

http://github.com/tybor/Liberty
Specman e | 120 lines | 98 code | 15 blank | 7 comment | 2 complexity | d73b74d51b640ed30c63e0bcccbe8a2c MD5 | raw file
  1indexing
  2	description: "."
  3	copyright: "[
  4					Copyright (C) 2006 Paolo Redaelli, 
  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 hopeOA 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
 22deferred class GTK_STORE_SETTERS
 23
 24insert
 25	ANY
 26		undefine
 27			copy,
 28			is_equal
 29		end
 30
 31feature -- Easy to use setters
 32	
 33	-- Note: wrapping gtk_list/tree_store_set is problematic since it's
 34	-- a variadic function but also its not-variadic variant
 35	-- (gtk_list_store_set_valist) is not easy to use from within
 36	-- ewg-wrapped libraries since currently it's not easy/possible to
 37	-- wrap va_list-using functions. Using the plain
 38	-- gtk_list_store_set_value can be an answer but I haven't checked
 39	-- its performance (2005-05-16 Paolo)
 40
 41	set_string (an_iterator: GTK_TREE_ITER; a_column: INTEGER; a_string: STRING) is
 42		require
 43			a_column_contains_a_string: -- TODO
 44			valid_iterator: an_iterator/=Void
 45		local a_value: G_VALUE
 46		do
 47			create a_value.from_string (a_string)
 48			set_value (an_iterator, a_column, a_value)
 49		end
 50
 51	set_natural (an_iterator: GTK_TREE_ITER; a_column: INTEGER; a_natural: INTEGER) is
 52		require
 53			a_column_contains_a_natural: -- TODO
 54			valid_natural: a_natural >= 0
 55			valid_iterator: an_iterator/=Void
 56		local a_value: G_VALUE
 57		do
 58			create a_value.from_natural (a_natural)
 59			set_value (an_iterator, a_column, a_value)
 60		end
 61
 62	set_integer (an_iterator: GTK_TREE_ITER; a_column: INTEGER; an_integer: INTEGER) is
 63		require
 64			a_column_contains_a_integer: -- TODO
 65			valid_iterator: an_iterator/=Void
 66		local a_value: G_VALUE
 67		do
 68			create a_value.from_integer (an_integer)
 69			set_value (an_iterator, a_column, a_value)
 70		end
 71
 72	set_real (an_iterator: GTK_TREE_ITER; a_column: INTEGER; a_real: REAL) is
 73		require
 74			a_column_contains_a_double: -- TODO
 75			valid_iterator: an_iterator/=Void
 76		local
 77			a_value: G_VALUE
 78		do
 79			create a_value.from_real (a_real)
 80			set_value (an_iterator, a_column, a_value)
 81		end
 82
 83	set_boolean (an_iterator: GTK_TREE_ITER; a_column: INTEGER; a_boolean: BOOLEAN) is
 84		require
 85			valid_iterator: an_iterator/=Void
 86			a_column_contains_a_boolean: -- TODO
 87		local
 88			a_value: G_VALUE
 89		do
 90			create a_value.from_boolean (a_boolean)
 91			set_value (an_iterator, a_column, a_value)
 92		end
 93
 94	set_object (an_iterator: GTK_TREE_ITER; a_column: INTEGER; an_object: G_OBJECT) is
 95		require
 96			valid_iterator: an_iterator/=Void
 97			a_column_contains_an_object: -- TODO
 98		local
 99			a_value: G_VALUE
100		do
101			create a_value.from_object (an_object)
102			set_value (an_iterator, a_column, a_value)
103		end
104
105	set_pointer (an_iterator: GTK_TREE_ITER; a_column: INTEGER; a_pointer: POINTER) is
106		require
107			valid_iterator: an_iterator/=Void
108			a_column_contains_an_object: -- TODO
109		local
110			a_value: G_VALUE
111		do
112			create a_value.from_pointer (a_pointer)
113			set_value (an_iterator, a_column, a_value)
114		end
115
116feature -- Generic setter
117	set_value (an_iterator: GTK_TREE_ITER; a_column: INTEGER; a_value: G_VALUE) is
118		deferred
119		end
120end -- class GTK_STORE_SETTERS