File: notebook_cmd.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 (78 lines) | stat: -rw-r--r-- 1,746 bytes parent folder | download | duplicates (4)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
-- Copyright 1998 Richie Bielak and others
-- Licensed under Eiffel Forum Freeware License, version 1;
-- (see forum.txt)
--
class NOTEBOOK_CMD

inherit

	GTK_COMMAND

	GTK_CONSTANTS

feature

	notebook: GTK_NOTEBOOK

	window: WINDOW_WITH_CLOSE_BUTTON

	rotate_command: ROTATE_COMMAND

	tab_pos_command: TAB_POS_COMMAND

	tab_vis_command: TAB_VIS_COMMAND

	execute is
		local
			a_button: GTK_BUTTON
		do
			!!window.make ("Notebook")
			!!notebook.make
			notebook.set_tab_pos (GTK_POS_TOP)
			notebook.set_border_width (10)
			window.box.pack (notebook, True, True, 0)
			create_pages (1, 4)
			-- create a button for rotating pages
			!!a_button.make_with_label (" Rotate ")
			!!rotate_command
			rotate_command.set_direction(1)
			rotate_command.connect_to_notebook (notebook, a_button)
			window.button_box.pack (a_button, True, True, 0)
			-- create a button for moving tabs around
			!!a_button.make_with_label (" Tabs ")
			!!tab_pos_command
			tab_pos_command.connect_to_notebook (notebook, a_button)
			window.button_box.pack (a_button, True, True, 0)
			-- button to hide or show tabs
			!!a_button.make_with_label ("Hide/Show")
			!!tab_vis_command
			tab_vis_command.connect_to_notebook (notebook, a_button)
			window.button_box.pack (a_button, True, True, 0)
			window.show_all
		end

	create_pages (start, finish: INTEGER) is
		local
			child: GTK_FRAME
			label: GTK_LABEL
			i: INTEGER
			s: STRING
		do
			from i := start
			until i > finish
			loop
				s := clone ("Page ")
				s.append (i.out)
				!!child.make (s)
				child.set_border_width (10)
				child.set_size (100, 75)
				!!label.make (s)
				child.add_widget (label)
				!!label.make (s)
				notebook.append_page (child, label)
				i := i + 1
			end
				
		end

end