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

/src/wrappers/gtk/examples/gtk-demo/demo.e

http://github.com/tybor/Liberty
Specman e | 68 lines | 49 code | 13 blank | 6 comment | 3 complexity | 66fc29208609b525f813c19257e46701 MD5 | raw file
 1indexing
 2	description: "A single complete demo widget for gtk-demo application."
 3	copyright: "[
 4					Copyright (C) 2006 Paolo Redaelli, 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
22deferred class DEMO
23inherit GTK_CONTAINER 
24
25feature 
26	name: STRING is 
27			-- Demo name
28		deferred 
29		end
30
31	description: STRING is
32			-- Demo description
33		deferred
34		end
35	
36	source_code: STRING 
37			-- Demo source code, loaded at runtime
38	
39	filename: STRING is 
40			-- Filename where the sourcecode is stored.
41		deferred 
42		end 
43
44	subdemos: COLLECTION [DEMO] 
45			-- Eventual sub-demos
46
47	has_children, has_subdemos: BOOLEAN is
48		do
49			Result := subdemos /= Void
50		end
51
52	--window: GTK_WINDOW
53
54feature {}
55	load_source_code is
56		local file: TEXT_FILE_READ
57		do
58			create file.connect_to (filename)
59			check file_connected: file.is_connected end
60			create source_code.make_empty
61			file.read_tail_in (source_code)
62		ensure source_code_loaded: source_code /= Void
63		end
64	
65invariant
66	name_not_void: name /= Void
67	source_code_loaded: source_code /= Void
68end