Class: Fastui::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/fastui/window.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, opts = {}, &block) ⇒ Window

:opts => => ‘m_window’, tabs:



17
18
19
20
21
22
23
24
25
26
# File 'lib/fastui/window.rb', line 17

def initialize(name, opts = {}, &block)
  self.name = name
  opts.each_pair do |k,v|
    self.send "#{k}=",  v
  end
  self.tabs = self.tabs || []
  block.call(self) if block_given?
  self.wrap_tab
  self.class.windows[name.to_s] = self
end

Class Attribute Details

.windowsObject

Returns the value of attribute windows.



8
9
10
# File 'lib/fastui/window.rb', line 8

def windows
  @windows
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/fastui/window.rb', line 14

def name
  @name
end

#tabsObject

Returns the value of attribute tabs.



14
15
16
# File 'lib/fastui/window.rb', line 14

def tabs
  @tabs
end

#titleObject

Returns the value of attribute title.



14
15
16
# File 'lib/fastui/window.rb', line 14

def title
  @title
end

#window_kindObject

Returns the value of attribute window_kind.



14
15
16
# File 'lib/fastui/window.rb', line 14

def window_kind
  @window_kind
end

Class Method Details

.find(name) ⇒ Object



9
10
11
# File 'lib/fastui/window.rb', line 9

def find(name)
  @windows[name.to_s]
end

Instance Method Details

#tab(name, opts = {}) ⇒ Object



38
39
40
# File 'lib/fastui/window.rb', line 38

def tab(name, opts = {})
  self.tabs << (opts.blank? ? name : Fastui::Tab.new(name,opts))
end

#wrap_tabObject



28
29
30
31
32
33
34
35
36
# File 'lib/fastui/window.rb', line 28

def wrap_tab
  self.tabs.each_index do |i|
    tab = self.tabs[i]
    unless tab.kind_of?(Fastui::Tab)
      raise "not fond #{tab} ui." unless Fastui::Tab.find(tab)
      self.tabs[i] =  Fastui::Tab.find(tab)
    end
  end
end