class Fidgit::List
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
Fidgit::Composite::new
# File lib/fidgit/elements/list.rb, line 13 def initialize(options = {}) options = { background_color: default(:background_color), border_color: default(:border_color), }.merge! options super options group do subscribe :changed do |sender, value| publish :changed, value end @items = vertical spacing: 0 end end
Public Instance Methods
clear()
click to toggle source
# File lib/fidgit/elements/list.rb, line 11 def clear; @items.clear; end
item(text, value, options = {}, &block)
click to toggle source
@param [String] text @option options [Gosu::Image] :icon
# File lib/fidgit/elements/list.rb, line 32 def item(text, value, options = {}, &block) Item.new(text, value, { parent: @items }.merge!(options), &block) end
size()
click to toggle source
# File lib/fidgit/elements/list.rb, line 10 def size; @items.size; end
Protected Instance Methods
layout()
click to toggle source
Calls superclass method
# File lib/fidgit/elements/list.rb, line 37 def layout super if @items max_width = @items.each.to_a.map {|c| c.width }.max || 0 @items.each {|c| c.rect.width = max_width } end nil end