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

/tutorial/vision/layout/shrink_expand.e

http://github.com/tybor/Liberty
Specman e | 68 lines | 52 code | 9 blank | 7 comment | 0 complexity | 435a451a6af5dd2dddfd3ca587b1e63f MD5 | raw file
 1class SHRINK_EXPAND
 2--
 3-- This example show how standards layouts (row / column) handle *_shrink_allowed and *_expand_allowed 
 4-- widget's properties.
 5--
 6-- See also WIDGET and LAYOUT for more information.
 7--
 8	
 9inherit
10	GRAPHIC
11
12creation {ANY}
13	make
14
15feature {}
16	toplevel_window: TOPLEVEL_WINDOW
17
18	make is
19		local
20			sub_window: SUB_WINDOW; label: LABEL
21		do
22			create toplevel_window
23			-- The default layout is column.
24			toplevel_window.set_title("Layout example")
25			toplevel_window.set_background_color(white_color)
26			toplevel_window.when_close_requested(agent vision.loop_stack.break)
27			toplevel_window.map
28			toplevel_window.set_x_shrink(True)
29			toplevel_window.set_y_shrink(True)
30			toplevel_window.child_attach(create {LABEL}.make(U"Fixed size label"))
31			
32			create sub_window.make(toplevel_window)
33			sub_window.set_background_color(light_sky_blue_color)
34			sub_window.child_attach(create {LABEL}.make(U"Expand area"))
35			sub_window.set_x_expand(True)
36			sub_window.set_y_expand(True)
37			sub_window.map
38			
39			create sub_window.make(toplevel_window)
40			sub_window.set_background_color(pink_color)
41			create label.make(U"Expand and shrink area")
42			label.set_x_shrink(True)
43			label.set_y_shrink(True)
44			label.set_min_width(0)
45			label.set_min_height(0)
46			sub_window.child_attach(label)
47			sub_window.set_x_expand(True)
48			sub_window.set_y_expand(True)
49			sub_window.set_x_shrink(True)
50			sub_window.set_y_shrink(True)
51			sub_window.map
52			
53			create sub_window.make(toplevel_window)
54			sub_window.set_background_color(light_green_color)
55			create label.make(U"Shrink area")
56			label.set_x_shrink(True)
57			label.set_y_shrink(True)
58			label.set_min_width(0)
59			label.set_min_height(0)
60			sub_window.child_attach(label)
61			sub_window.set_x_shrink(True)
62			sub_window.set_y_shrink(True)
63			sub_window.map
64			
65			vision.start
66		end
67
68end -- class SHRINK_EXPAND