Sha256: 0b7921ff8c42a5507d89044fe9d401a59fa3715e11233a888e11211176f8af31
Contents?: true
Size: 997 Bytes
Versions: 16
Compression:
Stored size: 997 Bytes
Contents
# encoding: utf-8 module Fidgit class List < Composite class Item < RadioButton end event :changed def size; @items.size; end def clear; @items.clear; end 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 # @param [String] text # @option options [Gosu::Image] :icon def item(text, value, options = {}, &block) Item.new(text, value, { parent: @items }.merge!(options), &block) end protected 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 end end
Version data entries
16 entries across 16 versions & 1 rubygems