class TheFox::TermKit::Controller

Attributes

subcontrollers[R]

Public Class Methods

new() click to toggle source
# File lib/termkit/controller/controller.rb, line 9
def initialize
    #puts 'Controller initialize'
    
    @is_active = false
    @subcontrollers = []
end

Public Instance Methods

active() click to toggle source
# File lib/termkit/controller/controller.rb, line 16
def active
    @is_active = true
    
    @subcontrollers.each do |subcontroller|
        subcontroller.active
    end
end
add_subcontroller(subcontroller) click to toggle source
# File lib/termkit/controller/controller.rb, line 40
def add_subcontroller(subcontroller)
    if !subcontroller.is_a?(Controller)
        raise ArgumentError, "Argument is not a Controller -- #{subcontroller.class} given"
    end
    if !@subcontrollers.is_a?(Array)
        raise Exception::ParentClassNotInitializedException, "@subcontrollers is not an Array -- #{@subcontrollers.class} given"
    end
    
    @subcontrollers.push(subcontroller)
end
handle_event(event) click to toggle source
# File lib/termkit/controller/controller.rb, line 36
def handle_event(event)
    #puts "Controller handle_event: #{event.class}"
end
inactive() click to toggle source
# File lib/termkit/controller/controller.rb, line 24
def inactive
    @is_active = false
    
    @subcontrollers.each do |subcontroller|
        subcontroller.inactive
    end
end
is_active?() click to toggle source
# File lib/termkit/controller/controller.rb, line 32
def is_active?
    @is_active
end
remove_subcontroller(subcontroller) click to toggle source
# File lib/termkit/controller/controller.rb, line 51
def remove_subcontroller(subcontroller)
    @subcontrollers.delete(subcontroller)
end