File: window_with_close_button.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 (61 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download | duplicates (8)
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
-- Copyright 1998 Richie Bielak and others
-- Licensed under Eiffel Forum Freeware License, version 1;
-- (see forum.txt)
--
indexing

	description: "Window with two boxes, where the bottom box has a %
                 %close button"

class WINDOW_WITH_CLOSE_BUTTON 

inherit

	GTK_WINDOW

creation

	make

feature

	make (label: STRING) is
		require
			label /= Void
		local
			close_cmd: CLOSE_WINDOW_COMMAND
			close_button: GTK_BUTTON
			separator: GTK_SEPARATOR
		do
			make_top_level
			set_title (label)
			!!close_cmd.make (Current)
			close_cmd.connect ("delete_event", Current)
			-- make the boxes
			!!enclosing_box.make_vertical (False, 0)
			add_widget (enclosing_box)
			!!box.make_vertical (False, 0)
			enclosing_box.pack (box, True, True, 0)
			!!separator.make_horizontal
			enclosing_box.pack (separator, False, False, 0)
			-- make the close button
			!!button_box.make_horizontal (False, 10)
			button_box.set_border_width (10)
			enclosing_box.pack (button_box, False, True, 0)
			!!close_button.make_with_label ("close")
			!!close_cmd.make (Current)
			close_cmd.connect ("clicked", close_button)
			button_box.pack (close_button, True, True, 0)
			close_button.set_flags (Gtk_can_default)
			close_button.grab_default
		end

feature -- windows is composed of one box containg two others

	box: GTK_BOX

	enclosing_box: GTK_BOX

	button_box: GTK_BOX

end