diff options
author | fvogel <fvogelnew1@free.fr> | 2023-05-28 09:33:11 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2023-05-28 09:33:11 (GMT) |
commit | 30529ae3c9cb4ba814bcc609791bdb24a8ce12dc (patch) | |
tree | 207b6a318f6defa4f9b73e722bc27a02f6f1e53b /library | |
parent | d4e2fda1837c59fa8cf3499154cd7a005e6bb945 (diff) | |
parent | f4a0fde006c321df81b8e0dd2569e54b5c63e870 (diff) | |
download | tk-30529ae3c9cb4ba814bcc609791bdb24a8ce12dc.zip tk-30529ae3c9cb4ba814bcc609791bdb24a8ce12dc.tar.gz tk-30529ae3c9cb4ba814bcc609791bdb24a8ce12dc.tar.bz2 |
merge trunk
Diffstat (limited to 'library')
-rw-r--r-- | library/choosedir.tcl | 4 | ||||
-rw-r--r-- | library/demos/image2.tcl | 8 | ||||
-rw-r--r-- | library/demos/mac_styles.tcl | 14 | ||||
-rw-r--r-- | library/demos/mac_tabs.tcl | 77 | ||||
-rw-r--r-- | library/demos/mac_wm.tcl | 228 | ||||
-rw-r--r-- | library/demos/print.tcl | 81 | ||||
-rw-r--r-- | library/demos/systray.tcl | 8 | ||||
-rw-r--r-- | library/demos/widget | 7 | ||||
-rw-r--r-- | library/demos/windowicons.tcl | 25 | ||||
-rw-r--r-- | library/icons.tcl | 37 | ||||
-rw-r--r-- | library/scaling.tcl | 55 | ||||
-rw-r--r-- | library/text.tcl | 6 | ||||
-rw-r--r-- | library/tk.tcl | 17 | ||||
-rw-r--r-- | library/tkfbox.tcl | 45 | ||||
-rw-r--r-- | library/ttk/altTheme.tcl | 2 | ||||
-rw-r--r-- | library/ttk/aquaTheme.tcl | 14 | ||||
-rw-r--r-- | library/ttk/classicTheme.tcl | 4 | ||||
-rw-r--r-- | library/ttk/defaults.tcl | 52 | ||||
-rw-r--r-- | library/ttk/winTheme.tcl | 2 | ||||
-rw-r--r-- | library/ttk/xpTheme.tcl | 2 |
20 files changed, 516 insertions, 172 deletions
diff --git a/library/choosedir.tcl b/library/choosedir.tcl index 6b4f15e..c583215 100644 --- a/library/choosedir.tcl +++ b/library/choosedir.tcl @@ -118,7 +118,9 @@ proc ::tk::dialog::file::chooseDir:: {args} { foreach trace [trace info variable data(selectPath)] { trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1] } - $data(dirMenuBtn) configure -textvariable {} + if {[winfo exists $data(dirMenuBtn)]} { + $data(dirMenuBtn) configure -textvariable {} + } # Return value to user # diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl index 34c94a4..9691b87 100644 --- a/library/demos/image2.tcl +++ b/library/demos/image2.tcl @@ -55,8 +55,14 @@ proc loadImage {w x y} { global dirName set file [file join $dirName [$w.f.list get @$x,$y]] + set opts [list -file $file] + if {[string tolower [file extension $file]] eq ".svg"} { + lappend opts -format $tk::svgFmt + } else { + lappend opts -format {} + } if {[catch { - image2a configure -file $file + image2a configure {*}$opts }]} then { # Mark the file as not loadable $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000 diff --git a/library/demos/mac_styles.tcl b/library/demos/mac_styles.tcl index df727df..33fa888 100644 --- a/library/demos/mac_styles.tcl +++ b/library/demos/mac_styles.tcl @@ -34,8 +34,8 @@ image create nsimage starry2 -source $starryImg -as file -width 96 -radius 10 -r image create nsimage field -source $fieldImg -as file -width 96 -radius 10 image create nsimage field1 -source $fieldImg -as file -width 96 -radius 10 -pressed 1 image create nsimage field2 -source $fieldImg -as file -width 96 -radius 10 -ring 3 -image create nsimage add -source NSAddTemplate -width 11 -height 11 -image create nsimage remove -source NSRemoveTemplate -width 11 -height 11 +image create nsimage add -source NSAddTemplate -width 20 -height 20 +image create nsimage remove -source NSRemoveTemplate -width 18 -height 4 # Off state and variables for checkbuttons and radio buttons set off {!selected !alternate} @@ -130,9 +130,9 @@ set feather [ttk::button $buttonFrame.feather -style ImageButton -text Tk \ -image {tkfeather pressed tkfeather1}] set gradient [ttk::frame $buttonFrame.gradient] pack [ttk::button $buttonFrame.gradient.add -style GradientButton \ - -image add -padding 7] -side left + -image add -padding {2 0}] -side left pack [ttk::button $buttonFrame.gradient.remove -style GradientButton \ - -image remove -padding 7] -side left + -image remove -padding {2 8}] -side left set disclosure [ttk::checkbutton $buttonFrame.disclosure -style DisclosureButton] set help [ttk::button $buttonFrame.help -style HelpButton]; @@ -240,20 +240,20 @@ set dark [ttk::button $appearanceFrame.dark -style ImageButton -text Dark \ -image {starry pressed starry1 selected starry2} \ -command "beDark $appearanceFrame $w"] grid $dark -row 1 -column 2 -sticky w -if { [::tk::unsupported::MacWindowStyle isdark $w] } { +if { [wm attributes $w -isdark] } { $dark state selected } else { $light state selected } proc beLight {f w} { - ::tk::unsupported::MacWindowStyle appearance $w aqua + wm attributes $w -appearance aqua $f.dark state !selected $f.light state selected after 10 $f.light state !hover } proc beDark {f w} { - ::tk::unsupported::MacWindowStyle appearance $w darkaqua + wm attributes $w -appearance darkaqua $f.light state !selected $f.dark state selected after 10 $f.dark state !hover diff --git a/library/demos/mac_tabs.tcl b/library/demos/mac_tabs.tcl new file mode 100644 index 0000000..16771a8 --- /dev/null +++ b/library/demos/mac_tabs.tcl @@ -0,0 +1,77 @@ +# mac_tabs.tcl -- +# +# This demonstration script creates three tabbable windows and allows the +# wm attributes tabbingid and tabbingmode to be manipulated for the third +# window, to demonstrate the effects of those attributes. + +if {![info exists widgetDemo]} { + error "This script should be run from the \"widget\" demo." +} + +package require Tk +catch {font create giant -family {Times New Roman} -size 64} +set w .mac_tabs +catch {destroy $w} +toplevel $w +package require Tk +wm title $w "Tabbed Windows in Aqua" +wm iconname $w "mac_tabs" +positionWindow $w +set suffix 0 +set winlist {} +## + +## See Code / Dismiss +pack [addSeeDismiss $w.buttons $w] -side bottom -fill x +## +set info "\ +This demo shows 3 toplevels, A, B, and C. \ +Each of these has tabbingmode set to preferred. \ +The tabbingid of Window A is groupA, the \ +tabbingid of Window B is groupB and the tabbingid \ +of Window C is groupC. Use the menubuttons below \ +to see the effect of changing the tabbingid and \ +tabbingmode attributes for Window C. \ +" +pack [message $w.info -text $info -width 300] +wm geometry $w +450+350 + +ttk::frame $w.f +menu $w.idmenu -tearoff 0 +foreach id {groupA groupB groupC} { + $w.idmenu add command -label $id \ + -command [list wm attributes $w.c -tabbingid $id] +} +menu $w.modemenu -tearoff 0 +foreach mode {auto preferred disallowed} { + $w.modemenu add command -label $mode \ + -command [list wm attributes $w.c -tabbingmode $mode] +} +ttk::menubutton $w.f.idbutton -menu $w.idmenu -text "tabbingid"\ + -direction below +grid $w.f.idbutton -row 0 -column 0 +ttk::menubutton $w.f.modebutton -menu $w.modemenu -text "tabbingmode"\ + -direction below +grid $w.f.modebutton -row 1 -column 0 +pack $w.f + +wm attributes $w.a -tabbingid groupA +wm attributes $w.a -tabbingmode preferred +toplevel $w.a +wm geometry $w.a +50+100 +wm title $w.a "Window A" +pack [ttk::label $w.a.l -text A -font giant] -padx 100 -pady 30 + +wm attributes $w.b -tabbingid groupB +wm attributes $w.b -tabbingmode preferred +toplevel $w.b +wm geometry $w.b +400+100 +wm title $w.b "Window B" +pack [ttk::label $w.b.l -text B -font giant] -padx 100 -pady 30 + +wm attributes $w.c -tabbingid groupC +wm attributes $w.c -tabbingmode preferred +toplevel $w.c +wm geometry $w.c +750+100 +wm title $w.c "Window C" +pack [ttk::label $w.c.l -text C -font giant] -padx 100 -pady 30 diff --git a/library/demos/mac_wm.tcl b/library/demos/mac_wm.tcl new file mode 100644 index 0000000..3272623 --- /dev/null +++ b/library/demos/mac_wm.tcl @@ -0,0 +1,228 @@ +# mac_window_styles.tcl -- +# +# This demonstration script creates a toplevel window containing a notebook +# whose pages provide examples of the various mac-specific widgets that are +# provided via special values for the -style option. + +if {![info exists widgetDemo]} { + error "This script should be run from the \"widget\" demo." +} + +package require Tk + +set w .mac_wm +catch {destroy $w} +toplevel $w +package require Tk +wm title $w "Tk Aqua Window Styles" +wm iconname $w "mac_wm" +positionWindow $w +set suffix 0 +set winlist {} +## + +## See Code / Dismiss +pack [addSeeDismiss $w.buttons $w] -side bottom -fill x + +proc launch {name windowInfo class} { + if {[winfo exists $name]} { + wm deiconify $name + focus -force $name + return + } + wm attributes $name -class $class; toplevel $name + wm title $name $class + set f $name.f + ttk::frame $f + set t $f.t + text $t -background systemWindowBackgroundColor \ + -highlightcolor systemWindowBackgroundColor \ + -font systemDefaultFont\ + -wrap word -width 50 -height 6 + $t insert insert $windowInfo + $t configure -state disabled + grid columnconfigure $f 0 -weight 1 + grid $t -row 0 -column 0 -columnspan 2 -sticky NSEW + ttk::labelframe $f.stylemask -text "styleMask bits" + # titled + if {$class == "nswindow"} { + ttk::checkbutton $f.stylemask.titled -text titled -variable $name.titled \ + -command [list setbit $name $f.stylemask.titled titled] + $f.stylemask.titled state selected + grid $f.stylemask.titled -row 0 -column 0 -sticky w + } + # closable + ttk::checkbutton $f.stylemask.closable -text closable -variable $name.closable \ + -command [list setbit $name $f.stylemask.closable closable] + $f.stylemask.closable state selected + grid $f.stylemask.closable -row 1 -column 0 -sticky w + # miniaturizableable + ttk::checkbutton $f.stylemask.miniaturizable -text miniaturizable \ + -variable $name.miniaturizable \ + -command [list setbit $name $f.stylemask.miniaturizable miniaturizable] + if {$class == "nswindow"} { + $f.stylemask.miniaturizable state selected + } else { + $f.stylemask.miniaturizable state !alternate + } + grid $f.stylemask.miniaturizable -row 2 -column 0 -sticky w + # resizable + ttk::checkbutton $f.stylemask.resizable -text resizable -variable $name.resizable \ + -command [list setbit $name $f.stylemask.resizable resizable] + $f.stylemask.resizable state selected + grid $f.stylemask.resizable -row 3 -column 0 -sticky w + # docmodal + ttk::checkbutton $f.stylemask.docmodal -text docmodal -variable $name.docmodal \ + -command [list setbit $name $f.stylemask.docmodal docmodal] + $f.stylemask.docmodal state !alternate + grid $f.stylemask.docmodal -row 4 -column 0 -sticky w + + grid $f.stylemask -row 1 -column 0 + pack $name.f -side bottom -fill both -expand 1 -padx 16 -pady 16 +} + +set info "The command wm attributes window -stylemask ?bitnames? can \ +be used to modify bits in the stylemask property of the NSWindow or \ +NSPanel underlying a Tk Window. Changing these bits causes the \ +style of the window to change. This demo allows you to see the \ +effects of changing the bits. (Note that buttons in the title bar \ +can also be enabled or disabled with the ::tk::unsupported::MacWindowStyle \ +command.)" + +set panelInfo "A toplevel based on an NSPanel has a narrower title bar\ +than one based on an NSWindow. In addition the panel remains above all\ +windows on the screen, regardless of which app is active. These are\ +intended to be used as modal windows." + +set windowInfo "This is a standard Apple document window, based on an\ +NSWindow. It has a larger title bar and behaves normally with respect\ +to other windows from the same or another app." + +## background frame +set f $w.f +ttk::frame $f +set t $f.t +text $t -background systemWindowBackgroundColor \ + -highlightcolor systemWindowBackgroundColor \ + -font systemDefaultFont\ + -wrap word -width 50 -height 8 +$t insert insert $info +$t configure -state disabled +grid columnconfigure $f 0 -weight 1 +grid $t -row 0 -column 0 -columnspan 2 -sticky NSEW +ttk::labelframe $f.stylemask -text "styleMask" +grid $f.stylemask -row 1 -column 0 +grid [ttk::button $f.wbw -text "Open an NSWindow" -width 20 \ + -command [list launch .nswindow $windowInfo nswindow]] -row 2 -column 0 +grid [ttk::button $f.wbp -text "Open an NSPanel" -width 20 \ + -command [list launch .nspanel $panelInfo nspanel]] -row 3 -column 0 +grid [ttk::button $f.wbm -text "Open a modern window" -width 20 \ + -command launchModernWindow] -row 4 -column 0 +pack $w.f -side bottom -fill both -expand 1 -padx 16 -pady 16 + +proc setbit {win cb bitname} { + set state [$cb instate selected] + set bits [wm attributes $win -stylemask] + set index [lsearch $bits $bitname] + if {$index >= 0 && !$state} { + set bits [lreplace $bits $index $index] + } + if {$index < 0 && $state} { + lappend bits $bitname + } + wm attributes $win -stylemask $bits +} + +set aboutText \ +"Most of the apps which ship with a contemporary version of macOS \ +feature a window similar to this one, with a left sidebar that \ +allows selecting the content to be shown on the right hand side of \ +the window. These windows do not have a (visible) titlebar.\ +\n\nApps that use such windows include the Finder and the App Store as \ +well as Notes, Messages, Books, Maps and many others.\ +\n\nTo create a window like this one in Tk simply set the fullsizecontent bit \ +in the stylemask. For example:\n\n" + +set aboutCode \ +"wm attributes .t -stylemask {titled \\\ +\nfullsizecontent closable miniaturizable \\\ +\nresizable}\n\n" + +set detailsText \ +"(1) In the Apple API, setting the fullsizecontent bit in the stylemask \ +only allows content to be drawn in the part of the window covered by \ +the titlebar. In order for that content to be visible the title bar \ +must be transparent. Since it would be pointless to draw content under \ +an opaque title bar, Tk makes the title bar transparent whenever the \ +fullsizecontent bit is set.\ + +\n\n\(2) Each radio button in the sidebar is a standard ttk::radiobutton \ +but created with a special value for its -style option. The value of the \ +-style option used to create these buttons is SidebarButton.\n" + +set whichPage 1 +trace add variable whichPage write "flipPage whichPage" +proc flipPage {varname args} { + global whichPage + set newpage [set $varname] + grid remove [grid content .mod.right -row 0 -column 0] + switch $newpage\ + 1 {grid .mod.right.about -padx 30 -pady 30 -row 0 -column 0 -sticky nsew}\ + 2 {grid .mod.right.details -padx 30 -pady 30 -row 0 -column 0 -sticky nsew} + update idletasks +} + +proc launchModernWindow {} { + global whichPage + global aboutText + global aboutCode + global detailsText + if {[winfo exists .mod]} { + wm deiconify .mod + focus -force .mod + return + } + toplevel .mod + wm title .mod {} + wm attributes .mod -stylemask {titled fullsizecontent closable \ + miniaturizable resizable} + .mod configure -background white + grid columnconfigure .mod 0 -weight 0 + grid columnconfigure .mod 1 -weight 1 + grid rowconfigure .mod 0 -weight 1 + frame .mod.left -width 220 -height 400 -background systemWindowBackgroundColor + catch { + font create leftFont -family .AppleSystemUIFont -size 11 + font create rightFont -family .AppleSystemUIFont -size 16 + font create codeFont -family Courier -size 16 + } + grid [ttk::label .mod.left.spacer -padding {220 30 0 0}] -row 0 -column 0 + grid [ttk::radiobutton .mod.left.about -text About -style SidebarButton \ + -variable whichPage -value 1] \ + -row 1 -column 0 -sticky nsew -padx 14 + grid [ttk::radiobutton .mod.left.details -text Details -style SidebarButton \ + -variable whichPage -value 2] \ + -row 2 -column 0 -sticky nsew -padx 14 + grid .mod.left -row 0 -column 0 -sticky nsew + frame .mod.right -width 500 -background systemTextBackgroundColor + grid rowconfigure .mod.right 0 -weight 0 + text .mod.right.about -highlightcolor systemTextBackgroundColor \ + -background systemTextBackgroundColor -font rightFont \ + -highlightthickness 0 -wrap word -width 40 + .mod.right.about tag configure code -font codeFont + .mod.right.about insert end $aboutText + .mod.right.about insert end $aboutCode code + .mod.right.about configure -state disabled + + text .mod.right.details -highlightcolor systemTextBackgroundColor \ + -background systemTextBackgroundColor -font rightFont\ + -highlightthickness 0 -wrap word -width 40 + .mod.right.details insert end $detailsText + .mod.right.details configure -state disabled + + grid .mod.right.about -padx 30 -pady 30 -row 0 -column 0 -sticky nsew + grid .mod.right -row 0 -column 1 -sticky nsew + wm geometry .mod 800x500 + update idletasks +} + diff --git a/library/demos/print.tcl b/library/demos/print.tcl index ebe6553..00ccd2a 100644 --- a/library/demos/print.tcl +++ b/library/demos/print.tcl @@ -13,24 +13,66 @@ toplevel $w wm title $w "Printing Demonstration" positionWindow $w -image create photo logo -data {R0lGODlhMABLAPUAAP//////zP//mf//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM/8zMzMyZzMyZmcyZZsyZAMxmZsxmM8xmAMwzM8wzAJnMzJmZzJmZmZlmmZlmZplmM5kzZpkzM5kzAGaZzGZmzGZmmWYzZmYzMzNmzDNmmTMzmTMzZgAzmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+BSAtZGwtACH5BAEKAAIALAAAAAAwAEsAAAb+QIFwSCwahY9HRMI8Op/JJVNSqVqv2OvjyRU8slbIJGwYg60S5ZR6jRi/4ITBOhkYIOd8dltEnAdmFQMJeoVXCEd/VnKGjRVOZ3NVgHlsjpBxVRCEYBIEAAARl4lgZmVgEQAKFx8Mo0ZnpqgAFyi2JqKGmGebWRIAILbCIo27cYFWASTCtievRXqSVwQfzLYeeYESxlnSVRIW1igjWHJmjBXbpKXeFQTizlh1eJNVHbYf0LGc39XW2PIoVZE0whasWPSqFBBHrkKEA3QG0DFTEMXBUsjCWesg4oMFAGwgtKsiwqA+jGiCiRPGAM6pLCVLGKHQ6EGJlc0IuDxzAgX+CCOW9DjAaUsEyAoT+GHpeSRoHgxEUWgAUEUpFhMWgTbKEPUBAU15TBZxekYD0RMEqCDLIpYIWTAcmGEd9rWQBxQyjeQqdK/ZTWEO3mK5l+9No75SrcHhm9WwnlzNoA5zdM+JHz0HCPQdUauZowoFnSw+c2CBvw6dUXT4LMKE6EIHUqMexgCiIREknOwl7Q+FhNQoLuzOc6Kw3kIIVOLqjYKBYCwinmgo9CBEswfMAziK7mRDoQhcUZxwoBKFibq3n3jXI0GyCPLC0DrS8GR1oaEoRBRYVhT99/qG4DcCA/yNU4Ajbjhhnx4P2DJggR3YZog6RyyYxwM9PSgMBaP+sQdgIRL0JAKBwnTooRMAFWLdiPyJ8JwvTnyQoh5midCASh149ZkTIFAmHnzOZOBfIU6U4Mhd4zF34DNEoDAhARGY50BvJkioyxFOGkKAShGkFsJwejiR5Xf8aZAaBp89coQJjuDXAQOApekEm45ANaAtIbyYxREf0OlICCK841uaahZBQjyfjXCACYjuaASjhFagRKSFNtloHg+hYWIxRohnBQWCSSAhBVZ+hkgRnlbxwJIVgIqGlaU6wkeTxHxjm6gVLImrFbHWVEQ1taZjWxJX7KqqnqgUEUxDwtqajrOaRkqhEDcxWwECbEjxTYe9gojqOJQ6JO231ob72bSqAjh4RgfsjiDCCfDCK8K8I9TL7r33nvGtCO7CO1dUAONk3LcBFxzwwEMwZ/DC4iAsRIE+CWNCbzeV8FfEtoDwVwnlacxMkcKQYIE/F5TQ2QcedUZCagyc3NsFGrXVZMipWVBCzKv4Q0JvCviDsjAwf4ylxBeX0KcwGs81ccgqGS3MBxc3RjDDVAvdBRcfeFy1MFd3bcQHJEQdlddkP5E1Cf9yXfbaV2d9RBAAOw== -} +pack [label $w.l -text "This demonstration showcases +the tk print command. Clicking the buttons below +prints the data from the canvas and text widgets +using platform-native dialogs."] -side top +## See Code / Dismiss buttons +pack [addSeeDismiss $w.buttons $w] -side bottom -fill x -pack [label $w.l -text "This demonstration showcases - the tk print command. Clicking the buttons below - print the data from the canvas and text widgets - using platform-native dialogs."] -side top +frame $w.m -pack [frame $w.m] -fill both -expand yes -side top +image create photo logo -data { +R0lGODlhMABLAPUAAP//////zP//mf//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM/8zMzMyZzMyZ +mcyZZsyZAMxmZsxmM8xmAMwzM8wzAJnMzJmZzJmZmZlmmZlmZplmM5kzZpkzM5kzAGaZzGZmzGZm +mWYzZmYzMzNmzDNmmTMzmTMzZgAzmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+BSAtZGwtACH5BAEKAAIALAAAAAAw +AEsAAAb+QIFwSCwahY9HRMI8Op/JJVNSqVqv2OvjyRU8slbIJGwYg60S5ZR6jRi/4ITBOhkYIOd8 +dltEnAdmFQMJeoVXCEd/VnKGjRVOZ3NVgHlsjpBxVRCEYBIEAAARl4lgZmVgEQAKFx8Mo0ZnpqgA +Fyi2JqKGmGebWRIAILbCIo27cYFWASTCtievRXqSVwQfzLYeeYESxlnSVRIW1igjWHJmjBXbpKXe +FQTizlh1eJNVHbYf0LGc39XW2PIoVZE0whasWPSqFBBHrkKEA3QG0DFTEMXBUsjCWesg4oMFAGwg +tKsiwqA+jGiCiRPGAM6pLCVLGKHQ6EGJlc0IuDxzAgX+CCOW9DjAaUsEyAoT+GHpeSRoHgxEUWgA +UEUpFhMWgTbKEPUBAU15TBZxekYD0RMEqCDLIpYIWTAcmGEd9rWQBxQyjeQqdK/ZTWEO3mK5l+9N +o75SrcHhm9WwnlzNoA5zdM+JHz0HCPQdUauZowoFnSw+c2CBvw6dUXT4LMKE6EIHUqMexgCiIREk +nOwl7Q+FhNQoLuzOc6Kw3kIIVOLqjYKBYCwinmgo9CBEswfMAziK7mRDoQhcUZxwoBKFibq3n3jX +I0GyCPLC0DrS8GR1oaEoRBRYVhT99/qG4DcCA/yNU4Ajbjhhnx4P2DJggR3YZog6RyyYxwM9PSgM +BaP+sQdgIRL0JAKBwnTooRMAFWLdiPyJ8JwvTnyQoh5midCASh149ZkTIFAmHnzOZOBfIU6U4Mhd +4zF34DNEoDAhARGY50BvJkioyxFOGkKAShGkFsJwejiR5Xf8aZAaBp89coQJjuDXAQOApekEm45A +NaAtIbyYxREf0OlICCK841uaahZBQjyfjXCACYjuaASjhFagRKSFNtloHg+hYWIxRohnBQWCSSAh +BVZ+hkgRnlbxwJIVgIqGlaU6wkeTxHxjm6gVLImrFbHWVEQ1taZjWxJX7KqqnqgUEUxDwtqajrOa +RkqhEDcxWwECbEjxTYe9gojqOJQ6JO231ob72bSqAjh4RgfsjiDCCfDCK8K8I9TL7r33nvGtCO7C +O1dUAONk3LcBFxzwwEMwZ/DC4iAsRIE+CWNCbzeV8FfEtoDwVwnlacxMkcKQYIE/F5TQ2QcedUZC +agyc3NsFGrXVZMipWVBCzKv4Q0JvCviDsjAwf4ylxBeX0KcwGs81ccgqGS3MBxc3RjDDVAvdBRcf +eFy1MFd3bcQHJEQdlddkP5E1Cf9yXfbaV2d9RBAAOw== +} + +# +# Create a copy of the image just created, magnified according +# to the display's DPI scaling level. Note that the copy will +# only be effectively magnified if $tk::scalingPct >= 200. +# +image create photo logo2 +logo2 copy logo -zoom [expr {$tk::scalingPct / 100}] set c [canvas $w.m.c -bg white] -pack $c -fill both -expand no -side left +pack $c -fill both -expand yes -fill both -side left -$c create rectangle 30 10 200 50 -fill blue -outline black -$c create oval 30 60 200 110 -fill green -$c create image 130 150 -image logo -$c create text 150 250 -anchor n -font {Helvetica 12} \ +# +# For scaling-awareness specify the coordinates of the canvas items in points +# rather than pixels. Create the items with a left and top padding of 15 pt. +# +$c create rectangle 15p 15p 165p 60p -fill blue -outline black ;# 150p x 45p +$c create oval 15p 75p 165p 120p -fill green ;# 150p x 45p +set imgId [$c create image 90p 135p -image logo2 -anchor n] + +# +# Compute the scaled y coordinate of the next canvas item's top edge in pixels +# +lassign [$c bbox $imgId] x1 y1 x2 y2 ;# x1, y1, x2, y2 are in pixels +incr y2 [expr {int(15 * [tk scaling])}] ;# convert 15 pt to pixels + +$c create text 15p $y2 -anchor nw -font {Helvetica 12} \ -text "A short demo of simple canvas elements." set txt { @@ -40,14 +82,15 @@ Tcl is fit for both the smallest and largest programming tasks, obviating the ne } set t [text $w.m.t -wrap word] -pack $t -side right -fill both -expand no +pack $t -side right -expand yes -fill both $t insert end $txt -pack [frame $w.f] -side top -fill both -expand no -pack [button $w.f.b -text "Print Canvas" -command [list tk print $w.m.c]] -expand no -pack [button $w.f.x -text "Print Text" -command [list tk print $w.m.t]] -expand no - -## See Code / Dismiss buttons -pack [addSeeDismiss $w.buttons $w] -side bottom -fill x +frame $w.f +pack [button $w.f.c -text "Print Canvas" -command [list tk print $w.m.c]] \ + -side left -anchor w -padx 4 +pack [button $w.f.t -text "Print Text" -command [list tk print $w.m.t]] \ + -side right -anchor e -padx 4 +pack $w.f -side bottom -fill x +pack $w.m -expand yes -fill both -side top diff --git a/library/demos/systray.tcl b/library/demos/systray.tcl index 05315bb..9ca9745 100644 --- a/library/demos/systray.tcl +++ b/library/demos/systray.tcl @@ -13,6 +13,9 @@ toplevel $w wm title $w "System Tray Demonstration" positionWindow $w +## See Code / Dismiss buttons +pack [addSeeDismiss $w.buttons $w] -side bottom -fill x + catch {tk systray destroy} set trayIconExists false @@ -37,7 +40,7 @@ button $w.f.b2 -text "Destroy" -command remove pack $w.f.b0 $w.f.b1 $w.f.b2 -padx 5 -pady 3 -side left -expand true -fill x button $w.b3 -text "Display Notification" -command notify -pack $w.f $w.b3 -expand true -fill x -padx 5 -pady 5 +pack $w.f $w.b3 -fill x -padx 4 -pady 4 proc create {} { global trayIconExists @@ -84,6 +87,3 @@ proc remove {} { } create - -## See Code / Dismiss buttons -pack [addSeeDismiss $w.buttons $w] -side bottom -fill x diff --git a/library/demos/widget b/library/demos/widget index 8ca11ad..f96e778 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -328,12 +328,19 @@ addFormattedText { @@demo labelframe Labelled frames @@demo ttkbut The simple Themed Tk widgets } + if {[tk windowingsystem] eq "aqua"} { addFormattedText { + @@subtitle Mac-Specific Widgets and Window Styles @@new @@demo mac_styles Special widgets for macOS + @@new + @@demo mac_wm Window styles for macOS + @@new + @@demo mac_tabs Tabbed Windows on macOS } } + addFormattedText { @@subtitle Listboxes and Trees @@demo states The 50 states diff --git a/library/demos/windowicons.tcl b/library/demos/windowicons.tcl index f89d252..25c8308 100644 --- a/library/demos/windowicons.tcl +++ b/library/demos/windowicons.tcl @@ -13,6 +13,9 @@ toplevel $w wm title $w "Window Icon Demonstration" positionWindow $w +## See Code / Dismiss buttons +pack [addSeeDismiss $w.buttons $w] -side bottom -fill x + image create photo icon -data { iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGP C/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3Cc @@ -89,11 +92,19 @@ image create photo icon -data { set ::tk::icons::base_icon(.) icon -pack [button $w.i -text "Set Window Icon to Globe" -image $::tk::icons::base_icon(.) \ - -compound top -command {wm iconphoto . $::tk::icons::base_icon(.) }] -pack [button $w.b -text "Set Badge to 3" -command {wm iconbadge . 3}] -pack [button $w.e -text "Set Badge to 11" -command {wm iconbadge . 11}] -pack [button $w.f -text "Reset Badge" -command {wm iconbadge . ""}] +# +# Create a copy of the image just created, magnified according +# to the display's DPI scaling level. Note that the copy will +# only be effectively magnified if $tk::scalingPct >= 200. +# +image create photo icon2 +icon2 copy icon -zoom [expr {$tk::scalingPct / 100}] -## See Code / Dismiss buttons -pack [addSeeDismiss $w.buttons $w] -side bottom -fill x +pack [button $w.i -text "Set Window Icon to Globe" -image icon2 \ + -compound top -command {wm iconphoto . icon}] -fill x -padx 4 +pack [button $w.b -text "Set Badge to 3" -command {wm iconbadge . 3}] \ + -fill x -padx 4 +pack [button $w.e -text "Set Badge to 11" -command {wm iconbadge . 11}] \ + -fill x -padx 4 +pack [button $w.f -text "Reset Badge" -command {wm iconbadge . ""}] \ + -fill x -padx 4 diff --git a/library/icons.tcl b/library/icons.tcl index cf8b525..da3e9f4 100644 --- a/library/icons.tcl +++ b/library/icons.tcl @@ -18,10 +18,11 @@ variable ::tk::svgFmt [list svg -scale [expr {[::tk::ScalingPct] / 100.0}]] image create photo ::tk::icons::error -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> - <svg width="32" height="32" version="1.1" viewBox="0 0 8.4669 8.4669" xmlns="http://www.w3.org/2000/svg"> - <g transform="matrix(1.4545 0 0 1.4545 5.0036 -423.15)"> - <rect transform="matrix(0,-1,-1,0,0,0)" x="-296.73" y="-2.381" width="5.821" height="5.821" rx="2.91" ry="2.91" fill="#d32f2f"/> - <path d="m-1.587 292.77 2.116 2.116m1e-3 -2.116-2.118 2.116" fill="none" stroke="#fff" stroke-linecap="square" stroke-width=".661"/> + <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <circle cx="16" cy="16" r="16" fill="#d32f2f"/> + <g transform="rotate(45,16,16)" fill="#fff"> + <rect x="6" y="14" width="20" height="4"/> + <rect x="14" y="6" width="4" height="20"/> </g> </svg> } @@ -29,37 +30,25 @@ image create photo ::tk::icons::error -format $::tk::svgFmt -data { image create photo ::tk::icons::warning -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> - <style id="current-color-scheme" type="text/css">.ColorScheme-NeutralText { - color:#f67400; - } - .ColorScheme-Text { - color:#232629; - }</style> - <g stroke-width="2"> - <circle transform="scale(1,-1)" cx="16" cy="-16" r="16" fill="#f67400"/> - <circle cx="16" cy="24" r="2" fill="#fff"/> - <path d="m14 20h4v-14h-4z" fill="#fff" fill-rule="evenodd"/> - </g> + <circle cx="16" cy="16" r="16" fill="#f67400"/> + <circle cx="16" cy="24" r="2" fill="#fff"/> + <path d="m14 20h4v-14h-4z" fill="#fff"/> </svg> } image create photo ::tk::icons::information -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> - <g stroke-width="2"> - <circle transform="scale(1,-1)" cx="16" cy="-16" r="16" fill="#2091df"/> - <circle transform="scale(1,-1)" cx="16" cy="-8" r="2" fill="#fff"/> - <path d="m14 12h4v14h-4z" fill="#fff" fill-rule="evenodd"/> - </g> + <circle cx="16" cy="16" r="16" fill="#2091df"/> + <circle cx="16" cy="8" r="2" fill="#fff"/> + <path d="m14 12h4v14h-4z" fill="#fff"/> </svg> } image create photo ::tk::icons::question -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> - <g transform="matrix(.8 0 0 .8 -3.2 -3.2)"> - <circle cx="24" cy="24" r="20" fill="#78c367"/> - <path d="m26 38h-4v-4h4zm4.14-15.5-1.8 1.84c-1.44 1.46-2.34 2.66-2.34 5.66h-4v-1c0-2.2 0.9-4.2 2.34-5.66l2.48-2.52a3.91 3.91 0 0 0 1.18-2.82c0-2.2-1.8-4-4-4s-4 1.8-4 4h-4c0-4.42 3.58-8 8-8s8 3.58 8 8c0 1.76-0.72 3.36-1.86 4.5z" fill="#fff"/> - </g> + <circle cx="16" cy="16" r="16" fill="#5c6bc0"/> + <path d="m17.6 27.2h-3.2v-3.2h3.2zm3.312-12.4-1.44 1.472c-1.152 1.168-1.872 2.128-1.872 4.528h-3.2v-0.8c0-1.76 0.72-3.36 1.872-4.528l1.984-2.016a3.128 3.128 0 0 0 0.944-2.256c0-1.76-1.44-3.2-3.2-3.2s-3.2 1.44-3.2 3.2h-3.2c0-3.536 2.864-6.4 6.4-6.4s6.4 2.864 6.4 6.4c0 1.408-0.576 2.688-1.488 3.6z" fill="#fff"/> </svg> } diff --git a/library/scaling.tcl b/library/scaling.tcl index 092fa14..a7b6ea6 100644 --- a/library/scaling.tcl +++ b/library/scaling.tcl @@ -102,34 +102,14 @@ proc ::tk::ScalingPct {} { } } - if {$pct < 100 + 12.5} { - set pct 100 - } elseif {$pct < 125 + 12.5} { - set pct 125 - } elseif {$pct < 150 + 12.5} { - set pct 150 - } elseif {$pct < 175 + 12.5} { - set pct 175 - } elseif {$pct < 200 + 12.5} { - set pct 200 - } elseif {$pct < 225 + 12.5} { - set pct 225 - } elseif {$pct < 250 + 12.5} { - set pct 250 - } elseif {$pct < 275 + 12.5} { - set pct 275 - } elseif {$pct < 300 + 25} { - set pct 300 - } elseif {$pct < 350 + 25} { - set pct 350 - } elseif {$pct < 400 + 25} { - set pct 400 - } elseif {$pct < 450 + 25} { - set pct 450 - } elseif {$pct < 500 + 25} { - set pct 500 - } else { - set pct [expr {int($pct + 0.5)}] + # + # Set pct to a multiple of 25 + # + for {set pct2 100} {1} {incr pct2 25} { + if {$pct < $pct2 + 12.5} { + set pct $pct2 + break + } } if {$onX11 && $pct != 100 && $pct != $origPct} { @@ -212,20 +192,25 @@ proc ::tk::ScanMonitorsFile {xrandrResult chan pctName} { # # If $outputList and $connectorList are identical then set the - # variable pct to 100 or 200, depending on the max. scaling - # within this configuration, and exit the loop. (Due to the - # way fractional scaling is implemented in GNOME, we have to - # set the variable pct to 200 rather than 125, 150, or 175.) + # variable pct to 100, 200, 300, 400, or 500, depending on the + # max. scaling within this configuration, and exit the loop # - if {[string compare $outputList $connectorList] == 0} { - set maxScaling 0.0 + if {$outputList eq $connectorList} { + set maxScaling 1.0 foreach {dummy scaling} [regexp -all -inline \ {<scale>([^<]+)</scale>} $config] { if {$scaling > $maxScaling} { set maxScaling $scaling } } - set pct [expr {$maxScaling > 1.0 ? 200 : 100}] + + foreach n {4 3 2 1 0} { + if {$maxScaling > $n} { + set pct [expr {($n + 1) * 100}] + break + } + } + break } } diff --git a/library/text.tcl b/library/text.tcl index 9dfef1a..eb73db0 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -485,7 +485,11 @@ proc ::tk::TextClosestGap {w x y} { if {$bbox eq ""} { return $pos } - if {($x - [lindex $bbox 0]) < ([lindex $bbox 2]/2)} { + # The check on y coord of the line bbox with dlineinfo is to fix + # [a9cf210a42] to properly handle selecting and moving the mouse + # out of the widget. + if {$y < [lindex [$w dlineinfo $pos] 1] || + $x - [lindex $bbox 0] < [lindex $bbox 2]/2} { return $pos } $w index "$pos + 1 char" diff --git a/library/tk.tcl b/library/tk.tcl index d4656a1..a6dc37c 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -178,16 +178,21 @@ proc ::tk::RestoreFocusGrab {grab focus {destroy destroy}} { catch {focus $oldFocus} grab release $grab - if {$destroy eq "withdraw"} { - wm withdraw $grab - } else { - destroy $grab + if {[winfo exists $grab]} { + if {$destroy eq "withdraw"} { + wm withdraw $grab + } else { + destroy $grab + } } if {[winfo exists $oldGrab] && [winfo ismapped $oldGrab]} { + # The "grab" command will fail if another application + # already holds the grab on a window with the same name. + # So catch it. See [7447ed20ec] for an example. if {$oldStatus eq "global"} { - grab -global $oldGrab + catch {grab -global $oldGrab} } else { - grab $oldGrab + catch {grab $oldGrab} } } } diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index fbaa25a..9c43cf6 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -24,50 +24,35 @@ namespace eval ::tk::dialog::file { # Create the images if they did not already exist. if {![info exists ::tk::Priv(updirImage)]} { - # Based on Vimix/22/actions/go-up.svg + # Based on Vimix/16/actions/go-up.svg # See https://github.com/vinceliuice/vimix-icon-theme - set ::tk::Priv(updirImage) [image create photo -format $::tk::svgFmt -data { + set ::tk::Priv(updirImage) [image create photo -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> - <svg width="22" height="22" version="1.1" xmlns="http://www.w3.org/2000/svg"> - <defs> - <style id="current-color-scheme" type="text/css">.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }</style> - </defs> - <g transform="translate(3 3)"> - <path class="ColorScheme-Text" d="m7 14v-8l-3.5 3.5-1.5-1.5 6-6 6 6-1.5 1.5-3.5-3.5v8z"/> - </g> + <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <path d="m7 14v-9l-4 4-1-1 6-6 6 6-1 1-4-4v9z"/> </svg> }] } if {![info exists ::tk::Priv(folderImage)]} { - # Based on Boston/16/places/folder.svg - # See https://github.com/thecheis/Boston-Icons + # Based on https://icons8.com/icon/JXYalxb9XWWd/folder set ::tk::Priv(folderImage) [image create photo -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> - <g> - <path d="m2 1a2 2 0 0 0-0.51758 0.068359 2 2 0 0 0-0.48242 0.19922 2 2 0 0 0-0.41406 0.31836 2 2 0 0 0-0.31836 0.41406 2 2 0 0 0-0.19922 0.48242 2 2 0 0 0-0.068359 0.51758v13h2 12 2v-11-0.96094a1 1 0 0 0 0-0.039062 1 1 0 0 0 0-0.0058594 1 1 0 0 0 0-0.0097656 1 1 0 0 0 0-0.0058594 1 1 0 0 0 0-0.0097656 1 1 0 0 0 0-0.0097656 1 1 0 0 0-0.001953-0.0097656 1 1 0 0 0 0-0.0058594 1 1 0 0 0 0-0.0097656 1 1 0 0 0 0-0.0097657 1 1 0 0 0-0.001953-0.0097656 1 1 0 0 0 0-0.0058594 1 1 0 0 0 0-0.0097656 1 1 0 0 0-0.001953-0.0097656 1 1 0 0 0 0-0.0058594 1 1 0 0 0-0.001953-0.0097656 1 1 0 0 0 0-0.0039063 1 1 0 0 0-0.025391-0.12891 1 1 0 0 0-0.042969-0.12305 1 1 0 0 0-0.058594-0.11719 1 1 0 0 0-0.072265-0.10938 1 1 0 0 0-0.085938-0.097656 1 1 0 0 0-0.097656-0.085938 1 1 0 0 0-0.10938-0.072266 1 1 0 0 0-0.11719-0.058594 1 1 0 0 0-0.12305-0.042969 1 1 0 0 0-0.12891-0.025391 1 1 0 0 0-0.13086-0.0078125h-6l-2-2h-5zm13.99 3.1367a1 1 0 0 1-0.001953 0.019531 1 1 0 0 0 0.001953-0.019531zm-0.019531 0.10547a1 1 0 0 1-0.005859 0.019531 1 1 0 0 0 0.005859-0.019531z" fill="#2d8cff"/> - <path d="m9.5996 4-2.5 3h-6.0996v8h14v-10.471a0.5 0.5 0 0 1-0.001953 0.011719 0.5 0.5 0 0 0 0.001953-0.011719 0.5 0.5 0 0 0 0-0.0019531 0.5 0.5 0 0 0 0-0.027344 0.5 0.5 0 0 0-0.007812-0.085938 0.5 0.5 0 0 0-0.021485-0.085938 0.5 0.5 0 0 0-0.037109-0.078125 0.5 0.5 0 0 0-0.050782-0.072266 0.5 0.5 0 0 0-0.060546-0.060547 0.5 0.5 0 0 0-0.072266-0.050781 0.5 0.5 0 0 0-0.078125-0.037109 0.5 0.5 0 0 0-0.085937-0.021484 0.5 0.5 0 0 0-0.085938-0.0078125h-4.9004z" fill="#6fb7ff"/> - <path d="m2 2a1 1 0 0 0-0.22266 0.025391 1 1 0 0 0-0.21094 0.074219 1 1 0 0 0-0.18945 0.11914 1 1 0 0 0-0.1582 0.1582 1 1 0 0 0-0.11914 0.18945 1 1 0 0 0-0.074219 0.21094 1 1 0 0 0-0.025391 0.22266v3h5.5l1.7734-2.127-1.873-1.873h-4.4004z" fill="#6fb7ff"/> - </g> + <path d="m0.5 13.5v-12h4.293l2 2h8.707v10z" fill="#59afff"/> + <path d="m4.586 2 2 2h8.414v9h-14v-11h3.586m0.414-1h-5v13h16v-11h-9l-2-2z" fill="#2d8cff"/> + <path d="m0.5 14.5v-10h4.618l2-1h8.382v11z" fill="#8cc5ff"/> + <path d="m15 4v10h-14v-9h4.236l0.211-0.106 1.789-0.894h7.764m1-1h-9l-2 1h-5v11h16z" fill="#2d8cff"/> </svg> }] } if {![info exists ::tk::Priv(fileImage)]} { - # Based on Boston/16/mimes/text-x-plain.svg - # See https://github.com/thecheis/Boston-Icons + # Based on https://icons8.com/icon/mEF_vyjYlnE3/file set ::tk::Priv(fileImage) [image create photo -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> - <path d="m2 0h9l3 3v13h-12z" fill="#556e81"/> - <path d="m3 1h7.5l2.5 2.5v11.5h-10z" fill="#fff"/> - <g fill="#556e81"> - <path d="m10 0v4h4v-1h-3v-3z"/> - <rect x="5" y="4" width="3" height="1"/> - <rect x="5" y="6" width="6" height="1"/> - <rect x="5" y="8" width="6" height="1"/> - <rect x="5" y="10" width="6" height="1"/> - <rect x="5" y="12" width="3" height="1"/> - </g> + <path d="m2 1h8l4 4v11h-12z" fill="#808080"/> + <path d="m3 2h6.5l3.5 3.5v9.5h-10z" fill="#e8e8e8"/> + <path d="m9 1v5h5v-1h-4v-4h-1z" fill="#808080"/> </svg> }] } @@ -216,7 +201,9 @@ proc ::tk::dialog::file:: {type args} { foreach trace [trace info variable data(selectPath)] { trace remove variable data(selectPath) {*}$trace } - $data(dirMenuBtn) configure -textvariable {} + if {[winfo exists $data(dirMenuBtn)]} { + $data(dirMenuBtn) configure -textvariable {} + } return $Priv(selectFilePath) } diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index 26708b7..fc88dee 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -95,7 +95,7 @@ namespace eval ttk::theme::alt { # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised - ttk::style configure Item -diameter 6.75p \ + ttk::style configure Item \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background $colors(-window) \ -stripedbackground $colors(-alternate) -indent 15p diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index 00bb686..7b6dd9c 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -75,6 +75,20 @@ namespace eval ttk::theme::aqua { pressed RecessedFont } + # Sidebar (radio) button + font create SidebarFont -family .AppleSystemUIFont -size 11 -weight normal + ttk::style configure SidebarButton \ + -foreground systemControlTextColor \ + -font SidebarFont + ttk::style map SidebarButton \ + -foreground { + {disabled selected} systemWindowBackgroundColor3 + {disabled !selected} systemDisabledControlTextColor + selected systemTextColor + active systemTextColor + pressed systemTextColor + } + # For Entry, Combobox and Spinbox widgets the selected text background # is the "Highlight color" selected in preferences when the widget # has focus. It is a gray color when the widget does not have focus or diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index 7235b2b..331b3ad 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -49,7 +49,7 @@ namespace eval ttk::theme::classic { ttk::style map TButton -relief {{!disabled pressed} sunken} ttk::style configure TCheckbutton -indicatorrelief raised \ - -indicatordiameter 9p -indicatormargin {0 1.5p 3p 1.5p} + -indicatormargin {0 1.5p 3p 1.5p} ttk::style map TCheckbutton \ -indicatorcolor [list \ pressed $colors(-frame) \ @@ -58,7 +58,7 @@ namespace eval ttk::theme::classic { -indicatorrelief {alternate raised selected sunken pressed sunken} ttk::style configure TRadiobutton -indicatorrelief raised \ - -indicatordiameter 9p -indicatormargin {0 1.5p 3p 1.5p} + -indicatormargin {0 1.5p 3p 1.5p} ttk::style map TRadiobutton \ -indicatorcolor [list \ pressed $colors(-frame) \ diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index ba851cb..6f46dfd 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -18,8 +18,7 @@ namespace eval ttk::theme::default { -disabledfg "#a3a3a3" -indicator "#4a6984" -disabledindicator "#a3a3a3" - -altindicator "#9fbdd8" - -disabledaltindicator "#c0c0c0" + -pressedindicator "#5895bc" } # On X11, if the user specifies their own choice of colour scheme via @@ -40,14 +39,12 @@ namespace eval ttk::theme::default { { selectBackground SelectBackground } { disabledForeground DisabledForeground } { selectBackground SelectBackground } - { troughColor TroughColor } { windowColor Background } } \ colorName { -frame -foreground -window -alternate -text -activebg -selectbg -selectfg -darker -disabledfg -indicator - -disabledindicator -altindicator - -disabledaltindicator -window } { + -disabledindicator -pressedindicator -window } { set color [eval option get . $xResourceName] if {$color ne ""} { set colors($colorName) $color @@ -64,9 +61,9 @@ namespace eval ttk::theme::default { background {-frame -window -alternate} foreground {-foreground -text} activeBackground -activebg - selectBackground {-selectbg -indicator -altindicator} + selectBackground {-selectbg -indicator -pressedindicator} selectForeground -selectfg - troughColor {-darker -disabledaltindicator} + troughColor -darker disabledForeground {-disabledfg -disabledindicator} } } @@ -97,7 +94,6 @@ proc ttk::theme::default::reconfigureDefaultTheme {} { -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -insertwidth 1 \ - -indicatordiameter 10 \ ; ttk::style map "." -background \ @@ -114,31 +110,21 @@ proc ttk::theme::default::reconfigureDefaultTheme {} { -relief raised -shiftrelief 1 ttk::style map TButton -relief [list {!disabled pressed} sunken] - ttk::style configure TCheckbutton \ - -indicatorcolor $colors(-window) -indicatorrelief sunken \ - -indicatordiameter 7.5p -indicatormargin {0 1.5p 3p 1.5p} \ - -padding 0.75p - ttk::style map TCheckbutton -indicatorcolor \ - [list pressed $colors(-activebg) \ - {!disabled alternate} $colors(-altindicator) \ - {disabled alternate} $colors(-disabledaltindicator) \ - {!disabled selected} $colors(-indicator) \ - {disabled selected} $colors(-disabledindicator)] - ttk::style map TCheckbutton -indicatorrelief \ - [list alternate raised] - - ttk::style configure TRadiobutton \ - -indicatorcolor $colors(-window) -indicatorrelief sunken \ - -indicatordiameter 7.5p -indicatormargin {0 1.5p 3p 1.5p} \ - -padding 0.75p - ttk::style map TRadiobutton -indicatorcolor \ - [list pressed $colors(-activebg) \ - {!disabled alternate} $colors(-altindicator) \ - {disabled alternate} $colors(-disabledaltindicator) \ - {!disabled selected} $colors(-indicator) \ - {disabled selected} $colors(-disabledindicator)] - ttk::style map TRadiobutton -indicatorrelief \ - [list alternate raised] + foreach style {TCheckbutton TRadiobutton} { + ttk::style configure $style \ + -indicatorbackground $colors(-window) \ + -indicatorforeground $colors(-selectfg) \ + -indicatormargin {0 1.5p 3p 1.5p} -padding 0.75p + ttk::style map $style -indicatorbackground \ + [list {alternate disabled} $colors(-disabledindicator) \ + {alternate pressed} $colors(-pressedindicator) \ + alternate $colors(-indicator) \ + {selected disabled} $colors(-disabledindicator) \ + {selected pressed} $colors(-pressedindicator) \ + selected $colors(-indicator) \ + disabled $colors(-frame) \ + pressed $colors(-darker)] + } ttk::style configure TMenubutton \ -relief raised -indicatormargin {3.75p 0} -padding {7.5p 2.25p} diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl index 834d177..d34d860 100644 --- a/library/ttk/winTheme.tcl +++ b/library/ttk/winTheme.tcl @@ -70,7 +70,7 @@ namespace eval ttk::theme::winnative { # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised - ttk::style configure Item -diameter 6.75p \ + ttk::style configure Item \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background SystemWindow \ -stripedbackground System3dLight -indent 15p diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl index 12ae979..cf299b1 100644 --- a/library/ttk/xpTheme.tcl +++ b/library/ttk/xpTheme.tcl @@ -52,7 +52,7 @@ namespace eval ttk::theme::xpnative { # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised - ttk::style configure Item -diameter 6.75p \ + ttk::style configure Item \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background SystemWindow \ -stripedbackground System3dLight -indent 15p |