summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2006-12-18 19:33:10 (GMT)
committerjenglish <jenglish@flightlab.com>2006-12-18 19:33:10 (GMT)
commitfb835826dd21c44784539b40e590866ffb89bd93 (patch)
treeb0a6aa116ab0a8f8f7eefc79d7816eb5eb6e5c58 /library
parent16cde6f4aaf0d168843b71218b3b76cad1f1da4c (diff)
downloadtk-fb835826dd21c44784539b40e590866ffb89bd93.zip
tk-fb835826dd21c44784539b40e590866ffb89bd93.tar.gz
tk-fb835826dd21c44784539b40e590866ffb89bd93.tar.bz2
Big batch of ttk::treeview improvements:
Added column '-stretch' and '-minwidth' options. Improved column drag and resize behavior. Added horizontal scrolling [#1518650]. Row height and child indent specifiable on Treeview style. Decreased default row height, no default -padding. Use correct heading height [#1163349]. Apply tag settings to tree item as well as to data columns [NOTE: 'tag configure' still buggy]. Fix off-by-one condition when moving nodes forward [#1618142] Prevent overscroll ([#1173434]) Treeview style settings specified separately in each theme. Added disclosure triangle element in aqua theme.
Diffstat (limited to 'library')
-rw-r--r--library/ttk/altTheme.tcl17
-rw-r--r--library/ttk/aquaTheme.tcl13
-rw-r--r--library/ttk/clamTheme.tcl19
-rw-r--r--library/ttk/classicTheme.tcl14
-rw-r--r--library/ttk/defaults.tcl18
-rw-r--r--library/ttk/treeview.tcl47
-rw-r--r--library/ttk/winTheme.tcl16
-rw-r--r--library/ttk/xpTheme.tcl16
8 files changed, 108 insertions, 52 deletions
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl
index b1bbc65..62a0607 100644
--- a/library/ttk/altTheme.tcl
+++ b/library/ttk/altTheme.tcl
@@ -1,5 +1,5 @@
#
-# $Id: altTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
+# $Id: altTheme.tcl,v 1.3 2006/12/18 19:33:14 jenglish Exp $
#
# Ttk widget set: Alternate theme
#
@@ -9,6 +9,7 @@ namespace eval ttk::theme::alt {
variable colors
array set colors {
-frame "#d9d9d9"
+ -window "#ffffff"
-darker "#c3c3c3"
-activebg "#ececec"
-disabledfg "#a3a3a3"
@@ -77,6 +78,20 @@ namespace eval ttk::theme::alt {
-expand [list selected {2 2 1 0}] \
;
+ # Treeview:
+ style configure Heading -font TkHeadingFont -relief raised
+ style configure Row -background $colors(-window)
+ style configure Cell -background $colors(-window)
+ style map Row \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+ style map Cell \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+ style map Item \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
style configure TScale \
-groovewidth 4 -troughrelief sunken \
-sliderwidth raised -borderwidth 2
diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl
index 4b4ad5e..f0f63aa 100644
--- a/library/ttk/aquaTheme.tcl
+++ b/library/ttk/aquaTheme.tcl
@@ -1,5 +1,5 @@
#
-# $Id: aquaTheme.tcl,v 1.1 2006/10/31 01:42:26 hobbs Exp $
+# $Id: aquaTheme.tcl,v 1.2 2006/12/18 19:33:14 jenglish Exp $
#
# Ttk widget set: Aqua theme (OSX native look and feel)
#
@@ -38,6 +38,16 @@ namespace eval ttk {
style configure TNotebook -tabposition n -padding {20 12}
style configure TNotebook.Tab -padding {10 2 10 2}
+ # Treeview:
+ style configure Treeview -rowheight 18
+ style configure Heading -font TkHeadingFont
+ style map Row -background [list \
+ {selected background} "#c3c3c3" selected SystemHighlight] ;
+ style map Cell -foreground [list \
+ {selected background} "#000000" selected SystemHighlightText] ;
+ style map Item -foreground [list \
+ {selected background} "#000000" selected SystemHighlightText] ;
+
# Enable animation for ttk::progressbar widget:
style configure TProgressbar -period 100 -maxphase 255
@@ -56,5 +66,6 @@ namespace eval ttk {
#
style configure TLabelframe \
-labeloutside true -labelmargins {14 0 14 4}
+
}
}
diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl
index 9061006..930ec97 100644
--- a/library/ttk/clamTheme.tcl
+++ b/library/ttk/clamTheme.tcl
@@ -1,5 +1,5 @@
#
-# $Id: clamTheme.tcl,v 1.3 2006/12/13 17:06:32 jenglish Exp $
+# $Id: clamTheme.tcl,v 1.4 2006/12/18 19:33:14 jenglish Exp $
#
# "Clam" theme.
#
@@ -10,8 +10,8 @@ namespace eval ttk::theme::clam {
variable colors
array set colors {
-disabledfg "#999999"
-
-frame "#dcdad5"
+ -window "#ffffff"
-dark "#cfcdc8"
-darker "#bab5ab"
-darkest "#9e9a91"
@@ -111,6 +111,21 @@ namespace eval ttk::theme::clam {
-lightcolor [list selected $colors(-lighter) {} $colors(-dark)] \
;
+ # Treeview:
+ ttk::style configure Heading \
+ -font TkHeadingFont -relief raised -padding {3}
+ ttk::style configure Row -background $colors(-window)
+ ttk::style configure Cell -background $colors(-window)
+ ttk::style map Row \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+ ttk::style map Cell \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+ ttk::style map Item \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
ttk::style configure TLabelframe \
-labeloutside true -labelmargins {0 0 0 4} \
-borderwidth 2 -relief raised
diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl
index 5e29787..2061b4e 100644
--- a/library/ttk/classicTheme.tcl
+++ b/library/ttk/classicTheme.tcl
@@ -1,5 +1,5 @@
#
-# $Id: classicTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
+# $Id: classicTheme.tcl,v 1.3 2006/12/18 19:33:14 jenglish Exp $
#
# "classic" Tk theme.
#
@@ -10,6 +10,7 @@ namespace eval ttk::theme::classic {
variable colors; array set colors {
-frame "#d9d9d9"
+ -window "#ffffff"
-activebg "#ececec"
-troughbg "#c3c3c3"
-selectbg "#c3c3c3"
@@ -84,6 +85,17 @@ namespace eval ttk::theme::classic {
-background $colors(-troughbg)
style map TNotebook.Tab -background [list selected $colors(-frame)]
+ # Treeview:
+ ttk::style configure Heading -font TkHeadingFont -relief raised
+ ttk::style configure Row -background $colors(-window)
+ ttk::style configure Cell -background $colors(-window)
+ ttk::style map Row \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+ ttk::style map Cell \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
#
# Toolbar buttons:
#
diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl
index 0869fd3..d076d8e 100644
--- a/library/ttk/defaults.tcl
+++ b/library/ttk/defaults.tcl
@@ -1,5 +1,5 @@
#
-# $Id: defaults.tcl,v 1.3 2006/12/13 17:06:32 jenglish Exp $
+# $Id: defaults.tcl,v 1.4 2006/12/18 19:33:14 jenglish Exp $
#
# Settings for default theme.
#
@@ -8,6 +8,7 @@ namespace eval ttk::theme::default {
variable colors
array set colors {
-frame "#d9d9d9"
+ -window "#ffffff"
-activebg "#ececec"
-selectbg "#4a6984"
-selectfg "#ffffff"
@@ -80,6 +81,21 @@ namespace eval ttk::theme::default {
ttk::style map TNotebook.Tab \
-background [list selected $colors(-frame)]
+ # Treeview.
+ #
+ ttk::style configure Heading -font TkHeadingFont -relief raised
+ ttk::style configure Row -background $colors(-window)
+ ttk::style configure Cell -background $colors(-window)
+ ttk::style map Row \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+ ttk::style map Cell \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+ ttk::style map Item \
+ -background [list selected $colors(-selectbg)] \
+ -foreground [list selected $colors(-selectfg)] ;
+
#
# Toolbar buttons:
#
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl
index 265f34c..3ccb746 100644
--- a/library/ttk/treeview.tcl
+++ b/library/ttk/treeview.tcl
@@ -1,7 +1,6 @@
+# $Id: treeview.tcl,v 1.2 2006/12/18 19:33:14 jenglish Exp $
#
-# $Id: treeview.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
-#
-# Ttk widget set -- bindings for Treeview widget.
+# ttk::treeview widget bindings and utilities.
#
namespace eval ttk::treeview {
@@ -18,9 +17,7 @@ namespace eval ttk::treeview {
set State(pressX) 0
# For pressMode == "resize"
- set State(minWidth) 24
set State(resizeColumn) #0
- set State(resizeWidth) 0
# For pressmode == "heading"
set State(heading) {}
@@ -217,24 +214,15 @@ proc ttk::treeview::Release {w x y} {
### Interactive column resizing.
#
-# @@@ needs work.
-#
proc ttk::treeview::resize.press {w x column} {
variable State
-
set State(pressMode) "resize"
- set State(pressX) $x
set State(resizeColumn) $column
- set State(resizeWidth) [$w column $column -width]
}
proc ttk::treeview::resize.drag {w x} {
variable State
- set newWidth [expr {$State(resizeWidth) + $x - $State(pressX)}]
- if {$newWidth < $State(minWidth)} {
- set newWidth $State(minWidth)
- }
- $w column $State(resizeColumn) -width $newWidth
+ $w drag $State(resizeColumn) $x
}
proc ttk::treeview::resize.release {w x} {
@@ -391,33 +379,4 @@ proc ttk::treeview::BrowseTo {w item} {
$w selection set [list $item]
}
-### Style settings for selected built-in themes.
-#
-# Do this here instead of in the theme definitions since the details are
-# likely to change; it's better to keep this all in one place for now.
-#
-namespace eval ::ttk::treeview {
- variable theme
- namespace import -force ::ttk::style
- foreach theme [style theme names] {
- style theme settings $theme {
- style map Item -foreground [list selected "#FFFFFF"]
- style configure Row -background "#EEEEEE"
- style configure Heading -relief raised -font TkHeadingFont
- style configure Item -justify left
- style map Heading -relief {
- pressed sunken
- }
- style map Row -background {
- selected #4a6984
- focus #ccccff
- alternate #FFFFFF
- }
- style map Cell -foreground {
- selected #FFFFFF
- }
- }
- }
-}
-
#*EOF*
diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl
index 9678b10..34a6bc3 100644
--- a/library/ttk/winTheme.tcl
+++ b/library/ttk/winTheme.tcl
@@ -1,5 +1,5 @@
#
-# $Id: winTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
+# $Id: winTheme.tcl,v 1.3 2006/12/18 19:33:14 jenglish Exp $
#
# Ttk widget set: Windows Native theme
#
@@ -57,6 +57,20 @@ namespace eval ttk {
style configure TNotebook.Tab -padding {3 1} -borderwidth 1
style map TNotebook.Tab -expand [list selected {2 2 2 0}]
+ # Treeview:
+ style configure Heading -font TkHeadingFont -relief raised
+ style configure Row -background SystemWindow
+ style configure Cell -background SystemWindow
+ style map Row \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+ style map Cell \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+ style map Item \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+
style configure TProgressbar -borderwidth 0 -background SystemHighlight
}
}
diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl
index 9bb8b8b..5320b85 100644
--- a/library/ttk/xpTheme.tcl
+++ b/library/ttk/xpTheme.tcl
@@ -1,5 +1,5 @@
#
-# $Id: xpTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
+# $Id: xpTheme.tcl,v 1.3 2006/12/18 19:33:14 jenglish Exp $
#
# Ttk widget set: XP Native theme
#
@@ -30,6 +30,20 @@ namespace eval ttk {
style map TNotebook.Tab \
-expand [list selected {2 2 2 2}]
+ # Treeview:
+ style configure Heading -font TkHeadingFont
+ style configure Row -background SystemWindow
+ style configure Cell -background SystemWindow
+ style map Row \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+ style map Cell \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+ style map Item \
+ -background [list selected SystemHighlight] \
+ -foreground [list selected SystemHighlightText] ;
+
style configure TLabelframe -foreground "#0046d5"
# OR: -padding {3 3 3 6}, which some apps seem to use.