diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-07 05:12:26 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-07 05:12:26 +0000 |
commit | 64e3a162117a3ebc1a6e13361d32786031d80f0d (patch) | |
tree | bff497e546ec40677a7193d6dc74c4f8a4e17bd8 /ext/tk/sample | |
parent | 590a5218cae2a2b52d732576306090b4bb8ffe93 (diff) | |
download | ruby-64e3a162117a3ebc1a6e13361d32786031d80f0d.tar.gz ruby-64e3a162117a3ebc1a6e13361d32786031d80f0d.tar.xz ruby-64e3a162117a3ebc1a6e13361d32786031d80f0d.zip |
* ext/tk/sample/tkextlib/tile/themes/kroc.{rb,tcl}: support tile 0.5 or later.
("pixmap" element constructor replaced by "image")
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample')
-rw-r--r-- | ext/tk/sample/tkextlib/tile/themes/kroc.rb | 84 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tile/themes/kroc.tcl | 79 |
2 files changed, 111 insertions, 52 deletions
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.rb b/ext/tk/sample/tkextlib/tile/themes/kroc.rb index a4b227947..7886848e4 100644 --- a/ext/tk/sample/tkextlib/tile/themes/kroc.rb +++ b/ext/tk/sample/tkextlib/tile/themes/kroc.rb @@ -46,7 +46,7 @@ def kroc_rb_settings # Tk::Tile::Style.map(nil, :background=>[:active, '#694418']) # or Tk::Tile::Style.map(:background=>[:active, '#694418']) - Tk::Tile::Style.map(:foreground=>[:disabled, 'B2B2B2', :active, '#FFE7CB']) + Tk::Tile::Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB']) # Tk::Tile::Style.default('TButton', :padding=>[10,4]) Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4]) @@ -89,32 +89,62 @@ def kroc_rb_settings # # Elements: # - 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=>[ - [: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'], - ], :tiling=>:fixed) - - Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, - :images=>[ - [: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'], - ], :tiling=>:fixed) + if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0 + + Tk::Tile::Style.element_create('Button.button', :image, $images['button-n'], + :map=>[ + :pressed, $images['button-p'], + :active, $images['button-h'], + ], :border=>3, :sticky=>:ew) + + Tk::Tile::Style.element_create('Checkbutton.indicator', :image, $images['check-nu'], + :map=>[ + [:pressed, :selected], $images['check-nc'], + :pressed, $images['check-nu'], + [:active, :selected], $images['check-hc'], + :active, $images['check-hu'], + :selected, $images['check-nc'], + ], :sticky=>:w) + + Tk::Tile::Style.element_create('Radiobutton.indicator', :image, $images['radio-nu'], + :map=>[ + [:pressed, :selected], $images['radio-nc'], + :pressed, $images['radio-nu'], + [:active, :selected], $images['radio-hc'], + :active, $images['radio-hu'], + :selected, $images['radio-nc'], + ], :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=>[ + [: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'], + ], :tiling=>:fixed) + + Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, + :images=>[ + [: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'], + ], :tiling=>:fixed) + + end # # Settings: diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.tcl b/ext/tk/sample/tkextlib/tile/themes/kroc.tcl index 0f92674a2..29ff58d8e 100644 --- a/ext/tk/sample/tkextlib/tile/themes/kroc.tcl +++ b/ext/tk/sample/tkextlib/tile/themes/kroc.tcl @@ -57,31 +57,60 @@ namespace eval tile::kroc { # # Elements: # - style element create Button.button pixmap -images [list \ - pressed $Images(button-p) \ - active $Images(button-h) \ - {} $Images(button-n) \ - ] -border 3 -tiling tile - - style element create Checkbutton.indicator pixmap -images [list \ - {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) \ - ] -tiling fixed - - style element create Radiobutton.indicator pixmap -images [list \ - {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) \ - ] -tiling fixed - - + if {[package vsatisfies [package provide tile] 0.5]} { + + style element create Button.button image $Images(button-n) \ + -map [list \ + pressed $Images(button-p) \ + active $Images(button-h) \ + ] -border 3 -sticky ew + + style element create Checkbutton.indicator image $Images(check-nu) \ + -map [list \ + {pressed selected} $Images(check-nc) \ + pressed $Images(check-nu) \ + {active selected} $Images(check-hc) \ + active $Images(check-hu) \ + selected $Images(check-nc) \ + ] -sticky w + + style element create Radiobutton.indicator image $Images(radio-nu) \ + -map [list \ + {pressed selected} $Images(radio-nc) \ + pressed $Images(radio-nu) \ + {active selected} $Images(radio-hc) \ + active $Images(radio-hu) \ + selected $Images(radio-nc) \ + ] -sticky w + + } else { + + style element create Button.button pixmap -images [list \ + pressed $Images(button-p) \ + active $Images(button-h) \ + {} $Images(button-n) \ + ] -border 3 -tiling tile + + style element create Checkbutton.indicator pixmap -images [list \ + {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) \ + ] -tiling fixed + + style element create Radiobutton.indicator pixmap -images [list \ + {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) \ + ] -tiling fixed + + } + # # Settings: # |