Class: Ig3tool::ToolWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/ui/toolwindow.rb

Overview

Hoofdmenu (altijd on top) Zorgt voor dynamische uitbreidingsmogelijkheden van de ig3tool

Constant Summary collapse

ICON_BASEPATH =
Pathname.new(__FILE__).parent.parent + "glade/icons"
@@windows =
{}

Instance Method Summary collapse

Constructor Details

#initialize(klasses) ⇒ ToolWindow

Returns a new instance of ToolWindow.



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
# File 'lib/ui/toolwindow.rb', line 14

def initialize (klasses)
	window = Gtk::Window.new
	window.title = "Ig3tool"
	window.type_hint = Gdk::Window::TYPE_HINT_NORMAL
	#window.keep_above = true
	window.move(0,0)

	bigbox = Gtk::VBox.new(true)
	bigbox.border_width = 6
	bigbox.spacing = 12
	window.add(bigbox)


	klasses.each do |klass|
		name = klass::MENU_PATH.last
		icon = (klass::ICON || "no.xpm")
		button = create_button(name, icon.to_s)
		button.signal_connect("clicked") do
			Thread.new do
				@@windows[klass] ||= klass.new
				@@windows[klass].show
				@@windows[klass].present
			end
		end
		bigbox.add(button)
	end

	window.signal_connect("delete-event") do
		not ask_to_quit(window)
	end
	window.signal_connect("destroy") do
		Gtk::main_quit
	end

	bigbox.show_all
	size = window.size_request
	size[0] += 24
	size[1] += klasses.length * 12
	window.set_default_size(*size)
	window.show_all
end