mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries.
* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes.
( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. )
* ext/tk/*: Unify sources between Ruby 1.8 & 1.9.
Improve default_widget_set handling.
* ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9.
( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk
callbacks may freeze. On Ruby 1.9, cannot create a second
master interpreter (creating slaves are OK); supported master
interpreter is the default master interpreter only. )
* ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions.
Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5
BWidgets 1.7 ==> BWidgets 1.8
TkTable 2.9 ==> TkTable 2.10
TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9
Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1
IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15
TclX 2005-02-07 ==> TclX 2008-12-15
Trofs 0.4.3 ==> Trofs 0.4.4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4e94c36f3d
commit
41b74c6e20
535 changed files with 16499 additions and 10067 deletions
|
|
@ -4,12 +4,12 @@
|
|||
def demoBitmaps(t)
|
||||
#if $Version_1_1_OrLater
|
||||
if @has_bgimg
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items',
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items',
|
||||
:showheader=>false, :backgroundimage=>@images['sky'])
|
||||
else
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items',
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items',
|
||||
:showheader=>false)
|
||||
end
|
||||
|
||||
|
|
@ -19,15 +19,15 @@ def demoBitmaps(t)
|
|||
t.column_configure(0, :itembackground=>['gray90', []])
|
||||
end
|
||||
|
||||
t.element_create('elemTxt', :text,
|
||||
t.element_create('elemTxt', :text,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('elemSelTxt', :rect, :showfocus=>true,
|
||||
t.element_create('elemSelTxt', :rect, :showfocus=>true,
|
||||
:fill=>[@SystemHighlight, ['selected', 'focus']])
|
||||
t.element_create('elemSelBmp', :rect, :outlinewidth=>4,
|
||||
t.element_create('elemSelBmp', :rect, :outlinewidth=>4,
|
||||
:outline=>[@SystemHighlight, ['selected', 'focus']])
|
||||
t.element_create('elemBmp', :bitmap,
|
||||
:foreground=>[@SystemHighlight, ['selected', 'focus']],
|
||||
:background=>'linen',
|
||||
t.element_create('elemBmp', :bitmap,
|
||||
:foreground=>[@SystemHighlight, ['selected', 'focus']],
|
||||
:background=>'linen',
|
||||
:bitmap=>['question' ['selected']])
|
||||
|
||||
s = t.style_create('STYLE', :orient=>:vertical)
|
||||
|
|
@ -42,7 +42,7 @@ def demoBitmaps(t)
|
|||
t.defaultstyle = [s]
|
||||
end
|
||||
|
||||
bitmap_names = %w(error gray75 gray50 gray25 gray12
|
||||
bitmap_names = %w(error gray75 gray50 gray25 gray12
|
||||
hourglass info questhead question warning)
|
||||
|
||||
bitmap_names.each{|name|
|
||||
|
|
@ -60,15 +60,15 @@ def demoBitmaps(t)
|
|||
t.item_style_set(i, 0, s)
|
||||
t.item_text(i, 0, name)
|
||||
if true
|
||||
t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name,
|
||||
:foreground=>['brown', ''],
|
||||
t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name,
|
||||
:foreground=>['brown', ''],
|
||||
:background=>['', ''])
|
||||
else
|
||||
t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name,
|
||||
t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name,
|
||||
:foreground=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'brown', []
|
||||
],
|
||||
],
|
||||
:background=>['', []])
|
||||
end
|
||||
t.item_lastchild(:root, i)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class TkTreeCtrl_demo
|
|||
|
||||
####################
|
||||
|
||||
@tree2.bind('ButtonPress-3',
|
||||
@tree2.bind('ButtonPress-3',
|
||||
proc{|w, x, y, rootx, rooty|
|
||||
show_list_popup(w, x, y, rootx, rooty)
|
||||
}, '%W %x %y %X %Y')
|
||||
|
|
@ -94,7 +94,7 @@ class TkTreeCtrl_demo
|
|||
|
||||
####################
|
||||
|
||||
@tree1.notify_bind(@tree1, 'Selection',
|
||||
@tree1.notify_bind(@tree1, 'Selection',
|
||||
proc{|c, t|
|
||||
if c == 1
|
||||
item = t.selection_get[0]
|
||||
|
|
@ -102,10 +102,10 @@ class TkTreeCtrl_demo
|
|||
end
|
||||
}, '%c %T')
|
||||
|
||||
# When one item is selected in the demo list, display the styles in
|
||||
# When one item is selected in the demo list, display the styles in
|
||||
# that item.
|
||||
# See DemoClear for why the tag "DontDelete" is used
|
||||
@tree2.notify_bind('DontDelete', 'Selection',
|
||||
@tree2.notify_bind('DontDelete', 'Selection',
|
||||
proc{|c, t|
|
||||
display_styles_in_item(t.selection_get[0]) if c == 1
|
||||
}, '%c %T')
|
||||
|
|
@ -156,15 +156,13 @@ class TkTreeCtrl_demo
|
|||
@src_top = TkToplevel.new
|
||||
f = TkFrame.new(@src_top, :borderwidth=>0)
|
||||
case @thisPlatform
|
||||
when 'macintosh', 'macos'
|
||||
font = TkFont.new(['Geneva', 9])
|
||||
when 'unix'
|
||||
font = TkFont.new(['Courier', -12])
|
||||
else
|
||||
font = TkFont.new(['Courier', 9])
|
||||
end
|
||||
|
||||
@src_txt = TkText.new(f, :font=>font, :tabs=>font.measure('1234'),
|
||||
@src_txt = TkText.new(f, :font=>font, :tabs=>font.measure('1234'),
|
||||
:wrap=>:none)
|
||||
xscr = @src_txt.xscrollbar(TkScrollbar.new(f))
|
||||
yscr = @src_txt.yscrollbar(TkScrollbar.new(f))
|
||||
|
|
@ -198,10 +196,6 @@ class TkTreeCtrl_demo
|
|||
def tree_plus_scrollbars_in_a_frame(parent, h, v)
|
||||
f = TkFrame.new(parent, :borderwidth=>1, :relief=>:sunken)
|
||||
case @thisPlatform
|
||||
when 'macintosh'
|
||||
font = TkFont.new(['Geneva', 9])
|
||||
when 'macos'
|
||||
font = TkFont.new(['Lucida Grande', 11])
|
||||
when 'unix'
|
||||
font = TkFont.new(['Helvetica', -12])
|
||||
else
|
||||
|
|
@ -210,23 +204,23 @@ class TkTreeCtrl_demo
|
|||
font = TkFont.new(['MS Sans', 8])
|
||||
end
|
||||
|
||||
tree = Tk::TreeCtrl.new(f, :highlightthickness=>0,
|
||||
tree = Tk::TreeCtrl.new(f, :highlightthickness=>0,
|
||||
:borderwidth=>0, :font=>font)
|
||||
tree[:xscrollincrement] = 20
|
||||
tree.debug_configure(:enable=>false, :display=>false)
|
||||
|
||||
if h
|
||||
h_scr = TkScrollbar.new(f, :orient=>:horizontal,
|
||||
h_scr = TkScrollbar.new(f, :orient=>:horizontal,
|
||||
:command=>proc{|*args| tree.xview(*args)})
|
||||
tree.notify_bind(h_scr, 'Scroll-x',
|
||||
tree.notify_bind(h_scr, 'Scroll-x',
|
||||
proc{|w, l, u| w.set(l, u)}, '%W %l %u')
|
||||
h_scr.bind('ButtonPress-1', proc{tree.set_focus})
|
||||
end
|
||||
|
||||
if v
|
||||
v_scr = TkScrollbar.new(f, :orient=>:vertical,
|
||||
v_scr = TkScrollbar.new(f, :orient=>:vertical,
|
||||
:command=>proc{|*args| tree.yview(*args)})
|
||||
tree.notify_bind(v_scr, 'Scroll-y',
|
||||
tree.notify_bind(v_scr, 'Scroll-y',
|
||||
proc{|w, l, u| w.set(l, u)}, '%W %l %u')
|
||||
v_scr.bind('ButtonPress-1', proc{tree.set_focus})
|
||||
end
|
||||
|
|
@ -244,7 +238,7 @@ class TkTreeCtrl_demo
|
|||
Tk.root.title('Tk::TreeCtrl Demo')
|
||||
|
||||
case @thisPlatform
|
||||
when 'macintosh', 'macosx'
|
||||
when 'macosx'
|
||||
Tk.root.geometry('+40+40')
|
||||
else
|
||||
Tk.root.geometry('+0+30')
|
||||
|
|
@ -255,13 +249,13 @@ class TkTreeCtrl_demo
|
|||
|
||||
# Tree + scrollbar: demos
|
||||
f1, @tree1 = tree_plus_scrollbars_in_a_frame(nil, false, true)
|
||||
@tree1.configure(:showbuttons=>false, :showlines=>:false,
|
||||
@tree1.configure(:showbuttons=>false, :showlines=>:false,
|
||||
:showroot=>false, :height=>100)
|
||||
if $HasColumnCreate
|
||||
@tree1.column_create(:text=>'List of Demos',
|
||||
@tree1.column_create(:text=>'List of Demos',
|
||||
:expand=>true, :button=>false)
|
||||
else
|
||||
@tree1.column_configure(0, :text=>'List of Demos',
|
||||
@tree1.column_configure(0, :text=>'List of Demos',
|
||||
:expand=>true, :button=>false)
|
||||
end
|
||||
|
||||
|
|
@ -269,10 +263,10 @@ class TkTreeCtrl_demo
|
|||
f4, @tree4 = tree_plus_scrollbars_in_a_frame(nil, false, true)
|
||||
@tree4.configure(:showroot=>false, :height=>140)
|
||||
if $HasColumnCreate
|
||||
@tree4.column_create(:text=>'Elements and Styles',
|
||||
@tree4.column_create(:text=>'Elements and Styles',
|
||||
:expand=>true, :button=>false)
|
||||
else
|
||||
@tree4.column_configure(0, :text=>'Elements and Styles',
|
||||
@tree4.column_configure(0, :text=>'Elements and Styles',
|
||||
:expand=>true, :button=>false)
|
||||
end
|
||||
|
||||
|
|
@ -280,10 +274,10 @@ class TkTreeCtrl_demo
|
|||
f3, @tree3 = tree_plus_scrollbars_in_a_frame(nil, false, true)
|
||||
@tree3.configure(:showroot=>false)
|
||||
if $HasColumnCreate
|
||||
@tree3.column_create(:text=>'Styles in Item',
|
||||
@tree3.column_create(:text=>'Styles in Item',
|
||||
:expand=>true, :button=>false)
|
||||
else
|
||||
@tree3.column_configure(0, :text=>'Styles in Item',
|
||||
@tree3.column_configure(0, :text=>'Styles in Item',
|
||||
:expand=>true, :button=>false)
|
||||
end
|
||||
|
||||
|
|
@ -296,7 +290,7 @@ class TkTreeCtrl_demo
|
|||
# Tree + scrollbars
|
||||
f2, @tree2 = tree_plus_scrollbars_in_a_frame(f2_base, true, true)
|
||||
@tree2.configure(:indent=>19)
|
||||
@tree2.debug_configure(:enable=>false, :display=>true,
|
||||
@tree2.debug_configure(:enable=>false, :display=>true,
|
||||
:erasecolor=>'pink', :displaydelay=>30)
|
||||
|
||||
# Give it a big border to debug drawing
|
||||
|
|
@ -349,7 +343,7 @@ class TkTreeCtrl_demo
|
|||
@popup[:show] = Hash.new{|h, k| h[k] = TkVariable.new}
|
||||
|
||||
menuspec = [
|
||||
[ 'Collapse', [], nil, '', {:menu_config=>{:tearoff=>false}} ],
|
||||
[ 'Collapse', [], nil, '', {:menu_config=>{:tearoff=>false}} ],
|
||||
|
||||
[ 'Expand', [], nil, '', {:menu_config=>{:tearoff=>false}} ]
|
||||
]
|
||||
|
|
@ -357,61 +351,61 @@ class TkTreeCtrl_demo
|
|||
# if $Version_1_1_OrLater
|
||||
if @has_bgimg
|
||||
menuspec << \
|
||||
[ 'Background Image',
|
||||
[ 'Background Image',
|
||||
[
|
||||
[ 'none', [@popup[:bgimg], 'none'], nil, '',
|
||||
{:command=>proc{@tree2.backgroundimage = ''}} ],
|
||||
[ 'sky', [@popup[:bgimg], 'sky'], nil, '',
|
||||
[ 'none', [@popup[:bgimg], 'none'], nil, '',
|
||||
{:command=>proc{@tree2.backgroundimage = ''}} ],
|
||||
[ 'sky', [@popup[:bgimg], 'sky'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.backgroundimage = @images[@popup[:bgimg].value]}} ]
|
||||
],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
]
|
||||
end
|
||||
|
||||
menuspec.concat([
|
||||
[ 'Background Mode',
|
||||
[ 'Background Mode',
|
||||
%w(column index row visindex).collect{|val|
|
||||
[ val, [@popup[:bgmode], val] , nil, '',
|
||||
[ val, [@popup[:bgmode], val] , nil, '',
|
||||
{:command=>proc{@tree2.backgroundmode = @popup[:bgmode].value}} ]
|
||||
},
|
||||
},
|
||||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
],
|
||||
|
||||
[ 'Debug',
|
||||
[ 'Debug',
|
||||
[
|
||||
[ 'Data', @popup[:debug][:data], nil, '',
|
||||
[ 'Data', @popup[:debug][:data], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.debug_configure(:data=>@popup[:debug][:data].value)
|
||||
}
|
||||
} ],
|
||||
[ 'Display', @popup[:debug][:display], nil, '',
|
||||
} ],
|
||||
[ 'Display', @popup[:debug][:display], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.debug_configure(:display=>@popup[:debug][:display].value)
|
||||
}
|
||||
} ],
|
||||
[ 'Enable', @popup[:debug][:enable], nil, '',
|
||||
} ],
|
||||
[ 'Enable', @popup[:debug][:enable], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.debug_configure(:enable=>@popup[:debug][:enable].value)
|
||||
}
|
||||
} ]
|
||||
],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
],
|
||||
|
||||
[ 'Buffering',
|
||||
[ 'Buffering',
|
||||
[
|
||||
[ 'none', [@popup[:doublebuffer], 'none'], nil, '',
|
||||
[ 'none', [@popup[:doublebuffer], 'none'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.doublebuffer = @popup[:doublebuffer].value
|
||||
}
|
||||
} ],
|
||||
[ 'item', [@popup[:doublebuffer], 'item'], nil, '',
|
||||
} ],
|
||||
[ 'item', [@popup[:doublebuffer], 'item'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.doublebuffer = @popup[:doublebuffer].value
|
||||
}
|
||||
} ],
|
||||
[ 'window', [@popup[:doublebuffer], 'window'], nil, '',
|
||||
} ],
|
||||
[ 'window', [@popup[:doublebuffer], 'window'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.doublebuffer = @popup[:doublebuffer].value
|
||||
}
|
||||
|
|
@ -420,62 +414,62 @@ class TkTreeCtrl_demo
|
|||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
],
|
||||
|
||||
[ 'Line style',
|
||||
[ 'Line style',
|
||||
[
|
||||
[ 'dot', [@popup[:linestyle], 'dot'], nil, '',
|
||||
{:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ],
|
||||
[ 'solid', [@popup[:linestyle], 'solid'], nil, '',
|
||||
[ 'dot', [@popup[:linestyle], 'dot'], nil, '',
|
||||
{:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ],
|
||||
[ 'solid', [@popup[:linestyle], 'solid'], nil, '',
|
||||
{:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ]
|
||||
],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
],
|
||||
|
||||
[ 'Orient',
|
||||
[ 'Orient',
|
||||
[
|
||||
[ 'Horizontal', [@popup[:orient], 'horizontal'], nil, '',
|
||||
{:command=>proc{@tree2.orient = @popup[:orient].value}} ],
|
||||
[ 'Vertical', [@popup[:orient], 'vertical'], nil, '',
|
||||
[ 'Horizontal', [@popup[:orient], 'horizontal'], nil, '',
|
||||
{:command=>proc{@tree2.orient = @popup[:orient].value}} ],
|
||||
[ 'Vertical', [@popup[:orient], 'vertical'], nil, '',
|
||||
{:command=>proc{@tree2.orient = @popup[:orient].value}} ]
|
||||
],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
],
|
||||
|
||||
[ 'Selectmode',
|
||||
[ 'Selectmode',
|
||||
%w(list browse extended multiple single).collect{|val|
|
||||
[ val, [@popup[:selectmode], val] , nil, '',
|
||||
[ val, [@popup[:selectmode], val] , nil, '',
|
||||
{:command=>proc{@tree2.selectmode = @popup[:selectmode].value}} ]
|
||||
},
|
||||
},
|
||||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
],
|
||||
|
||||
[ 'Show',
|
||||
[ 'Show',
|
||||
[
|
||||
[ 'Buttons', @popup[:show][:buttons], nil, '',
|
||||
[ 'Buttons', @popup[:show][:buttons], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.showbuttons = @popup[:show][:buttons].value
|
||||
}
|
||||
} ],
|
||||
[ 'Header', @popup[:show][:header], nil, '',
|
||||
} ],
|
||||
[ 'Header', @popup[:show][:header], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.showheader = @popup[:show][:header].value
|
||||
}
|
||||
} ],
|
||||
[ 'Lines', @popup[:show][:lines], nil, '',
|
||||
} ],
|
||||
[ 'Lines', @popup[:show][:lines], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.showlines = @popup[:show][:lines].value
|
||||
}
|
||||
} ],
|
||||
[ 'Root', @popup[:show][:root], nil, '',
|
||||
} ],
|
||||
[ 'Root', @popup[:show][:root], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.showroot = @popup[:show][:root].value
|
||||
}
|
||||
} ],
|
||||
[ 'Root Button', @popup[:show][:rootbutton], nil, '',
|
||||
} ],
|
||||
[ 'Root Button', @popup[:show][:rootbutton], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.showrootbutton = @popup[:show][:rootbutton].value
|
||||
}
|
||||
} ]
|
||||
],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}}
|
||||
],
|
||||
|
||||
|
|
@ -515,14 +509,14 @@ class TkTreeCtrl_demo
|
|||
if id[0] == 'item'
|
||||
item = id[1]
|
||||
if $Version_1_1_OrLater
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
:command=>proc{w.item_collapse(item)})
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
:command=>proc{w.item_collapse_recurse(item)})
|
||||
else
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
:command=>proc{w.collapse(item)})
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
:command=>proc{w.collapse_recurse(item)})
|
||||
end
|
||||
end
|
||||
|
|
@ -539,14 +533,14 @@ class TkTreeCtrl_demo
|
|||
if id[0] == 'item'
|
||||
item = id[1]
|
||||
if $Version_1_1_OrLater
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
:command=>proc{w.item_expand(item)})
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
:command=>proc{w.item_expand_recurse(item)})
|
||||
else
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
m.add_command(:label=>"Item #{item}",
|
||||
:command=>proc{w.expand(item)})
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
m.add_command(:label=>"Item #{item} (recurse)",
|
||||
:command=>proc{w.expand_recurse(item)})
|
||||
end
|
||||
end
|
||||
|
|
@ -578,8 +572,8 @@ class TkTreeCtrl_demo
|
|||
txt = w.column_cget(i, :text)
|
||||
img_name = w.column_cget(i, :image)
|
||||
img_name = @images.key(img_name) if img_name.kind_of?(TkImage)
|
||||
m.add_checkbutton(:variable=>@popup[:visible][i],
|
||||
:label=>"Column #{i} \"#{txt}\" [#{img_name}]",
|
||||
m.add_checkbutton(:variable=>@popup[:visible][i],
|
||||
:label=>"Column #{i} \"#{txt}\" [#{img_name}]",
|
||||
:command=>proc{w.column_configure(i, :visible=>@popup[:visible][i].value)})
|
||||
}
|
||||
|
||||
|
|
@ -596,90 +590,90 @@ class TkTreeCtrl_demo
|
|||
@popup[:justify] = TkVariable.new
|
||||
|
||||
menuspec = [
|
||||
[ 'Arrow',
|
||||
[ 'Arrow',
|
||||
[
|
||||
[ 'None', [@popup[:arrow], 'none'], nil, '',
|
||||
[ 'None', [@popup[:arrow], 'none'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value, :arrow=>:none)
|
||||
}
|
||||
} ],
|
||||
[ 'Up', [@popup[:arrow], 'up'], nil, '',
|
||||
[ 'Up', [@popup[:arrow], 'up'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value, :arrow=>:up)
|
||||
}
|
||||
} ],
|
||||
[ 'Down', [@popup[:arrow], 'down'], nil, '',
|
||||
[ 'Down', [@popup[:arrow], 'down'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value, :arrow=>:down)
|
||||
}
|
||||
} ],
|
||||
|
||||
'---',
|
||||
'---',
|
||||
|
||||
[ 'Side Left', [@popup[:arrowside], 'left'], nil, '',
|
||||
[ 'Side Left', [@popup[:arrowside], 'left'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:arrowside=>:left)
|
||||
}
|
||||
} ],
|
||||
[ 'Side Right', [@popup[:arrowside], 'right'], nil, '',
|
||||
[ 'Side Right', [@popup[:arrowside], 'right'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:arrowside=>:right)
|
||||
}
|
||||
} ],
|
||||
|
||||
'---',
|
||||
'---',
|
||||
|
||||
[ 'Gravity Left', [@popup[:arrowgravity], 'left'], nil, '',
|
||||
[ 'Gravity Left', [@popup[:arrowgravity], 'left'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:arrowgravity=>:left)
|
||||
}
|
||||
} ],
|
||||
[ 'Gravity Right', [@popup[:arrowgravity], 'right'], nil, '',
|
||||
[ 'Gravity Right', [@popup[:arrowgravity], 'right'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:arrowgravity=>:right)
|
||||
}
|
||||
} ],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}} ],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}} ],
|
||||
|
||||
[ 'Expand', @popup[:expand], nil, '',
|
||||
[ 'Expand', @popup[:expand], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:expand=>@popup[:expand].value)
|
||||
}
|
||||
} ],
|
||||
|
||||
[ 'Squeeze', @popup[:squeeze], nil, '',
|
||||
[ 'Squeeze', @popup[:squeeze], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:squeeze=>@popup[:squeeze].value)
|
||||
}
|
||||
} ],
|
||||
|
||||
[ 'Justify',
|
||||
[ 'Justify',
|
||||
[
|
||||
[ 'Left', [@popup[:justify], 'left'], nil, '',
|
||||
[ 'Left', [@popup[:justify], 'left'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value, :justify=>:left)
|
||||
}
|
||||
} ],
|
||||
[ 'Center', [@popup[:justify], 'center'], nil, '',
|
||||
[ 'Center', [@popup[:justify], 'center'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:justify=>:center)
|
||||
}
|
||||
} ],
|
||||
[ 'Right', [@popup[:justify], 'right'], nil, '',
|
||||
[ 'Right', [@popup[:justify], 'right'], nil, '',
|
||||
{:command=>proc{
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
@tree2.column_configure(@popup[:column].value,
|
||||
:justify=>:right)
|
||||
}
|
||||
} ]
|
||||
],
|
||||
],
|
||||
nil, '', {:menu_config=>{:tearoff=>false}} ]
|
||||
]
|
||||
|
||||
|
|
@ -713,7 +707,7 @@ class TkTreeCtrl_demo
|
|||
def master._pub_display_styles_in_item(item)
|
||||
display_styles_in_item(item)
|
||||
end
|
||||
proc_disp_styles_in_item = proc{|item|
|
||||
proc_disp_styles_in_item = proc{|item|
|
||||
master._pub_display_styles_in_item(item)
|
||||
}
|
||||
|
||||
|
|
@ -777,15 +771,15 @@ class TkTreeCtrl_demo
|
|||
def load_demo_scripts
|
||||
# demo sources
|
||||
[
|
||||
'bitmaps',
|
||||
'explorer',
|
||||
'help',
|
||||
'imovie',
|
||||
'layout',
|
||||
'mailwasher',
|
||||
'outlook-folders',
|
||||
'outlook-newgroup',
|
||||
'random',
|
||||
'bitmaps',
|
||||
'explorer',
|
||||
'help',
|
||||
'imovie',
|
||||
'layout',
|
||||
'mailwasher',
|
||||
'outlook-folders',
|
||||
'outlook-newgroup',
|
||||
'random',
|
||||
'www-options'
|
||||
].each{|f|
|
||||
@demo_scripts.load_demo(File.join(@ScriptDir, "#{f}.rb"))
|
||||
|
|
@ -795,18 +789,18 @@ class TkTreeCtrl_demo
|
|||
###########################
|
||||
|
||||
def init_demo_list
|
||||
@tree1.element_create('e1', :text,
|
||||
@tree1.element_create('e1', :text,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
@tree1.element_create('e2', :rect, :showfocus=>true,
|
||||
@tree1.element_create('e2', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus'],
|
||||
])
|
||||
@tree1.style_create('s1')
|
||||
@tree1.style_elements('s1', ['e2', 'e1'])
|
||||
|
||||
# Tk listbox has linespace + 1 height
|
||||
@tree1.style_layout('s1', 'e2', :union=>['e1'],
|
||||
@tree1.style_layout('s1', 'e2', :union=>['e1'],
|
||||
:ipadx=>2, :ipady=>[0, 1], :iexpand=>:e)
|
||||
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -815,19 +809,19 @@ class TkTreeCtrl_demo
|
|||
|
||||
###
|
||||
[
|
||||
["Random #{@RandomN[0]} Items", :demoRandom, 'random.rb'],
|
||||
["Random #{@RandomN[0]} Items, Button Images", :demoRandom2, 'random.rb'],
|
||||
["Random #{@RandomN[0]} Items", :demoRandom, 'random.rb'],
|
||||
["Random #{@RandomN[0]} Items, Button Images", :demoRandom2, 'random.rb'],
|
||||
["Outlook Express (Folders)", :demoOutlookFolders, 'outlook-folders.rb'],
|
||||
["Outlook Express (Newsgroup)", :demoOutlookNewsgroup, 'outlook-newgroup.rb'],
|
||||
["Explorer (Details)", :demoExplorerDetails, 'explorer.rb'],
|
||||
["Explorer (List)", :demoExplorerList, 'explorer.rb'],
|
||||
["Explorer (Large icons)", :demoExplorerLargeIcons, 'explorer.rb'],
|
||||
["Explorer (Small icons)", :demoExplorerSmallIcons, 'explorer.rb'],
|
||||
["Internet Options", :demoInternetOptions, 'www-options.rb'],
|
||||
["Help Contents", :demoHelpContents, 'help.rb'],
|
||||
["Layout", :demoLayout, 'layout.rb'],
|
||||
["MailWasher", :demoMailWasher, 'mailwasher.rb'],
|
||||
["Bitmaps", :demoBitmaps, 'bitmaps.rb'],
|
||||
["Outlook Express (Newsgroup)", :demoOutlookNewsgroup, 'outlook-newgroup.rb'],
|
||||
["Explorer (Details)", :demoExplorerDetails, 'explorer.rb'],
|
||||
["Explorer (List)", :demoExplorerList, 'explorer.rb'],
|
||||
["Explorer (Large icons)", :demoExplorerLargeIcons, 'explorer.rb'],
|
||||
["Explorer (Small icons)", :demoExplorerSmallIcons, 'explorer.rb'],
|
||||
["Internet Options", :demoInternetOptions, 'www-options.rb'],
|
||||
["Help Contents", :demoHelpContents, 'help.rb'],
|
||||
["Layout", :demoLayout, 'layout.rb'],
|
||||
["MailWasher", :demoMailWasher, 'mailwasher.rb'],
|
||||
["Bitmaps", :demoBitmaps, 'bitmaps.rb'],
|
||||
["iMovie", :demoIMovie, 'imovie.rb']
|
||||
].each{|label, cmd, file|
|
||||
item = @tree1.item_create
|
||||
|
|
@ -859,15 +853,15 @@ class TkTreeCtrl_demo
|
|||
def display_styles_in_list
|
||||
# Create elements and styles the first time this is called
|
||||
if @tree4.style_names.empty?
|
||||
@tree4.element_create('e1', :text,
|
||||
@tree4.element_create('e1', :text,
|
||||
:fill=>[@SystemHighlightText,['selected','focus']])
|
||||
@tree4.element_create('e2', :text,
|
||||
@tree4.element_create('e2', :text,
|
||||
:fill=>[
|
||||
@SystemHighlightText, ['selected','focus'],
|
||||
'', ['selected','!focus'],
|
||||
@SystemHighlightText, ['selected','focus'],
|
||||
'', ['selected','!focus'],
|
||||
'blue', []
|
||||
])
|
||||
@tree4.element_create('e3', :rect, :showfocus=>true,
|
||||
@tree4.element_create('e3', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected','focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
|
|
@ -880,13 +874,13 @@ class TkTreeCtrl_demo
|
|||
@tree4.style_create('s2')
|
||||
@tree4.style_elements('s2', ['e3', 'e1', 'e2'])
|
||||
@tree4.style_layout('s2', 'e1', :padx=>[0,4])
|
||||
@tree4.style_layout('s2', 'e3', :union=>['e1', 'e2'],
|
||||
@tree4.style_layout('s2', 'e3', :union=>['e1', 'e2'],
|
||||
:ipadx=>1, :ipady=>[0,1])
|
||||
end
|
||||
|
||||
# Clear the list
|
||||
@tree4.item_delete(:all)
|
||||
|
||||
|
||||
# One item for each element in the demo list
|
||||
@tree2.element_names.sort.each{|elem|
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -898,7 +892,7 @@ class TkTreeCtrl_demo
|
|||
@tree4.collapse(item)
|
||||
end
|
||||
@tree4.item_style_set(item, 0, 's1')
|
||||
@tree4.item_text(item, 0,
|
||||
@tree4.item_text(item, 0,
|
||||
"Element #{elem} (#{@tree2.element_type(elem)})")
|
||||
|
||||
# One item for each configuration option for this element
|
||||
|
|
@ -913,7 +907,7 @@ class TkTreeCtrl_demo
|
|||
else
|
||||
@tree4.item_style_set(item2, 0, 's2')
|
||||
@tree4.item_complex(item2, [
|
||||
['e1', {:text=>name}],
|
||||
['e1', {:text=>name}],
|
||||
['e2', {:text=>current.inspect}]
|
||||
])
|
||||
end
|
||||
|
|
@ -948,7 +942,7 @@ class TkTreeCtrl_demo
|
|||
@tree4.collapse(item2)
|
||||
end
|
||||
@tree4.item_style_set(item2, 0, 's1')
|
||||
@tree4.item_text(item2, 0,
|
||||
@tree4.item_text(item2, 0,
|
||||
"Element #{elem} (#{@tree2.element_type(elem)})")
|
||||
|
||||
# One item for each layout option for this element in this style
|
||||
|
|
@ -977,15 +971,15 @@ class TkTreeCtrl_demo
|
|||
|
||||
# Create elements and styles the first time this is called
|
||||
if @tree3.style_names.empty?
|
||||
@tree3.element_create('e1', :text,
|
||||
@tree3.element_create('e1', :text,
|
||||
:fill=>[@SystemHighlightText,['selected','focus']])
|
||||
@tree3.element_create('e2', :text,
|
||||
@tree3.element_create('e2', :text,
|
||||
:fill=>[
|
||||
@SystemHighlightText, ['selected','focus'],
|
||||
'', ['selected','!focus'],
|
||||
@SystemHighlightText, ['selected','focus'],
|
||||
'', ['selected','!focus'],
|
||||
'blue', []
|
||||
])
|
||||
@tree3.element_create('e3', :rect, :showfocus=>true,
|
||||
@tree3.element_create('e3', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected','focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
|
|
@ -998,7 +992,7 @@ class TkTreeCtrl_demo
|
|||
@tree3.style_create('s2')
|
||||
@tree3.style_elements('s2', ['e3', 'e1', 'e2'])
|
||||
@tree3.style_layout('s2', 'e1', :padx=>[0,4])
|
||||
@tree3.style_layout('s2', 'e3', :union=>['e1', 'e2'],
|
||||
@tree3.style_layout('s2', 'e3', :union=>['e1', 'e2'],
|
||||
:ipadx=>1, :ipady=>[0,1])
|
||||
end
|
||||
# Clear the list
|
||||
|
|
@ -1014,7 +1008,7 @@ class TkTreeCtrl_demo
|
|||
@tree3.collapse(item2)
|
||||
end
|
||||
@tree3.item_style_set(item2, 0, 's1')
|
||||
@tree3.item_element_configure(item2, 0, 'e1',
|
||||
@tree3.item_element_configure(item2, 0, 'e1',
|
||||
:text=>"Column #{column}: Style #{sty}")
|
||||
|
||||
button = false
|
||||
|
|
@ -1035,7 +1029,7 @@ class TkTreeCtrl_demo
|
|||
@tree3.collapse(item3)
|
||||
end
|
||||
@tree3.item_style_set(item3, 0, 's1')
|
||||
@tree3.item_element_configure(item3, 0, 'e1',
|
||||
@tree3.item_element_configure(item3, 0, 'e1',
|
||||
:text=>"Element #{elem} (#{@tree2.element_type(elem)})")
|
||||
|
||||
# One item for each configuration option in this element
|
||||
|
|
@ -1052,13 +1046,13 @@ class TkTreeCtrl_demo
|
|||
if sameAsMaster
|
||||
@tree3.item_style_set(item4, 0, 's1')
|
||||
@tree3.item_complex(item4, [
|
||||
['e1',
|
||||
['e1',
|
||||
{:text=>"#{name} #{current.inspect}"}]
|
||||
])
|
||||
else
|
||||
@tree3.item_style_set(item4, 0, 's2')
|
||||
@tree3.item_complex(item4, [
|
||||
['e1', {:text=>name}],
|
||||
['e1', {:text=>name}],
|
||||
['e2', {:text=>current.inspect}]
|
||||
])
|
||||
end
|
||||
|
|
@ -1118,28 +1112,28 @@ class TkTreeCtrl_demo
|
|||
# Restore some happy defaults to the demo list
|
||||
# if $Version_1_1_OrLater
|
||||
if @has_bgimg
|
||||
@tree2.configure(:orient=>:vertical, :wrap=>'',
|
||||
:xscrollincrement=>0, :yscrollincrement=>0,
|
||||
:itemheight=>0, :showheader=>true,
|
||||
:background=>'white', :scrollmargin=>0,
|
||||
:xscrolldelay=>50, :yscrolldelay=>50,
|
||||
:openbuttonimage=>'', :closedbuttonimage=>'',
|
||||
:backgroundmode=>:row, :treecolumn=>0, :indent=>19,
|
||||
@tree2.configure(:orient=>:vertical, :wrap=>'',
|
||||
:xscrollincrement=>0, :yscrollincrement=>0,
|
||||
:itemheight=>0, :showheader=>true,
|
||||
:background=>'white', :scrollmargin=>0,
|
||||
:xscrolldelay=>50, :yscrolldelay=>50,
|
||||
:openbuttonimage=>'', :closedbuttonimage=>'',
|
||||
:backgroundmode=>:row, :treecolumn=>0, :indent=>19,
|
||||
:defaultstyle=>'', :backgroundimage=>'')
|
||||
else
|
||||
@tree2.configure(:orient=>:vertical, :wrap=>'',
|
||||
:xscrollincrement=>0, :yscrollincrement=>0,
|
||||
:itemheight=>0, :showheader=>true,
|
||||
:background=>'white', :scrollmargin=>0,
|
||||
:xscrolldelay=>50, :yscrolldelay=>50,
|
||||
:openbuttonimage=>'', :closedbuttonimage=>'',
|
||||
@tree2.configure(:orient=>:vertical, :wrap=>'',
|
||||
:xscrollincrement=>0, :yscrollincrement=>0,
|
||||
:itemheight=>0, :showheader=>true,
|
||||
:background=>'white', :scrollmargin=>0,
|
||||
:xscrolldelay=>50, :yscrolldelay=>50,
|
||||
:openbuttonimage=>'', :closedbuttonimage=>'',
|
||||
:backgroundmode=>:row, :treecolumn=>0, :indent=>19)
|
||||
end
|
||||
|
||||
# Restore default bindings to the demo list
|
||||
@tree2.bindtags = [ @tree2, Tk::TreeCtrl, @tree2.winfo_toplevel, :all ]
|
||||
|
||||
@tree2.winfo_children.each{|w|
|
||||
@tree2.winfo_children.each{|w|
|
||||
w.destroy unless @non_clear_list.include?(w)
|
||||
}
|
||||
end
|
||||
|
|
@ -1153,8 +1147,8 @@ def cursor_window(top = nil)
|
|||
top.destroy if top.kind_of?(TkWindow) && top.winfo_exist?
|
||||
top = TkToplevel.new(:title=>'Cursor Window')
|
||||
|
||||
c = TkCanvas.new(top, :background=>'white',
|
||||
:width=>50*10, :highlightthickness=>0,
|
||||
c = TkCanvas.new(top, :background=>'white',
|
||||
:width=>50*10, :highlightthickness=>0,
|
||||
:borderwidth=>0).pack(:expand=>true, :fill=>:both)
|
||||
cursors = %w(
|
||||
X_cursor
|
||||
|
|
@ -1247,7 +1241,7 @@ def cursor_window(top = nil)
|
|||
begin
|
||||
c.cursor = cur
|
||||
|
||||
r = TkcRectangle.new(c, x, y, x+50, y+40,
|
||||
r = TkcRectangle.new(c, x, y, x+50, y+40,
|
||||
:fill=>'gray90', :outline=>'black', :width=>2)
|
||||
t = TkcText.new(c, x+50/2, y+4, :text=>cur, :anchor=>:n, :width=>42)
|
||||
|
||||
|
|
@ -1284,10 +1278,10 @@ if Tk::PLATFORM['platform'] == 'unix' && Tk.windowingsystem != 'aqua'
|
|||
loupe[:y] = 0 unless loupe[:y]
|
||||
loupe[:auto] = true unless loupe[:auto]
|
||||
loupe[:delay] = 500 unless loupe[:delay]
|
||||
loupe[:image] =
|
||||
loupe[:image] =
|
||||
TkPhotoImage.new(:width=>150, :height=>150) unless loupe[:image]
|
||||
|
||||
top = TkToplevel.new(:geometry=>'-0+30',
|
||||
top = TkToplevel.new(:geometry=>'-0+30',
|
||||
:title=>'A little screen magnifier for X11')
|
||||
TkLabel.new(top, :image=>loupe[:image]).pack
|
||||
|
||||
|
|
|
|||
|
|
@ -49,44 +49,44 @@ def demoExplorerDetails(t)
|
|||
height = t.font.metrics(:linespace)
|
||||
height = 18 if height < 18
|
||||
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:extended,
|
||||
:xscrollincrement=>20, :scrollmargin=>16,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:extended,
|
||||
:xscrollincrement=>20, :scrollmargin=>16,
|
||||
:xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
|
||||
|
||||
init_pics('small-*')
|
||||
|
||||
if $HasColumnCreate
|
||||
t.column_create(:text=>'Name', :tag=>'name',
|
||||
t.column_create(:text=>'Name', :tag=>'name',
|
||||
:width=>200, :arrow=>:up, :arrowpad=>6)
|
||||
t.column_create(:text=>'Size', :tag=>'size', :justify=>:right,
|
||||
t.column_create(:text=>'Size', :tag=>'size', :justify=>:right,
|
||||
:width=>60, :arrowside=>:left, :arrowgravity=>:right)
|
||||
t.column_create(:text=>'Type', :tag=>'type', :width=>120)
|
||||
t.column_create(:text=>'Modified', :tag=>'modified', :width=>130)
|
||||
else
|
||||
t.column_configure(0, :text=>'Name', :tag=>'name',
|
||||
t.column_configure(0, :text=>'Name', :tag=>'name',
|
||||
:width=>200, :arrow=>:up, :arrowpad=>6)
|
||||
t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right,
|
||||
t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right,
|
||||
:width=>60, :arrowside=>:left, :arrowgravity=>:right)
|
||||
t.column_configure(2, :text=>'Type', :tag=>'type', :width=>120)
|
||||
t.column_configure(3, :text=>'Modified', :tag=>'modified', :width=>130)
|
||||
end
|
||||
|
||||
t.element_create('e1', :image,
|
||||
t.element_create('e1', :image,
|
||||
:image=>[
|
||||
@sel_images['small-folder'], ['selected'],
|
||||
@sel_images['small-folder'], ['selected'],
|
||||
@images['small-folder'], []
|
||||
])
|
||||
t.element_create('e2', :text, :lines=>1,
|
||||
t.element_create('e2', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('txtType', :text, :lines=>1)
|
||||
t.element_create('txtSize', :text, :lines=>1,
|
||||
t.element_create('txtSize', :text, :lines=>1,
|
||||
:datatype=>:integer, :format=>'%dKB')
|
||||
t.element_create('txtDate', :text, :lines=>1,
|
||||
t.element_create('txtDate', :text, :lines=>1,
|
||||
:datatype=>:time, :format=>'%d/%m/%y %I:%M %p')
|
||||
t.element_create('e4', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
|
||||
|
|
@ -116,23 +116,23 @@ def demoExplorerDetails(t)
|
|||
@Priv[:sensitive, t] = [ ['name', 'styName', 'e1', 'e2'] ]
|
||||
@Priv[:dragimage, t] = [ ['name', 'styName', 'e1', 'e2'] ]
|
||||
|
||||
t.notify_bind(t, 'Edit-accept',
|
||||
t.notify_bind(t, 'Edit-accept',
|
||||
proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t')
|
||||
|
||||
dir_proc = proc{|file|
|
||||
item = t.item_create
|
||||
t.item_style_set(item, 0, 'styName', 2, 'styType', 3, 'styDate')
|
||||
t.item_complex(item,
|
||||
[['e2', {:text=>File.basename(file)}]],
|
||||
[],
|
||||
[['txtType', {:text=>'Folder'}]],
|
||||
t.item_complex(item,
|
||||
[['e2', {:text=>File.basename(file)}]],
|
||||
[],
|
||||
[['txtType', {:text=>'Folder'}]],
|
||||
[['txtDate', {:data=>File.mtime(file).tv_sec}]])
|
||||
t.item_lastchild(:root, item)
|
||||
}
|
||||
|
||||
file_proc = proc{|file|
|
||||
item = t.item_create
|
||||
t.item_style_set(item, 0, 'styName', 1, 'stySize',
|
||||
t.item_style_set(item, 0, 'styName', 1, 'stySize',
|
||||
2, 'styType', 3, 'styDate')
|
||||
|
||||
ext = File.extname(file)
|
||||
|
|
@ -151,14 +151,14 @@ def demoExplorerDetails(t)
|
|||
type = type[1..-1] << ' ' unless type.empty?
|
||||
type << 'File'
|
||||
|
||||
t.item_complex(item,
|
||||
[
|
||||
['e1', {:image=>[@sel_images[img], ['selected'],
|
||||
t.item_complex(item,
|
||||
[
|
||||
['e1', {:image=>[@sel_images[img], ['selected'],
|
||||
@images[img], []]}],
|
||||
['e2', {:text=>File.basename(file)}]
|
||||
],
|
||||
[ ['txtSize', {:data=>File.size(file)/1024 + 1}] ],
|
||||
[ ['txtType', {:text=>type}] ],
|
||||
],
|
||||
[ ['txtSize', {:data=>File.size(file)/1024 + 1}] ],
|
||||
[ ['txtType', {:text=>type}] ],
|
||||
[ ['txtDate', {:data=>File.mtime(file).tv_sec}] ]
|
||||
)
|
||||
t.item_lastchild(:root, item)
|
||||
|
|
@ -167,7 +167,7 @@ def demoExplorerDetails(t)
|
|||
demoExplorerAux(t, dir_proc, file_proc)
|
||||
|
||||
@SortColumn = 0
|
||||
t.notify_bind(t, 'Header-invoke',
|
||||
t.notify_bind(t, 'Header-invoke',
|
||||
proc{|w, c| explorerHeaderInvoke(t, w, c)}, '%T %C')
|
||||
|
||||
t.bindtags = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ]
|
||||
|
|
@ -200,37 +200,37 @@ def explorerHeaderInvoke(t, w, c)
|
|||
case t.column_cget(c, :tag)
|
||||
when 'name'
|
||||
if dirCount > 0
|
||||
t.item_sort(:root, order, {:last=>"root child #{lastDir}"},
|
||||
t.item_sort(:root, order, {:last=>"root child #{lastDir}"},
|
||||
{:column=>c, :dictionary=>true})
|
||||
end
|
||||
if dirCount < t.numitems - 1
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
{:column=>c, :dictionary=>true})
|
||||
end
|
||||
|
||||
when 'size'
|
||||
if dirCount < t.numitems - 1
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
{:column=>c, :integer=>true},
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
{:column=>c, :integer=>true},
|
||||
{:column=>'name', :dictionary=>true})
|
||||
end
|
||||
|
||||
when 'type'
|
||||
if dirCount < t.numitems - 1
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
{:column=>c, :dictionary=>true},
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
{:column=>c, :dictionary=>true},
|
||||
{:column=>'name', :dictionary=>true})
|
||||
end
|
||||
|
||||
when 'modified'
|
||||
if dirCount > 0
|
||||
t.item_sort(:root, order, {:last=>"root child #{lastDir}"},
|
||||
{:column=>c, :integer=>true},
|
||||
t.item_sort(:root, order, {:last=>"root child #{lastDir}"},
|
||||
{:column=>c, :integer=>true},
|
||||
{:column=>'name', :dictionary=>true})
|
||||
end
|
||||
if dirCount < t.numitems - 1
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
{:column=>c, :integer=>true},
|
||||
t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
|
||||
{:column=>c, :integer=>true},
|
||||
{:column=>'name', :dictionary=>true})
|
||||
end
|
||||
|
||||
|
|
@ -241,9 +241,9 @@ def demoExplorerLargeIcons(t)
|
|||
# Item height is 32 for icon, 4 padding, 3 lines of text
|
||||
itemHeight = 32 + 4 + t.font.metrics(:linespace) * 3
|
||||
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:extended, :wrap=>:window, :orient=>:horizontal,
|
||||
:itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:extended, :wrap=>:window, :orient=>:horizontal,
|
||||
:itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16,
|
||||
:xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
|
||||
|
||||
init_pics('big-*')
|
||||
|
|
@ -254,17 +254,17 @@ def demoExplorerLargeIcons(t)
|
|||
t.column_configure(0, :width=>75)
|
||||
end
|
||||
|
||||
t.element_create('elemImg', :image,
|
||||
t.element_create('elemImg', :image,
|
||||
:image=>[
|
||||
@sel_images['big-folder'], ['selected'],
|
||||
@sel_images['big-folder'], ['selected'],
|
||||
@images['big-folder'], []
|
||||
])
|
||||
t.element_create('elemTxt', :text, :justify=>:center,
|
||||
:lines=>1, :width=>71, :wrap=>:word,
|
||||
t.element_create('elemTxt', :text, :justify=>:center,
|
||||
:lines=>1, :width=>71, :wrap=>:word,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('elemSel', :rect, :showfocus=>true,
|
||||
t.element_create('elemSel', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected']
|
||||
])
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ def demoExplorerLargeIcons(t)
|
|||
s = t.style_create('STYLE', :orient=>:vertical)
|
||||
t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt'])
|
||||
t.style_layout(s, 'elemImg', :expand=>:we)
|
||||
t.style_layout(s, 'elemTxt',
|
||||
t.style_layout(s, 'elemTxt',
|
||||
:pady=>[4,0], :padx=>2, :squeeze=>:x, :expand=>:we)
|
||||
t.style_layout(s, 'elemSel', :union=>['elemTxt'])
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ def demoExplorerLargeIcons(t)
|
|||
@Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
|
||||
@Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
|
||||
|
||||
t.notify_bind(t, 'Edit-accept',
|
||||
t.notify_bind(t, 'Edit-accept',
|
||||
proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t')
|
||||
|
||||
dir_proc = proc{|file|
|
||||
|
|
@ -310,9 +310,9 @@ def demoExplorerLargeIcons(t)
|
|||
type = type[1..-1] << ' ' unless type.empty?
|
||||
type << 'File'
|
||||
|
||||
t.item_complex(item,
|
||||
[
|
||||
['elemImg', {:image=>[@sel_images[img], ['selected'],
|
||||
t.item_complex(item,
|
||||
[
|
||||
['elemImg', {:image=>[@sel_images[img], ['selected'],
|
||||
@images[img], []]}],
|
||||
['elemTxt', {:text=>File.basename(file)}]
|
||||
])
|
||||
|
|
@ -323,7 +323,7 @@ def demoExplorerLargeIcons(t)
|
|||
|
||||
t.activate(t.index('root firstchild'))
|
||||
|
||||
t.notify_bind(t, 'ActiveItem',
|
||||
t.notify_bind(t, 'ActiveItem',
|
||||
proc{|w, a, c|
|
||||
w.item_element_configure(a, 0, 'elemTxt', :lines=>'')
|
||||
w.item_element_configure(c, 0, 'elemTxt', :lines=>3)
|
||||
|
|
@ -346,9 +346,9 @@ def demoExplorerList(t)
|
|||
height = t.font.metrics(:linespace) + 2
|
||||
height = 18 if height < 18
|
||||
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:extended, :wrap=>:window,
|
||||
:showheader=>false, :scrollmargin=>16,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:extended, :wrap=>:window,
|
||||
:showheader=>false, :scrollmargin=>16,
|
||||
:xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
|
||||
|
||||
init_pics('small-*')
|
||||
|
|
@ -359,16 +359,16 @@ def demoExplorerList(t)
|
|||
t.column_configure(0, :widthhack=>true)
|
||||
end
|
||||
|
||||
t.element_create('elemImg', :image,
|
||||
t.element_create('elemImg', :image,
|
||||
:image=>[
|
||||
@sel_images['small-folder'], ['selected'],
|
||||
@sel_images['small-folder'], ['selected'],
|
||||
@images['small-folder'], []
|
||||
])
|
||||
t.element_create('elemTxt', :text, :lines=>1,
|
||||
t.element_create('elemTxt', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('elemSel', :rect, :showfocus=>true,
|
||||
t.element_create('elemSel', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ def demoExplorerList(t)
|
|||
@Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
|
||||
@Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
|
||||
|
||||
t.notify_bind(t, 'Edit-accept',
|
||||
t.notify_bind(t, 'Edit-accept',
|
||||
proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t')
|
||||
|
||||
dir_proc = proc{|file|
|
||||
|
|
@ -413,9 +413,9 @@ def demoExplorerList(t)
|
|||
type = type[1..-1] << ' ' unless type.empty?
|
||||
type << 'File'
|
||||
|
||||
t.item_complex(item,
|
||||
[
|
||||
['elemImg', {:image=>[@sel_images[img], ['selected'],
|
||||
t.item_complex(item,
|
||||
[
|
||||
['elemImg', {:image=>[@sel_images[img], ['selected'],
|
||||
@images[img], []]}],
|
||||
['elemTxt', {:text=>File.basename(file)}]
|
||||
])
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
def demoHelpContents(t)
|
||||
height = t.font.metrics(:linespace)
|
||||
height = 18 if height < 18
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:browse)
|
||||
|
||||
init_pics('help-*')
|
||||
|
|
@ -20,16 +20,16 @@ def demoHelpContents(t)
|
|||
|
||||
t.element_create('e1', :image, :image=>@images['help-page'])
|
||||
t.element_create('e2', :image, :image=>[
|
||||
@images['help-book-open'], ['open'],
|
||||
@images['help-book-closed'], [],
|
||||
@images['help-book-open'], ['open'],
|
||||
@images['help-book-closed'], [],
|
||||
])
|
||||
t.element_create('e3', :text,
|
||||
:font=>[t.font.dup.underline(true), ['mouseover']],
|
||||
t.element_create('e3', :text,
|
||||
:font=>[t.font.dup.underline(true), ['mouseover']],
|
||||
:fill=>[
|
||||
@SystemHighlightText, ['selected', 'focus'],
|
||||
@SystemHighlightText, ['selected', 'focus'],
|
||||
'blue', ['mouseover']
|
||||
])
|
||||
t.element_create('e4', :rect, :showfocus=>true,
|
||||
t.element_create('e4', :rect, :showfocus=>true,
|
||||
:fill=>[@SystemHighlight, ['selected', 'focus']])
|
||||
|
||||
# book
|
||||
|
|
@ -49,21 +49,21 @@ def demoHelpContents(t)
|
|||
parentList = [:root, '', '', '', '', '', '']
|
||||
parent = :root
|
||||
[
|
||||
[0, 's1', "Welcome to Help"],
|
||||
[0, 's2', "Introducing Windows 98"],
|
||||
[1, 's2', "How to Use Help"],
|
||||
[2, 's1', "Find a topic"],
|
||||
[0, 's1', "Welcome to Help"],
|
||||
[0, 's2', "Introducing Windows 98"],
|
||||
[1, 's2', "How to Use Help"],
|
||||
[2, 's1', "Find a topic"],
|
||||
[2, 's1', "Get more out of help"],
|
||||
[1, 's2', "Register Your Software"],
|
||||
[2, 's1', "Registering Windows 98 online"],
|
||||
[1, 's2', "What's New in Windows 98"],
|
||||
[2, 's1', "Innovative, easy-to-use features"],
|
||||
[2, 's1', "Improved reliability"],
|
||||
[2, 's1', "A faster operating system"],
|
||||
[2, 's1', "True Web integration"],
|
||||
[2, 's1', "More entertaining and fun"],
|
||||
[1, 's2', "If You're New to Windows 98"],
|
||||
[2, 's2', "Tips for Macintosh Users"],
|
||||
[2, 's1', "Registering Windows 98 online"],
|
||||
[1, 's2', "What's New in Windows 98"],
|
||||
[2, 's1', "Innovative, easy-to-use features"],
|
||||
[2, 's1', "Improved reliability"],
|
||||
[2, 's1', "A faster operating system"],
|
||||
[2, 's1', "True Web integration"],
|
||||
[2, 's1', "More entertaining and fun"],
|
||||
[1, 's2', "If You're New to Windows 98"],
|
||||
[2, 's2', "Tips for Macintosh Users"],
|
||||
[3, 's1', "Why does the mouse have two buttons?"]
|
||||
].each{|depth, style, text|
|
||||
item = t.item_create
|
||||
|
|
@ -81,7 +81,7 @@ def demoHelpContents(t)
|
|||
|
||||
treeCtrlHelp = TkBindTag.new
|
||||
|
||||
treeCtrlHelp.bind('Double-ButtonPress-1',
|
||||
treeCtrlHelp.bind('Double-ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
if w.identify(x, y)[0] == 'header'
|
||||
Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
|
||||
|
|
@ -91,25 +91,25 @@ def demoHelpContents(t)
|
|||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('ButtonPress-1',
|
||||
treeCtrlHelp.bind('ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
helpButton1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('Button1-Motion',
|
||||
treeCtrlHelp.bind('Button1-Motion',
|
||||
proc{|w, x, y|
|
||||
helpMotion1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('Button1-Leave',
|
||||
treeCtrlHelp.bind('Button1-Leave',
|
||||
proc{|w, x, y|
|
||||
helpLeave1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('ButtonRelease-1',
|
||||
treeCtrlHelp.bind('ButtonRelease-1',
|
||||
proc{|w, x, y|
|
||||
helpRelease1(w, x, y)
|
||||
Tk.callback_break
|
||||
|
|
@ -119,7 +119,7 @@ def demoHelpContents(t)
|
|||
|
||||
treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('KeyPress-Return',
|
||||
treeCtrlHelp.bind('KeyPress-Return',
|
||||
proc{|w, x, y|
|
||||
if w.selection_get.length == 1
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -141,7 +141,7 @@ end
|
|||
def demoHelpContents2(t)
|
||||
height = t.font.metrics(:linespace)
|
||||
height = 18 if height < 18
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:browse)
|
||||
|
||||
init_pics('help-*')
|
||||
|
|
@ -154,19 +154,19 @@ def demoHelpContents2(t)
|
|||
|
||||
t.element_create('e1', :image, :image=>@images['help-page'])
|
||||
t.element_create('e2', :image, :image=>[
|
||||
@images['help-book-open'], ['open'],
|
||||
@images['help-book-closed'], [],
|
||||
@images['help-book-open'], ['open'],
|
||||
@images['help-book-closed'], [],
|
||||
])
|
||||
t.element_create('e3', :text,
|
||||
t.element_create('e3', :text,
|
||||
:fill=>[
|
||||
@SystemHighlightText, ['selected', 'focus'],
|
||||
@SystemHighlightText, ['selected', 'focus'],
|
||||
'blue', []
|
||||
])
|
||||
t.element_create('e4', :rect, :showfocus=>true,
|
||||
t.element_create('e4', :rect, :showfocus=>true,
|
||||
:fill=>[@SystemHighligh, ['selected', 'focus']])
|
||||
t.element_create('e5', :text, :font=>t.font.dup.underline(true),
|
||||
t.element_create('e5', :text, :font=>t.font.dup.underline(true),
|
||||
:fill=>[
|
||||
@SystemHighlightText, ['selected', 'focus'],
|
||||
@SystemHighlightText, ['selected', 'focus'],
|
||||
'blue', []
|
||||
])
|
||||
|
||||
|
|
@ -201,21 +201,21 @@ def demoHelpContents2(t)
|
|||
parentList = [:root, '', '', '', '', '', '']
|
||||
parent = :root
|
||||
[
|
||||
[0, 's1', "Welcome to Help"],
|
||||
[0, 's2', "Introducing Windows 98"],
|
||||
[1, 's2', "How to Use Help"],
|
||||
[2, 's1' "Find a topic"],
|
||||
[0, 's1', "Welcome to Help"],
|
||||
[0, 's2', "Introducing Windows 98"],
|
||||
[1, 's2', "How to Use Help"],
|
||||
[2, 's1' "Find a topic"],
|
||||
[2, 's1', "Get more out of help"],
|
||||
[1, 's2', "Register Your Software"],
|
||||
[2, 's1', "Registering Windows 98 online"],
|
||||
[1, 's2', "What's New in Windows 98"],
|
||||
[2, 's1', "Innovative, easy-to-use features"],
|
||||
[2, 's1', "Improved reliability"],
|
||||
[2, 's1', "A faster operating system"],
|
||||
[2, 's1', "True Web integration"],
|
||||
[2, 's1', "More entertaining and fun"],
|
||||
[1, 's2', "If You're New to Windows 98"],
|
||||
[2, 's2', "Tips for Macintosh Users"],
|
||||
[2, 's1', "Registering Windows 98 online"],
|
||||
[1, 's2', "What's New in Windows 98"],
|
||||
[2, 's1', "Innovative, easy-to-use features"],
|
||||
[2, 's1', "Improved reliability"],
|
||||
[2, 's1', "A faster operating system"],
|
||||
[2, 's1', "True Web integration"],
|
||||
[2, 's1', "More entertaining and fun"],
|
||||
[1, 's2', "If You're New to Windows 98"],
|
||||
[2, 's2', "Tips for Macintosh Users"],
|
||||
[3, 's1', "Why does the mouse have two buttons?"]
|
||||
].each{|depth, style, text|
|
||||
item = t.item_create
|
||||
|
|
@ -233,7 +233,7 @@ def demoHelpContents2(t)
|
|||
|
||||
treeCtrlHelp = TkBindTag.new
|
||||
|
||||
treeCtrlHelp.bind('Double-ButtonPress-1',
|
||||
treeCtrlHelp.bind('Double-ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
if w.identify(x, y)[0] == 'header'
|
||||
Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
|
||||
|
|
@ -243,25 +243,25 @@ def demoHelpContents2(t)
|
|||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('ButtonPress-1',
|
||||
treeCtrlHelp.bind('ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
helpButton1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('Button1-Motion',
|
||||
treeCtrlHelp.bind('Button1-Motion',
|
||||
proc{|w, x, y|
|
||||
helpMotion1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('Button1-Leave',
|
||||
treeCtrlHelp.bind('Button1-Leave',
|
||||
proc{|w, x, y|
|
||||
helpLeave1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('ButtonRelease-1',
|
||||
treeCtrlHelp.bind('ButtonRelease-1',
|
||||
proc{|w, x, y|
|
||||
helpRelease1(w, x, y)
|
||||
Tk.callback_break
|
||||
|
|
@ -271,7 +271,7 @@ def demoHelpContents2(t)
|
|||
|
||||
treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y')
|
||||
|
||||
treeCtrlHelp.bind('KeyPress-Return',
|
||||
treeCtrlHelp.bind('KeyPress-Return',
|
||||
proc{|w, x, y|
|
||||
if w.selection_get.length == 1
|
||||
w.item_toggle(w.selection_get[0])
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
# Demo: iMovie
|
||||
#
|
||||
def demoIMovie(t)
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:browse, :orient=>:horizontal, :wrap=>:window,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:selectmode=>:browse, :orient=>:horizontal, :wrap=>:window,
|
||||
:showheader=>false, :background=>'#dcdcdc')
|
||||
|
||||
if $HasColumnCreate
|
||||
|
|
@ -26,24 +26,24 @@ def demoIMovie(t)
|
|||
|
||||
t.element_create('elemTime', :text, :font=>font1)
|
||||
t.element_create('elemName', :text, :font=>font2, :lines=>1, :width=>80)
|
||||
t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1,
|
||||
t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1,
|
||||
:fill=>['#ffdc5a', ['selected'], 'white', []])
|
||||
t.element_create('elemImg', :image)
|
||||
t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1,
|
||||
t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1,
|
||||
:open=>:wn)
|
||||
|
||||
s = t.style_create('STYLE', :orient=>:vertical)
|
||||
t.style_elements(s, [
|
||||
'elemShadow', 'elemRect', 'elemTime',
|
||||
'elemShadow', 'elemRect', 'elemTime',
|
||||
'elemImg', 'elemName'
|
||||
])
|
||||
t.style_layout(s, 'elemShadow', :detach=>true,
|
||||
t.style_layout(s, 'elemShadow', :detach=>true,
|
||||
:padx=>[1,2], :pady=>[1,2], :iexpand=>:es)
|
||||
t.style_layout(s, 'elemTime', :padx=>[2,0])
|
||||
t.style_layout(s, 'elemImg', :pady=>[0,1])
|
||||
t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3],
|
||||
t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3],
|
||||
:squeeze=>:x)
|
||||
t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'],
|
||||
t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'],
|
||||
:ipadx=>6, :padx=>[0,3], :pady=>[0,3])
|
||||
|
||||
# Set default item style
|
||||
|
|
@ -53,12 +53,12 @@ def demoIMovie(t)
|
|||
|
||||
(0..4).each{|i|
|
||||
[
|
||||
['15:20', 'Clip 1', @images['imovie-01']],
|
||||
['19:18', 'Clip 2', @images['imovie-02']],
|
||||
['07:20', 'Clip 3', @images['imovie-03']],
|
||||
['07:20', 'Clip 4', @images['imovie-04']],
|
||||
['07:20', 'Clip 5', @images['imovie-05']],
|
||||
['07:20', 'Clip 6', @images['imovie-06']],
|
||||
['15:20', 'Clip 1', @images['imovie-01']],
|
||||
['19:18', 'Clip 2', @images['imovie-02']],
|
||||
['07:20', 'Clip 3', @images['imovie-03']],
|
||||
['07:20', 'Clip 4', @images['imovie-04']],
|
||||
['07:20', 'Clip 5', @images['imovie-05']],
|
||||
['07:20', 'Clip 6', @images['imovie-06']],
|
||||
['07:20', 'Clip 7', @images['imovie-07']]
|
||||
].each{|time, name, image|
|
||||
item = t.item_create
|
||||
|
|
@ -110,7 +110,7 @@ def iMovieButton1(w, x, y)
|
|||
Tk::TreeCtrl::BindCallback.entryOpen(w, i, 0, e)
|
||||
ent = TkComm.window(w.path + '.entry')
|
||||
unless exists
|
||||
ent.configure(:borderwidth=>0, :justify=>:center,
|
||||
ent.configure(:borderwidth=>0, :justify=>:center,
|
||||
:background=>'#ffdc5a')
|
||||
x1, y1, x2, y2 = w.item_bbox(i, 0, e)
|
||||
ent.place(:y=>y1 - 1)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Demo: Layout
|
||||
#
|
||||
def demoLayout(t)
|
||||
t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true,
|
||||
t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true,
|
||||
:showlines=>true, :itemheight=>0, :selectmode=>:browse)
|
||||
|
||||
if $HasColumnCreate
|
||||
|
|
@ -12,10 +12,10 @@ def demoLayout(t)
|
|||
end
|
||||
|
||||
t.element_create('e1', :rect, :width=>30, :height=>30, :fill=>'gray20')
|
||||
t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40',
|
||||
t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40',
|
||||
:outline=>'blue', :outlinewidth=>3)
|
||||
t.element_create('e3', :rect, :fill=>'gray60')
|
||||
t.element_create('e4', :rect, :showfocus=>true,
|
||||
t.element_create('e4', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'], 'gray80', []
|
||||
])
|
||||
|
|
@ -31,9 +31,9 @@ def demoLayout(t)
|
|||
t.style_layout(s, 'e3', :union=>['e1', 'e2'], :ipadx=>4, :ipady=>4, :pady=>2)
|
||||
t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es)
|
||||
t.style_layout(s, 'e5', :detach=>true, :padx=>[2,0], :pady=>2, :iexpand=>:s)
|
||||
t.style_layout(s, 'e6', :detach=>true, :expand=>:ws,
|
||||
t.style_layout(s, 'e6', :detach=>true, :expand=>:ws,
|
||||
:padx=>[0,2], :pady=>[2,0])
|
||||
t.style_layout(s, 'e7', :detach=>true, :expand=>:wn,
|
||||
t.style_layout(s, 'e7', :detach=>true, :expand=>:wn,
|
||||
:padx=>[0,2], :pady=>[0,2])
|
||||
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -53,7 +53,7 @@ def demoLayout(t)
|
|||
t.item_style_set(i, 0, s)
|
||||
t.item_lastchild(parent, i)
|
||||
|
||||
###
|
||||
###
|
||||
|
||||
s = t.style_create('s2')
|
||||
t.style_elements(s, ['e4', 'e3', 'e1'])
|
||||
|
|
@ -77,7 +77,7 @@ def demoLayout(t)
|
|||
t.item_style_set(i2, 0, s)
|
||||
t.item_lastchild(i, i2)
|
||||
|
||||
###
|
||||
###
|
||||
|
||||
s = t.style_create('s3')
|
||||
t.style_elements(s, ['e4', 'e3', 'e1', 'e5', 'e6'])
|
||||
|
|
@ -101,10 +101,10 @@ def demoLayout(t)
|
|||
t.item_style_set(i2, 0, s)
|
||||
t.item_lastchild(i, i2)
|
||||
|
||||
###
|
||||
###
|
||||
|
||||
t.element_create('eb', :border, :background=>@SystemButtonFace,
|
||||
:relief=>[:sunken, ['selected'], :raised, []],
|
||||
t.element_create('eb', :border, :background=>@SystemButtonFace,
|
||||
:relief=>[:sunken, ['selected'], :raised, []],
|
||||
:thickness=>2, :filled=>true)
|
||||
t.element_create('et', :text)
|
||||
|
||||
|
|
@ -134,11 +134,11 @@ def demoLayout(t)
|
|||
t.item_text(i, 0, text)
|
||||
t.item_lastchild(parent, i)
|
||||
|
||||
###
|
||||
###
|
||||
|
||||
styleNum = 5
|
||||
[
|
||||
[:horizontal, [:s, :ns, :n]],
|
||||
[
|
||||
[:horizontal, [:s, :ns, :n]],
|
||||
[:vertical, [:e, :we, :w]]
|
||||
].each{|orient, expandList|
|
||||
expandList.each{|expand|
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ def demoMailWasher(t)
|
|||
height = t.font.metrics(:linespace) + 2
|
||||
height = 18 if height < 18
|
||||
|
||||
t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false,
|
||||
:showlines=>false, :itemheight=>height, :selectmode=>:browse,
|
||||
t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false,
|
||||
:showlines=>false, :itemheight=>height, :selectmode=>:browse,
|
||||
:xscrollincrement=>1)
|
||||
|
||||
pad = 4
|
||||
|
|
@ -16,14 +16,14 @@ def demoMailWasher(t)
|
|||
if $Version_1_1_OrLater
|
||||
t.column_create(:text=>'Delete', :textpadx=>pad, :tag=>'delete')
|
||||
t.column_create(:text=>'Bounce', :textpadx=>pad, :tag=>'bounce')
|
||||
t.column_create(:text=>'Status', :width=>80, :textpadx=>pad,
|
||||
t.column_create(:text=>'Status', :width=>80, :textpadx=>pad,
|
||||
:tag=>'status')
|
||||
t.column_create(:text=>'Size', :width=>40, :textpadx=>pad,
|
||||
t.column_create(:text=>'Size', :width=>40, :textpadx=>pad,
|
||||
:justify=>:right, :tag=>'size')
|
||||
t.column_create(:text=>'From', :width=>140, :textpadx=>pad, :tag=>'from')
|
||||
t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad,
|
||||
t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad,
|
||||
:tag=>'subject')
|
||||
t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up,
|
||||
t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up,
|
||||
:arrowpad=>[4,0], :tag=>'received')
|
||||
t.column_create(:text=>'Attachments', :textpadx=>pad, :tag=>'attachments')
|
||||
|
||||
|
|
@ -36,38 +36,38 @@ def demoMailWasher(t)
|
|||
else # TreeCtrl 1.0
|
||||
t.column_configure(0, :text=>'Delete', :textpadx=>pad, :tag=>'delete')
|
||||
t.column_configure(1, :text=>'Bounce', :textpadx=>pad, :tag=>'bounce')
|
||||
t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad,
|
||||
t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad,
|
||||
:tag=>'status')
|
||||
t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad,
|
||||
t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad,
|
||||
:justify=>:right, :tag=>'size')
|
||||
t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad,
|
||||
t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad,
|
||||
:tag=>'from')
|
||||
t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad,
|
||||
t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad,
|
||||
:tag=>'subject')
|
||||
t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up,
|
||||
t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up,
|
||||
:arrowpad=>[4,0], :tag=>'received')
|
||||
t.column_configure(7, :text=>'Attachments', :textpadx=>pad,
|
||||
t.column_configure(7, :text=>'Attachments', :textpadx=>pad,
|
||||
:tag=>'attachments')
|
||||
|
||||
t.element_create('imgOff', :image, :image=>@images['unchecked'])
|
||||
t.element_create('imgOn', :image, :image=>@images['checked'])
|
||||
end
|
||||
|
||||
t.element_create('border', :rect, :open=>:nw, :outline=>'gray',
|
||||
t.element_create('border', :rect, :open=>:nw, :outline=>'gray',
|
||||
:outlinewidth=>1, :fill=>[@SystemHighlight, ['selected']])
|
||||
t.element_create('txtAny', :text, :lines=>1,
|
||||
t.element_create('txtAny', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected']])
|
||||
t.element_create('txtNone', :text, :text=>'none', :lines=>1,
|
||||
t.element_create('txtNone', :text, :text=>'none', :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected']])
|
||||
t.element_create('txtYes', :text, :text=>'yes', :lines=>1,
|
||||
t.element_create('txtYes', :text, :text=>'yes', :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected']])
|
||||
t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1,
|
||||
t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected'], '#006800', []])
|
||||
t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1,
|
||||
t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected'], '#787800', []])
|
||||
t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1,
|
||||
t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected'], '#FF9000', []])
|
||||
t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1,
|
||||
t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected'], '#FF5800', []])
|
||||
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -96,16 +96,16 @@ def demoMailWasher(t)
|
|||
}
|
||||
|
||||
[
|
||||
['baldy@spammer.com', "Your hair is thinning"],
|
||||
['flat@spammer.com', "Your breasts are too small"],
|
||||
['tiny@spammer.com', "Your penis is too small"],
|
||||
['dumbass@spammer.com', "You are not very smart"],
|
||||
['bankrobber@spammer.com', "You need more money"],
|
||||
['loser@spammer.com', "You need better friends"],
|
||||
['gossip@spammer.com', "Find out what your coworkers think about you"],
|
||||
['baldy@spammer.com', "Your hair is thinning"],
|
||||
['flat@spammer.com', "Your breasts are too small"],
|
||||
['tiny@spammer.com', "Your penis is too small"],
|
||||
['dumbass@spammer.com', "You are not very smart"],
|
||||
['bankrobber@spammer.com', "You need more money"],
|
||||
['loser@spammer.com', "You need better friends"],
|
||||
['gossip@spammer.com', "Find out what your coworkers think about you"],
|
||||
['whoami@spammer.com', "Find out what you think about yourself"],
|
||||
['downsized@spammer.com', "You need a better job"],
|
||||
['poorhouse@spammer.com', "Your mortgage is a joke"],
|
||||
['downsized@spammer.com', "You need a better job"],
|
||||
['poorhouse@spammer.com', "Your mortgage is a joke"],
|
||||
['spam4ever@spammer.com', "You need more spam"]
|
||||
].each{|frm, subj|
|
||||
item = t.item_create
|
||||
|
|
@ -115,8 +115,8 @@ def demoMailWasher(t)
|
|||
if $Version_1_1_OrLater
|
||||
delete = [false, true][rand(2)]
|
||||
bounce = [false, true][rand(2)]
|
||||
t.item_style_set(item,
|
||||
0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny',
|
||||
t.item_style_set(item,
|
||||
0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny',
|
||||
4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments)
|
||||
t.item_state_forcolumn(item, 'delete', 'CHECK') if delete
|
||||
t.item_state_forcolumn(item, 'bounce', 'CHECK') if bounce
|
||||
|
|
@ -124,8 +124,8 @@ def demoMailWasher(t)
|
|||
else # TreeCtrl 1.0
|
||||
delete = ['styOn', 'styOff'][rand(2)]
|
||||
bounce = ['styOn', 'styOff'][rand(2)]
|
||||
t.item_style_set(item,
|
||||
0, delete, 1, bounce, 2, status, 3, 'styAny',
|
||||
t.item_style_set(item,
|
||||
0, delete, 1, bounce, 2, status, 3, 'styAny',
|
||||
4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments)
|
||||
end
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ def demoMailWasher(t)
|
|||
}
|
||||
|
||||
sortColumn = 6
|
||||
t.notify_bind(t, 'Header-invoke',
|
||||
t.notify_bind(t, 'Header-invoke',
|
||||
proc{|c, w|
|
||||
if c == sortColumn
|
||||
if w.column_cget(sortColumn, :arrow) == 'down'
|
||||
|
|
@ -162,35 +162,35 @@ def demoMailWasher(t)
|
|||
w.column_configure(c, :arrow=>arrow)
|
||||
case w.column_cget(c, :tag)
|
||||
when 'bounce', 'delete'
|
||||
w.item_sort(:root, order,
|
||||
{
|
||||
:column=>c,
|
||||
w.item_sort(:root, order,
|
||||
{
|
||||
:column=>c,
|
||||
:command=>proc{|item1, item2|
|
||||
compareOnOff(w, c, item1, item2)
|
||||
}
|
||||
},
|
||||
},
|
||||
{ :column=>'subject', :dictionary=>true })
|
||||
when 'status'
|
||||
w.item_sort(:root, order,
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true })
|
||||
when 'from'
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
{ :column=>'subject', :dictionary=>true })
|
||||
when 'subject'
|
||||
w.item_sort(:root, order,
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true })
|
||||
when 'size'
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
{ :column=>'subject', :dictionary=>true })
|
||||
when 'received'
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
{ :column=>'subject', :dictionary=>true })
|
||||
when 'attachments'
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
w.item_sort(:root, order,
|
||||
{ :column=>c, :dictionary=>true },
|
||||
{ :column=>'subject', :dictionary=>true })
|
||||
end
|
||||
}, '%C %T')
|
||||
|
|
@ -198,7 +198,7 @@ def demoMailWasher(t)
|
|||
mailWasher = TkBindTag.new
|
||||
|
||||
if $Version_1_1_OrLater
|
||||
mailWasher.bind('ButtonPress-1',
|
||||
mailWasher.bind('ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
id = w.identify(x, y)
|
||||
if id.empty?
|
||||
|
|
@ -214,7 +214,7 @@ def demoMailWasher(t)
|
|||
end
|
||||
}, '%W %x %y')
|
||||
else # TreeCtrl 1.0
|
||||
mailWasher.bind('ButtonPress-1',
|
||||
mailWasher.bind('ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
id = w.identify(x, y)
|
||||
if id.empty?
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ def demoOutlookFolders(t)
|
|||
height = t.font.metrics(:linespace) + 2
|
||||
height = 18 if height < 18
|
||||
|
||||
t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true,
|
||||
t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true,
|
||||
:showroot=>true, :showrootbutton=>false, :showbuttons=>true)
|
||||
|
||||
if $HasColumnCreate
|
||||
|
|
@ -17,15 +17,15 @@ def demoOutlookFolders(t)
|
|||
end
|
||||
|
||||
t.element_create('e1', :image)
|
||||
t.element_create('e2', :text, :lines=>1,
|
||||
t.element_create('e2', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold),
|
||||
t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold),
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('e4', :text, :fill=>'blue')
|
||||
t.element_create('e5', :image, :image=>@images['outlook-folder'])
|
||||
t.element_create('e6', :rect, :showfocus=>true,
|
||||
t.element_create('e6', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
|
||||
|
|
@ -60,28 +60,28 @@ def demoOutlookFolders(t)
|
|||
t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
|
||||
|
||||
t.item_style_set(:root, 0, 's1')
|
||||
t.item_complex(:root,
|
||||
t.item_complex(:root,
|
||||
[
|
||||
['e1', {:image=>@images['outlook-main']}],
|
||||
['e1', {:image=>@images['outlook-main']}],
|
||||
['e2', {:text=>'Outlook Express'}]
|
||||
])
|
||||
|
||||
parentList = [:root, '', '', '', '', '', '']
|
||||
parent = :root
|
||||
[
|
||||
[0, :local, "Local Folders", true, 0],
|
||||
[1, :inbox, 'Inbox', false, 5],
|
||||
[1, :outbox, 'Outbox', false, 0],
|
||||
[1, :sent, "Sent Items", false, 0],
|
||||
[1, :deleted, "Deleted Items", false, 50],
|
||||
[1, :draft, 'Drafts', false, 0],
|
||||
[1, :folder, "Messages to Dad", false, 0],
|
||||
[1, :folder, "Messages to Sis", false, 0],
|
||||
[1, :folder, "Messages to Me", false, 0],
|
||||
[2, :folder, "2001", false, 0],
|
||||
[2, :folder, "2000", false, 0],
|
||||
[2, :folder, "1999", false, 0],
|
||||
[0, :server, "news.gmane.org", true, 0],
|
||||
[0, :local, "Local Folders", true, 0],
|
||||
[1, :inbox, 'Inbox', false, 5],
|
||||
[1, :outbox, 'Outbox', false, 0],
|
||||
[1, :sent, "Sent Items", false, 0],
|
||||
[1, :deleted, "Deleted Items", false, 50],
|
||||
[1, :draft, 'Drafts', false, 0],
|
||||
[1, :folder, "Messages to Dad", false, 0],
|
||||
[1, :folder, "Messages to Sis", false, 0],
|
||||
[1, :folder, "Messages to Me", false, 0],
|
||||
[2, :folder, "2001", false, 0],
|
||||
[2, :folder, "2000", false, 0],
|
||||
[2, :folder, "1999", false, 0],
|
||||
[0, :server, "news.gmane.org", true, 0],
|
||||
[1, :group, "gmane.comp.lang.lua.general", false, 498]
|
||||
].each{|depth, img, text, button, unread|
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -93,7 +93,7 @@ def demoOutlookFolders(t)
|
|||
if img == :folder
|
||||
if unread != 0
|
||||
t.item_style_set(item, 0, 's4')
|
||||
t.item_complex(item,
|
||||
t.item_complex(item,
|
||||
[['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}]])
|
||||
else
|
||||
t.item_style_set(item, 0, 's3')
|
||||
|
|
@ -102,17 +102,17 @@ def demoOutlookFolders(t)
|
|||
else
|
||||
if unread != 0
|
||||
t.item_style_set(item, 0, 's2')
|
||||
t.item_complex(item,
|
||||
t.item_complex(item,
|
||||
[
|
||||
['e1', {:image=>@images["outlook-#{img}"]}],
|
||||
['e3', {:text=>text}],
|
||||
['e1', {:image=>@images["outlook-#{img}"]}],
|
||||
['e3', {:text=>text}],
|
||||
['e4', {:text=>"(#{unread})"}]
|
||||
])
|
||||
else
|
||||
t.item_style_set(item, 0, 's1')
|
||||
t.item_complex(item,
|
||||
t.item_complex(item,
|
||||
[
|
||||
['e1', {:image=>@images["outlook-#{img}"]}],
|
||||
['e1', {:image=>@images["outlook-#{img}"]}],
|
||||
['e2', {:text=>text}]
|
||||
])
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ def demoOutlookNewsgroup(t)
|
|||
|
||||
height = t.font.metrics(:linespace)
|
||||
height = 18 if height < 18
|
||||
t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false,
|
||||
t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false,
|
||||
:showroot=>false, :showrootbutton=>false, :showbuttons=>true)
|
||||
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -24,7 +24,7 @@ def demoOutlookNewsgroup(t)
|
|||
t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject')
|
||||
t.column_configure(4, :text=>'From', :width=>150, :tag=>'from')
|
||||
t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent')
|
||||
t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right,
|
||||
t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right,
|
||||
:tag=>'size')
|
||||
end
|
||||
|
||||
|
|
@ -37,35 +37,35 @@ def demoOutlookNewsgroup(t)
|
|||
# State for a message with unread descendants
|
||||
t.state_define('unread')
|
||||
|
||||
t.element_create('elemImg', :image,
|
||||
t.element_create('elemImg', :image,
|
||||
:image=>[
|
||||
@sel_images['outlook-read-2'],
|
||||
['selected', 'read', 'unread', '!open'],
|
||||
@sel_images['outlook-read-2'],
|
||||
['selected', 'read', 'unread', '!open'],
|
||||
@images['outlook-read-2'], ['read', 'unread', '!open'],
|
||||
@sel_images['outlook-read'], ['selected', 'read'],
|
||||
@images['outlook-read'], ['read'],
|
||||
@sel_images['outlook-unread'], ['selected'],
|
||||
@sel_images['outlook-read'], ['selected', 'read'],
|
||||
@images['outlook-read'], ['read'],
|
||||
@sel_images['outlook-unread'], ['selected'],
|
||||
@images['outlook-unread'], []
|
||||
])
|
||||
t.element_create('elemTxt', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']],
|
||||
t.element_create('elemTxt', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']],
|
||||
:font=>[
|
||||
t.font.dup.weight(:bold), ['read', 'unread', '!open'],
|
||||
t.font.dup.weight(:bold), ['read', 'unread', '!open'],
|
||||
t.font.dup.weight(:bold), ['!read']
|
||||
])
|
||||
t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true,
|
||||
t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true,
|
||||
t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true,
|
||||
t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ def demoOutlookNewsgroup(t)
|
|||
t.style_elements(s, ['sel.e', 'elemImg', 'elemTxt'])
|
||||
t.style_layout(s, 'elemImg', :expand=>:ns)
|
||||
t.style_layout(s, 'elemTxt', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
|
||||
t.style_layout(s, 'sel.e', :union=>['elemTxt'],
|
||||
t.style_layout(s, 'sel.e', :union=>['elemTxt'],
|
||||
:iexpand=>:nes, :ipadx=>[2,0])
|
||||
|
||||
# Text
|
||||
|
|
@ -168,12 +168,12 @@ def demoOutlookNewsgroup(t)
|
|||
}
|
||||
|
||||
# Do something when the selection changes
|
||||
t.notify_bind(t, 'Selection',
|
||||
t.notify_bind(t, 'Selection',
|
||||
proc{|w|
|
||||
if w.selection_count == 1
|
||||
# One item is selected
|
||||
if @Message[:afterId][:id]
|
||||
Tk.after_cancel(@Message[:afterId][:id])
|
||||
Tk.after_cancel(@Message[:afterId][:id])
|
||||
end
|
||||
@Message[:afterId][:item] = w.selection_get[0]
|
||||
@Message[:afterId][:id] = Tk.after(500, proc{
|
||||
|
|
@ -208,7 +208,7 @@ def demoOutlookNewsgroup2(t)
|
|||
|
||||
height = t.font.metrics(:linespace)
|
||||
height = 18 if height < 18
|
||||
t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false,
|
||||
t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false,
|
||||
:showroot=>false, :showrootbutton=>false, :showbuttons=>true)
|
||||
|
||||
if $Version_1_1_OrLater
|
||||
|
|
@ -226,7 +226,7 @@ def demoOutlookNewsgroup2(t)
|
|||
t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject')
|
||||
t.column_configure(4, :text=>'From', :width=>150, :tag=>'from')
|
||||
t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent')
|
||||
t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right,
|
||||
t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right,
|
||||
:tag=>'size')
|
||||
end
|
||||
|
||||
|
|
@ -235,24 +235,24 @@ def demoOutlookNewsgroup2(t)
|
|||
t.element_create('image.unread', :image, :image=>@images['outlook-unread'])
|
||||
t.element_create('image.read', :image, :image=>@images['outlook-read'])
|
||||
t.element_create('image.read2', :image, :image=>@images['outlook-read-2'])
|
||||
t.element_create('text.read', :text, :lines=>1,
|
||||
t.element_create('text.read', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('text.unread', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']],
|
||||
t.element_create('text.unread', :text, :lines=>1,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']],
|
||||
:font=>t.font.dup.weight(:bold))
|
||||
t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true,
|
||||
t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true,
|
||||
t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true,
|
||||
t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ def demoOutlookNewsgroup2(t)
|
|||
t.style_elements(s, ['sel.e', 'image.unread', 'text.unread'])
|
||||
t.style_layout(s, 'image.unread', :expand=>:ns)
|
||||
t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
|
||||
t.style_layout(s, 'sel.e', :union=>['text.unread'],
|
||||
t.style_layout(s, 'sel.e', :union=>['text.unread'],
|
||||
:iexpand=>:nes, :ipadx=>[2,0])
|
||||
|
||||
# Image + text
|
||||
|
|
@ -269,7 +269,7 @@ def demoOutlookNewsgroup2(t)
|
|||
t.style_elements(s, ['sel.e', 'image.read', 'text.read'])
|
||||
t.style_layout(s, 'image.read', :expand=>:ns)
|
||||
t.style_layout(s, 'text.read', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
|
||||
t.style_layout(s, 'sel.e', :union=>['text.read'],
|
||||
t.style_layout(s, 'sel.e', :union=>['text.read'],
|
||||
:iexpand=>:nes, :ipadx=>[2,0])
|
||||
|
||||
# Image + text
|
||||
|
|
@ -277,7 +277,7 @@ def demoOutlookNewsgroup2(t)
|
|||
t.style_elements(s, ['sel.e', 'image.read2', 'text.unread'])
|
||||
t.style_layout(s, 'image.read2', :expand=>:ns)
|
||||
t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
|
||||
t.style_layout(s, 'sel.e', :union=>['text.unread'],
|
||||
t.style_layout(s, 'sel.e', :union=>['text.unread'],
|
||||
:iexpand=>:nes, :ipadx=>[2,0])
|
||||
|
||||
# Text
|
||||
|
|
@ -350,7 +350,7 @@ def demoOutlookNewsgroup2(t)
|
|||
style = 'unread'
|
||||
style2 = 'unread2'
|
||||
end
|
||||
t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we",
|
||||
t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we",
|
||||
6, "#{style2}.w")
|
||||
t.item_text(i, 3, subject, 4, from, 5, sent, 6, size)
|
||||
if t.item_numchildren(i) > 0
|
||||
|
|
@ -359,24 +359,24 @@ def demoOutlookNewsgroup2(t)
|
|||
}
|
||||
|
||||
# Do something when the selection changes
|
||||
t.notify_bind(t, 'Selection',
|
||||
t.notify_bind(t, 'Selection',
|
||||
proc{|w|
|
||||
if w.selection_count == 1
|
||||
i = t.selection_get[0]
|
||||
unless @Message[:read][i]
|
||||
if t.item_isopen(i) || !anyUnreadDescendants(t, i)
|
||||
# unread -> read
|
||||
t.item_style_map(i, 'subject', 'read',
|
||||
t.item_style_map(i, 'subject', 'read',
|
||||
['text.unread', 'text.read'])
|
||||
t.item_style_map(i, 'from', 'read.we',
|
||||
t.item_style_map(i, 'from', 'read.we',
|
||||
['text.unread', 'text.read'])
|
||||
t.item_style_map(i, 'sent', 'read.we',
|
||||
t.item_style_map(i, 'sent', 'read.we',
|
||||
['text.unread', 'text.read'])
|
||||
t.item_style_map(i, 'size', 'read.w',
|
||||
t.item_style_map(i, 'size', 'read.w',
|
||||
['text.unread', 'text.read'])
|
||||
else
|
||||
# unread -> read2
|
||||
t.item_style_map(i, 'subject', 'read2',
|
||||
t.item_style_map(i, 'subject', 'read2',
|
||||
['text.unread', 'text.unread'])
|
||||
end
|
||||
|
||||
|
|
@ -386,34 +386,34 @@ def demoOutlookNewsgroup2(t)
|
|||
end
|
||||
}, '%T')
|
||||
|
||||
t.notify_bind(t, 'Expand-after',
|
||||
t.notify_bind(t, 'Expand-after',
|
||||
proc{|w, i|
|
||||
if @Messge[:read][i] && anyUnreadDescendants(t, i)
|
||||
# read2 -> read
|
||||
t.item_style_map(i, 'subject', 'read',
|
||||
t.item_style_map(i, 'subject', 'read',
|
||||
['text.unread', 'text.read'])
|
||||
# unread -> read
|
||||
t.item_style_map(i, 'from', 'read.we',
|
||||
t.item_style_map(i, 'from', 'read.we',
|
||||
['text.unread', 'text.read'])
|
||||
t.item_style_map(i, 'sent', 'read.we',
|
||||
t.item_style_map(i, 'sent', 'read.we',
|
||||
['text.unread', 'text.read'])
|
||||
t.item_style_map(i, 'size', 'read.w',
|
||||
t.item_style_map(i, 'size', 'read.w',
|
||||
['text.unread', 'text.read'])
|
||||
end
|
||||
}, '%T %I')
|
||||
|
||||
t.notify_bind(t, 'Collapse-after',
|
||||
t.notify_bind(t, 'Collapse-after',
|
||||
proc{|w, i|
|
||||
if @Messge[:read][i] && anyUnreadDescendants(t, i)
|
||||
# read -> read2
|
||||
t.item_style_map(i, 'subject', 'read2',
|
||||
t.item_style_map(i, 'subject', 'read2',
|
||||
['text.read', 'text.unread'])
|
||||
# read -> unread
|
||||
t.item_style_map(i, 'from', 'unread.we',
|
||||
t.item_style_map(i, 'from', 'unread.we',
|
||||
['text.read', 'text.unread'])
|
||||
t.item_style_map(i, 'sent', 'unread.we',
|
||||
t.item_style_map(i, 'sent', 'unread.we',
|
||||
['text.read', 'text.unread'])
|
||||
t.item_style_map(i, 'size', 'unread.w',
|
||||
t.item_style_map(i, 'size', 'unread.w',
|
||||
['text.read', 'text.unread'])
|
||||
end
|
||||
}, '%T %I')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
#
|
||||
def random_N
|
||||
@RandomN[0] || 500
|
||||
end
|
||||
|
|
@ -11,39 +11,39 @@ def demoRandom(t)
|
|||
|
||||
height = t.font.metrics(:linespace)
|
||||
height = 18 if height < 18
|
||||
t.configure(:itemheight=>height, :selectmode=>:extended,
|
||||
:showroot=>true, :showrootbutton=>true, :showbuttons=>true,
|
||||
:showlines=>true, :scrollmargin=>16,
|
||||
t.configure(:itemheight=>height, :selectmode=>:extended,
|
||||
:showroot=>true, :showrootbutton=>true, :showbuttons=>true,
|
||||
:showlines=>true, :scrollmargin=>16,
|
||||
:xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
|
||||
|
||||
if $Version_1_1_OrLater
|
||||
t.column_create(:expand=>true, :text=>'Item',
|
||||
t.column_create(:expand=>true, :text=>'Item',
|
||||
:itembackground=>['#e0e8f0', []], :tag=>'item')
|
||||
t.column_create(:text=>'Parent', :justify=>:center,
|
||||
t.column_create(:text=>'Parent', :justify=>:center,
|
||||
:itembackground=>['gray90', []], :tag=>'parent')
|
||||
t.column_create(:text=>'Depth', :justify=>:center,
|
||||
t.column_create(:text=>'Depth', :justify=>:center,
|
||||
:itembackground=>['linen', []], :tag=>'depth')
|
||||
else # TreeCtrl 1.0
|
||||
t.column_configure(0, :expand=>true, :text=>'Item',
|
||||
t.column_configure(0, :expand=>true, :text=>'Item',
|
||||
:itembackground=>['#e0e8f0', []], :tag=>'item')
|
||||
t.column_configure(1, :text=>'Parent', :justify=>:center,
|
||||
t.column_configure(1, :text=>'Parent', :justify=>:center,
|
||||
:itembackground=>['gray90', []], :tag=>'parent')
|
||||
t.column_configure(2, :text=>'Depth', :justify=>:center,
|
||||
t.column_configure(2, :text=>'Depth', :justify=>:center,
|
||||
:itembackground=>['linen', []], :tag=>'depth')
|
||||
end
|
||||
|
||||
t.element_create('e1', :image, :image=>[
|
||||
@images['folder-open'], ['open'],
|
||||
@images['folder-open'], ['open'],
|
||||
@images['folder-closed'], []
|
||||
])
|
||||
t.element_create('e2', :image, :image=>@images['small-file'])
|
||||
t.element_create('e3', :text,
|
||||
t.element_create('e3', :text,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('e4', :text, :fill=>'blue')
|
||||
t.element_create('e6', :text)
|
||||
t.element_create('e5', :rect, :showfocus=>true,
|
||||
t.element_create('e5', :rect, :showfocus=>true,
|
||||
:fill=>[
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
@SystemHighlight, ['selected', 'focus'],
|
||||
'gray', ['selected', '!focus']
|
||||
])
|
||||
|
||||
|
|
@ -65,11 +65,11 @@ def demoRandom(t)
|
|||
t.style_layout(s, 'e6', :padx=>6, :expand=>:ns)
|
||||
|
||||
@Priv[:sensitive, t] = [
|
||||
[:item, 's1', 'e5', 'e1', 'e3'],
|
||||
[:item, 's1', 'e5', 'e1', 'e3'],
|
||||
[:item, 's2', 'e5', 'e2', 'e3']
|
||||
]
|
||||
@Priv[:dragimage, t] = [
|
||||
[:item, 's1', 'e1', 'e3'],
|
||||
[:item, 's1', 'e1', 'e3'],
|
||||
[:item, 's2', 'e2', 'e3']
|
||||
]
|
||||
|
||||
|
|
@ -108,16 +108,16 @@ def demoRandom(t)
|
|||
t.item_hasbutton(item_i, true)
|
||||
end
|
||||
t.item_style_set(item_i, 0, 's1', 1, 's3', 2, 's3')
|
||||
t.item_complex(item_i,
|
||||
[ ['e3', {:text=>"Item #{i}"}],
|
||||
['e4', {:text=>"(#{numChildren})"}] ],
|
||||
[ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ],
|
||||
t.item_complex(item_i,
|
||||
[ ['e3', {:text=>"Item #{i}"}],
|
||||
['e4', {:text=>"(#{numChildren})"}] ],
|
||||
[ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ],
|
||||
[ ['e6', {:text=>"#{t.depth(item_i)}"}] ])
|
||||
else
|
||||
t.item_style_set(item_i, 1, 's3', 2, 's3', 0, 's2')
|
||||
t.item_complex(item_i,
|
||||
[ ['e3', {:text=>"Item #{i}"}] ],
|
||||
[ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ],
|
||||
t.item_complex(item_i,
|
||||
[ ['e3', {:text=>"Item #{i}"}] ],
|
||||
[ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ],
|
||||
[ ['e6', {:text=>"#{t.depth(item_i)}"}] ])
|
||||
end
|
||||
}
|
||||
|
|
@ -125,46 +125,46 @@ def demoRandom(t)
|
|||
|
||||
treeCtrlRandom = TkBindTag.new
|
||||
|
||||
treeCtrlRandom.bind('Double-ButtonPress-1',
|
||||
treeCtrlRandom.bind('Double-ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlRandom.bind('Control-ButtonPress-1',
|
||||
treeCtrlRandom.bind('Control-ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
@Priv['selectMode'] = :toggle
|
||||
randomButton1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlRandom.bind('Shift-ButtonPress-1',
|
||||
treeCtrlRandom.bind('Shift-ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
@Priv['selectMode'] = :add
|
||||
randomButton1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlRandom.bind('ButtonPress-1',
|
||||
treeCtrlRandom.bind('ButtonPress-1',
|
||||
proc{|w, x, y|
|
||||
@Priv['selectMode'] = :set
|
||||
randomButton1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlRandom.bind('Button1-Motion',
|
||||
treeCtrlRandom.bind('Button1-Motion',
|
||||
proc{|w, x, y|
|
||||
randomMotion1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlRandom.bind('Button1-Leave',
|
||||
treeCtrlRandom.bind('Button1-Leave',
|
||||
proc{|w, x, y|
|
||||
randomLeave1(w, x, y)
|
||||
Tk.callback_break
|
||||
}, '%W %x %y')
|
||||
|
||||
treeCtrlRandom.bind('ButtonRelease-1',
|
||||
treeCtrlRandom.bind('ButtonRelease-1',
|
||||
proc{|w, x, y|
|
||||
randomRelease1(w, x, y)
|
||||
Tk.callback_break
|
||||
|
|
@ -363,7 +363,7 @@ def randomRelease1(t, x, y)
|
|||
t.selection_modify('', @Priv[:drop])
|
||||
t[:cursor] = ''
|
||||
if @Priv[:drop] != ''
|
||||
randomDrop(t, @Priv[:drop], @Priv.list_element(:selection),
|
||||
randomDrop(t, @Priv[:drop], @Priv.list_element(:selection),
|
||||
@Priv[:drop, :pos])
|
||||
end
|
||||
end
|
||||
|
|
@ -479,7 +479,7 @@ def randomAutoScanCheck(t, x, y)
|
|||
when 'drag', 'marquee'
|
||||
randomMotion(t, x, y)
|
||||
end
|
||||
@Priv[:autoscan, :afterId, t] =
|
||||
@Priv[:autoscan, :afterId, t] =
|
||||
Tk.after(delay, proc{ randomAutoScanCheckAux(t) })
|
||||
end
|
||||
return
|
||||
|
|
@ -502,7 +502,7 @@ def demoRandom2(t)
|
|||
|
||||
init_pics('mac-*')
|
||||
|
||||
t.configure(:openbuttonimage=>@images['mac-collapse'],
|
||||
:closedbuttonimage=>@images['mac-expand'],
|
||||
t.configure(:openbuttonimage=>@images['mac-collapse'],
|
||||
:closedbuttonimage=>@images['mac-expand'],
|
||||
:showlines=>false)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ def demoInternetOptions (t)
|
|||
|
||||
height = t.font.metrics(:linespace) + 2
|
||||
height = 18 if height < 18
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:browse)
|
||||
|
||||
init_pics('internet-*')
|
||||
|
|
@ -19,14 +19,14 @@ def demoInternetOptions (t)
|
|||
t.state_define('on')
|
||||
|
||||
t.element_create('e1', :image, :image=>[
|
||||
@images['internet-check-on'], ['check', 'on'],
|
||||
@images['internet-check-off'], ['check'],
|
||||
@images['internet-radio-on'], ['radio', 'on'],
|
||||
@images['internet-check-on'], ['check', 'on'],
|
||||
@images['internet-check-off'], ['check'],
|
||||
@images['internet-radio-on'], ['radio', 'on'],
|
||||
@images['internet-radio-off'], ['radio']
|
||||
])
|
||||
t.element_create('e2', :text,
|
||||
t.element_create('e2', :text,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('e3', :rect, :showfocus=>true,
|
||||
t.element_create('e3', :rect, :showfocus=>true,
|
||||
:fill=>[@SystemHighlight, ['selected', 'focus']])
|
||||
|
||||
s = t.style_create('s1')
|
||||
|
|
@ -38,18 +38,18 @@ def demoInternetOptions (t)
|
|||
parentList = [:root, '', '', '', '', '', '']
|
||||
parent = :root
|
||||
[
|
||||
[0, :print, "Printing", "", ""],
|
||||
[1, :off, "Print background colors and images", "o1", ""],
|
||||
[0, :search, "Search from Address bar", "", ""],
|
||||
[1, :search, "When searching", "", ""],
|
||||
[2, :off, "Display results, and go to the most likely sites",
|
||||
"o2", "r1"],
|
||||
[2, :off, "Do not search from the Address bar", "o3", "r1"],
|
||||
[2, :off, "Just display the results in the main window",
|
||||
[0, :print, "Printing", "", ""],
|
||||
[1, :off, "Print background colors and images", "o1", ""],
|
||||
[0, :search, "Search from Address bar", "", ""],
|
||||
[1, :search, "When searching", "", ""],
|
||||
[2, :off, "Display results, and go to the most likely sites",
|
||||
"o2", "r1"],
|
||||
[2, :off, "Do not search from the Address bar", "o3", "r1"],
|
||||
[2, :off, "Just display the results in the main window",
|
||||
"o4", "r1"],
|
||||
[2, :on, "Just go to the most likely site", "o5", "r1"],
|
||||
[0, :security, "Security", "", ""],
|
||||
[1, :on, "Check for publisher's certificate revocation", "o5", ""],
|
||||
[2, :on, "Just go to the most likely site", "o5", "r1"],
|
||||
[0, :security, "Security", "", ""],
|
||||
[1, :on, "Check for publisher's certificate revocation", "o5", ""],
|
||||
[1, :off, "Check for server certificate revocation (requires restart)",
|
||||
"o6", ""]
|
||||
].each{|depth, setting, text, option, group|
|
||||
|
|
@ -73,7 +73,7 @@ def demoInternetOptions (t)
|
|||
t.item_state_set(item, 'radio')
|
||||
end
|
||||
else
|
||||
t.item_element_configure(item, 0, 'e1',
|
||||
t.item_element_configure(item, 0, 'e1',
|
||||
:image=>@images["internet-#{setting}"])
|
||||
end
|
||||
t.item_lastchild(parentList[depth], item)
|
||||
|
|
@ -146,7 +146,7 @@ end
|
|||
def demoInternetOptions_2(t)
|
||||
height = t.font.metrics(:linespace) + 2
|
||||
height = 18 if height < 18
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
|
||||
:itemheight=>height, :selectmode=>:browse)
|
||||
|
||||
init_pics('internet-*')
|
||||
|
|
@ -154,9 +154,9 @@ def demoInternetOptions_2(t)
|
|||
t.column_configure(0, :text=>'Internet Options')
|
||||
|
||||
t.element_create('e1', :image)
|
||||
t.element_create('e2', :text,
|
||||
t.element_create('e2', :text,
|
||||
:fill=>[@SystemHighlightText, ['selected', 'focus']])
|
||||
t.element_create('e3', :rect, :showfocus=>true,
|
||||
t.element_create('e3', :rect, :showfocus=>true,
|
||||
:fill=>[@SystemHighlight, ['selected', 'focus']])
|
||||
|
||||
s = t.style_create('s1')
|
||||
|
|
@ -168,18 +168,18 @@ def demoInternetOptions_2(t)
|
|||
parentList = [:root, '', '', '', '', '', '']
|
||||
parent = :root
|
||||
[
|
||||
[0, :print, "Printing", "", ""],
|
||||
[1, :off, "Print background colors and images", "o1", ""],
|
||||
[0, :search, "Search from Address bar", "", ""],
|
||||
[1, :search, "When searching", "", ""],
|
||||
[2, :off, "Display results, and go to the most likely sites",
|
||||
"o2", "r1"],
|
||||
[2, :off, "Do not search from the Address bar", "o3", "r1"],
|
||||
[2, :off, "Just display the results in the main window",
|
||||
[0, :print, "Printing", "", ""],
|
||||
[1, :off, "Print background colors and images", "o1", ""],
|
||||
[0, :search, "Search from Address bar", "", ""],
|
||||
[1, :search, "When searching", "", ""],
|
||||
[2, :off, "Display results, and go to the most likely sites",
|
||||
"o2", "r1"],
|
||||
[2, :off, "Do not search from the Address bar", "o3", "r1"],
|
||||
[2, :off, "Just display the results in the main window",
|
||||
"o4", "r1"],
|
||||
[2, :on, "Just go to the most likely site", "o5", "r1"],
|
||||
[0, :security, "Security", "", ""],
|
||||
[1, :on, "Check for publisher's certificate revocation", "o5", ""],
|
||||
[2, :on, "Just go to the most likely site", "o5", "r1"],
|
||||
[0, :security, "Security", "", ""],
|
||||
[1, :on, "Check for publisher's certificate revocation", "o5", ""],
|
||||
[1, :off, "Check for server certificate revocation (requires restart)",
|
||||
"o6", ""]
|
||||
].each{|depth, setting, text, option, group|
|
||||
|
|
@ -201,7 +201,7 @@ def demoInternetOptions_2(t)
|
|||
t.item_element_configure(item, 0, 'e1', :image=>img)
|
||||
end
|
||||
else
|
||||
t.item_element_configure(item, 0, 'e1',
|
||||
t.item_element_configure(item, 0, 'e1',
|
||||
:image=>@images["internet-#{setting}"])
|
||||
end
|
||||
t.item_lastchild(parentList[depth], item)
|
||||
|
|
@ -256,16 +256,16 @@ def optionButton1_2(w, x, y)
|
|||
else
|
||||
setting = :on
|
||||
end
|
||||
w.item_element_configure(item, 0, 'e1',
|
||||
w.item_element_configure(item, 0, 'e1',
|
||||
:image=>@images["internet-check-#{setting}"])
|
||||
@Option[:setting, item] = setting
|
||||
else
|
||||
# a radiobutton
|
||||
current = @Option[:current, group]
|
||||
return if current == item.to_s
|
||||
w.item_element_configure(current, 0, 'e1',
|
||||
w.item_element_configure(current, 0, 'e1',
|
||||
:image=>@images["internet-radio-off"])
|
||||
w.item_element_configure(item, 0, 'e1',
|
||||
w.item_element_configure(item, 0, 'e1',
|
||||
:image=>@images["internet-radio-on"])
|
||||
@Option[:setting, item] = :on
|
||||
@Option[:current, group] = item
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue