class Interphase::Window
An application window.
Public Class Methods
new(title, **options, &block)
click to toggle source
Creates a new window.
Calls superclass method
Interphase::Widget::new
# File lib/interphase/widgets/window.rb, line 9 def initialize(title, **options, &block) super(Gtk::Window.new(title), options, &block) end
Public Instance Methods
in_background(&block)
click to toggle source
Binds a block to run as a Thread
; it begins executing immediately. Destroying the window kills all threads. TOOD DOES IT?
# File lib/interphase/widgets/window.rb, line 49 def in_background(&block) @threads ||= [] thread = Thread.new(&block) thread.abort_on_exception = true @threads << thread end
on_delete(&block)
click to toggle source
The given block will trigger when this window is closed.
# File lib/interphase/widgets/window.rb, line 14 def on_delete(&block) on('delete-event', &block) end
quit()
click to toggle source
Quits the entire Interphase
application, killing all its threads.
# File lib/interphase/widgets/window.rb, line 31 def quit @threads&.each(&:kill) Gtk.main_quit end
quit!()
click to toggle source
Force-quits the entire Interphase
application, including the Ruby Kernel. If your GUI quits but your terminal stays occupied after quit
, this will probably solve that issue. Having to use this is usually the sign of a badly-written program!
# File lib/interphase/widgets/window.rb, line 40 def quit! @threads&.each(&:kill) Gtk.main_quit exit! end
quit_on_delete!()
click to toggle source
run()
click to toggle source
Runs the entire Interphase
application.
# File lib/interphase/widgets/window.rb, line 26 def run Gtk.main end