diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-07 05:11:55 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-07 05:11:55 +0000 |
commit | 7eef190796511c58756e58d4e3666f3a78523f5c (patch) | |
tree | fcc29f1bd284b4175e9b3e80b52ca9f7dc417fb2 /ext/tk/sample/tkextlib | |
parent | 261f8e0f734e7114622508057a291ac410a672a2 (diff) | |
download | ruby-7eef190796511c58756e58d4e3666f3a78523f5c.tar.gz |
* sample/tkextlib/tile/themes/kroc.{rb,tcl}: support tile 0.5 or later.
("pixmap" element constructor replaced by "image")
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/tkextlib')
-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 a4b2279470..7886848e40 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 0f92674a24..29ff58d8ea 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: # |