mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
92 lines
2.5 KiB
Ruby
92 lines
2.5 KiB
Ruby
|
#
|
|||
|
# iconic button widget demo (called by 'widget')
|
|||
|
#
|
|||
|
|
|||
|
# toplevel widget <20><>¸<EFBFBD>ߤ<EFBFBD><DFA4><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if defined?($icon_demo) && $icon_demo
|
|||
|
$icon_demo.destroy
|
|||
|
$icon_demo = nil
|
|||
|
end
|
|||
|
|
|||
|
# demo <20>Ѥ<EFBFBD> toplevel widget <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$icon_demo = TkToplevel.new {|w|
|
|||
|
title("Iconic Button Demonstration")
|
|||
|
iconname("icon")
|
|||
|
positionWindow(w)
|
|||
|
}
|
|||
|
|
|||
|
# label <20><><EFBFBD><EFBFBD>
|
|||
|
msg = TkLabel.new($icon_demo) {
|
|||
|
font $font
|
|||
|
wraplength '5i'
|
|||
|
justify 'left'
|
|||
|
text "<EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><EFBFBD>ˤϥ饸<EFBFBD><EFBFBD><EFBFBD>ܥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD><EFBFBD>ܥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˥ӥåȥޥåפ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3 <20>Ĥ<EFBFBD><C4A4><EFBFBD>ˡ<EFBFBD><EFBFBD><F2BCA8A4>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><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<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD><C3A5>ܥ<EFBFBD><DCA5><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>"
|
|||
|
}
|
|||
|
msg.pack('side'=>'top')
|
|||
|
|
|||
|
# frame <20><><EFBFBD><EFBFBD>
|
|||
|
TkFrame.new($icon_demo) {|frame|
|
|||
|
TkButton.new(frame) {
|
|||
|
text 'λ<><CEBB>'
|
|||
|
command proc{
|
|||
|
tmppath = $icon_demo
|
|||
|
$icon_demo = nil
|
|||
|
tmppath.destroy
|
|||
|
}
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|||
|
|
|||
|
TkButton.new(frame) {
|
|||
|
text '<27><><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>'
|
|||
|
command proc{showCode 'icon'}
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|||
|
|
|||
|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
|||
|
|
|||
|
# image <20><><EFBFBD><EFBFBD>
|
|||
|
flagup = \
|
|||
|
TkBitmapImage.new('file'=>[$demo_dir,
|
|||
|
'images','flagup.bmp'].join(File::Separator),
|
|||
|
'maskfile'=>\
|
|||
|
[$demo_dir,'images','flagup.bmp'].join(File::Separator))
|
|||
|
flagdown = \
|
|||
|
TkBitmapImage.new('file'=>[$demo_dir,
|
|||
|
'images','flagdown.bmp'].join(File::Separator),
|
|||
|
'maskfile'=>\
|
|||
|
[$demo_dir,'images','flagdown.bmp'].join(File::Separator))
|
|||
|
|
|||
|
# <20>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
letters = TkVariable.new
|
|||
|
|
|||
|
# frame <20><><EFBFBD><EFBFBD>
|
|||
|
TkFrame.new($icon_demo, 'borderwidth'=>10){|w|
|
|||
|
TkFrame.new(w) {|f|
|
|||
|
TkRadioButton.new(f){
|
|||
|
bitmap '@' + [$demo_dir,'images','letters.bmp'].join(File::Separator)
|
|||
|
variable letters
|
|||
|
value 'full'
|
|||
|
}.pack('side'=>'top', 'expand'=>'yes')
|
|||
|
|
|||
|
TkRadioButton.new(f){
|
|||
|
bitmap '@' + [$demo_dir,'images','noletter.bmp'].join(File::Separator)
|
|||
|
variable letters
|
|||
|
value 'empty'
|
|||
|
}.pack('side'=>'top', 'expand'=>'yes')
|
|||
|
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'5m')
|
|||
|
|
|||
|
TkCheckButton.new(w) {
|
|||
|
image flagdown
|
|||
|
selectimage flagup
|
|||
|
indicatoron 0
|
|||
|
selectcolor self['background']
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'5m')
|
|||
|
|
|||
|
TkCheckButton.new(w) {
|
|||
|
bitmap '@' + [$demo_dir,'images','letters.bmp'].join(File::Separator)
|
|||
|
indicatoron 0
|
|||
|
selectcolor 'SeaGreen1'
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'5m')
|
|||
|
|
|||
|
}.pack('side'=>'top')
|
|||
|
|