Module: Canis::FocusManager

Extended by:
FocusManager
Included in:
FocusManager
Defined in:
lib/canis/core/util/focusmanager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#focusablesObject (readonly)

Returns the value of attribute focusables.



14
15
16
# File 'lib/canis/core/util/focusmanager.rb', line 14

def focusables
  @focusables
end

Instance Method Details

#add(component) ⇒ Object

add a component to this list so it can be made focusable later



16
17
18
19
20
# File 'lib/canis/core/util/focusmanager.rb', line 16

def add component
  @focusables ||= []
  @focusables << component
  self
end

#make_focusable(bool = true) ⇒ Object



21
22
23
24
# File 'lib/canis/core/util/focusmanager.rb', line 21

def make_focusable bool=true
  @focusing = bool
  @focusables.each { |e| e.focusable(bool) }
end

#toggle_focusableObject



25
26
27
28
29
# File 'lib/canis/core/util/focusmanager.rb', line 25

def toggle_focusable
  return unless @focusables
  alert "FocusManager Making #{@focusables.length} objects #{!@focusing} "
  make_focusable !@focusing
end