Import build of Tcl/Tk 8.6.10

This commit is contained in:
Steve Dower
2020-09-24 23:32:28 +01:00
parent 86027ce3ed
commit c0c00d5551
498 changed files with 65344 additions and 64042 deletions

View File

@@ -96,10 +96,8 @@ namespace eval ttk::theme::alt {
ttk::style configure Treeview -background $colors(-window)
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
{!disabled !selected} $colors(-window) \
selected $colors(-selectbg)] \
-foreground [list disabled $colors(-disabledfg) \
{!disabled !selected} black \
selected $colors(-selectfg)]
ttk::style configure TScale \

View File

@@ -7,47 +7,113 @@ namespace eval ttk::theme::aqua {
ttk::style configure . \
-font TkDefaultFont \
-background systemWindowBody \
-foreground systemModelessDialogActiveText \
-selectbackground systemHighlight \
-selectforeground systemModelessDialogActiveText \
-background systemWindowBackgroundColor \
-foreground systemLabelColor \
-selectbackground systemSelectedTextBackgroundColor \
-selectforeground systemSelectedTextColor \
-selectborderwidth 0 \
-insertwidth 1
ttk::style map . \
-foreground {disabled systemModelessDialogInactiveText
background systemModelessDialogInactiveText} \
-selectbackground {background systemHighlightSecondary
!focus systemHighlightSecondary} \
-selectforeground {background systemModelessDialogInactiveText
!focus systemDialogActiveText}
-foreground {
disabled systemDisabledControlTextColor
background systemLabelColor} \
-selectbackground {
background systemSelectedTextBackgroundColor
!focus systemSelectedTextBackgroundColor} \
-selectforeground {
background systemSelectedTextColor
!focus systemSelectedTextColor}
# Button
ttk::style configure TButton -anchor center -width -6 \
-foreground systemControlTextColor
ttk::style map TButton \
-foreground {
pressed white
{alternate !pressed !background} white}
ttk::style configure TMenubutton -anchor center -padding {2 0 0 2}
ttk::style configure Toolbutton -anchor center
# Entry
ttk::style configure TEntry \
-foreground systemTextColor \
-background systemTextBackgroundColor
ttk::style map TEntry \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectforeground {
background systemTextColor
} \
-selectbackground {
background systemTextBackgroundColor
}
# Workaround for #1100117:
# Actually, on Aqua we probably shouldn't stipple images in
# disabled buttons even if it did work...
ttk::style configure . -stipple {}
ttk::style configure TButton -anchor center -width -6
ttk::style configure Toolbutton -padding 4
# Notebook
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}
ttk::style configure TNotebook.Tab -foreground systemControlTextColor
ttk::style map TNotebook.Tab \
-foreground {
background systemControlTextColor
disabled systemDisabledControlTextColor
selected systemSelectedTabTextColor}
# Combobox:
ttk::style configure TCombobox -postoffset {5 -2 -10 0}
ttk::style configure TCombobox \
-foreground systemTextColor \
-background systemTransparent
ttk::style map TCombobox \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectforeground {
background systemTextColor
} \
-selectbackground {
background systemTransparent
}
# Spinbox
ttk::style configure TSpinbox \
-foreground systemTextColor \
-background systemTextBackgroundColor \
-selectforeground systemSelectedTextColor \
-selectbackground systemSelectedTextBackgroundColor
ttk::style map TSpinbox \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectforeground {
!active systemTextColor
} \
-selectbackground {
!active systemTextBackgroundColor
!focus systemTextBackgroundColor
focus systemSelectedTextBackgroundColor
}
# Treeview:
ttk::style configure Heading -font TkHeadingFont
ttk::style configure Treeview -rowheight 18 -background White
ttk::style configure Heading \
-font TkHeadingFont \
-foreground systemTextColor \
-background systemWindowBackgroundColor
ttk::style configure Treeview -rowheight 18 \
-background systemTextBackgroundColor \
-foreground systemTextColor \
-fieldbackground systemTextBackgroundColor
ttk::style map Treeview \
-background [list disabled systemDialogBackgroundInactive \
{!disabled !selected} systemWindowBody \
{selected background} systemHighlightSecondary \
selected systemHighlight] \
-foreground [list disabled systemModelessDialogInactiveText \
{!disabled !selected} black \
selected systemModelessDialogActiveText]
-background {
selected systemSelectedTextBackgroundColor
}
# Enable animation for ttk::progressbar widget:
ttk::style configure TProgressbar -period 100 -maxphase 255

