Sha256: 58e8b15200edbbc74898c65d6fae6fc6207a51e3a34d25de6018ac970c105430

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

class DDMenuWidget
  include Widget

  def initialize
  end

  def show(opt={})
    app.info "#{self.class.name}.show"
    app.stack(opt) do
      app.para "The left column has active links with right click for drop down menu."
      app.para "The right column has hover activation for the drop down menu."
      app.para "Both columns close the menu when the mouse leaves it."
      app.flow do
        app.stack(:width => 100) do
          list = UnorderedList.new(app)
          numbers = %w(one two three four five).collect do |item|
            ListItem.new(item,
                        :click => lambda{alert("#{item} was clicked")})
          end
          %w(alpha bravo charlie delta echo foxtrot).each do |item|
            list.add(ListItem.new(item,
                                  :menu_items => numbers,
                                  :menu_trigger => DropDownMenuWidget::RIGHT_BUTTON,
                                  :menu_options => {:width => 70},
                                  :click => lambda{alert("#{item} was clicked")},
                                  :bullet => List::CIRCLE_BULLET
                                  ))
          end
          list.show
        end
        app.stack(:width => 100) do
          list = UnorderedList.new(app)
          numbers = %w(six seven eight nine).collect do |item|
            ListItem.new(item,
                        :click => lambda{alert("#{item} was clicked")})
          end
          %w(golf hotel india juliet kilo lima).each do |item|
            list.add(ListItem.new(item,
                                  :menu_items => numbers,
                                  :menu_trigger => DropDownMenuWidget::HOVER,
                                  :menu_options => {:width => 70},
                                  :bullet => List::PLUS_BULLET
                                  ))
          end
          list.show
        end
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
royw-shoeshine-0.0.1 examples/dd_menu_widget.rb
royw-shoeshine-0.0.2 examples/dd_menu_widget.rb