2005-04-09 05:27:54 -04:00
|
|
|
#
|
|
|
|
# kroc.rb
|
|
|
|
#
|
|
|
|
# based on:
|
|
|
|
# >> kroc.tcl - Copyright (C) 2004 David Zolli <kroc@kroc.tk>
|
|
|
|
#
|
|
|
|
|
2005-11-25 02:12:58 -05:00
|
|
|
imgdir = File.join(File.dirname(__FILE__), 'kroc', 'kroc')
|
2005-04-09 05:27:54 -04:00
|
|
|
$images = Tk::Tile.load_images(imgdir, '*.gif')
|
|
|
|
|
2005-06-07 05:04:18 -04:00
|
|
|
if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0
|
|
|
|
$TNotebook_Tab = Tk::Tile::TNotebook.style('Tab')
|
|
|
|
else
|
|
|
|
$TNotebook_Tab = 'Tab.TNotebook'
|
|
|
|
end
|
|
|
|
|
2005-04-09 05:27:54 -04:00
|
|
|
def kroc_rb_settings
|
|
|
|
# Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F',
|
|
|
|
# :troughcolor=>'#F8C278', :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F',
|
|
|
|
# :troughcolor=>'#F8C278', :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.default('.', :background=>'#FCB64F',
|
|
|
|
# :troughcolor=>'#F8C278', :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.default(nil, :background=>'#FCB64F',
|
|
|
|
# :troughcolor=>'#F8C278', :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278',
|
|
|
|
:borderwidth=>1)
|
|
|
|
# Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default,
|
|
|
|
# :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default,
|
|
|
|
# :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default,
|
|
|
|
# :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default,
|
|
|
|
# :borderwidth=>1)
|
|
|
|
# or
|
|
|
|
Tk::Tile::Style.default(:font=>Tk::Tile::Font::Default, :borderwidth=>1)
|
|
|
|
|
|
|
|
# Tk::Tile::Style.map(TkRoot, :background=>[:active, '#694418'])
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.map(Tk.root, :background=>[:active, '#694418'])
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.map('.', :background=>[:active, '#694418'])
|
|
|
|
# or
|
|
|
|
# Tk::Tile::Style.map(nil, :background=>[:active, '#694418'])
|
|
|
|
# or
|
|
|
|
Tk::Tile::Style.map(:background=>[:active, '#694418'])
|
2005-06-07 01:11:55 -04:00
|
|
|
Tk::Tile::Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB'])
|
2005-04-09 05:27:54 -04:00
|
|
|
|
|
|
|
# Tk::Tile::Style.default('TButton', :padding=>[10,4])
|
|
|
|
Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4])
|
|
|
|
|
|
|
|
# Tk::Tile::Style.default('TNotebook.Tab',
|
2005-06-07 05:04:18 -04:00
|
|
|
Tk::Tile::Style.default($TNotebook_Tab,
|
2005-04-09 05:27:54 -04:00
|
|
|
:padding=>[10, 3], :font=>Tk::Tile::Font::Default)
|
|
|
|
# Tk::Tile::Style.map('TNotebook.Tab',
|
2005-06-07 05:04:18 -04:00
|
|
|
Tk::Tile::Style.map($TNotebook_Tab,
|
2005-04-09 05:27:54 -04:00
|
|
|
:background=>[:selected, '#FCB64F', '', '#FFE6BA'],
|
|
|
|
:foreground=>['', 'black'],
|
|
|
|
:padding=>[:selected, [10, 6, 10, 3]])
|
|
|
|
|
|
|
|
# Tk::Tile::Style.map('TScrollbar',
|
|
|
|
Tk::Tile::Style.map(Tk::Tile::TScrollbar,
|
|
|
|
:background=>[:pressed, '#694418'],
|
|
|
|
:arrowcolor=>[:pressed, '#FEF7CB'],
|
|
|
|
:relief=>[:pressed, :sunken])
|
|
|
|
|
|
|
|
# Tk::Tile::Style.layout('Vertical.TScrollbar',
|
|
|
|
Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar),
|
|
|
|
['Scrollbar.trough', {:children=>[
|
|
|
|
'Scrollbar.uparrow', {:side=>:top},
|
|
|
|
'Scrollbar.downarrow', {:side=>:bottom},
|
|
|
|
'Scrollbar.uparrow', {:side=>:bottom},
|
|
|
|
'Scrollbar.thumb', {:side=>:top, :expand=>true}
|
|
|
|
]}
|
|
|
|
])
|
|
|
|
|
|
|
|
# Tk::Tile::Style.layout('Horizontal.TScrollbar',
|
|
|
|
Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar),
|
|
|
|
['Scrollbar.trough', {:children=>[
|
|
|
|
'Scrollbar.leftarrow', {:side=>:left},
|
|
|
|
'Scrollbar.rightarrow', {:side=>:right},
|
|
|
|
'Scrollbar.leftarrow', {:side=>:right},
|
|
|
|
'Scrollbar.thumb', {:side=>:left, :expand=>true}
|
|
|
|
]}
|
|
|
|
])
|
|
|
|
|
|
|
|
#
|
|
|
|
# Elements:
|
|
|
|
#
|
2005-06-07 01:11:55 -04:00
|
|
|
if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0
|
|
|
|
|
2005-11-25 02:12:58 -05:00
|
|
|
Tk::Tile::Style.element_create('Button.button',
|
|
|
|
:image, $images['button-n'],
|
2005-06-07 01:11:55 -04:00
|
|
|
:map=>[
|
|
|
|
:pressed, $images['button-p'],
|
|
|
|
:active, $images['button-h'],
|
|
|
|
], :border=>3, :sticky=>:ew)
|
|
|
|
|
2005-11-25 02:12:58 -05:00
|
|
|
Tk::Tile::Style.element_create('Checkbutton.indicator',
|
|
|
|
:image, $images['check-nu'],
|
2005-06-07 01:11:55 -04:00
|
|
|
:map=>[
|
2005-11-25 02:12:58 -05:00
|
|
|
[:pressed, :selected],$images['check-nc'],
|
|
|
|
:pressed, $images['check-nu'],
|
|
|
|
[:active, :selected], $images['check-hc'],
|
|
|
|
:active, $images['check-hu'],
|
|
|
|
:selected, $images['check-nc'],
|
2005-06-07 01:11:55 -04:00
|
|
|
], :sticky=>:w)
|
|
|
|
|
2005-11-25 02:12:58 -05:00
|
|
|
Tk::Tile::Style.element_create('Radiobutton.indicator',
|
|
|
|
:image, $images['radio-nu'],
|
2005-06-07 01:11:55 -04:00
|
|
|
:map=>[
|
2005-11-25 02:12:58 -05:00
|
|
|
[:pressed, :selected],$images['radio-nc'],
|
|
|
|
:pressed, $images['radio-nu'],
|
|
|
|
[:active, :selected], $images['radio-hc'],
|
|
|
|
:active, $images['radio-hu'],
|
|
|
|
:selected, $images['radio-nc'],
|
2005-06-07 01:11:55 -04:00
|
|
|
], :sticky=>:w)
|
|
|
|
|
|
|
|
else # tile 0.4 or earlier
|
|
|
|
|
|
|
|
Tk::Tile::Style.element_create('Button.button', :pixmap,
|
|
|
|
:images=>[
|
|
|
|
:pressed, $images['button-p'],
|
|
|
|
:active, $images['button-h'],
|
|
|
|
'', $images['button-n']
|
|
|
|
], :border=>3, :tiling=>:tile)
|
|
|
|
|
|
|
|
Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap,
|
|
|
|
:images=>[
|
2005-11-25 02:12:58 -05:00
|
|
|
[:pressed, :selected],$images['check-nc'],
|
|
|
|
:pressed, $images['check-nu'],
|
|
|
|
[:active, :selected], $images['check-hc'],
|
|
|
|
:active, $images['check-hu'],
|
|
|
|
:selected, $images['check-nc'],
|
|
|
|
'', $images['check-nu'],
|
2005-06-07 01:11:55 -04:00
|
|
|
], :tiling=>:fixed)
|
|
|
|
|
|
|
|
Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap,
|
|
|
|
:images=>[
|
2005-11-25 02:12:58 -05:00
|
|
|
[:pressed, :selected],$images['radio-nc'],
|
|
|
|
:pressed, $images['radio-nu'],
|
|
|
|
[:active, :selected], $images['radio-hc'],
|
|
|
|
:active, $images['radio-hu'],
|
|
|
|
:selected, $images['radio-nc'],
|
|
|
|
'', $images['radio-nu'],
|
2005-06-07 01:11:55 -04:00
|
|
|
], :tiling=>:fixed)
|
|
|
|
|
|
|
|
end
|
2005-04-09 05:27:54 -04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Settings:
|
|
|
|
#
|
|
|
|
# Tk::Tile::Style.layout(Tk::Tile::TButton,
|
|
|
|
Tk::Tile::Style.layout('TButton', [
|
|
|
|
'Button.button', {:children=>[
|
|
|
|
'Button.focus', {:children=>[
|
|
|
|
'Button.padding', {:children=>[
|
|
|
|
'Button.label', {:expand=>true, :sticky=>''}
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
])
|
|
|
|
|
|
|
|
# Tk::Tile::Style.layout(Tk::Tile::TCheckbutton,
|
|
|
|
Tk::Tile::Style.layout('TCheckbutton', [
|
2005-06-07 05:04:18 -04:00
|
|
|
'Checkbutton.background', # this is not needed in tile 0.5 or later
|
2005-04-09 05:27:54 -04:00
|
|
|
'Checkbutton.border', {:children=>[
|
|
|
|
'Checkbutton.padding', {:children=>[
|
|
|
|
'Checkbutton.indicator', {:side=>:left},
|
|
|
|
'Checkbutton.focus', {:side=>:left, :children=>[
|
|
|
|
'Checkbutton.label'
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
])
|
|
|
|
|
|
|
|
# Tk::Tile::Style.layout(Tk::Tile::TRadiobutton,
|
|
|
|
Tk::Tile::Style.layout('TRadiobutton', [
|
2005-06-07 05:04:18 -04:00
|
|
|
'Radiobutton.background', # this is not needed in tile 0.5 or later
|
2005-04-09 05:27:54 -04:00
|
|
|
'Radiobutton.border', {:children=>[
|
|
|
|
'Radiobutton.padding', {:children=>[
|
|
|
|
'Radiobutton.indicator', {:side=>:left},
|
|
|
|
'Radiobutton.focus', {:expand=>true, :sticky=>:w, :children=>[
|
|
|
|
'Radiobutton.label', {:side=>:right, :expand=>true}
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
])
|
|
|
|
end
|
|
|
|
|
|
|
|
Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt',
|
|
|
|
:settings=>proc{ kroc_rb_settings() })
|