summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-07 09:04:18 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-07 09:04:18 +0000
commit15dfe8eee69ce3bc065be8f0cc69963c1404202d (patch)
tree4c616d06eb2b35d9379d4600e987020114d4d63e /ext
parent1049fd5f6401a3769aad4fd60ab9dac8350c85bb (diff)
* 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
Diffstat (limited to 'ext')
-rw-r--r--ext/tk/ChangeLog.tkextlib4
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc.rb12
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc.tcl22
3 files changed, 29 insertions, 9 deletions
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib
index 279dcc79be..dc04585985 100644
--- a/ext/tk/ChangeLog.tkextlib
+++ b/ext/tk/ChangeLog.tkextlib
@@ -1,5 +1,9 @@
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>
+
* sample/tkextlib/tile/themes/kroc.{rb,tcl}: support tile 0.5 or later.
("pixmap" element constructor replaced by "image")
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.rb b/ext/tk/sample/tkextlib/tile/themes/kroc.rb
index 7886848e40..ab782b8c36 100644
--- a/ext/tk/sample/tkextlib/tile/themes/kroc.rb
+++ b/ext/tk/sample/tkextlib/tile/themes/kroc.rb
@@ -8,6 +8,12 @@
imgdir = File.join(File.dirname(__FILE__), 'kroc')
$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
# Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F',
# :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('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)
# 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'],
:foreground=>['', 'black'],
: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('TCheckbutton', [
+ 'Checkbutton.background', # this is not needed in tile 0.5 or later
'Checkbutton.border', {:children=>[
'Checkbutton.padding', {:children=>[
'Checkbutton.indicator', {:side=>:left},
@@ -174,6 +181,7 @@ def kroc_rb_settings
# Tk::Tile::Style.layout(Tk::Tile::TRadiobutton,
Tk::Tile::Style.layout('TRadiobutton', [
+ 'Radiobutton.background', # this is not needed in tile 0.5 or later
'Radiobutton.border', {:children=>[
'Radiobutton.padding', {:children=>[
'Radiobutton.indicator', {:side=>:left},
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.tcl b/ext/tk/sample/tkextlib/tile/themes/kroc.tcl
index 29ff58d8ea..73548acef2 100644
--- a/ext/tk/sample/tkextlib/tile/themes/kroc.tcl
+++ b/ext/tk/sample/tkextlib/tile/themes/kroc.tcl
@@ -15,6 +15,12 @@ namespace eval tile::kroc {
set imgdir [file join [file dirname [info script]] kroc]
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 default . -background #FCB64F -troughcolor #F8C278 -borderwidth 1
@@ -24,8 +30,8 @@ namespace eval tile::kroc {
style default TButton -padding "10 4"
- style default TNotebook.Tab -padding {10 3} -font TkDefaultFont
- style map TNotebook.Tab \
+ style default $TNoteBook_Tab -padding {10 3} -font TkDefaultFont
+ style map $TNoteBook_Tab \
-background [list selected #FCB64F {} #FFE6BA] \
-foreground [list {} black] \
-padding [list selected {10 6 10 3}]
@@ -58,7 +64,7 @@ namespace eval tile::kroc {
# Elements:
#
if {[package vsatisfies [package provide tile] 0.5]} {
-
+
style element create Button.button image $Images(button-n) \
-map [list \
pressed $Images(button-p) \
@@ -82,9 +88,9 @@ namespace eval tile::kroc {
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) \
@@ -108,11 +114,11 @@ namespace eval tile::kroc {
selected $Images(radio-nc) \
{} $Images(radio-nu) \
] -tiling fixed
-
+
}
#
- # Settings:
+ # Settings: (*button.background is not needed in tile 0.5 or above)
#
style layout TButton {
Button.button -children {
@@ -126,6 +132,7 @@ namespace eval tile::kroc {
style layout TCheckbutton {
Checkbutton.border -children {
+ Checkbutton.background
Checkbutton.padding -children {
Checkbutton.indicator -side left
Checkbutton.focus -side left -children {
@@ -137,6 +144,7 @@ namespace eval tile::kroc {
style layout TRadiobutton {
Radiobutton.border -children {
+ Radiobutton.background
Radiobutton.padding -children {
Radiobutton.indicator -side left
Radiobutton.focus -expand true -sticky w -children {