Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/samples/simple-menu1.rb
diff options
context:
space:
mode:
Diffstat (limited to 'samples/simple-menu1.rb')
-rw-r--r--samples/simple-menu1.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/samples/simple-menu1.rb b/samples/simple-menu1.rb
new file mode 100644
index 0000000..60fb1b6
--- /dev/null
+++ b/samples/simple-menu1.rb
@@ -0,0 +1,35 @@
+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
+ yield
+ end
+end
+
+Shoes.app :width => 600, :height => 130 do
+ style(Link, :underline => nil)
+ style(LinkHover, :fill => nil, :underline => nil)
+
+ expand = proc do
+ hover do |box|
+ if box.width < 170
+ a = animate 30 do
+ $boxes.each do |b|
+ b.width -= 5 if b != box and b.width > 140
+ end
+ box.width += 5
+ a.stop if box.width >= 170
+ end
+ end
+ end
+ end
+
+ menu_panel green, :width => 170, :height => 120, :margin => 4, &expand
+ menu_panel blue, :width => 140, :height => 120, :margin => 4, &expand
+ menu_panel red, :width => 140, :height => 120, :margin => 4, &expand
+ menu_panel purple, :width => 140, :height => 120, :margin => 4, &expand
+end