diff options
author | hobbs <hobbs> | 2010-08-26 02:06:08 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2010-08-26 02:06:08 (GMT) |
commit | 75076ec1c581221a115e64416447c246c5b8096d (patch) | |
tree | fa90e1e6d32590addfbb0a1599a40b1f7f99ea3b /library/ttk | |
parent | e0686e4f6b4369083d9e50073026f210dc4b237b (diff) | |
download | tk-75076ec1c581221a115e64416447c246c5b8096d.zip tk-75076ec1c581221a115e64416447c246c5b8096d.tar.gz tk-75076ec1c581221a115e64416447c246c5b8096d.tar.bz2 |
Major backport of 8.6 Ttk for 8.5.9. Most changes were only being
committed to head (8.6), although they could apply for 8.5 as well.
This re-sync makes future work easier to maintain and adds some
useful work for 8.5 users. Notable changes:
- Lots of code cleanup
- Some bug fixes never backported
- Addition of ttk::spinbox
- minor color changes
- Improved Vista/7 styling
- Move to tile version 0.8.6 (pseudo-package)
- ABI and API compatible (even $w identify)
- minor new features (extended $w identify)
Diffstat (limited to 'library/ttk')
-rw-r--r-- | library/ttk/altTheme.tcl | 22 | ||||
-rw-r--r-- | library/ttk/aquaTheme.tcl | 19 | ||||
-rw-r--r-- | library/ttk/button.tcl | 4 | ||||
-rw-r--r-- | library/ttk/clamTheme.tcl | 20 | ||||
-rw-r--r-- | library/ttk/classicTheme.tcl | 16 | ||||
-rw-r--r-- | library/ttk/combobox.tcl | 56 | ||||
-rw-r--r-- | library/ttk/cursors.tcl | 2 | ||||
-rw-r--r-- | library/ttk/defaults.tcl | 31 | ||||
-rw-r--r-- | library/ttk/entry.tcl | 35 | ||||
-rw-r--r-- | library/ttk/notebook.tcl | 33 | ||||
-rw-r--r-- | library/ttk/panedwindow.tcl | 17 | ||||
-rw-r--r-- | library/ttk/scale.tcl | 2 | ||||
-rw-r--r-- | library/ttk/sizegrip.tcl | 34 | ||||
-rw-r--r-- | library/ttk/spinbox.tcl | 175 | ||||
-rw-r--r-- | library/ttk/treeview.tcl | 64 | ||||
-rw-r--r-- | library/ttk/ttk.tcl | 12 | ||||
-rw-r--r-- | library/ttk/utils.tcl | 104 | ||||
-rw-r--r-- | library/ttk/vistaTheme.tcl | 14 | ||||
-rw-r--r-- | library/ttk/winTheme.tcl | 19 | ||||
-rw-r--r-- | library/ttk/xpTheme.tcl | 21 |
20 files changed, 476 insertions, 224 deletions
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index c92e3d5..28e1bc1 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: altTheme.tcl,v 1.6 2007/12/13 15:27:07 dgp Exp $ +# $Id: altTheme.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $ # # Ttk widget set: Alternate theme # @@ -11,6 +11,7 @@ namespace eval ttk::theme::alt { -frame "#d9d9d9" -window "#ffffff" -darker "#c3c3c3" + -border "#414141" -activebg "#ececec" -disabledfg "#a3a3a3" -selectbg "#4a6984" @@ -23,6 +24,7 @@ namespace eval ttk::theme::alt { -background $colors(-frame) \ -foreground black \ -troughcolor $colors(-darker) \ + -bordercolor $colors(-border) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -font TkDefaultFont \ @@ -59,6 +61,13 @@ namespace eval ttk::theme::alt { ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style configure ComboboxPopdownFrame \ + -relief solid -borderwidth 1 + + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} + ttk::style map TSpinbox -fieldbackground \ + [list readonly $colors(-frame) disabled $colors(-frame)] \ + -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure Toolbutton -relief flat -padding 2 ttk::style map Toolbutton -relief \ @@ -80,15 +89,8 @@ namespace eval ttk::theme::alt { # 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 \ + ttk::style configure Treeview -background $colors(-window) + ttk::style map Treeview \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index 8ff2ea0..471e919 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: aquaTheme.tcl,v 1.11.2.1 2008/07/22 17:02:31 das Exp $ +# $Id: aquaTheme.tcl,v 1.11.2.2 2010/08/26 02:06:10 hobbs Exp $ # # Aqua theme (OSX native look and feel) # @@ -31,25 +31,20 @@ namespace eval ttk::theme::aqua { ttk::style configure TButton -anchor center -width -6 ttk::style configure Toolbutton -padding 4 - # See Apple HIG figs 14-63, 14-65 - ttk::style configure TNotebook -tabposition n -padding {20 12} - ttk::style configure TNotebook.Tab -padding {10 2 10 2} + + ttk::style configure TNotebook -tabmargins {10 0} -tabposition n + ttk::style configure TNotebook -padding {18 8 18 17} + ttk::style configure TNotebook.Tab -padding {12 3 12 2} # Combobox: ttk::style configure TCombobox -postoffset {5 -2 -10 0} # Treeview: - ttk::style configure Treeview -rowheight 18 ttk::style configure Heading -font TkHeadingFont - ttk::style map Row \ + ttk::style configure Treeview -rowheight 18 -background White + ttk::style map Treeview \ -background {{selected background} systemHighlightSecondary selected systemHighlight} - ttk::style map Cell \ - -foreground {{selected background} systemModelessDialogInactiveText - selected systemModelessDialogActiveText} - ttk::style map Item \ - -foreground {{selected background} systemModelessDialogInactiveText - selected systemModelessDialogActiveText} # Enable animation for ttk::progressbar widget: ttk::style configure TProgressbar -period 100 -maxphase 255 diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl index 494a674..fc9c1bb 100644 --- a/library/ttk/button.tcl +++ b/library/ttk/button.tcl @@ -1,5 +1,5 @@ # -# $Id: button.tcl,v 1.2 2006/11/27 06:53:55 jenglish Exp $ +# $Id: button.tcl,v 1.2.4.1 2010/08/26 02:06:10 hobbs Exp $ # # Bindings for Buttons, Checkbuttons, and Radiobuttons. # @@ -54,7 +54,7 @@ bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 } proc ttk::button::activate {w} { $w instate disabled { return } set oldState [$w state pressed] - update idletasks; after 100 + update idletasks; after 100 ;# block event loop to avoid reentrancy $w state $oldState $w invoke } diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl index c4c8184..ea29abe 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: clamTheme.tcl,v 1.6 2007/12/13 15:27:08 dgp Exp $ +# $Id: clamTheme.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $ # # "Clam" theme. # @@ -105,6 +105,13 @@ namespace eval ttk::theme::clam { readonly $colors(-frame)] \ -foreground [list {readonly focus} $colors(-selectfg)] \ ; + ttk::style configure ComboboxPopdownFrame \ + -relief solid -borderwidth 1 + + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} + ttk::style map TSpinbox \ + -background [list readonly $colors(-frame)] \ + -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TNotebook.Tab -padding {6 2 6 2} ttk::style map TNotebook.Tab \ @@ -116,15 +123,8 @@ namespace eval ttk::theme::clam { # 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 \ + ttk::style configure Treeview -background $colors(-window) + ttk::style map Treeview \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index c96d7ff..bd165a5 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: classicTheme.tcl,v 1.6 2007/12/13 15:27:08 dgp Exp $ +# $Id: classicTheme.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $ # # "classic" Tk theme. # @@ -70,6 +70,12 @@ namespace eval ttk::theme::classic { ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style configure ComboboxPopdownFrame \ + -relief solid -borderwidth 1 + + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} + ttk::style map TSpinbox -fieldbackground \ + [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TLabelframe -borderwidth 2 -relief groove @@ -87,12 +93,8 @@ namespace eval ttk::theme::classic { # 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 \ + ttk::style configure Treeview -background $colors(-window) + ttk::style map Treeview \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 6f34f69..f04aaaa 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -1,13 +1,8 @@ # -# $Id: combobox.tcl,v 1.12.2.3 2010/01/20 23:43:51 patthoyts Exp $ +# $Id: combobox.tcl,v 1.12.2.4 2010/08/26 02:06:10 hobbs Exp $ # # Combobox bindings. # -# Each combobox $cb has a child $cb.popdown, which contains -# a listbox $cb.popdown.l and a scrollbar. The listbox -listvariable -# is set to a namespace variable, which is used to synchronize the -# combobox values with the listbox values. -# # <<NOTE-WM-TRANSIENT>>: # # Need to set [wm transient] just before mapping the popdown @@ -60,12 +55,9 @@ bind TCombobox <Shift-ButtonPress-1> { ttk::combobox::Press "s" %W %x %y } bind TCombobox <Double-ButtonPress-1> { ttk::combobox::Press "2" %W %x %y } bind TCombobox <Triple-ButtonPress-1> { ttk::combobox::Press "3" %W %x %y } bind TCombobox <B1-Motion> { ttk::combobox::Drag %W %x } +bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y } -bind TCombobox <MouseWheel> { ttk::combobox::Scroll %W [expr {%D/-120}] } -if {[tk windowingsystem] eq "x11"} { - bind TCombobox <ButtonPress-4> { ttk::combobox::Scroll %W -1 } - bind TCombobox <ButtonPress-5> { ttk::combobox::Scroll %W 1 } -} +ttk::bindMouseWheel TCombobox [list ttk::combobox::Scroll %W] bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W } @@ -152,6 +144,19 @@ proc ttk::combobox::Drag {w x} { } } +## Motion -- +# Set cursor. +# +proc ttk::combobox::Motion {w x y} { + if { [$w identify $x $y] eq "textarea" + && [$w instate {!readonly !disabled}] + } { + ttk::setCursor $w text + } else { + ttk::setCursor $w "" + } +} + ## TraverseIn -- receive focus due to keyboard navigation # For editable comboboxes, set the selection and insert cursor. # @@ -216,9 +221,9 @@ proc ttk::combobox::LBTab {lb dir} { LBSelect $lb Unpost $cb # The [grab release] call in [Unpost] queues events that later - # re-set the focus. [update] to make sure these get processed first: - update - ttk::traverseTo $newFocus + # re-set the focus (@@@ NOTE: this might not be true anymore). + # Set new focus later: + after 0 [list ttk::traverseTo $newFocus] } } @@ -265,7 +270,8 @@ proc ttk::combobox::PopdownWindow {cb} { variable scrollbar if {![winfo exists $cb.popdown]} { - set popdown [PopdownToplevel $cb.popdown] + set poplevel [PopdownToplevel $cb.popdown] + set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame] $scrollbar $popdown.sb \ -orient vertical -command [list $popdown.l yview] @@ -280,9 +286,14 @@ proc ttk::combobox::PopdownWindow {cb} { bindtags $popdown.l \ [list $popdown.l ComboboxListbox Listbox $popdown all] - grid $popdown.l $popdown.sb -sticky news + grid $popdown.l -row 0 -column 0 -padx {1 0} -pady 1 -sticky nsew + grid $popdown.sb -row 0 -column 1 -padx {0 1} -pady 1 -sticky ns grid columnconfigure $popdown 0 -weight 1 grid rowconfigure $popdown 0 -weight 1 + + grid $popdown -sticky news -padx 0 -pady 0 + grid rowconfigure $poplevel 0 -weight 1 + grid columnconfigure $poplevel 0 -weight 1 } return $cb.popdown } @@ -297,13 +308,14 @@ proc ttk::combobox::PopdownToplevel {w} { switch -- [tk windowingsystem] { default - x11 { - $w configure -relief solid -borderwidth 1 + $w configure -relief flat -borderwidth 0 wm attributes $w -type combo wm overrideredirect $w true } win32 { - $w configure -relief solid -borderwidth 1 + $w configure -relief flat -borderwidth 0 wm overrideredirect $w true + wm attributes $w -topmost 1 } aqua { $w configure -relief solid -borderwidth 0 @@ -322,7 +334,7 @@ proc ttk::combobox::PopdownToplevel {w} { proc ttk::combobox::ConfigureListbox {cb} { variable Values - set popdown [PopdownWindow $cb] + set popdown [PopdownWindow $cb].f set values [$cb cget -values] set current [$cb current] if {$current < 0} { @@ -337,8 +349,10 @@ proc ttk::combobox::ConfigureListbox {cb} { if {$height > [$cb cget -height]} { set height [$cb cget -height] grid $popdown.sb + grid configure $popdown.l -padx {1 0} } else { grid remove $popdown.sb + grid configure $popdown.l -padx 1 } $popdown.l configure -height $height } @@ -383,7 +397,7 @@ proc ttk::combobox::Post {cb} { set popdown [PopdownWindow $cb] ConfigureListbox $cb - update idletasks + update idletasks ;# needed for geometry propagation. PlacePopdown $cb $popdown # See <<NOTE-WM-TRANSIENT>> switch -- [tk windowingsystem] { @@ -411,7 +425,7 @@ proc ttk::combobox::Unpost {cb} { # Return the combobox main widget that owns the listbox. # proc ttk::combobox::LBMaster {lb} { - winfo parent [winfo parent $lb] + winfo parent [winfo parent [winfo parent $lb]] } ## LBSelect $lb -- diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index f5abd54..23198bd 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -1,5 +1,5 @@ # -# $Id: cursors.tcl,v 1.1.4.1 2009/04/10 16:39:47 das Exp $ +# $Id: cursors.tcl,v 1.1.4.2 2010/08/26 02:06:10 hobbs Exp $ # # Map symbolic cursor names to platform-appropriate cursors. # diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index 500562d..30830de 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -1,5 +1,5 @@ # -# $Id: defaults.tcl,v 1.6 2007/12/13 15:27:08 dgp Exp $ +# $Id: defaults.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $ # # Settings for default theme. # @@ -8,7 +8,9 @@ namespace eval ttk::theme::default { variable colors array set colors { -frame "#d9d9d9" + -foreground "#000000" -window "#ffffff" + -text "#000000" -activebg "#ececec" -selectbg "#4a6984" -selectfg "#ffffff" @@ -22,7 +24,7 @@ namespace eval ttk::theme::default { ttk::style configure "." \ -borderwidth 1 \ -background $colors(-frame) \ - -foreground black \ + -foreground $colors(-foreground) \ -troughcolor $colors(-darker) \ -font TkDefaultFont \ -selectborderwidth 1 \ @@ -64,6 +66,11 @@ namespace eval ttk::theme::default { ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} + ttk::style map TSpinbox -fieldbackground \ + [list readonly $colors(-frame) disabled $colors(-frame)] \ + -arrowcolor [list disabled $colors(-disabledfg)] + ttk::style configure TLabelframe \ -relief groove -borderwidth 2 @@ -85,18 +92,20 @@ namespace eval ttk::theme::default { # 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 \ + ttk::style configure Treeview \ + -background $colors(-window) \ + -foreground $colors(-text) ; + ttk::style map Treeview \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; + # Combobox popdown frame + ttk::style layout ComboboxPopdownFrame { + ComboboxPopdownFrame.border -sticky nswe + } + ttk::style configure ComboboxPopdownFrame \ + -borderwidth 1 -relief solid + # # Toolbar buttons: # diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index 37a2419..ef769cd 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -1,5 +1,5 @@ # -# $Id: entry.tcl,v 1.4 2007/12/13 15:27:08 dgp Exp $ +# $Id: entry.tcl,v 1.4.2.1 2010/08/26 02:06:10 hobbs Exp $ # # DERIVED FROM: tk/library/entry.tcl r1.22 # @@ -34,6 +34,10 @@ namespace eval ttk { } } +### Option database settings. +# +option add *TEntry.cursor [ttk::cursor text] + ### Bindings. # # Removed the following standard Tk bindings: @@ -91,19 +95,19 @@ bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x } ## Keyboard navigation bindings: # -bind TEntry <Key-Left> { ttk::entry::Move %W prevchar } -bind TEntry <Key-Right> { ttk::entry::Move %W nextchar } -bind TEntry <Control-Key-Left> { ttk::entry::Move %W prevword } -bind TEntry <Control-Key-Right> { ttk::entry::Move %W nextword } -bind TEntry <Key-Home> { ttk::entry::Move %W home } -bind TEntry <Key-End> { ttk::entry::Move %W end } +bind TEntry <<PrevChar>> { ttk::entry::Move %W prevchar } +bind TEntry <<NextChar>> { ttk::entry::Move %W nextchar } +bind TEntry <<PrevWord>> { ttk::entry::Move %W prevword } +bind TEntry <<NextWord>> { ttk::entry::Move %W nextword } +bind TEntry <<LineStart>> { ttk::entry::Move %W home } +bind TEntry <<LineEnd>> { ttk::entry::Move %W end } -bind TEntry <Shift-Key-Left> { ttk::entry::Extend %W prevchar } -bind TEntry <Shift-Key-Right> { ttk::entry::Extend %W nextchar } -bind TEntry <Shift-Control-Key-Left> { ttk::entry::Extend %W prevword } -bind TEntry <Shift-Control-Key-Right> { ttk::entry::Extend %W nextword } -bind TEntry <Shift-Key-Home> { ttk::entry::Extend %W home } -bind TEntry <Shift-Key-End> { ttk::entry::Extend %W end } +bind TEntry <<SelectPrevChar>> { ttk::entry::Extend %W prevchar } +bind TEntry <<SelectNextChar>> { ttk::entry::Extend %W nextchar } +bind TEntry <<SelectPrevWord>> { ttk::entry::Extend %W prevword } +bind TEntry <<SelectNextWord>> { ttk::entry::Extend %W nextword } +bind TEntry <<SelectLineStart>> { ttk::entry::Extend %W home } +bind TEntry <<SelectLineEnd>> { ttk::entry::Extend %W end } bind TEntry <Control-Key-slash> { %W selection range 0 end } bind TEntry <Control-Key-backslash> { %W selection clear } @@ -133,6 +137,9 @@ bind TEntry <Key-Tab> {# nothing} if {[tk windowingsystem] eq "aqua"} { bind TEntry <Command-KeyPress> {# nothing} } +# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] +bind TEntry <Down> {# nothing} +bind TEntry <Up> {# nothing} ## Additional emacs-like bindings: # @@ -224,7 +231,7 @@ proc ttk::entry::See {w {index insert}} { # position following the next end-of-word position. # set ::ttk::entry::State(startNext) \ - [string equal $tcl_platform(platform) "windows"] + [string equal $::tcl_platform(platform) "windows"] proc ttk::entry::NextWord {w start} { variable State diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl index 4fe58cc..cf5ffc1 100644 --- a/library/ttk/notebook.tcl +++ b/library/ttk/notebook.tcl @@ -1,5 +1,5 @@ # -# $Id: notebook.tcl,v 1.4 2007/02/24 09:15:07 das Exp $ +# $Id: notebook.tcl,v 1.4.4.1 2010/08/26 02:06:10 hobbs Exp $ # # Bindings for TNotebook widget # @@ -21,21 +21,26 @@ bind TNotebook <Destroy> { ttk::notebook::Cleanup %W } # ActivateTab $nb $tab -- # Select the specified tab and set focus. # -# If $tab was already the current tab, set the focus to the -# notebook widget. Otherwise, set the focus to the first -# traversable widget in the pane. The behavior is that the -# notebook takes focus when the user selects the same tab -# a second time. This mirrors Windows tab behavior. +# Desired behavior: +# + take focus when reselecting the currently-selected tab; +# + keep focus if the notebook already has it; +# + otherwise set focus to the first traversable widget +# in the newly-selected tab; +# + do not leave the focus in a deselected tab. # proc ttk::notebook::ActivateTab {w tab} { - if {[$w index $tab] eq [$w index current]} { - focus $w + set oldtab [$w select] + $w select $tab + set newtab [$w select] ;# NOTE: might not be $tab, if $tab is disabled + + if {[focus] eq $w} { return } + if {$newtab eq $oldtab} { focus $w ; return } + + update idletasks ;# needed so focus logic sees correct mapped states + if {[set f [ttk::focusFirst $newtab]] ne ""} { + ttk::traverseTo $f } else { - $w select $tab - update ;# needed so focus logic sees correct mapped/unmapped states - if {[set f [ttk::focusFirst [$w select]]] ne ""} { - tk::TabToWindow $f - } + focus $w } } @@ -102,6 +107,8 @@ proc ttk::notebook::enableTraversal {nb} { if {![info exists TLNotebooks($top)]} { # Augment $top bindings: # + bind $top <Control-Key-Next> {+ttk::notebook::TLCycleTab %W 1} + bind $top <Control-Key-Prior> {+ttk::notebook::TLCycleTab %W -1} bind $top <Control-Key-Tab> {+ttk::notebook::TLCycleTab %W 1} bind $top <Shift-Control-Key-Tab> {+ttk::notebook::TLCycleTab %W -1} catch { diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index 423baa9..06c6c50 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -1,5 +1,5 @@ # -# $Id: panedwindow.tcl,v 1.5 2007/12/13 15:27:08 dgp Exp $ +# $Id: panedwindow.tcl,v 1.5.2.1 2010/08/26 02:06:10 hobbs Exp $ # # Bindings for ttk::panedwindow widget. # @@ -27,7 +27,6 @@ bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W } # See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>> bind TPanedwindow <<EnteredChild>> { ttk::panedwindow::ResetCursor %W } - ## Sash movement: # proc ttk::panedwindow::Press {w x y} { @@ -66,22 +65,20 @@ proc ttk::panedwindow::Release {w x y} { proc ttk::panedwindow::ResetCursor {w} { variable State if {!$State(pressed)} { - $w configure -cursor {} + ttk::setCursor $w {} } } proc ttk::panedwindow::SetCursor {w x y} { - variable ::ttk::Cursors - - if {![llength [$w identify $x $y]]} { - ResetCursor $w - } else { + set cursor "" + if {[llength [$w identify $x $y]]} { # Assume we're over a sash. switch -- [$w cget -orient] { - horizontal { $w configure -cursor $Cursors(hresize) } - vertical { $w configure -cursor $Cursors(vresize) } + horizontal { set cursor hresize } + vertical { set cursor vresize } } } + ttk::setCursor $w $cursor } #*EOF* diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl index b660809..2025588 100644 --- a/library/ttk/scale.tcl +++ b/library/ttk/scale.tcl @@ -2,7 +2,7 @@ # # Bindings for the TScale widget # -# $Id: scale.tcl,v 1.1.4.1 2008/10/17 12:44:04 patthoyts Exp $ +# $Id: scale.tcl,v 1.1.4.2 2010/08/26 02:06:10 hobbs Exp $ namespace eval ttk::scale { variable State diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl index f167b00..1b9119b 100644 --- a/library/ttk/sizegrip.tcl +++ b/library/ttk/sizegrip.tcl @@ -1,14 +1,22 @@ # -# $Id: sizegrip.tcl,v 1.1.4.1 2009/12/23 04:30:51 jenglish Exp $ +# $Id: sizegrip.tcl,v 1.1.4.2 2010/08/26 02:06:10 hobbs Exp $ # -# Ttk widget set -- sizegrip widget bindings. +# Sizegrip widget bindings. # # Dragging a sizegrip widget resizes the containing toplevel. # # NOTE: the sizegrip widget must be in the lower right hand corner. # -option add *TSizegrip.cursor $::ttk::Cursors(seresize) +switch -- [tk windowingsystem] { + x11 - + win32 { + option add *TSizegrip.cursor [ttk::cursor seresize] + } + aqua { + # Aqua sizegrips use default Arrow cursor. + } +} namespace eval ttk::sizegrip { variable State @@ -20,6 +28,8 @@ namespace eval ttk::sizegrip { height 0 widthInc 1 heightInc 1 + resizeX 1 + resizeY 1 toplevel {} } } @@ -31,8 +41,16 @@ bind TSizegrip <ButtonRelease-1> { ttk::sizegrip::Release %W %X %Y } proc ttk::sizegrip::Press {W X Y} { variable State + if {[$W instate disabled]} { return } + set top [winfo toplevel $W] + # If the toplevel is not resizable then bail + foreach {State(resizeX) State(resizeY)} [wm resizable $top] break + if {!$State(resizeX) && !$State(resizeY)} { + return + } + # Sanity-checks: # If a negative X or Y position was specified for [wm geometry], # just bail out -- there's no way to handle this cleanly. @@ -64,8 +82,14 @@ proc ttk::sizegrip::Press {W X Y} { proc ttk::sizegrip::Drag {W X Y} { variable State if {!$State(pressed)} { return } - set w [expr {$State(width) + ($X - $State(pressX))/$State(widthInc)}] - set h [expr {$State(height) + ($Y - $State(pressY))/$State(heightInc)}] + set w $State(width) + set h $State(height) + if {$State(resizeX)} { + set w [expr {$w + ($X - $State(pressX))/$State(widthInc)}] + } + if {$State(resizeY)} { + set h [expr {$h + ($Y - $State(pressY))/$State(heightInc)}] + } if {$w <= 0} { set w 1 } if {$h <= 0} { set h 1 } set x $State(x) ; set y $State(y) diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl new file mode 100644 index 0000000..a717379 --- /dev/null +++ b/library/ttk/spinbox.tcl @@ -0,0 +1,175 @@ +# +# $Id: spinbox.tcl,v 1.3.2.2 2010/08/26 02:06:10 hobbs Exp $ +# +# ttk::spinbox bindings +# + +namespace eval ttk::spinbox { } + +### Spinbox bindings. +# +# Duplicate the Entry bindings, override if needed: +# + +ttk::copyBindings TEntry TSpinbox + +bind TSpinbox <Motion> { ttk::spinbox::Motion %W %x %y } +bind TSpinbox <ButtonPress-1> { ttk::spinbox::Press %W %x %y } +bind TSpinbox <ButtonRelease-1> { ttk::spinbox::Release %W } +bind TSpinbox <Double-Button-1> { ttk::spinbox::DoubleClick %W %x %y } +bind TSpinbox <Triple-Button-1> {} ;# disable TEntry triple-click + +bind TSpinbox <KeyPress-Up> { event generate %W <<Increment>> } +bind TSpinbox <KeyPress-Down> { event generate %W <<Decrement>> } + +bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 } +bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 } + +ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W] + +## Motion -- +# Sets cursor. +# +proc ttk::spinbox::Motion {w x y} { + if { [$w identify $x $y] eq "textarea" + && [$w instate {!readonly !disabled}] + } { + ttk::setCursor $w text + } else { + ttk::setCursor $w "" + } +} + +## Press -- +# +proc ttk::spinbox::Press {w x y} { + if {[$w instate disabled]} { return } + focus $w + switch -glob -- [$w identify $x $y] { + *textarea { ttk::entry::Press $w $x } + *rightarrow - + *uparrow { ttk::Repeatedly event generate $w <<Increment>> } + *leftarrow - + *downarrow { ttk::Repeatedly event generate $w <<Decrement>> } + *spinbutton { + if {$y * 2 >= [winfo height $w]} { + set event <<Decrement>> + } else { + set event <<Increment>> + } + ttk::Repeatedly event generate $w $event + } + } +} + +## DoubleClick -- +# Select all if over the text area; otherwise same as Press. +# +proc ttk::spinbox::DoubleClick {w x y} { + if {[$w instate disabled]} { return } + + switch -glob -- [$w identify $x $y] { + *textarea { SelectAll $w } + * { Press $w $x $y } + } +} + +proc ttk::spinbox::Release {w} { + ttk::CancelRepeat +} + +## MouseWheel -- +# Mousewheel callback. Turn these into <<Increment>> (-1, up) +# or <<Decrement> (+1, down) events. +# +proc ttk::spinbox::MouseWheel {w dir} { + if {$dir < 0} { + event generate $w <<Increment>> + } else { + event generate $w <<Decrement>> + } +} + +## SelectAll -- +# Select widget contents. +# +proc ttk::spinbox::SelectAll {w} { + $w selection range 0 end + $w icursor end +} + +## Limit -- +# Limit $v to lie between $min and $max +# +proc ttk::spinbox::Limit {v min max} { + if {$v < $min} { return $min } + if {$v > $max} { return $max } + return $v +} + +## Wrap -- +# Adjust $v to lie between $min and $max, wrapping if out of bounds. +# +proc ttk::spinbox::Wrap {v min max} { + if {$v < $min} { return $max } + if {$v > $max} { return $min } + return $v +} + +## Adjust -- +# Limit or wrap spinbox value depending on -wrap. +# +proc ttk::spinbox::Adjust {w v min max} { + if {[$w cget -wrap]} { + return [Wrap $v $min $max] + } else { + return [Limit $v $min $max] + } +} + +## Spin -- +# Handle <<Increment>> and <<Decrement>> events. +# If -values is specified, cycle through the list. +# Otherwise cycle through numeric range based on +# -from, -to, and -increment. +# +proc ttk::spinbox::Spin {w dir} { + set nvalues [llength [set values [$w cget -values]]] + set value [$w get] + if {$nvalues} { + set current [lsearch -exact $values $value] + set index [Adjust $w [expr {$current + $dir}] 0 [expr {$nvalues - 1}]] + $w set [lindex $values $index] + } else { + if {[catch { + set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}] + }]} { + set v [$w cget -from] + } + $w set [FormatValue $w [Adjust $w $v [$w cget -from] [$w cget -to]]] + } + SelectAll $w + uplevel #0 [$w cget -command] +} + +## FormatValue -- +# Reformat numeric value based on -format. +# +proc ttk::spinbox::FormatValue {w val} { + set fmt [$w cget -format] + if {$fmt eq ""} { + # Try to guess a suitable -format based on -increment. + set delta [expr {abs([$w cget -increment])}] + if {0 < $delta && $delta < 1} { + # NB: This guesses wrong if -increment has more than 1 + # significant digit itself, e.g., -increment 0.25 + set nsd [expr {int(ceil(-log10($delta)))}] + set fmt "%.${nsd}f" + } else { + set fmt "%.0f" + } + } + return [format $fmt $val] +} + +#*EOF* diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index 796b356..632bf7a 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -1,4 +1,4 @@ -# $Id: treeview.tcl,v 1.4.2.1 2008/06/20 14:14:20 jenglish Exp $ +# $Id: treeview.tcl,v 1.4.2.2 2010/08/26 02:06:10 hobbs Exp $ # # ttk::treeview widget bindings and utilities. # @@ -21,15 +21,6 @@ namespace eval ttk::treeview { # For pressmode == "heading" set State(heading) {} - - # Provide [lassign] if not already present - # (@@@ TODO: check if this is still needed after horrible-identify purge) - # - if {![llength [info commands lassign]]} { - proc lassign {vals args} { - uplevel 1 [list foreach $args $vals break] - } - } } ### Widget bindings. @@ -112,21 +103,15 @@ proc ttk::treeview::Keynav {w dir} { # Sets cursor, active element ... # proc ttk::treeview::Motion {w x y} { - variable ::ttk::Cursors - variable State - set cursor {} set activeHeading {} - lassign [$w identify $x $y] what where detail - switch -- $what { - separator { set cursor $Cursors(hresize) } - heading { set activeHeading $where } + switch -- [$w identify region $x $y] { + separator { set cursor hresize } + heading { set activeHeading [$w identify column $x $y] } } - if {[$w cget -cursor] ne $cursor} { - $w configure -cursor $cursor - } + ttk::setCursor $w $cursor ActivateHeading $w $activeHeading } @@ -170,19 +155,20 @@ proc ttk::treeview::DoubleClick {w x y} { ## Press -- ButtonPress binding. # proc ttk::treeview::Press {w x y} { - lassign [$w identify $x $y] what where detail - focus $w ;# or: ClickToFocus? - - switch -- $what { + focus $w + switch -- [$w identify region $x $y] { nothing { } - heading { heading.press $w $where } - separator { resize.press $w $x $where } - cell - - row - - item { SelectOp $w $where choose } - } - if {$what eq "item" && [string match *indicator $detail]} { - Toggle $w $where + heading { heading.press $w $x $y } + separator { resize.press $w $x $y } + tree - + cell { + set item [$w identify item $x $y] + SelectOp $w $item choose + switch -glob -- [$w identify element $x $y] { + *indicator - + *disclosure { Toggle $w $item } + } + } } } @@ -208,10 +194,10 @@ proc ttk::treeview::Release {w x y} { ### Interactive column resizing. # -proc ttk::treeview::resize.press {w x column} { +proc ttk::treeview::resize.press {w x y} { variable State set State(pressMode) "resize" - set State(resizeColumn) $column + set State(resizeColumn) [$w identify column $x $y] } proc ttk::treeview::resize.drag {w x} { @@ -226,8 +212,9 @@ proc ttk::treeview::resize.release {w x} { ### Heading activation. # -proc ttk::treeview::heading.press {w column} { +proc ttk::treeview::heading.press {w x y} { variable State + set column [$w identify column $x $y] set State(pressMode) "heading" set State(heading) $column $w heading $column state pressed @@ -235,8 +222,9 @@ proc ttk::treeview::heading.press {w column} { proc ttk::treeview::heading.drag {w x y} { variable State - lassign [$w identify $x $y] what where detail - if {$what eq "heading" && $where eq $State(heading)} { + if { [$w identify region $x $y] eq "heading" + && [$w identify column $x $y] eq $State(heading) + } { $w heading $State(heading) state pressed } else { $w heading $State(heading) state !pressed @@ -246,7 +234,7 @@ proc ttk::treeview::heading.drag {w x y} { proc ttk::treeview::heading.release {w} { variable State if {[lsearch -exact [$w heading $State(heading) state] pressed] >= 0} { - after idle [$w heading $State(heading) -command] + after 0 [$w heading $State(heading) -command] } $w heading $State(heading) state !pressed } diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl index 70e5121..6740d17 100644 --- a/library/ttk/ttk.tcl +++ b/library/ttk/ttk.tcl @@ -1,5 +1,5 @@ # -# $Id: ttk.tcl,v 1.8.2.1 2009/05/14 00:53:04 patthoyts Exp $ +# $Id: ttk.tcl,v 1.8.2.2 2010/08/26 02:06:10 hobbs Exp $ # # Ttk widget set initialization script. # @@ -44,8 +44,11 @@ proc ttk::deprecated'warning {old new} { ### Backward-compatibility. # - -package ifneeded tile 0.8.0 { package require Tk ; package provide tile 0.8.0 } +# +# Make [package require tile] an effective no-op; +# see SF#3016598 for discussion. +# +package ifneeded tile 0.8.6 { package provide tile 0.8.6 } # ttk::panedwindow used to be named ttk::paned. Keep the alias for now. # @@ -105,6 +108,7 @@ source [file join $::ttk::library notebook.tcl] source [file join $::ttk::library panedwindow.tcl] source [file join $::ttk::library entry.tcl] source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl +source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl source [file join $::ttk::library treeview.tcl] source [file join $::ttk::library sizegrip.tcl] @@ -143,7 +147,7 @@ ttk::LoadThemes; rename ::ttk::LoadThemes {} ### Select platform-specific default theme: # -# Notes: +# Notes: # + On OSX, aqua theme is the default # + On Windows, xpnative takes precedence over winnative if available. # + On X11, users can use the X resource database to diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index 1de8ec8..60aa5a7 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -1,22 +1,52 @@ # -# $Id: utils.tcl,v 1.6 2008/01/06 19:16:12 jenglish Exp $ +# $Id: utils.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $ # # Utilities for widget implementations. # ### Focus management. # +# See also: #1516479 +# ## ttk::takefocus -- # This is the default value of the "-takefocus" option -# for widgets that participate in keyboard navigation. +# for ttk::* widgets that participate in keyboard navigation. +# +# NOTES: +# tk::FocusOK (called by tk_focusNext) tests [winfo viewable] +# if -takefocus is 1, empty, or missing; but not if it's a +# script prefix, so we have to check that here as well. # -# See also: tk::FocusOK # proc ttk::takefocus {w} { expr {[$w instate !disabled] && [winfo viewable $w]} } +## ttk::GuessTakeFocus -- +# This routine is called as a fallback for widgets +# with a missing or empty -takefocus option. +# +# It implements the same heuristics as tk::FocusOK. +# +proc ttk::GuessTakeFocus {w} { + # Don't traverse to widgets with '-state disabled': + # + if {![catch {$w cget -state} state] && $state eq "disabled"} { + return 0 + } + + # Allow traversal to widgets with explicit key or focus bindings: + # + if {[regexp {Key|Focus} [concat [bind $w] [bind [winfo class $w]]]]} { + return 1; + } + + # Default is nontraversable: + # + return 0; +} + ## ttk::traverseTo $w -- # Set the keyboard focus to the specified window. # @@ -38,36 +68,26 @@ proc ttk::clickToFocus {w} { } ## ttk::takesFocus w -- -# Test if the widget can take keyboard focus: +# Test if the widget can take keyboard focus. # -# + widget is viewable, AND: -# - if -takefocus is missing or empty, return 0, OR -# - if -takefocus is 0 or 1, return that value, OR -# - append the widget name to -takefocus and evaluate it -# as a script. -# -# See also: tk::FocusOK -# -# Note: This routine doesn't implement the same fallback heuristics -# as tk::FocusOK. +# See the description of the -takefocus option in options(n) +# for details. # proc ttk::takesFocus {w} { - - if {![winfo viewable $w]} { return 0 } - - if {![catch {$w cget -takefocus} takefocus]} { + if {![winfo viewable $w]} { + return 0 + } elseif {[catch {$w cget -takefocus} takefocus]} { + return [GuessTakeFocus $w] + } else { switch -- $takefocus { - 0 - - 1 { return $takefocus } - "" { return 0 } + "" { return [GuessTakeFocus $w] } + 0 { return 0 } + 1 { return 1 } default { - set value [uplevel #0 $takefocus [list $w]] - return [expr {$value eq 1}] + return [expr {[uplevel #0 $takefocus [list $w]] == 1}] } } } - - return 0 } ## ttk::focusFirst $w -- @@ -251,10 +271,7 @@ proc ttk::copyBindings {from to} { } } -## Standard mousewheel bindings. -# -# Usage: [ttk::copyBindings TtkScrollable $bindtag] -# adds mousewheel support to a scrollable widget. +### Mousewheel bindings. # # Platform inconsistencies: # @@ -278,6 +295,35 @@ proc ttk::copyBindings {from to} { # Gtk+ and Qt do not appear to use as large a factor). # +## ttk::bindMouseWheel $bindtag $command... +# Adds basic mousewheel support to $bindtag. +# $command will be passed one additional argument +# specifying the mousewheel direction (-1: up, +1: down). +# + +proc ttk::bindMouseWheel {bindtag callback} { + switch -- [tk windowingsystem] { + x11 { + bind $bindtag <ButtonPress-4> "$callback -1" + bind $bindtag <ButtonPress-5> "$callback +1" + } + win32 { + bind $bindtag <MouseWheel> [append callback { [expr {-(%D/120)}]}] + } + aqua { + bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ] + } + } +} + +## Mousewheel bindings for standard scrollable widgets. +# +# Usage: [ttk::copyBindings TtkScrollable $bindtag] +# +# $bindtag should be for a widget that supports the +# standard scrollbar protocol. +# + switch -- [tk windowingsystem] { x11 { bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units } diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index 9b9418d..107f227 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -57,18 +57,6 @@ namespace eval ttk::theme::vista { -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; - ttk::style configure Row -background SystemWindow - ttk::style configure Cell -background SystemWindow - ttk::style map Row \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style map Cell \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style map Item \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - # Label and Toolbutton ttk::style configure TLabelframe.Label -foreground "#0046d5" @@ -230,4 +218,4 @@ namespace eval ttk::theme::vista { unset -nocomplain cx cy package provide ttk::theme::vista 1.0 } -}
\ No newline at end of file +} diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl index 20f45de..9ccb98e 100644 --- a/library/ttk/winTheme.tcl +++ b/library/ttk/winTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: winTheme.tcl,v 1.6 2007/12/13 15:27:08 dgp Exp $ +# $Id: winTheme.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $ # # Settings for 'winnative' theme. # @@ -45,6 +45,12 @@ namespace eval ttk::theme::winnative { -focusfill [list {readonly focus} SystemHighlight] \ ; + ttk::style element create ComboboxPopdownFrame.border from default + ttk::style configure ComboboxPopdownFrame \ + -borderwidth 1 -relief solid + + ttk::style configure TSpinbox -padding {2 0 16 0} + ttk::style configure TLabelframe -borderwidth 2 -relief groove ttk::style configure Toolbutton -relief flat -padding {8 4} @@ -59,15 +65,8 @@ namespace eval ttk::theme::winnative { # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised - ttk::style configure Row -background SystemWindow - ttk::style configure Cell -background SystemWindow - ttk::style map Row \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style map Cell \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style map Item \ + ttk::style configure Treeview -background SystemWindow + ttk::style map Treeview \ -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl index 8a0400e..edf5fa4 100644 --- a/library/ttk/xpTheme.tcl +++ b/library/ttk/xpTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: xpTheme.tcl,v 1.6.2.3 2009/12/03 23:58:35 patthoyts Exp $ +# $Id: xpTheme.tcl,v 1.6.2.4 2010/08/26 02:06:10 hobbs Exp $ # # Settings for 'xpnative' theme # @@ -36,18 +36,6 @@ namespace eval ttk::theme::xpnative { -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; - ttk::style configure Row -background SystemWindow - ttk::style configure Cell -background SystemWindow - ttk::style map Row \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style map Cell \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style map Item \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style configure TLabelframe.Label -foreground "#0046d5" # OR: -padding {3 3 3 6}, which some apps seem to use. @@ -64,6 +52,13 @@ namespace eval ttk::theme::xpnative { -focusfill [list {readonly focus} SystemHighlight] \ ; + ttk::style configure TSpinbox -padding {2 0 14 0} + ttk::style map TSpinbox \ + -selectbackground [list !focus SystemWindow] \ + -selectforeground [list !focus SystemWindowText] \ + ; + ttk::style configure Toolbutton -padding {4 4} + } } |