Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/samples/simple-menu.rb
diff options
context:
space:
mode:
authorIshan Bansal <ishan@seeta.in>2011-02-04 12:53:17 (GMT)
committer Ishan Bansal <ishan@seeta.in>2011-02-04 12:53:17 (GMT)
commitee852209b70c803e6ab1bb69b71c7dafcb1448e7 (patch)
treeac20673816893b398aed4c4da463b157d9e4899e /samples/simple-menu.rb
Imported Upstream version 1HEADmaster
Diffstat (limited to 'samples/simple-menu.rb')
-rw-r--r--samples/simple-menu.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/samples/simple-menu.rb b/samples/simple-menu.rb
new file mode 100644
index 0000000..aba8788
--- /dev/null
+++ b/samples/simple-menu.rb
@@ -0,0 +1,31 @@
+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(Link, :underline => nil)
+ style(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