1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/tk/sample/tkextlib/tile/themes/kroc.{rb,tcl}: also support tile 0.4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ocean 2005-06-07 09:04:18 +00:00
parent 1049fd5f64
commit 15dfe8eee6
3 changed files with 29 additions and 9 deletions

View file

@ -1,3 +1,7 @@
2005-06-07 ocean <ocean@ruby-lang.org>
* sample/tkextlib/tile/themes/kroc.{rb,tcl}: also support tile 0.4.
2005-06-07 ocean <ocean@ruby-lang.org> 2005-06-07 ocean <ocean@ruby-lang.org>
* sample/tkextlib/tile/themes/kroc.{rb,tcl}: support tile 0.5 or later. * sample/tkextlib/tile/themes/kroc.{rb,tcl}: support tile 0.5 or later.

View file

@ -8,6 +8,12 @@
imgdir = File.join(File.dirname(__FILE__), 'kroc') imgdir = File.join(File.dirname(__FILE__), 'kroc')
$images = Tk::Tile.load_images(imgdir, '*.gif') $images = Tk::Tile.load_images(imgdir, '*.gif')
if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0
$TNotebook_Tab = Tk::Tile::TNotebook.style('Tab')
else
$TNotebook_Tab = 'Tab.TNotebook'
end
def kroc_rb_settings def kroc_rb_settings
# Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F', # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F',
# :troughcolor=>'#F8C278', :borderwidth=>1) # :troughcolor=>'#F8C278', :borderwidth=>1)
@ -52,10 +58,10 @@ def kroc_rb_settings
Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4]) Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4])
# Tk::Tile::Style.default('TNotebook.Tab', # Tk::Tile::Style.default('TNotebook.Tab',
Tk::Tile::Style.default(Tk::Tile::TNotebook.style('Tab'), Tk::Tile::Style.default($TNotebook_Tab,
:padding=>[10, 3], :font=>Tk::Tile::Font::Default) :padding=>[10, 3], :font=>Tk::Tile::Font::Default)
# Tk::Tile::Style.map('TNotebook.Tab', # Tk::Tile::Style.map('TNotebook.Tab',
Tk::Tile::Style.map(Tk::Tile::TNotebook.style('Tab'), Tk::Tile::Style.map($TNotebook_Tab,
:background=>[:selected, '#FCB64F', '', '#FFE6BA'], :background=>[:selected, '#FCB64F', '', '#FFE6BA'],
:foreground=>['', 'black'], :foreground=>['', 'black'],
:padding=>[:selected, [10, 6, 10, 3]]) :padding=>[:selected, [10, 6, 10, 3]])
@ -162,6 +168,7 @@ def kroc_rb_settings
# Tk::Tile::Style.layout(Tk::Tile::TCheckbutton, # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton,
Tk::Tile::Style.layout('TCheckbutton', [ Tk::Tile::Style.layout('TCheckbutton', [
'Checkbutton.background', # this is not needed in tile 0.5 or later
'Checkbutton.border', {:children=>[ 'Checkbutton.border', {:children=>[
'Checkbutton.padding', {:children=>[ 'Checkbutton.padding', {:children=>[
'Checkbutton.indicator', {:side=>:left}, 'Checkbutton.indicator', {:side=>:left},
@ -174,6 +181,7 @@ def kroc_rb_settings
# Tk::Tile::Style.layout(Tk::Tile::TRadiobutton, # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton,
Tk::Tile::Style.layout('TRadiobutton', [ Tk::Tile::Style.layout('TRadiobutton', [
'Radiobutton.background', # this is not needed in tile 0.5 or later
'Radiobutton.border', {:children=>[ 'Radiobutton.border', {:children=>[
'Radiobutton.padding', {:children=>[ 'Radiobutton.padding', {:children=>[
'Radiobutton.indicator', {:side=>:left}, 'Radiobutton.indicator', {:side=>:left},

View file

@ -15,6 +15,12 @@ namespace eval tile::kroc {
set imgdir [file join [file dirname [info script]] kroc] set imgdir [file join [file dirname [info script]] kroc]
array set Images [tile::LoadImages $imgdir *.gif] array set Images [tile::LoadImages $imgdir *.gif]
if {[package vsatisfies [package provide tile] 0.5]} {
set TNoteBook_Tab TNotebook.Tab
} else {
set TNoteBook_Tab Tab.TNotebook
}
style theme create kroc -parent alt -settings { style theme create kroc -parent alt -settings {
style default . -background #FCB64F -troughcolor #F8C278 -borderwidth 1 style default . -background #FCB64F -troughcolor #F8C278 -borderwidth 1
@ -24,8 +30,8 @@ namespace eval tile::kroc {
style default TButton -padding "10 4" style default TButton -padding "10 4"
style default TNotebook.Tab -padding {10 3} -font TkDefaultFont style default $TNoteBook_Tab -padding {10 3} -font TkDefaultFont
style map TNotebook.Tab \ style map $TNoteBook_Tab \
-background [list selected #FCB64F {} #FFE6BA] \ -background [list selected #FCB64F {} #FFE6BA] \
-foreground [list {} black] \ -foreground [list {} black] \
-padding [list selected {10 6 10 3}] -padding [list selected {10 6 10 3}]
@ -112,7 +118,7 @@ namespace eval tile::kroc {
} }
# #
# Settings: # Settings: (*button.background is not needed in tile 0.5 or above)
# #
style layout TButton { style layout TButton {
Button.button -children { Button.button -children {
@ -126,6 +132,7 @@ namespace eval tile::kroc {
style layout TCheckbutton { style layout TCheckbutton {
Checkbutton.border -children { Checkbutton.border -children {
Checkbutton.background
Checkbutton.padding -children { Checkbutton.padding -children {
Checkbutton.indicator -side left Checkbutton.indicator -side left
Checkbutton.focus -side left -children { Checkbutton.focus -side left -children {
@ -137,6 +144,7 @@ namespace eval tile::kroc {
style layout TRadiobutton { style layout TRadiobutton {
Radiobutton.border -children { Radiobutton.border -children {
Radiobutton.background
Radiobutton.padding -children { Radiobutton.padding -children {
Radiobutton.indicator -side left Radiobutton.indicator -side left
Radiobutton.focus -expand true -sticky w -children { Radiobutton.focus -expand true -sticky w -children {