View File

@@ -132,10 +132,8 @@ namespace eval ttk::theme::clam {
ttk::style configure Treeview -background $colors(-window)
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
{!disabled !selected} $colors(-window) \
selected $colors(-selectbg)] \
-foreground [list disabled $colors(-disabledfg) \
{!disabled !selected} black \
selected $colors(-selectfg)]
ttk::style configure TLabelframe \

View File

@@ -99,10 +99,8 @@ namespace eval ttk::theme::classic {
ttk::style configure Treeview -background $colors(-window)
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
{!disabled !selected} $colors(-window) \
selected $colors(-selectbg)] \
-foreground [list disabled $colors(-disabledfg) \
{!disabled !selected} black \
selected $colors(-selectfg)]
#

View File

@@ -251,30 +251,16 @@ proc ttk::combobox::UnmapPopdown {w} {
ttk::releaseGrab $w
}
###
#
namespace eval ::ttk::combobox {
# @@@ Until we have a proper native scrollbar on Aqua, use
# @@@ the regular Tk one. Use ttk::scrollbar on other platforms.
variable scrollbar ttk::scrollbar
if {[tk windowingsystem] eq "aqua"} {
set scrollbar ::scrollbar
}
}
## PopdownWindow --
# Returns the popdown widget associated with a combobox,
# creating it if necessary.
#
proc ttk::combobox::PopdownWindow {cb} {
variable scrollbar
if {![winfo exists $cb.popdown]} {
set poplevel [PopdownToplevel $cb.popdown]
set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame]
$scrollbar $popdown.sb \
ttk::scrollbar $popdown.sb \
-orient vertical -command [list $popdown.l yview]
listbox $popdown.l \
-listvariable ttk::combobox::Values($cb) \

View File

@@ -111,10 +111,8 @@ namespace eval ttk::theme::default {
-foreground $colors(-text) ;
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
{!disabled !selected} $colors(-window) \
selected $colors(-selectbg)] \
-foreground [list disabled $colors(-disabledfg) \
{!disabled !selected} black \
selected $colors(-selectfg)]
# Combobox popdown frame

View File

@@ -145,6 +145,25 @@ bind TEntry <Control-Key-d> { ttk::entry::Delete %W }
bind TEntry <Control-Key-h> { ttk::entry::Backspace %W }
bind TEntry <Control-Key-k> { %W delete insert end }
# Bindings for IME text input.
bind TEntry <<TkStartIMEMarkedText>> {
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
}
bind TEntry <<TkEndIMEMarkedText>> {
if { [catch {dict get $::tk::Priv(IMETextMark) "%W"} mark] } {
bell
} else {
%W selection range $mark insert
}
}
bind TEntry <<TkClearIMEMarkedText>> {
%W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert]
}
bind TEntry <<TkAccentBackspace>> {
ttk::entry::Backspace %W
}
### Clipboard procedures.
#
@@ -211,7 +230,6 @@ proc ttk::entry::ClosestGap {w x} {
## See $index -- Make sure that the character at $index is visible.
#
proc ttk::entry::See {w {index insert}} {
update idletasks ;# ensure scroll data up-to-date
set c [$w index $index]
# @@@ OR: check [$w index left] / [$w index right]
if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} {

View File

@@ -61,43 +61,112 @@ if {[tk windowingsystem] eq "x11"} {
}
# PostPosition --
# Returns the x and y coordinates where the menu
# should be posted, based on the menubutton and menu size
# and -direction option.
# Returns x and y coordinates and a menu item index.
# If the index is not an empty string the menu should
# be posted so that the upper left corner of the indexed
# menu item is located at the point (x, y). Otherwise
# the top left corner of the menu itself should be located
# at that point.
#
# TODO: adjust menu width to be at least as wide as the button
# for -direction above, below.
#
proc ttk::menubutton::PostPosition {mb menu} {
set x [winfo rootx $mb]
set y [winfo rooty $mb]
set dir [$mb cget -direction]
set bw [winfo width $mb]
set bh [winfo height $mb]
set mw [winfo reqwidth $menu]
set mh [winfo reqheight $menu]
set sw [expr {[winfo screenwidth $menu] - $bw - $mw}]
set sh [expr {[winfo screenheight $menu] - $bh - $mh}]
switch -- $dir {
above { if {$y >= $mh} { incr y -$mh } { incr y $bh } }
below { if {$y <= $sh} { incr y $bh } { incr y -$mh } }
left { if {$x >= $mw} { incr x -$mw } { incr x $bw } }
right { if {$x <= $sw} { incr x $bw } { incr x -$mw } }
flush {
# post menu atop menubutton.
# If there's a menu entry whose label matches the
# menubutton -text, assume this is an optionmenu
# and place that entry over the menubutton.
set index [FindMenuEntry $menu [$mb cget -text]]
if {$index ne ""} {
incr y -[$menu yposition $index]
if {[tk windowingsystem] eq "aqua"} {
proc ::ttk::menubutton::PostPosition {mb menu} {
set menuPad 5
set buttonPad 1
set bevelPad 4
set mh [winfo reqheight $menu]
set bh [expr {[winfo height $mb]} + $buttonPad]
set bbh [expr {[winfo height $mb]} + $bevelPad]
set mw [winfo reqwidth $menu]
set bw [winfo width $mb]
set dF [expr {[winfo width $mb] - [winfo reqwidth $menu] - $menuPad}]
set entry ""
set entry [::tk::MenuFindName $menu [$mb cget -text]]
if {$entry eq ""} {
set entry 0
}
set x [winfo rootx $mb]
set y [winfo rooty $mb]
switch [$mb cget -direction] {
above {
set entry ""
incr y [expr {-$mh + 2 * $menuPad}]
}
below {
set entry ""
incr y $bh
}
left {
incr y $menuPad
incr x -$mw
}
right {
incr y $menuPad
incr x $bw
}
default {
incr y $bbh
}
}
return [list $x $y $entry]
}
} else {
proc ::ttk::menubutton::PostPosition {mb menu} {
set mh [expr {[winfo reqheight $menu]}]
set bh [expr {[winfo height $mb]}]
set mw [expr {[winfo reqwidth $menu]}]
set bw [expr {[winfo width $mb]}]
set dF [expr {[winfo width $mb] - [winfo reqwidth $menu]}]
if {[tk windowingsystem] eq "win32"} {
incr mh 6
incr mw 16
}
set entry {}
set entry [::tk::MenuFindName $menu [$mb cget -text]]
if {$entry eq {}} {
set entry 0
}
set x [winfo rootx $mb]
set y [winfo rooty $mb]
switch [$mb cget -direction] {
above {
set entry {}
incr y -$mh
# if we go offscreen to the top, show as 'below'
if {$y < [winfo vrooty $mb]} {
set y [expr {[winfo vrooty $mb] + [winfo rooty $mb]\
+ [winfo reqheight $mb]}]
}
}
below {
set entry {}
incr y $bh
# if we go offscreen to the bottom, show as 'above'
if {($y + $mh) > ([winfo vrooty $mb] + [winfo vrootheight $mb])} {
set y [expr {[winfo vrooty $mb] + [winfo vrootheight $mb] \
+ [winfo rooty $mb] - $mh}]
}
}
left {
incr x -$mw
}
right {
incr x $bw
}
default {
if {[$mb cget -style] eq ""} {
incr x [expr {([winfo width $mb] - \
[winfo reqwidth $menu])/ 2}]
} else {
incr y $bh
}
}
}
return [list $x $y $entry]
}
return [list $x $y]
}
# Popdown --
@@ -107,8 +176,8 @@ proc ttk::menubutton::Popdown {mb} {
if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
return
}
foreach {x y} [PostPosition $mb $menu] { break }
tk_popup $menu $x $y
foreach {x y entry} [PostPosition $mb $menu] { break }
tk_popup $menu $x $y $entry
}
# Pulldown (X11 only) --
@@ -121,13 +190,17 @@ proc ttk::menubutton::Pulldown {mb} {
if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
return
}
foreach {x y} [PostPosition $mb $menu] { break }
set State(pulldown) 1
set State(oldcursor) [$mb cget -cursor]
$mb state pressed
$mb configure -cursor [$menu cget -cursor]
$menu post $x $y
foreach {x y entry} [PostPosition $mb $menu] { break }
if {$entry ne {}} {
$menu post $x $y $entry
} else {
$menu post $x $y
}
tk_menuSetFocus $menu
}
@@ -143,6 +216,7 @@ proc ttk::menubutton::TransferGrab {mb} {
set State(pulldown) 0
set menu [$mb cget -menu]
foreach {x y entry} [PostPosition $mb $menu] { break }
tk_popup $menu [winfo rootx $menu] [winfo rooty $menu]
}
}

View File

@@ -2,24 +2,6 @@
# Bindings for TScrollbar widget
#
# Still don't have a working ttk::scrollbar under OSX -
# Swap in a [tk::scrollbar] on that platform,
# unless user specifies -class or -style.
#
if {[tk windowingsystem] eq "aqua"} {
rename ::ttk::scrollbar ::ttk::_scrollbar
proc ttk::scrollbar {w args} {
set constructor ::tk::scrollbar
foreach {option _} $args {
if {$option eq "-class" || $option eq "-style"} {
set constructor ::ttk::_scrollbar
break
}
}
return [$constructor $w {*}$args]
}
}
namespace eval ttk::scrollbar {
variable State
# State(xPress) --

View File

@@ -81,6 +81,7 @@ proc ttk::spinbox::Release {w} {
# or <<Decrement> (+1, down) events.
#
proc ttk::spinbox::MouseWheel {w dir} {
if {[$w instate disabled]} { return }
if {$dir < 0} {
event generate $w <<Increment>>
} else {
@@ -132,6 +133,7 @@ proc ttk::spinbox::Adjust {w v min max} {
# -from, -to, and -increment.
#
proc ttk::spinbox::Spin {w dir} {
if {[$w instate disabled]} { return }
set nvalues [llength [set values [$w cget -values]]]
set value [$w get]
if {$nvalues} {

View File

@@ -121,7 +121,17 @@ proc ttk::treeview::ActivateHeading {w heading} {
if {$w != $State(activeWidget) || $heading != $State(activeHeading)} {
if {[winfo exists $State(activeWidget)] && $State(activeHeading) != {}} {
$State(activeWidget) heading $State(activeHeading) state !active
# It may happen that $State(activeHeading) no longer corresponds
# to an existing display column. This happens for instance when
# changing -displaycolumns in a bound script when this change
# triggers a <Leave> event. A proc checking if the display column
# $State(activeHeading) is really still present or not could be
# written but it would need to check several special cases:
# a. -displaycolumns "#all" or being an explicit columns list
# b. column #0 display is not governed by the -displaycolumn
# list but by the value of the -show option
# --> Let's rather catch the following line.
catch {$State(activeWidget) heading $State(activeHeading) state !active}
}
if {$heading != {}} {
$w heading $heading state active
@@ -205,7 +215,7 @@ proc ttk::treeview::resize.drag {w x} {
}
proc ttk::treeview::resize.release {w x} {
# no-op
$w drop
}
### Heading activation.
@@ -336,6 +346,12 @@ proc ttk::treeview::CloseItem {w item} {
## Toggle -- toggle opened/closed state of item
#
proc ttk::treeview::Toggle {w item} {
# don't allow toggling on indicators that
# are not present in front of leaf items
if {[$w children $item] == {}} {
return
}
# not a leaf, toggle!
if {[$w item $item -open]} {
CloseItem $w $item
} else {

View File

@@ -300,17 +300,15 @@ proc ttk::copyBindings {from to} {
#
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)}]} ]
}
if {[tk windowingsystem] eq "x11"} {
bind $bindtag <ButtonPress-4> "$callback -1"
bind $bindtag <ButtonPress-5> "$callback +1"
}
if {[tk windowingsystem] eq "aqua"} {
bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
bind $bindtag <Option-MouseWheel> [append callback { [expr {-10 *(%D)}]} ]
} else {
bind $bindtag <MouseWheel> [append callback { [expr {-(%D / 120)}]}]
}
}
@@ -322,29 +320,26 @@ proc ttk::bindMouseWheel {bindtag callback} {
# standard scrollbar protocol.
#
switch -- [tk windowingsystem] {
x11 {
bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units }
bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units }
bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units }
bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units }
}
win32 {
bind TtkScrollable <MouseWheel> \
{ %W yview scroll [expr {-(%D/120)}] units }
bind TtkScrollable <Shift-MouseWheel> \
{ %W xview scroll [expr {-(%D/120)}] units }
}
aqua {
bind TtkScrollable <MouseWheel> \
if {[tk windowingsystem] eq "x11"} {
bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units }
bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units }
bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units }
bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units }
}
if {[tk windowingsystem] eq "aqua"} {
bind TtkScrollable <MouseWheel> \
{ %W yview scroll [expr {-(%D)}] units }
bind TtkScrollable <Shift-MouseWheel> \
bind TtkScrollable <Shift-MouseWheel> \
{ %W xview scroll [expr {-(%D)}] units }
bind TtkScrollable <Option-MouseWheel> \
{ %W yview scroll [expr {-10*(%D)}] units }
bind TtkScrollable <Shift-Option-MouseWheel> \
{ %W xview scroll [expr {-10*(%D)}] units }
}
bind TtkScrollable <Option-MouseWheel> \
{ %W yview scroll [expr {-10 * (%D)}] units }
bind TtkScrollable <Shift-Option-MouseWheel> \
{ %W xview scroll [expr {-10 * (%D)}] units }
} else {
bind TtkScrollable <MouseWheel> \
{ %W yview scroll [expr {-(%D / 120)}] units }
bind TtkScrollable <Shift-MouseWheel> \
{ %W xview scroll [expr {-(%D / 120)}] units }
}
#*EOF*

View File

@@ -48,10 +48,8 @@ namespace eval ttk::theme::vista {
ttk::style configure Treeview -background SystemWindow
ttk::style map Treeview \
-background [list disabled SystemButtonFace \
{!disabled !selected} SystemWindow \
selected SystemHighlight] \
-foreground [list disabled SystemGrayText \
{!disabled !selected} SystemWindowText \
selected SystemHighlightText]
# Label and Toolbutton

View File

@@ -74,10 +74,8 @@ namespace eval ttk::theme::winnative {
ttk::style configure Treeview -background SystemWindow
ttk::style map Treeview \
-background [list disabled SystemButtonFace \
{!disabled !selected} SystemWindow \
selected SystemHighlight] \
-foreground [list disabled SystemGrayText \
{!disabled !selected} SystemWindowText \
selected SystemHighlightText]
ttk::style configure TProgressbar \

View File

@@ -67,10 +67,8 @@ namespace eval ttk::theme::xpnative {
ttk::style configure Treeview -background SystemWindow
ttk::style map Treeview \
-background [list disabled SystemButtonFace \
{!disabled !selected} SystemWindow \
selected SystemHighlight] \
-foreground [list disabled SystemGrayText \
{!disabled !selected} SystemWindowText \
selected SystemHighlightText];
}
}