class RETerm::Components::Splash
Splash
Screen
Attributes
callback[R]
widget[R]
Public Class Methods
new(args={})
click to toggle source
Initialize the Splash
component
@param [Hash] args splash params @option args [Component] :widget component
to include in the slash window
Calls superclass method
RETerm::Component::new
# File lib/reterm/components/splash.rb, line 12 def initialize(args={}) super @widget = args[:widget] @callback = args[:callback] @terminate = false end
show(args={}, &bl)
click to toggle source
Client may invoke this to
- create dialog and window - activate it - periodically invoke callback, check return value - close / cleanup
# File lib/reterm/components/splash.rb, line 25 def self.show(args={}, &bl) splash = self.new args.merge(:callback => bl) win = Window.new args.merge(:component => splash, :x => :center, :y => :center) #win.component = splash splash.activate! update_reterm(true) splash.close! end
Public Instance Methods
activate!(*input)
click to toggle source
# File lib/reterm/components/splash.rb, line 74 def activate!(*input) until @terminate window.draw! sleep SYNC_TIMEOUT.to_f / 1000 run_sync! @terminate = !!callback.call end end
close!()
click to toggle source
# File lib/reterm/components/splash.rb, line 44 def close! widget.erase widget.finalize! window.erase window.finalize! # get rid of all outstanding input flush_input end
draw!()
click to toggle source
# File lib/reterm/components/splash.rb, line 59 def draw! window.border! widget.draw! end
requested_cols()
click to toggle source
# File lib/reterm/components/splash.rb, line 40 def requested_cols @widget.requested_cols + 3 end
requested_rows()
click to toggle source
# File lib/reterm/components/splash.rb, line 36 def requested_rows @widget.requested_rows + 3 end
sync!()
click to toggle source
# File lib/reterm/components/splash.rb, line 55 def sync! widget.sync! end
window=(win)
click to toggle source
Calls superclass method
RETerm::Component#window=
# File lib/reterm/components/splash.rb, line 64 def window=(win) super(win) cw = win.create_child :rows => widget.requested_rows, :cols => widget.requested_cols, :x => 1, :y => 1 raise ArgumentError, "could not create child" if cw.win.nil? cw.component = widget end