mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
138b4c427c
if possible) * sample/tkextlib/treectrl/*.rb: some speed up... cache the result of version checking. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
76 lines
2.7 KiB
Ruby
76 lines
2.7 KiB
Ruby
#
|
|
# Demo: Bitmaps
|
|
#
|
|
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',
|
|
: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 $Version_1_1_OrLater
|
|
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 $Version_1_1_OrLater
|
|
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
|