Commit 32b5904
Changed files (3)
lib
presentation
windows
lib/presentation/windows/application_shell.rb
@@ -19,13 +19,13 @@ class ApplicationShell < Window
@frame = Gtk::Frame.new
table.attach(@frame, 0, 2, 1, 3, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND, 1, 1)
- right_button = Gtk::Button.new "Right"
+ right_button = Gtk::Button.new("Right")
right_button.set_size_request(50, 30)
table.attach(right_button, 3, 4, 1, 2, Gtk::FILL, Gtk::SHRINK, 1, 1)
valign = Gtk::Alignment.new 0, 0, 0, 0
- wrong_button = Gtk::Button.new "Wrong"
- wrong_button.set_size_request 70, 30
+ wrong_button = Gtk::Button.new("Wrong")
+ wrong_button.set_size_request(70, 30)
valign.add(wrong_button)
table.set_row_spacing(1, 3)
table.attach(valign, 3, 4, 2, 3, Gtk::FILL, Gtk::FILL | Gtk::EXPAND, 1, 1)
lib/presentation/windows/signal.rb
@@ -0,0 +1,7 @@
+module Signal
+ def on(event, &command)
+ self.signal_connect(event.to_s) do |*args|
+ command.call(*args)
+ end
+ end
+end
lib/presentation/windows/window.rb
@@ -1,11 +1,10 @@
+require 'signal'
+
class Window < Gtk::Window
+ include Signal
+
def initialize
super
end
-
- def on(event, &command)
- self.signal_connect(event.to_s) do |*args|
- command.call(*args)
- end
- end
end
+