Sha256: b0d32d46ef8b991879981552a76016535bea83bca4237f6b93dfb569c9afe808

Contents?: true

Size: 949 Bytes

Versions: 6

Compression:

Stored size: 949 Bytes

Contents

class MenuPanel < Shoes::Widget
  @@boxes = []
  def initialize(color, args)
    @@boxes << self
    background color
    para link("Box #{@@boxes.length}", :stroke => white, :fill => nil).
      click { visit "/" },
        :margin => 18, :align => "center", :size => 20
    hover { expand }
  end
  def expand
    if self.width < 170
      a = animate 30 do
        @@boxes.each do |b|
          b.width -= 5 if b != self and b.width > 140
        end
        self.width += 5
        a.stop if self.width >= 170
      end
    end
  end
end

Shoes.app :width => 400, :height => 130 do
  style(Shoes::Link, :underline => nil)
  style(Shoes::LinkHover, :fill => nil, :underline => nil)
  menu_panel green,  :width => 170, :height => 120, :margin => 4
  menu_panel blue,   :width => 140, :height => 120, :margin => 4
  menu_panel red,    :width => 140, :height => 120, :margin => 4
  menu_panel purple, :width => 140, :height => 120, :margin => 4
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
scarpe-0.4.0 examples/legacy/not_checked/simple/menu.rb
scarpe-0.3.0 examples/legacy/not_checked/simple/menu.rb
scarpe-0.2.2 examples/legacy/not_checked/simple/menu.rb
lacci-0.2.1 examples/legacy/not_checked/simple/menu.rb
scarpe-0.2.1 examples/legacy/not_checked/simple/menu.rb
scarpe-0.2.0 examples/legacy/not_checked/simple/menu.rb