class UnderOs::UI::Locker

Attributes

label[R]
spinner[R]

Public Class Methods

new(options={}) click to toggle source
Calls superclass method UnderOs::UI::View::new
# File lib/under_os/ui/locker.rb, line 6
def initialize(options={})
  super options

  @dialog  = UnderOs::UI::View.new(class: 'locker-dialog')
  @spinner = UnderOs::UI::Spinner.new
  @label   = UnderOs::UI::Label.new(text: options[:text] || '')

  append @dialog.append(@spinner, @label)

  addClass 'with-label' if options[:text]
end

Public Instance Methods

hide() click to toggle source
# File lib/under_os/ui/locker.rb, line 23
def hide
  remove
end
show() click to toggle source
# File lib/under_os/ui/locker.rb, line 18
def show
  insertTo(UnderOs::App.history.current_page.view) if ! parent
  repaint
end
show_for(&block) click to toggle source
# File lib/under_os/ui/locker.rb, line 35
def show_for(&block)
  show
  1.ms.later do
    block.call
    1.ms.later { hide }
  end
end
text() click to toggle source
# File lib/under_os/ui/locker.rb, line 27
def text
  @label.text
end
text=(text) click to toggle source
# File lib/under_os/ui/locker.rb, line 31
def text=(text)
  @label.text = text
end