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

/src/wrappers/gtk/examples/entries/text_entry.e

http://github.com/tybor/Liberty
Specman e | 67 lines | 55 code | 10 blank | 2 comment | 0 complexity | 0fe0ccd2416bd417e2fbb967adf356ff MD5 | raw file
 1class TEXT_ENTRY
 2inherit
 3	GTK_ENTRY
 4		redefine
 5			on_activate,
 6			on_backspace,
 7			on_copy_clipboard,
 8			on_cut_clipboard,
 9			on_paste_clipboard,
10			on_changed
11		end
12	
13creation with_label
14feature with_label (a_label: STRING) is
15		require a_label/=Void
16		do
17			make
18			set_text (a_label)
19			-- Low level, unsecure signal handling
20			connect (Current, "changed", $on_changed)
21			connect (Current, "delete-text", $on_delete)
22			-- High level, secure signal handling
23			enable_on_activate
24			enable_on_backspace
25			enable_on_copy_clipboard
26			enable_on_cut_clipboard
27			enable_on_paste_clipboard
28		end
29
30feature -- Callbacks
31	on_changed is
32		do
33			print ("Entry has changed; now it contains `") print(text) print ("'%N")
34		end
35
36	on_delete (a_start,an_end: INTEGER) is
37		do
38			print ("Deleting text in entry from ") print(a_start.out) print (" to ") print (an_end.out) print("%N")
39		end
40
41	on_activate	is
42		do
43			print ("on activate%N")
44		end
45
46	on_backspace	is
47		do
48			print ("on backspace%N")
49		end
50
51	on_copy_clipboard	is
52		do
53			print ("Text copied to clipboard %N")
54		end
55
56	on_cut_clipboard	is
57		do
58			print ("Cut to clipboard%N")
59		end
60
61	on_paste_clipboard is
62		do
63			print ("Text pasted from clipboard%N")
64		end
65
66end
67