File: on_button_press_command.e

package info (click to toggle)
egtk 0.3.6-8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,984 kB
  • ctags: 5,256
  • sloc: ansic: 2,320; sh: 273; makefile: 234
file content (50 lines) | stat: -rw-r--r-- 666 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class ON_BUTTON_PRESS_COMMAND

inherit

	GTK_COMMAND_TYPE
		redefine
			parent
		end

creation

	make

feature

	parent: GTK_BUTTON

	pix1, pix2: GDK_PIXMAP

	first: BOOLEAN

	make (p1, p2: GDK_PIXMAP) is
		require
			p1_not_void: p1 /= Void
			p2_not_void: p2 /= Void
		do
			first := False
			pix1 := p1
			pix2 := p2
		end

	execute is
			-- this routine is called on button press, switch the 
			-- pixmaps
		local
			pic: GTK_PIXMAP
		do
			if first then
				-- first pixmap
				!!pic.make (pix1, default_pointer)
			else
				-- second pixmap
				!!pic.make (pix2, default_pointer)
			end
			pic.show
			parent.set_pixmap (pic)
			first := not first
		end

end