diff options
Diffstat (limited to 'trunk/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb')
-rw-r--r-- | trunk/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/trunk/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb b/trunk/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb new file mode 100644 index 0000000000..d6f2292650 --- /dev/null +++ b/trunk/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +helpvar = TkVariable.new +viewmode = TkVariable.new + +mb = Tk::Iwidgets::Menubar.new +mb.menubuttons = [ + [:menubutton, 'file', { + :text=>'File', :menu=>[ + [:command, 'new', {:label=>'New'}], + [:command, 'close', {:label=>'Close'}], + [:separator, 'sep1'], + [:command, 'quit', {:label=>'Quit'}] + ] + } + ], + [:menubutton, 'edit', {:text=>'Edit'}] +] + +mb.add(:command, '.edit.undo', :label=>'Undo', :underline=>0) +mb.add(:separator, '.edit.sep2') +mb.add(:command, '.edit.cut', :label=>'Cut', :underline=>1) +mb.add(:command, '.edit.copy', :label=>'Copy', :underline=>1) +mb.add(:command, '.edit.paste', :label=>'Paste', :underline=>0) + +mb.add(:menubutton, '.options', :text=>'Options', :menu=>[ + [:radiobutton, 'byName', { + :variable=>viewmode, :value=>'NAME', :label=>'by Name'} + ], + [:radiobutton, 'byDate', { + :variable=>viewmode, :value=>'DATE', :label=>'by Date'} + ] + ]) + +mb.add(:cascade, '.options.prefs', :label=>'Preferences', :menu=>[ + [:command, 'colors', {:label=>'Colors...'}], + [:command, 'fonts', {:label=>'Fonts...'}] + ]) + +mb.pack(:side=>:left, :anchor=>:nw, :fill=>:x, :expand=>true) + +Tk.mainloop |