class Rgw::SingleBox

Public Class Methods

new(dir) click to toggle source
Calls superclass method
# File lib/rgw/single-box.rb, line 30
def initialize dir
    super dir
    
    # only show the first child on first show
    show_id = signal_connect_after(:map) do
        signal_handler_disconnect show_id
        self.children[1..-1].each {|child| child.hide}
    end
end

Public Instance Methods

add(widget) click to toggle source
# File lib/rgw/single-box.rb, line 54
def add widget
    print "Warning: Do not use Container::add on a Rgw::SingleBox; Use pack_start instead\n"
end
pack_end(widget, *args) click to toggle source
Calls superclass method
# File lib/rgw/single-box.rb, line 48
def pack_end widget, *args
    widget.hide
    super
end
pack_start(widget, *args) click to toggle source

The user should not be able to add already shown widgets.

Calls superclass method
# File lib/rgw/single-box.rb, line 42
def pack_start widget, *args
    widget.hide
    super
end
show_by_id(id) click to toggle source
# File lib/rgw/single-box.rb, line 59
def show_by_id id
    cd = self.children
    found = false
    cd.each do |child|
        raise RuntimeError, 'SingleBox contains children without id' if child.rgw_single_box_id.nil?
        found = true if id == child.rgw_single_box_id
    end
    raise RuntimeError, 'invalid id' unless found
    cd.each do |child|
        unless id == child.rgw_single_box_id
            child.hide
        else
            child.show
        end
    end
end
show_by_index(i) click to toggle source
# File lib/rgw/single-box.rb, line 77
def show_by_index i
    cd = self.children
    raise ArgumentError, 'invalid child index' if i < 0 or i >= cd.length
    ch.each_with_index do |child, idx|
        unless idx == i
            child.hide
        else
            child.show
        end
    end
end