3 require 'tkextlib/iwidgets'
5 helpvar = TkVariable.new
6 viewmode = TkVariable.new
9 [:menubutton, 'file', {
10 :text=>'File', :menu=>[
11 [:options, {:tearoff=>false}],
14 :label=>'New', :helpstr=>'Open new document',
15 :command=>proc{puts 'NEW'}
20 :label=>'Close', :helpstr=>'Close current document',
21 :command=>proc{puts 'CLOSE'}
28 :label=>'Exit', :helpstr=>'Exit application',
36 [:menubutton, 'edit', {
37 :text=>'Edit', :menu=>[
38 [:options, {:tearoff=>false}],
41 :label=>'Undo', :underline=>0,
42 :helpstr=>'Undo last command',
43 :command=>proc{puts 'UNDO'}
50 :label=>'Cut', :underline=>1,
51 :helpstr=>'Cut selection to clipboard',
52 :command=>proc{puts 'CUT'}
57 :label=>'Copy', :underline=>1,
58 :helpstr=>'Copy selection to clipboard',
59 :command=>proc{puts 'COPY'}
64 :label=>'Paste', :underline=>0,
65 :helpstr=>'Paste clipboard contents',
66 :command=>proc{puts 'PASTE'}
73 [:menubutton, 'options', {
74 :text=>'Options', :menu=>[
75 [:options, {:tearoff=>false, :selectcolor=>'blue'}],
77 [:radiobutton, 'byName', {
78 :variable=>viewmode, :value=>'NAME',
79 :label=>'by Name', :helpstr=>'View files by name order',
80 :command=>proc{puts 'NAME'}
84 [:radiobutton, 'byDate', {
85 :variable=>viewmode, :value=>'DATE',
86 :label=>'by Date', :helpstr=>'View files by date order',
87 :command=>proc{puts 'DATE'}
92 :label=>'Preferences', :menu=>[
93 [:command, 'colors', {
94 :label=>'Colors...', :helpstr=>'Change text colors',
95 :command=>proc{puts 'COLORS'}
100 :label=>'Fonts...', :helpstr=>'Change text font',
101 :command=>proc{puts 'COLORS'}
112 #mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar,
113 # :menubuttons=>menu_spec)
114 mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar)
115 mb.configure(:menubuttons=>menu_spec)
117 fr = TkFrame.new(:width=>300, :height=>300)
118 ef = TkEntry.new(:textvariable=>helpvar)
120 mb.pack(:anchor=>:nw, :fill=>:x, :expand=>true)
121 fr.pack(:fill=>:both, :expand=>true)
122 ef.pack(:anchor=>:sw, :fill=>:x, :expand=>true)