1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/tk/sample/tkextlib/treectrl/bitmaps.rb
nagai 334325f72a * ext/tk/lib/tk.rb (_callback_entry_class?): add for checking whether
a class is available for a callback entry.
* ext/tk/lib/tk.rb (after_cancel): add Tk.after_cancel(afterID) method.
* ext/tk/lib/tk.rb (array2tk_list): change from private module method
  of TkComm to public module method.
* ext/tk/lib/tk.rb (cget): add check that slot argument is not empty string.
* ext/tk/lib/tk.rb (configinfo): ditto.
* ext/tk/lib/tk/itemconfig.rb (itemcget): add check that slot argument
  is not empty string.
* ext/tk/lib/tk/itemconfig.rb (itemconfiginfo): ditto.
* ext/tk/lib/tk/entry.rb: add TkEntry#icursor and icursor= (alias of
  cursor and cursor= method).
* ext/tk/lib/tk/font.rb: improve font treatment when the font name is
  empty string.
* ext/tk/lib/tk/variable.rb: add :variable, :window and :procedure type.
* ext/tk/lib/tk/variable.rb: improve treatment of array-type tkvariable.
* ext/tk/lib/tkextlib/blt.rb: add commands for zooming.
* ext/tk/lib/tkextlib/blt/*: bug fix.
* ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix and add methods
  to call TreeCtrl commands for bindings.
* ext/tk/sample/tkextlib/blt/*: new sample scritps.
* ext/tk/sample/tkextlib/treectrl/*: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-26 13:58:11 +00:00

75 lines
2.8 KiB
Ruby

#
# Demo: Bitmaps
#
def demoBitmaps(t)
if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
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',
:showheader=>false)
end
if $HasColumnCreate
t.column_create(:itembackground=>['gray90', []])
else
t.column_configure(0, :itembackground=>['gray90', []])
end
t.element_create('elemTxt', :text,
:fill=>[@SystemHighlightText, ['selected', 'focus']])
t.element_create('elemSelTxt', :rect, :showfocus=>true,
:fill=>[@SystemHighlight, ['selected', 'focus']])
t.element_create('elemSelBmp', :rect, :outlinewidth=>4,
:outline=>[@SystemHighlight, ['selected', 'focus']])
t.element_create('elemBmp', :bitmap,
:foreground=>[@SystemHighlight, ['selected', 'focus']],
:background=>'linen',
:bitmap=>['question' ['selected']])
s = t.style_create('STYLE', :orient=>:vertical)
t.style_elements(s, ['elemSelBmp', 'elemBmp', 'elemSelTxt', 'elemTxt'])
t.style_layout(s, 'elemSelBmp', :union=>'elemBmp', :ipadx=>6, :ipady=>6)
t.style_layout(s, 'elemBmp', :pady=>[0, 6], :expand=>:we)
t.style_layout(s, 'elemSelTxt', :union=>'elemTxt', :ipadx=>2)
t.style_layout(s, 'elemTxt', :expand=>:we)
# Set default item style
if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
t.defaultstyle = [s]
end
bitmap_names = %w(error gray75 gray50 gray25 gray12
hourglass info questhead question warning)
bitmap_names.each{|name|
i = t.item_create
unless (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
t.item_style_set(i, 0, s)
end
t.item_text(i, 0, name)
t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name)
t.item_lastchild(:root, i)
}
bitmap_names.each{|name|
i = t.item_create
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', ''],
:background=>['', ''])
else
t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name,
:foreground=>[
@SystemHighlight, ['selected', 'focus'],
'brown', []
],
:background=>['', []])
end
t.item_lastchild(:root, i)
}
end