class Entirety < Shoes
# based heavily on _why's example
  Shoes.app :width => 523, :height => 716 do
    # teh steelo
    BACKGROUNDS = [{:background_color => "#0FA", :text_color => "#000"},
                   {:background_color => "#3AF", :text_color => "#000"},
                   {:background_color => "#A54", :text_color => "#000"}]
    
    color_scheme = BACKGROUNDS[rand(BACKGROUNDS.size)]
    background(color_scheme[:background_color])
    # background("static/entirety_backgrounds/#{color_scheme[:background_image]}")
    
    # teh data
    INCIDENTS = YAML.load_file('samples/entirety.yaml')
    # adapted from _why's book example; clunky results
    incidents_hash = {}
    INCIDENTS.each {|incident| incidents_hash[incident[0]] = incident[1]}
    incidents_indexed = []
    INCIDENTS.each {|incident| incidents_indexed << incident[0]}

    # teh dropdown
    @box = list_box :items => INCIDENTS.map {|incident| incident[0]} do
      contents.each { |option| option.hide if option.is_a? Shoes::Stack }
      instance_variable_get("@#{@box.text.gsub(/ |\&/, "_")}").show
    end

    # teh infos
    incidents_hash.each do |category, text|
      instance_variable_set("@#{category.gsub(/ |\&/, "_")}", stack :hidden => true do
        text.split(/\n+/).each do |p|
          para p, :stroke => color_scheme[:text_color]
        end
      end)
    end
  end
end
