summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/altTheme.tcl56
-rw-r--r--library/ttk/aquaTheme.tcl76
-rw-r--r--library/ttk/button.tcl6
-rw-r--r--library/ttk/clamTheme.tcl63
-rw-r--r--library/ttk/classicTheme.tcl41
-rw-r--r--library/ttk/combobox.tcl278
-rw-r--r--library/ttk/defaults.tcl153
-rw-r--r--library/ttk/entry.tcl137
-rw-r--r--library/ttk/fonts.tcl118
-rw-r--r--library/ttk/menubutton.tcl16
-rw-r--r--library/ttk/notebook.tcl74
-rw-r--r--library/ttk/panedwindow.tcl6
-rw-r--r--library/ttk/progress.tcl10
-rw-r--r--library/ttk/scale.tcl2
-rw-r--r--library/ttk/scrollbar.tcl25
-rw-r--r--library/ttk/sizegrip.tcl4
-rw-r--r--library/ttk/spinbox.tcl28
-rw-r--r--library/ttk/treeview.tcl141
-rw-r--r--library/ttk/ttk.tcl32
-rw-r--r--library/ttk/utils.tcl83
-rw-r--r--library/ttk/vistaTheme.tcl30
-rw-r--r--library/ttk/winTheme.tcl51
-rw-r--r--library/ttk/xpTheme.tcl28
23 files changed, 979 insertions, 479 deletions
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl
index 8c0bfd6..2d1b6b9 100644
--- a/library/ttk/altTheme.tcl
+++ b/library/ttk/altTheme.tcl
@@ -8,6 +8,7 @@ namespace eval ttk::theme::alt {
array set colors {
-frame "#d9d9d9"
-window "#ffffff"
+ -alternate "#f0f0f0"
-darker "#c3c3c3"
-border "#414141"
-activebg "#ececec"
@@ -29,21 +30,23 @@ namespace eval ttk::theme::alt {
-font TkDefaultFont
ttk::style map "." -background \
- [list disabled $colors(-frame) active $colors(-activebg)] ;
- ttk::style map "." -foreground [list disabled $colors(-disabledfg)] ;
- ttk::style map "." -embossed [list disabled 1] ;
+ [list disabled $colors(-frame) active $colors(-activebg)]
+ ttk::style map "." -foreground [list disabled $colors(-disabledfg)]
+ ttk::style map "." -embossed [list disabled 1]
ttk::style configure TButton \
- -anchor center -width -11 -padding "1 1" \
+ -anchor center -width -11 -padding 0.75p \
-relief raised -shiftrelief 1 \
-highlightthickness 1 -highlightcolor $colors(-frame)
ttk::style map TButton -relief {
- {pressed !disabled} sunken
- {active !disabled} raised
+ {pressed !disabled} sunken
+ {active !disabled} raised
} -highlightcolor {alternate black}
- ttk::style configure TCheckbutton -indicatorcolor "#ffffff" -padding 2
- ttk::style configure TRadiobutton -indicatorcolor "#ffffff" -padding 2
+ ttk::style configure TCheckbutton -indicatorcolor "#ffffff" \
+ -indicatormargin {0 1.5p 3p 1.5p} -padding 1.5p
+ ttk::style configure TRadiobutton -indicatorcolor "#ffffff" \
+ -indicatormargin {0 1.5p 3p 1.5p} -padding 1.5p
ttk::style map TCheckbutton -indicatorcolor \
[list pressed $colors(-frame) \
alternate $colors(-altindicator) \
@@ -54,46 +57,53 @@ namespace eval ttk::theme::alt {
disabled $colors(-frame)]
ttk::style configure TMenubutton \
- -width -11 -padding "3 3" -relief raised
+ -width -11 -padding 2.25p -arrowsize 3.75p -relief raised
ttk::style configure TEntry -padding 1 \
-focuswidth 2 -focuscolor $colors(-selectbg)
ttk::style map TEntry -fieldbackground \
- [list readonly $colors(-frame) disabled $colors(-frame)]
+ [list readonly $colors(-frame) disabled $colors(-frame)]
- ttk::style configure TCombobox -padding 1 \
+ ttk::style configure TCombobox -padding 1 -arrowsize 10.5p \
-focuswidth 1 -focuscolor $colors(-selectbg)
ttk::style map TCombobox -fieldbackground \
- [list readonly $colors(-frame) disabled $colors(-frame)] \
- -arrowcolor [list disabled $colors(-disabledfg)]
+ [list readonly $colors(-frame) disabled $colors(-frame)] \
+ -arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure ComboboxPopdownFrame -relief solid -borderwidth 1
- ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} \
+ ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0} \
-focuswidth 1 -focuscolor $colors(-selectbg)
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 configure Toolbutton -relief flat -padding 1.5p
ttk::style map Toolbutton -relief \
{disabled flat selected sunken pressed sunken active raised}
ttk::style map Toolbutton -background \
[list pressed $colors(-darker) active $colors(-activebg)]
- ttk::style configure TScrollbar -relief raised
+ ttk::style configure TScrollbar -relief raised \
+ -arrowsize 10.5p -width 10.5p
ttk::style configure TLabelframe -relief groove -borderwidth 2
- ttk::style configure TNotebook -tabmargins {2 2 1 0}
+ ttk::style configure TNotebook -tabmargins {1.5p 1.5p 0.75p 0}
ttk::style configure TNotebook.Tab -background $colors(-darker) \
- -padding {4 2}
+ -padding {3p 1.5p}
ttk::style map TNotebook.Tab \
-background [list selected $colors(-frame)] \
- -expand [list selected {2 2 1 0}] \
+ -expand {selected {1.5p 1.5p 0.75p 0}}
# Treeview:
ttk::style configure Heading -font TkHeadingFont -relief raised
- ttk::style configure Treeview -background $colors(-window)
+ ttk::style configure Item \
+ -indicatormargins {1.5p 1.5p 3p 1.5p}
+ ttk::style configure Treeview -background $colors(-window) \
+ -stripedbackground $colors(-alternate) -indent 15p
+ ttk::setTreeviewRowHeight
+ ttk::style configure Treeview.Separator \
+ -background $colors(-alternate)
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
selected $colors(-selectbg)] \
@@ -101,9 +111,11 @@ namespace eval ttk::theme::alt {
selected $colors(-selectfg)]
ttk::style configure TScale \
- -groovewidth 4 -troughrelief sunken -borderwidth 2
+ -groovewidth 3p -troughrelief sunken \
+ -sliderthickness 11.25p -borderwidth 2
ttk::style configure TProgressbar \
- -background $colors(-selectbg) -borderwidth 0
+ -background $colors(-selectbg) -borderwidth 0 \
+ -barsize 22.5p -thickness 11.25p
}
}
diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl
index 59fa807..a631376 100644
--- a/library/ttk/aquaTheme.tcl
+++ b/library/ttk/aquaTheme.tcl
@@ -25,15 +25,69 @@ namespace eval ttk::theme::aqua {
!focus systemSelectedTextColor}
# Button
- ttk::style configure TButton -anchor center -width -6 \
+ ttk::style configure TButton -anchor center \
-foreground systemControlTextColor
ttk::style map TButton \
-foreground {
pressed white
- {alternate !pressed !background} white}
+ {alternate !pressed !background} white
+ disabled systemDisabledControlTextColor}
+
+ # Menubutton
ttk::style configure TMenubutton -anchor center -padding {2 0 0 2}
+
+ # Toolbutton
ttk::style configure Toolbutton -anchor center
+ # Inline Button
+ ttk::style configure InlineButton -anchor center -font TkHeadingFont \
+ -foreground systemTextBackgroundColor
+ ttk::style map InlineButton \
+ -foreground {
+ disabled systemWindowBackgroundColor
+ }
+
+ # Image Button
+ ttk::style configure ImageButton -anchor center -width 1 \
+ -compound top
+ ttk::style map ImageButton \
+ -foreground {
+ pressed systemLabelColor
+ !pressed systemSecondaryLabelColor
+ }
+
+ # Recessed (radio) button
+ font create RecessedFont -family EmphasizedSystem -size 11 -weight bold
+ ttk::style configure RecessedButton \
+ -foreground systemControlTextColor
+ ttk::style map RecessedButton \
+ -foreground {
+ {disabled selected} systemWindowBackgroundColor3
+ {disabled !selected} systemDisabledControlTextColor
+ selected systemTextBackgroundColor
+ active white
+ pressed white
+ } \
+ -font {
+ selected RecessedFont
+ active RecessedFont
+ 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
@@ -85,9 +139,10 @@ namespace eval ttk::theme::aqua {
ttk::style configure TNotebook.Tab -foreground systemControlTextColor
ttk::style map TNotebook.Tab \
-foreground {
- background systemControlTextColor
- disabled systemDisabledControlTextColor
- selected systemSelectedTabTextColor}
+ {background !selected} systemControlTextColor
+ {background selected} black
+ {!background selected} systemSelectedTabTextColor
+ disabled systemDisabledControlTextColor}
# Treeview:
ttk::style configure Heading \
@@ -95,8 +150,9 @@ namespace eval ttk::theme::aqua {
-foreground systemTextColor \
-background systemWindowBackgroundColor
ttk::style configure Treeview -rowheight 18 \
- -background systemTextBackgroundColor \
- -foreground systemTextColor \
+ -background systemControlBackgroundColor \
+ -stripedbackground systemControlAlternatingRowColor \
+ -foreground systemTextColor \
-fieldbackground systemTextBackgroundColor
ttk::style map Treeview \
-background {
@@ -111,7 +167,11 @@ namespace eval ttk::theme::aqua {
# (ref: Apple Human Interface Guidelines / Controls / Grouping Controls)
#
ttk::style configure TLabelframe \
- -labeloutside true -labelmargins {14 0 14 4}
+ -labeloutside true \
+ -labelmargins {14 0 14 2}
+
+ ttk::style configure TLabelframe.Label \
+ -font TkSmallCaptionFont
# TODO: panedwindow sashes should be 9 pixels (HIG:Controls:Split Views)
}
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl
index e8c24a1..a14a53b 100644
--- a/library/ttk/button.tcl
+++ b/library/ttk/button.tcl
@@ -42,7 +42,7 @@ ttk::copyBindings TButton TRadiobutton
bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 }
bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 }
-# bind TCheckbutton <plus> { %W select }
+# bind TCheckbutton <+> { %W select }
# bind TCheckbutton <minus> { %W deselect }
# activate --
@@ -66,7 +66,7 @@ proc ttk::button::activate {w} {
proc ttk::button::RadioTraverse {w dir} {
set group [list]
foreach sibling [winfo children [winfo parent $w]] {
- if { [winfo class $sibling] eq "TRadiobutton"
+ if { [winfo class $sibling] eq "TRadiobutton"
&& [$sibling cget -variable] eq [$w cget -variable]
&& ![$sibling instate disabled]
} {
@@ -75,7 +75,7 @@ proc ttk::button::RadioTraverse {w dir} {
}
if {![llength $group]} { # Shouldn't happen, but can.
- return
+ return
}
set pos [expr {([lsearch -exact $group $w] + $dir) % [llength $group]}]
diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl
index 707d849..6711d6c 100644
--- a/library/ttk/clamTheme.tcl
+++ b/library/ttk/clamTheme.tcl
@@ -39,13 +39,13 @@ namespace eval ttk::theme::clam {
-background [list disabled $colors(-frame) \
active $colors(-lighter)] \
-foreground [list disabled $colors(-disabledfg)] \
- -selectbackground [list !focus $colors(-darkest)] \
- -selectforeground [list !focus white]
+ -selectbackground [list !focus $colors(-darkest)] \
+ -selectforeground [list !focus white]
# -selectbackground [list !focus "#847d73"]
ttk::style configure TButton \
- -anchor center -width -11 -padding 5 -relief raised
+ -anchor center -width -11 -padding 3.75p -relief raised
ttk::style map TButton \
-background [list \
disabled $colors(-frame) \
@@ -53,10 +53,10 @@ namespace eval ttk::theme::clam {
active $colors(-lighter)] \
-lightcolor [list pressed $colors(-darker)] \
-darkcolor [list pressed $colors(-darker)] \
- -bordercolor [list alternate "#000000"]
+ -bordercolor {alternate #000000}
ttk::style configure Toolbutton \
- -anchor center -padding 2 -relief flat
+ -anchor center -padding 1.5p -relief flat
ttk::style map Toolbutton \
-relief [list \
disabled flat \
@@ -72,12 +72,12 @@ namespace eval ttk::theme::clam {
ttk::style configure TCheckbutton \
-indicatorbackground "#ffffff" \
- -indicatormargin {1 1 4 1} \
- -padding 2
+ -indicatormargin {0.75p 0.75p 3p 0.75p} \
+ -padding 1.5p
ttk::style configure TRadiobutton \
-indicatorbackground "#ffffff" \
- -indicatormargin {1 1 4 1} \
- -padding 2
+ -indicatormargin {0.75p 0.75p 3p 0.75p} \
+ -padding 1.5p
ttk::style map TCheckbutton -indicatorbackground \
[list pressed $colors(-frame) \
{!disabled alternate} $colors(-altindicator) \
@@ -90,15 +90,17 @@ namespace eval ttk::theme::clam {
disabled $colors(-frame)]
ttk::style configure TMenubutton \
- -width -11 -padding 5 -relief raised
+ -width -11 -arrowsize 3.75p -arrowpadding 2.25p -padding 3.75p \
+ -relief raised
ttk::style configure TEntry -padding 1 -insertwidth 1
ttk::style map TEntry \
- -background [list readonly $colors(-frame)] \
- -bordercolor [list focus $colors(-selectbg)] \
- -lightcolor [list focus "#6f9dc6"]
+ -background [list readonly $colors(-frame)] \
+ -bordercolor [list focus $colors(-selectbg)] \
+ -lightcolor [list focus #6f9dc6]
- ttk::style configure TCombobox -padding 1 -insertwidth 1
+ ttk::style configure TCombobox -padding 1 -insertwidth 1 \
+ -arrowsize 10.5p
ttk::style map TCombobox \
-background [list active $colors(-lighter) \
pressed $colors(-lighter)] \
@@ -110,34 +112,47 @@ namespace eval ttk::theme::clam {
ttk::style configure ComboboxPopdownFrame \
-relief solid -borderwidth 1
- ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
+ ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0}
ttk::style map TSpinbox \
- -background [list readonly $colors(-frame)] \
+ -background [list readonly $colors(-frame)] \
-arrowcolor [list disabled $colors(-disabledfg)] \
-bordercolor [list focus $colors(-selectbg)]
- ttk::style configure TNotebook.Tab -padding {6 2 6 2}
+ ttk::style configure TNotebook.Tab -padding {4.5p 1.5p 4.5p 1.5p}
ttk::style map TNotebook.Tab \
- -padding [list selected {6 4 6 2}] \
+ -padding {selected {4.5p 3p 4.5p 1.5p}} \
-background [list selected $colors(-frame) {} $colors(-darker)] \
-lightcolor [list selected $colors(-lighter) {} $colors(-dark)]
# Treeview:
ttk::style configure Heading \
- -font TkHeadingFont -relief raised -padding {3}
- ttk::style configure Treeview -background $colors(-window)
+ -font TkHeadingFont -relief raised -padding 2.25p
+ ttk::style configure Item -indicatorsize 9p \
+ -indicatormargins {1.5p 1.5p 3p 1.5p}
+ ttk::style configure Treeview -background $colors(-window) \
+ -stripedbackground $colors(-lighter) -indent 15p
+ ttk::setTreeviewRowHeight
+ ttk::style configure Treeview.Separator \
+ -background $colors(-lighter)
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
selected $colors(-selectbg)] \
-foreground [list disabled $colors(-disabledfg) \
selected $colors(-selectfg)]
- ttk::style configure TLabelframe \
- -labeloutside true -labelmargins {0 0 0 4} \
+ ttk::style configure TLabelframe \
+ -labeloutside true -labelmargins {0 0 0 3p} \
-borderwidth 2 -relief raised
- ttk::style configure TProgressbar -background $colors(-frame)
+ ttk::style configure TScrollbar -gripcount 3.75p \
+ -arrowsize 10.5p -width 10.5p
- ttk::style configure Sash -sashthickness 6 -gripcount 10
+ ttk::style configure TScale -gripcount 3.75p \
+ -arrowsize 10.5p -sliderlength 22.5p
+
+ ttk::style configure TProgressbar -background $colors(-frame) \
+ -arrowsize 10.5p -sliderlength 22.5p
+
+ ttk::style configure Sash -sashthickness 4.5p -gripcount 7.5p
}
}
diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl
index 609c5d7..7964034 100644
--- a/library/ttk/classicTheme.tcl
+++ b/library/ttk/classicTheme.tcl
@@ -10,6 +10,7 @@ namespace eval ttk::theme::classic {
array set colors {
-frame "#d9d9d9"
-window "#ffffff"
+ -alternate "#f0f0f0"
-activebg "#ececec"
-troughbg "#b3b3b3"
-selectbg "#c3c3c3"
@@ -42,13 +43,14 @@ namespace eval ttk::theme::classic {
ttk::style map "." -foreground \
[list disabled $colors(-disabledfg)]
- ttk::style map "." -highlightcolor [list focus black]
+ ttk::style map "." -highlightcolor {focus black}
ttk::style configure TButton \
-anchor center -padding "3m 1m" -relief raised -shiftrelief 1
- ttk::style map TButton -relief [list {!disabled pressed} sunken]
+ ttk::style map TButton -relief {{!disabled pressed} sunken}
- ttk::style configure TCheckbutton -indicatorrelief raised
+ ttk::style configure TCheckbutton -indicatorrelief raised \
+ -indicatormargin {0 1.5p 3p 1.5p}
ttk::style map TCheckbutton \
-indicatorcolor [list \
pressed $colors(-frame) \
@@ -56,7 +58,8 @@ namespace eval ttk::theme::classic {
selected $colors(-indicator)] \
-indicatorrelief {alternate raised selected sunken pressed sunken}
- ttk::style configure TRadiobutton -indicatorrelief raised
+ ttk::style configure TRadiobutton -indicatorrelief raised \
+ -indicatormargin {0 1.5p 3p 1.5p}
ttk::style map TRadiobutton \
-indicatorcolor [list \
pressed $colors(-frame) \
@@ -65,14 +68,14 @@ namespace eval ttk::theme::classic {
-indicatorrelief {alternate raised selected sunken pressed sunken}
ttk::style configure TMenubutton -relief raised \
- -indicatorborderwidth 2 -padding "3m 1m"
+ -indicatormargin {3.75p 0} -padding {3m 1m}
- ttk::style configure TEntry -relief sunken -padding 1 -font TkTextFont
+ ttk::style configure TEntry -padding 1 -font TkTextFont
ttk::style map TEntry -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)]
ttk::style element create Combobox.downarrow from default
- ttk::style configure TCombobox -padding 1 -arrowsize 12
+ ttk::style configure TCombobox -padding 1 -arrowsize 9p
ttk::style map TCombobox -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)]
ttk::style configure ComboboxPopdownFrame \
@@ -80,19 +83,22 @@ namespace eval ttk::theme::classic {
ttk::style element create Spinbox.uparrow from default
ttk::style element create Spinbox.downarrow from default
- ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
+ ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0}
ttk::style map TSpinbox -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)]
ttk::style configure TLabelframe -borderwidth 2 -relief groove
- ttk::style configure TScrollbar -relief raised -arrowsize 12 -width 12
+ ttk::style configure TScrollbar -relief raised -arrowsize 9p -width 9p
ttk::style map TScrollbar -relief {{pressed !disabled} sunken}
- ttk::style configure TScale -sliderrelief raised -sliderborderwidth 2
+ ttk::style configure TScale -sliderrelief raised \
+ -sliderlength 22.5p -sliderthickness 11.25p
ttk::style map TScale -sliderrelief {{pressed !disabled} sunken}
- ttk::style configure TProgressbar -background SteelBlue
+ ttk::style configure TProgressbar -background SteelBlue \
+ -barsize 22.5p -thickness 11.25p
+
ttk::style configure TNotebook.Tab \
-padding {3m 1m} \
-background $colors(-troughbg) \
@@ -101,7 +107,13 @@ namespace eval ttk::theme::classic {
# Treeview:
ttk::style configure Heading -font TkHeadingFont -relief raised
- ttk::style configure Treeview -background $colors(-window)
+ ttk::style configure Item -indicatorsize 9p \
+ -indicatormargins {1.5p 1.5p 3p 1.5p}
+ ttk::style configure Treeview -background $colors(-window) \
+ -stripedbackground $colors(-alternate) -indent 15p
+ ttk::setTreeviewRowHeight
+ ttk::style configure Treeview.Separator \
+ -background $colors(-alternate)
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
selected $colors(-selectbg)] \
@@ -111,10 +123,13 @@ namespace eval ttk::theme::classic {
#
# Toolbar buttons:
#
- ttk::style configure Toolbutton -padding 2 -relief flat -shiftrelief 2
+ ttk::style configure Toolbutton -padding 1.5p -relief flat -shiftrelief 2
ttk::style map Toolbutton -relief \
{disabled flat selected sunken pressed sunken active raised}
ttk::style map Toolbutton -background \
[list pressed $colors(-troughbg) active $colors(-activebg)]
+
+ ttk::style configure Sash \
+ -sashthickness 4.5p -sashpad 1.5 -handlesize 6p -handlepad 6p
}
}
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 31b60db..1b9d4cb 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -16,20 +16,17 @@
# window managers (even though the older ICCCM spec says
# it's meaningless).
#
-# On OSX: [wm transient] does utterly the wrong thing.
-# Instead, we use [MacWindowStyle "help" "noActivates hideOnSuspend"].
-# The "noActivates" attribute prevents the parent toplevel
-# from deactivating when the popdown is posted, and is also
-# necessary for "help" windows to receive mouse events.
-# "hideOnSuspend" makes the popdown disappear (resp. reappear)
-# when the parent toplevel is deactivated (resp. reactivated).
-# (see [#1814778]). Also set [wm resizable 0 0], to prevent
-# TkAqua from shrinking the scrollbar to make room for a grow box
-# that isn't there.
-#
-# In order to work around other platform quirks in TkAqua,
-# [grab] and [focus] are set in <Map> bindings instead of
-# immediately after deiconifying the window.
+# On OSX: The native combobox uses a popup menu to display the
+# combobox choices. So this implementation does that as well,
+# rather than construc a Tk listbox. Since the window manager
+# takes care of scrolling and making sure that the menu can be
+# displayed even when the button is close to the bottom of the
+# screen, this actually simplifies the implementation. The Post
+# and PopupWindow procs have separate implementations for Aqua
+# and other systems. The configuration of the menu is handled
+# by a different proc than the one which configures the listbox
+# on other platforms -- ConfigureAquaMenu instead of
+# ConfigureListbox.
#
namespace eval ttk::combobox {
@@ -55,8 +52,17 @@ bind TCombobox <Triple-Button-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 }
-ttk::bindMouseWheel TCombobox [list ttk::combobox::Scroll %W]
-
+ttk::bindMouseWheel TCombobox { ttk::combobox::Scroll %W }
+bind TCombobox <Shift-MouseWheel> {
+ # Ignore the event
+}
+bind TCombobox <TouchpadScroll> {
+ lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ # TouchpadScroll events fire about 60 times per second.
+ if {$deltaY != 0 && %# %% 15 == 0} {
+ ttk::combobox::Scroll %W [expr {$deltaY > 0 ? -1 : 1}]
+ }
+}
bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W }
### Combobox listbox bindings.
@@ -76,6 +82,9 @@ switch -- [tk windowingsystem] {
# NB: *only* do this on Windows (see #1814778)
bind ComboboxListbox <FocusOut> { ttk::combobox::LBCancel %W }
}
+ aqua {
+ bind TCombobox <Destroy> { ttk::combobox::AquaCleanup %W }
+ }
}
### Combobox popdown window bindings.
@@ -98,9 +107,6 @@ switch -- [tk windowingsystem] {
x11 {
option add *TCombobox*Listbox.background white widgetDefault
}
- aqua {
- option add *TCombobox*Listbox.borderWidth 0 widgetDefault
- }
}
### Binding procedures.
@@ -182,13 +188,20 @@ proc ttk::combobox::SelectEntry {cb index} {
## Scroll -- Mousewheel binding
#
-proc ttk::combobox::Scroll {cb dir} {
+proc ttk::combobox::Scroll {cb dir {factor 1.0}} {
$cb instate disabled { return }
set max [llength [$cb cget -values]]
set current [$cb current]
- incr current $dir
- if {$max != 0 && $current == $current % $max} {
- SelectEntry $cb $current
+ if {$current < 0} {
+ set index 0
+ } else {
+ set d [expr {$dir/$factor}]
+ set index [expr {$current + int($d > 0 ? ceil($d) : floor($d))}]
+ if {$index >= $max} {set index [expr {$max - 1}]}
+ if {$index < 0} {set index 0}
+ }
+ if {$max != 0 && $index != $current} {
+ SelectEntry $cb $index
}
}
@@ -197,7 +210,7 @@ proc ttk::combobox::Scroll {cb dir} {
# and unpost the listbox.
#
proc ttk::combobox::LBSelected {lb} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
LBSelect $lb
Unpost $cb
focus $cb
@@ -207,14 +220,14 @@ proc ttk::combobox::LBSelected {lb} {
# Unpost the listbox.
#
proc ttk::combobox::LBCancel {lb} {
- Unpost [LBMaster $lb]
+ Unpost [LBMain $lb]
}
## LBTab -- Tab key binding for combobox listbox.
# Set the selection, and navigate to next/prev widget.
#
proc ttk::combobox::LBTab {lb dir} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
switch -- $dir {
next { set newFocus [tk_focusNext $cb] }
prev { set newFocus [tk_focusPrev $cb] }
@@ -257,33 +270,52 @@ proc ttk::combobox::UnmapPopdown {w} {
# Returns the popdown widget associated with a combobox,
# creating it if necessary.
#
-proc ttk::combobox::PopdownWindow {cb} {
- if {![winfo exists $cb.popdown]} {
- set poplevel [PopdownToplevel $cb.popdown]
- set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame]
-
- ttk::scrollbar $popdown.sb \
- -orient vertical -command [list $popdown.l yview]
- listbox $popdown.l \
- -listvariable ttk::combobox::Values($cb) \
- -yscrollcommand [list $popdown.sb set] \
- -exportselection false \
- -selectmode browse \
- -activestyle none
-
- bindtags $popdown.l \
- [list $popdown.l ComboboxListbox Listbox $popdown all]
-
- 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
+
+if {[tk windowingsystem] ne "aqua"} {
+ proc ttk::combobox::PopdownWindow {cb} {
+ if {![winfo exists $cb.popdown]} {
+ set poplevel [PopdownToplevel $cb.popdown]
+ set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame]
+
+ ttk::scrollbar $popdown.sb \
+ -orient vertical -command [list $popdown.l yview]
+ listbox $popdown.l \
+ -listvariable ttk::combobox::Values($cb) \
+ -yscrollcommand [list $popdown.sb set] \
+ -exportselection false \
+ -selectmode browse \
+ -activestyle none \
+ ;
+
+ bindtags $popdown.l \
+ [list $popdown.l ComboboxListbox Listbox $popdown all]
+
+ 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
+ }
+} else {
+ proc ttk::combobox::PopdownWindow {cb} {
+ if {![winfo exists $cb.popdown]} {
+ set poplevel [PopdownToplevel $cb.popdown]
+ # The menu should be (at least) the same length as the button.
+ # Since there is no direct way to control the width of a menu
+ # in Tk, we fake it by using an invisible image in a disabled
+ # menu item, adjusting the image size to make the menu be the
+ # correct width.
+ image create nsimage $cb.spacer -source NSStatusNone -as name \
+ -alpha 0
+ set menu [menu $cb.popdown.menu -tearoff 0]
+ }
+ return $cb.popdown
}
- return $cb.popdown
}
## PopdownToplevel -- Create toplevel window for the combobox popdown
@@ -306,10 +338,8 @@ proc ttk::combobox::PopdownToplevel {w} {
wm attributes $w -topmost 1
}
aqua {
- $w configure -relief solid -borderwidth 0
- tk::unsupported::MacWindowStyle style $w \
- help {noActivates hideOnSuspend}
- wm resizable $w 0 0
+ wm overrideredirect $w true
+ wm attributes $w -alpha 0
}
}
return $w
@@ -336,7 +366,7 @@ proc ttk::combobox::ConfigureListbox {cb} {
set height [llength $values]
if {$height > [$cb cget -height]} {
set height [$cb cget -height]
- grid $popdown.sb
+ grid $popdown.sb
grid configure $popdown.l -padx {1 0}
} else {
grid remove $popdown.sb
@@ -345,6 +375,39 @@ proc ttk::combobox::ConfigureListbox {cb} {
$popdown.l configure -height $height
}
+proc ttk::combobox::ConfigureAquaMenu {cb width} {
+ set popdown [PopdownWindow $cb]
+ set values [$cb cget -values]
+ set current [$cb current]
+ if {$current < 0} {
+ set current 0 ;# no current entry, highlight first one
+ }
+ $cb.popdown.menu delete 0 end
+ $cb.spacer configure -width [expr {$width - 40}] -height 1
+ set i 0
+ foreach item $values {
+ if {$i == 0} {
+ # Add spaces to the first item to make the menu as long as cb
+ set menufont [$cb cget -font]
+ set stretch $item
+ while {[font measure $menufont $stretch] < [expr {$width - 32}]} {
+ set stretch "$stretch "
+ }
+ $cb.popdown.menu add command -label "$stretch" \
+ -command "ttk::combobox::SelectEntry $cb $i"
+ } else {
+ $cb.popdown.menu add command -label "$item" \
+ -command "ttk::combobox::SelectEntry $cb $i"
+ }
+ incr i
+ }
+ if { $i == 0 } {
+ # There are no items. To make an empty menu appear add a dummy item
+ # containing a transparent image of the right width.
+ $cb.popdown.menu add command -label {} -image $cb.spacer -state disabled
+ }
+}
+
## PlacePopdown --
# Set popdown window geometry.
#
@@ -361,7 +424,7 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
}
set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
foreach var {x y w h} delta $postoffset {
- incr $var $delta
+ incr $var $delta
}
set H [winfo reqheight $popdown]
@@ -373,34 +436,75 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
wm geometry $popdown ${w}x${H}+${x}+${Y}
}
+proc ttk::combobox::AquaPlacePopdown {cb popdown} {
+ set x [winfo rootx $cb]
+ set y [winfo rooty $cb]
+ set w [winfo width $cb]
+ set h [winfo height $cb]
+ set style [$cb cget -style]
+ set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
+ foreach var {x y w h} delta $postoffset {
+ incr $var $delta
+ }
+ wm geometry $popdown ${w}x${h}+${x}+${y}
+ return [list $x $y $w $h]
+}
+
## Post $cb --
-# Pop down the associated listbox.
-#
-proc ttk::combobox::Post {cb} {
- # Don't do anything if disabled:
- #
- $cb instate disabled { return }
+# Pop down the associated listbox or menu.
+#
+if {[tk windowingsystem] ne "aqua"} {
+ proc ttk::combobox::Post {cb} {
+ # Don't do anything if disabled:
+ #
+ $cb instate disabled { return }
+
+ # ASSERT: ![$cb instate pressed]
+
+ # Run -postcommand callback:
+ #
+ uplevel #0 [$cb cget -postcommand]
+
+ set popdown [PopdownWindow $cb]
+ ConfigureListbox $cb
+ update idletasks ;# needed for geometry propagation.
+ PlacePopdown $cb $popdown
+ # See <<NOTE-WM-TRANSIENT>>
+ switch -- [tk windowingsystem] {
+ x11 - win32 { wm transient $popdown [winfo toplevel $cb] }
+ }
- # ASSERT: ![$cb instate pressed]
+ # Post the listbox:
+ #
+ wm attribute $popdown -topmost 1
+ wm deiconify $popdown
+ raise $popdown
+ }
+} else {
+ proc ttk::combobox::Post {cb} {
+ # Don't do anything if disabled:
+ #
+ $cb instate disabled { return }
- # Run -postcommand callback:
- #
- uplevel #0 [$cb cget -postcommand]
+ # ASSERT: ![$cb instate pressed]
- set popdown [PopdownWindow $cb]
- ConfigureListbox $cb
- update idletasks ;# needed for geometry propagation.
- PlacePopdown $cb $popdown
- # See <<NOTE-WM-TRANSIENT>>
- switch -- [tk windowingsystem] {
- x11 - win32 { wm transient $popdown [winfo toplevel $cb] }
- }
+ # Run -postcommand callback:
+ #
+ uplevel #0 [$cb cget -postcommand]
+
+ set popdown [PopdownWindow $cb]
- # Post the listbox:
- #
- wm attribute $popdown -topmost 1
- wm deiconify $popdown
- raise $popdown
+ # Configure the menu
+
+ foreach {x y width height} [AquaPlacePopdown $cb $popdown] { break }
+ ConfigureAquaMenu $cb [winfo width $cb]
+
+ # Post the menu. It will have a disclosure indicator if it is too
+ # close to the bottom of the screen, and it may be posted above the
+ # button if necessary to be visible.
+
+ $popdown.menu post [expr {$x + 2}] [expr {$y + $height + 2}]
+ }
}
## Unpost $cb --
@@ -413,10 +517,10 @@ proc ttk::combobox::Unpost {cb} {
grab release $cb.popdown ;# in case of stuck or unexpected grab [#1239190]
}
-## LBMaster $lb --
+## LBMain $lb --
# Return the combobox main widget that owns the listbox.
#
-proc ttk::combobox::LBMaster {lb} {
+proc ttk::combobox::LBMain {lb} {
winfo parent [winfo parent [winfo parent $lb]]
}
@@ -424,7 +528,7 @@ proc ttk::combobox::LBMaster {lb} {
# Transfer listbox selection to combobox value.
#
proc ttk::combobox::LBSelect {lb} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
set selection [$lb curselection]
if {[llength $selection] == 1} {
SelectEntry $cb [lindex $selection 0]
@@ -441,7 +545,11 @@ proc ttk::combobox::LBSelect {lb} {
#
proc ttk::combobox::LBCleanup {lb} {
variable Values
- unset Values([LBMaster $lb])
+ unset Values([LBMain $lb])
+}
+
+proc ttk::combobox::AquaCleanup {cb} {
+ catch {image delete $cb.spacer}
}
#*EOF*
diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl
index 66706a3..226bd39 100644
--- a/library/ttk/defaults.tcl
+++ b/library/ttk/defaults.tcl
@@ -3,11 +3,13 @@
#
namespace eval ttk::theme::default {
+
variable colors
array set colors {
-frame "#d9d9d9"
-foreground "#000000"
-window "#ffffff"
+ -alternate "#e8e8e8"
-text "#000000"
-activebg "#ececec"
-selectbg "#4a6984"
@@ -16,10 +18,70 @@ 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
+ # X resources, then set the colour palette based on the user's choice.
+ if {[tk windowingsystem] eq "x11"} {
+ foreach \
+ xResourceName {
+ { background Background }
+ { foreground Foreground }
+ { background Background }
+ { background Background }
+ { foreground Foreground }
+ { activeBackground ActiveBackground }
+ { selectBackground SelectBackground }
+ { selectForeground SelectForeground }
+ { troughColor TroughColor }
+ { disabledForeground DisabledForeground }
+ { selectBackground SelectBackground }
+ { disabledForeground DisabledForeground }
+ { selectBackground SelectBackground }
+ { windowColor Background } } \
+ colorName {
+ -frame -foreground -window -alternate -text
+ -activebg -selectbg -selectfg
+ -darker -disabledfg -indicator
+ -disabledindicator -pressedindicator -window } {
+ set color [eval option get . $xResourceName]
+ if {$color ne ""} {
+ set colors($colorName) $color
+ }
+ }
}
+ # This array is used to match up the tk widget options with
+ # the corresponding values in the 'colors' array.
+ # This is used by tk_setPalette to apply the new palette
+ # to the ttk widgets.
+ variable colorOptionLookup
+ array set colorOptionLookup {
+ background {-frame -window -alternate}
+ foreground {-foreground -text}
+ activeBackground -activebg
+ selectBackground {-selectbg -indicator -pressedindicator}
+ selectForeground -selectfg
+ troughColor -darker
+ disabledForeground {-disabledfg -disabledindicator}
+ }
+}
+
+# ttk::theme::default::reconfigureDefaultTheme --
+#
+# This procedure contains the definition of the 'default' theme itself.
+# The theme definition is in a procedure, so it can be re-called when
+# required, enabling tk_setPalette to set the colours of the ttk widgets.
+#
+# Arguments:
+# None.
+
+proc ttk::theme::default::reconfigureDefaultTheme {} {
+ upvar ttk::theme::default::colors colors
+
+ # The definition of the 'default' theme.
+
ttk::style theme settings default {
ttk::style configure "." \
@@ -31,7 +93,8 @@ namespace eval ttk::theme::default {
-selectbackground $colors(-selectbg) \
-selectforeground $colors(-selectfg) \
-insertwidth 1 \
- -indicatordiameter 10
+ -insertcolor $colors(-foreground) \
+ -focuscolor $colors(-text)
ttk::style map "." -background \
[list disabled $colors(-frame) active $colors(-activebg)]
@@ -39,52 +102,49 @@ namespace eval ttk::theme::default {
[list disabled $colors(-disabledfg)]
ttk::style configure TButton \
- -anchor center -padding "3 3" -width -9 \
+ -anchor center -padding 2.25p -width -9 \
-relief raised -shiftrelief 1
ttk::style map TButton -relief [list {!disabled pressed} sunken]
- ttk::style configure TCheckbutton \
- -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
- 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 "#ffffff" -indicatorrelief sunken -padding 1
- 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 -indicatorborderwidth 1 -padding "10 3"
+ -relief raised -arrowsize 3.75p -arrowpadding 2.25p \
+ -arrowcolor $colors(-text) -padding {7.5p 2.25p}
+ ttk::style map TMenubutton \
+ -arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure TEntry \
- -fieldbackground white -padding 1 \
+ -fieldbackground $colors(-window) -padding 1 \
-focuswidth 2 -focuscolor $colors(-selectbg)
ttk::style map TEntry -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)]
ttk::style configure TCombobox \
- -arrowsize 12 -arrowcolor black \
- -fieldbackground white -padding 1 \
+ -arrowsize 9p -arrowcolor $colors(-text) \
+ -fieldbackground $colors(-window) -padding 1 \
-focuswidth 1 -focuscolor $colors(-selectbg)
ttk::style map TCombobox -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)] \
-arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure TSpinbox \
- -arrowsize 10 -arrowcolor black \
- -fieldbackground white -padding {2 0 10 0} \
+ -arrowsize 7.5p -arrowcolor $colors(-text) \
+ -fieldbackground $colors(-window) -padding {1.5p 0 7.5p 0} \
-focuswidth 1 -focuscolor $colors(-selectbg)
ttk::style map TSpinbox -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)] \
@@ -94,17 +154,26 @@ namespace eval ttk::theme::default {
-relief groove -borderwidth 2
ttk::style configure TScrollbar \
- -width 12 -arrowsize 12
+ -width 9p -arrowsize 9p -arrowcolor $colors(-text)
ttk::style map TScrollbar \
-arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure TScale \
- -sliderrelief raised -sliderborderwidth 1
+ -innercolor $colors(-selectbg) \
+ -outercolor $colors(-window) \
+ -bordercolor $colors(-darker) \
+ -groovewidth 3p
+ ttk::style map TScale \
+ -outercolor [list active $colors(-activebg)]
+
ttk::style configure TProgressbar \
- -background $colors(-selectbg)
+ -background $colors(-selectbg) \
+ -borderwidth 0 \
+ -barsize 22.5p \
+ -thickness 3p
ttk::style configure TNotebook.Tab \
- -padding {4 2} -background $colors(-darker)
+ -padding {3p 1.5p} -background $colors(-darker)
ttk::style map TNotebook.Tab \
-background [list selected $colors(-frame)] \
-highlight [list selected 1] \
@@ -113,9 +182,17 @@ namespace eval ttk::theme::default {
# Treeview.
#
ttk::style configure Heading -font TkHeadingFont -relief raised
+ ttk::style configure Item -indicatorsize 9p \
+ -indicatormargins {1.5p 1.5p 3p 1.5p}
ttk::style configure Treeview \
-background $colors(-window) \
- -foreground $colors(-text)
+ -stripedbackground $colors(-alternate) \
+ -fieldbackground $colors(-window) \
+ -foreground $colors(-text) \
+ -indent 15p
+ ttk::setTreeviewRowHeight
+ ttk::style configure Treeview.Separator \
+ -background $colors(-alternate)
ttk::style map Treeview \
-background [list disabled $colors(-frame)\
selected $colors(-selectbg)] \
@@ -141,10 +218,12 @@ namespace eval ttk::theme::default {
}
ttk::style configure Toolbutton \
- -padding 2 -relief flat
+ -padding 1.5p -relief flat
ttk::style map Toolbutton -relief \
[list disabled flat selected sunken pressed sunken active raised]
ttk::style map Toolbutton -background \
[list pressed $colors(-darker) active $colors(-activebg)]
}
}
+
+ttk::theme::default::reconfigureDefaultTheme
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index a9938cd..3d2ef90 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -1,9 +1,9 @@
#
# DERIVED FROM: tk/library/entry.tcl r1.22
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 2004, Joe English
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 2004, Joe English
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -82,20 +82,14 @@ bind TEntry <<ToggleSelection>> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
}
-## Button2 (Button3 on Aqua) bindings:
+## Button2 bindings:
# Used for scanning and primary transfer.
-# Note: ButtonRelease-2 (ButtonRelease-3 on Aqua)
+# Note: ButtonRelease-2
# is mapped to <<PasteSelection>> in tk.tcl.
#
-if {[tk windowingsystem] ne "aqua"} {
- bind TEntry <Button-2> { ttk::entry::ScanMark %W %x }
- bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
- bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
-} else {
- bind TEntry <Button-3> { ttk::entry::ScanMark %W %x }
- bind TEntry <B3-Motion> { ttk::entry::ScanDrag %W %x }
- bind TEntry <ButtonRelease-3> { ttk::entry::ScanRelease %W %x }
-}
+bind TEntry <Button-2> { ttk::entry::ScanMark %W %x }
+bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
+bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
## Keyboard navigation bindings:
@@ -110,7 +104,7 @@ bind TEntry <<LineEnd>> { ttk::entry::Move %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 <<SelectNextWord>> { ttk::entry::Extend %W selectnextword }
bind TEntry <<SelectLineStart>> { ttk::entry::Extend %W home }
bind TEntry <<SelectLineEnd>> { ttk::entry::Extend %W end }
@@ -125,7 +119,7 @@ bind TEntry <Key> { ttk::entry::Insert %W %A }
bind TEntry <Delete> { ttk::entry::Delete %W }
bind TEntry <BackSpace> { ttk::entry::Backspace %W }
-# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
+# Ignore all Alt, Meta, Control, Command, and Fn keypresses unless explicitly bound.
# Otherwise, the <Key> class binding will fire and insert the character.
# Ditto for Escape, Return, and Tab.
#
@@ -136,13 +130,9 @@ bind TEntry <Escape> {# nothing}
bind TEntry <Return> {# nothing}
bind TEntry <KP_Enter> {# nothing}
bind TEntry <Tab> {# nothing}
+bind TEntry <Command-Key> {# nothing}
+bind TEntry <Fn-Key> {# nothing}
-# Argh. Apparently on Windows, the NumLock modifier is interpreted
-# as a Command modifier.
-if {[tk windowingsystem] eq "aqua"} {
- bind TEntry <Command-Key> {# nothing}
- bind TEntry <Mod4-Key> {# nothing}
-}
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind TEntry <<PrevLine>> {# nothing}
bind TEntry <<NextLine>> {# nothing}
@@ -172,6 +162,19 @@ bind TEntry <<TkAccentBackspace>> {
ttk::entry::Backspace %W
}
+## EndIMEMarkedText -- Handle the end of input method selection.
+#
+proc ::ttk::entry::EndIMEMarkedText {w} {
+ variable ::tk::Priv
+ if {[catch {
+ set mark [dict get $Priv(IMETextMark) $w]
+ }]} {
+ bell
+ return
+ }
+ $w selection range $mark insert
+}
+
### Clipboard procedures.
#
@@ -180,7 +183,7 @@ bind TEntry <<TkAccentBackspace>> {
#
proc ttk::entry::EntrySelection {w} {
set entryString [string range [$w get] [$w index sel.first] \
- [expr {[$w index sel.last] - 1}]]
+ [$w index sel.last]-1]
if {[$w cget -show] ne ""} {
return [string repeat [string index [$w cget -show] 0] \
[string length $entryString]]
@@ -245,24 +248,35 @@ proc ttk::entry::See {w {index insert}} {
}
}
-## NextWord -- Find the next word position.
-# Note: The "next word position" follows platform conventions:
-# either the next end-of-word position, or the start-of-word
-# position following the next end-of-word position.
+## NextWord --
+# Returns the index of the next start-of-word position after the next
+# end-of-word position after a given position in the text.
#
-set ::ttk::entry::State(startNext) \
- [string equal [tk windowingsystem] "win32"]
-
proc ttk::entry::NextWord {w start} {
# the check on [winfo class] is because the spinbox and combobox also use this proc
if {[winfo class $w] eq "TEntry" && [$w cget -show] ne ""} {
return end
}
- variable State
- set pos [tcl_endOfWord [$w get] [$w index $start]]
- if {$pos >= 0 && $State(startNext)} {
- set pos [tcl_startOfNextWord [$w get] $pos]
+ set pos [tk::endOfWord [$w get] [$w index $start]]
+ if {$pos >= 0} {
+ set pos [tk::startOfNextWord [$w get] $pos]
+ }
+ if {$pos < 0} {
+ return end
+ }
+ return $pos
+}
+
+## SelectNextWord --
+# Returns the index of the next end-of-word position after a given
+# position in the text.
+#
+proc ttk::entry::SelectNextWord {w start} {
+ # the check on [winfo class] is because the spinbox and combobox also use this proc
+ if {[winfo class $w] eq "TEntry" && [$w cget -show] ne ""} {
+ return end
}
+ set pos [tk::endOfWord [$w get] [$w index $start]]
if {$pos < 0} {
return end
}
@@ -276,7 +290,28 @@ proc ttk::entry::PrevWord {w start} {
if {[winfo class $w] eq "TEntry" && [$w cget -show] ne ""} {
return 0
}
- set pos [tcl_startOfPreviousWord [$w get] [$w index $start]]
+ set pos [tk::startOfPreviousWord [$w get] [$w index $start]]
+ if {$pos < 0} {
+ return 0
+ }
+ return $pos
+}
+
+## NextChar -- Find the next char position.
+#
+proc ttk::entry::NextChar {w start} {
+ variable State
+ set pos [tk::endOfCluster [$w get] [$w index $start]]
+ if {$pos < 0} {
+ return end
+ }
+ return $pos
+}
+
+## PrevChar -- Find the previous char position.
+#
+proc ttk::entry::PrevChar {w start} {
+ set pos [tk::startOfCluster [$w get] [expr {[$w index $start]-1}]]
if {$pos < 0} {
return 0
}
@@ -287,10 +322,11 @@ proc ttk::entry::PrevWord {w start} {
#
proc ttk::entry::RelIndex {w where {index insert}} {
switch -- $where {
- prevchar { expr {[$w index $index] - 1} }
- nextchar { expr {[$w index $index] + 1} }
+ prevchar { PrevChar $w $index }
+ nextchar { NextChar $w $index }
prevword { PrevWord $w $index }
nextword { NextWord $w $index }
+ selectnextword { SelectNextWord $w $index }
home { return 0 }
end { $w index end }
default { error "Bad relative index $index" }
@@ -329,9 +365,9 @@ proc ttk::entry::ExtendTo {w index} {
# Figure out selection anchor:
if {![$w selection present]} {
- set anchor $insert
+ set anchor $insert
} else {
- set selfirst [$w index sel.first]
+ set selfirst [$w index sel.first]
set sellast [$w index sel.last]
if { ($index < $selfirst)
@@ -347,7 +383,7 @@ proc ttk::entry::ExtendTo {w index} {
if {$anchor < $index} {
$w selection range $anchor $index
} else {
- $w selection range $index $anchor
+ $w selection range $index $anchor
}
$w icursor $index
@@ -407,8 +443,8 @@ proc ttk::entry::Select {w x mode} {
set cur [ClosestGap $w $x]
switch -- $mode {
- word { WordSelect $w $cur $cur }
- line { LineSelect $w $cur $cur }
+ word { WordSelect $w $cur $cur }
+ line { LineSelect $w $cur $cur }
char { # no-op }
}
@@ -513,12 +549,12 @@ proc ttk::entry::WordSelect {w from to} {
## WordBack, WordForward -- helper routines for WordSelect.
#
-proc ttk::entry::WordBack {text index} {
- if {[set pos [tcl_wordBreakBefore $text $index]] < 0} { return 0 }
+proc ttk::entry::WordBack {text index {locale {}}} {
+ if {[set pos [tk::wordBreakBefore $text $index $locale]] < 0} { return 0 }
return $pos
}
-proc ttk::entry::WordForward {text index} {
- if {[set pos [tcl_wordBreakAfter $text $index]] < 0} { return end }
+proc ttk::entry::WordForward {text index {locale {}}} {
+ if {[set pos [tk::wordBreakAfter $text $index $locale]] < 0} { return end }
return $pos
}
@@ -556,7 +592,7 @@ proc ttk::entry::ScanDrag {w x} {
$w xview $left
if {$left != [set newLeft [$w index @0]]} {
- # We've scanned past one end of the entry;
+ # We've scanned past one end of the entry;
# reset the mark so that the text will start dragging again
# as soon as the mouse reverses direction.
#
@@ -613,13 +649,13 @@ proc ttk::entry::Insert {w s} {
#
proc ttk::entry::Backspace {w} {
if {[PendingDelete $w]} {
- See $w
+ See $w
return
}
set x [expr {[$w index insert] - 1}]
if {$x < 0} { return }
- $w delete $x
+ $w delete [tk::startOfCluster [$w get] $x] [tk::endOfCluster [$w get] $x]
if {[$w index @0] >= [$w index insert]} {
set range [$w xview]
@@ -634,7 +670,8 @@ proc ttk::entry::Backspace {w} {
#
proc ttk::entry::Delete {w} {
if {![PendingDelete $w]} {
- $w delete insert
+ $w delete [tk::startOfCluster [$w get] [$w index insert]] \
+ [tk::endOfCluster [$w get] [$w index insert]]
}
}
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index 4f735a8..5138c89 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -50,10 +50,6 @@
# Most other toolkits use medium weight for all UI elements,
# which is what we do now.
#
-# Font size specified in pixels on X11, not points.
-# This is Theoretically Wrong, but in practice works better; using
-# points leads to huge inconsistencies across different servers.
-#
namespace eval ttk {
@@ -67,87 +63,89 @@ catch {font create TkIconFont}
catch {font create TkMenuFont}
catch {font create TkSmallCaptionFont}
-if {!$tip145} {
-variable F ;# miscellaneous platform-specific font parameters
+if {!$tip145} {apply {{} {
+global tcl_platform
switch -- [tk windowingsystem] {
win32 {
# In safe interps there is no osVersion element.
if {[info exists tcl_platform(osVersion)]} {
if {$tcl_platform(osVersion) >= 5.0} {
- set F(family) "Tahoma"
+ set family "Tahoma"
} else {
- set F(family) "MS Sans Serif"
+ set family "MS Sans Serif"
}
} else {
if {[lsearch -exact [font families] Tahoma] >= 0} {
- set F(family) "Tahoma"
+ set family "Tahoma"
} else {
- set F(family) "MS Sans Serif"
+ set family "MS Sans Serif"
}
}
- set F(size) 8
+ set size 8
- font configure TkDefaultFont -family $F(family) -size $F(size)
- font configure TkTextFont -family $F(family) -size $F(size)
- font configure TkHeadingFont -family $F(family) -size $F(size)
- font configure TkCaptionFont -family $F(family) -size $F(size) \
- -weight bold
- font configure TkTooltipFont -family $F(family) -size $F(size)
+ font configure TkDefaultFont -family $family -size $size
+ font configure TkTextFont -family $family -size $size
+ font configure TkHeadingFont -family $family -size $size
+ font configure TkCaptionFont -family $family -size $size -weight bold
+ font configure TkTooltipFont -family $family -size $size
font configure TkFixedFont -family Courier -size 10
- font configure TkIconFont -family $F(family) -size $F(size)
- font configure TkMenuFont -family $F(family) -size $F(size)
- font configure TkSmallCaptionFont -family $F(family) -size $F(size)
+ font configure TkIconFont -family $family -size $size
+ font configure TkMenuFont -family $family -size $size
+ font configure TkSmallCaptionFont -family $family -size $size
}
aqua {
- set F(family) "Lucida Grande"
- set F(fixed) "Monaco"
- set F(menusize) 14
- set F(size) 13
- set F(viewsize) 12
- set F(smallsize) 11
- set F(labelsize) 10
- set F(fixedsize) 11
+ set family "Lucida Grande"
+ set fixed "Monaco"
+ set menusize 14
+ set size 13
+ set viewsize 12
+ set smallsize 11
+ set labelsize 10
+ set fixedsize 11
- font configure TkDefaultFont -family $F(family) -size $F(size)
- font configure TkTextFont -family $F(family) -size $F(size)
- font configure TkHeadingFont -family $F(family) -size $F(smallsize)
- font configure TkCaptionFont -family $F(family) -size $F(size) \
- -weight bold
- font configure TkTooltipFont -family $F(family) -size $F(smallsize)
- font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
- font configure TkIconFont -family $F(family) -size $F(size)
- font configure TkMenuFont -family $F(family) -size $F(menusize)
- font configure TkSmallCaptionFont -family $F(family) -size $F(labelsize)
+ font configure TkDefaultFont -family $family -size $size
+ font configure TkTextFont -family $family -size $size
+ font configure TkHeadingFont -family $family -size $smallsize
+ font configure TkCaptionFont -family $family -size $size -weight bold
+ font configure TkTooltipFont -family $family -size $smallsize
+ font configure TkFixedFont -family $fixed -size $fixedsize
+ font configure TkIconFont -family $family -size $size
+ font configure TkMenuFont -family $family -size $menusize
+ font configure TkSmallCaptionFont -family $family -size $labelsize
}
default -
x11 {
- if {![catch {tk::pkgconfig get fontsystem} F(fs)] && $F(fs) eq "xft"} {
- set F(family) "sans-serif"
- set F(fixed) "monospace"
+ if {![catch {tk::pkgconfig get fontsystem} fs] && $fs eq "xft"} {
+ set family "sans-serif"
+ set fixed "monospace"
+ } else {
+ set family "Helvetica"
+ set fixed "courier"
+ }
+ if {[::tk::FontScalingFactor] == 1} {
+ set size 10
+ set ttsize 9
+ set capsize 12
+ set fixedsize 10
} else {
- set F(family) "Helvetica"
- set F(fixed) "courier"
+ set size 20
+ set ttsize 18
+ set capsize 24
+ set fixedsize 20
}
- set F(size) -12
- set F(ttsize) -10
- set F(capsize) -14
- set F(fixedsize) -12
- font configure TkDefaultFont -family $F(family) -size $F(size)
- font configure TkTextFont -family $F(family) -size $F(size)
- font configure TkHeadingFont -family $F(family) -size $F(size) \
- -weight bold
- font configure TkCaptionFont -family $F(family) -size $F(capsize) \
- -weight bold
- font configure TkTooltipFont -family $F(family) -size $F(ttsize)
- font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
- font configure TkIconFont -family $F(family) -size $F(size)
- font configure TkMenuFont -family $F(family) -size $F(size)
- font configure TkSmallCaptionFont -family $F(family) -size $F(ttsize)
+ font configure TkDefaultFont -family $family -size $size
+ font configure TkTextFont -family $family -size $size
+ font configure TkHeadingFont -family $family -size $size -weight bold
+ font configure TkCaptionFont -family $family -size $capsize -weight bold
+ font configure TkTooltipFont -family $family -size $ttsize
+ font configure TkFixedFont -family $fixed -size $fixedsize
+ font configure TkIconFont -family $family -size $size
+ font configure TkMenuFont -family $family -size $size
+ font configure TkSmallCaptionFont -family $family -size $ttsize
}
}
-unset -nocomplain F
-}
+} ::ttk}}
}
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
index f98a5da..8ef8937 100644
--- a/library/ttk/menubutton.tcl
+++ b/library/ttk/menubutton.tcl
@@ -57,7 +57,7 @@ if {[tk windowingsystem] eq "x11"} {
bind TMenubutton <Button-1> \
{ %W state pressed ; ttk::menubutton::Popdown %W }
bind TMenubutton <ButtonRelease-1> \
- { if {[winfo exists %W]} { %W state !pressed } }
+ { if {[winfo exists %W]} { %W state {!pressed}} }
}
# PostPosition --
@@ -77,6 +77,7 @@ if {[tk windowingsystem] eq "aqua"} {
set menuPad 5
set buttonPad 1
set bevelPad 4
+ set flushPad 4
set mh [winfo reqheight $menu]
set bh [expr {[winfo height $mb]} + $buttonPad]
set bbh [expr {[winfo height $mb]} + $bevelPad]
@@ -105,8 +106,11 @@ if {[tk windowingsystem] eq "aqua"} {
incr y $menuPad
incr x $bw
}
- default { # flush
- incr y $bbh
+ flush {
+ incr y $flushPad
+ incr x -$flushPad
+ }
+ default {
}
}
return [list $x $y $entry]
@@ -134,7 +138,7 @@ if {[tk windowingsystem] eq "aqua"} {
# 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]}]
+ + [winfo reqheight $mb]}]
}
}
below {
@@ -207,7 +211,7 @@ proc ttk::menubutton::TransferGrab {mb} {
set menu [$mb cget -menu]
foreach {x y entry} [PostPosition $mb $menu] { break }
- tk_popup $menu [winfo rootx $menu] [winfo rooty $menu]
+ tk_popup $menu [winfo rootx $menu] [winfo rooty $menu]
}
}
@@ -218,7 +222,7 @@ proc ttk::menubutton::TransferGrab {mb} {
#
proc ttk::menubutton::FindMenuEntry {menu s} {
set last [$menu index last]
- if {$last eq "none" || $last < 0} {
+ if {$last < 0} {
return ""
}
for {set i 0} {$i <= $last} {incr i} {
diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl
index c5e6d94..1d59d1e 100644
--- a/library/ttk/notebook.tcl
+++ b/library/ttk/notebook.tcl
@@ -16,6 +16,28 @@ bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break }
}
bind TNotebook <Destroy> { ttk::notebook::Cleanup %W }
+bind TNotebook <Enter> {
+ set tk::Priv(xEvents) 0; set tk::Priv(yEvents) 0
+}
+bind TNotebook <MouseWheel> {
+ ttk::notebook::CondCycleTab1 %W y %D -120.0
+}
+bind TNotebook <Option-MouseWheel> {
+ ttk::notebook::CondCycleTab1 %W y %D -12.0
+}
+bind TNotebook <Shift-MouseWheel> {
+ ttk::notebook::CondCycleTab1 %W x %D -120.0
+}
+bind TNotebook <Shift-Option-MouseWheel> {
+ ttk::notebook::CondCycleTab1 %W x %D -12.0
+}
+bind TNotebook <TouchpadScroll> {
+ # TouchpadScroll events fire about 60 times per second.
+ if {%# %% 15 == 0} {
+ ttk::notebook::CondCycleTab2 %W %D
+ }
+}
+
# ActivateTab $nb $tab --
# Select the specified tab and set focus.
#
@@ -56,12 +78,14 @@ proc ttk::notebook::Press {w x y} {
# CycleTab --
# Select the next/previous tab in the list.
#
-proc ttk::notebook::CycleTab {w dir} {
+proc ttk::notebook::CycleTab {w dir {factor 1.0}} {
set current [$w index current]
if {$current >= 0} {
set tabCount [$w index end]
- set select [expr {($current + $dir) % $tabCount}]
- set step [expr {$dir > 0 ? 1 : -1}]
+ set d [expr {$dir/$factor}]
+ set d [expr {int($d > 0 ? ceil($d) : floor($d))}]
+ set select [expr {($current + $d) % $tabCount}]
+ set step [expr {$d > 0 ? 1 : -1}]
while {[$w tab $select -state] ne "normal" && ($select != $current)} {
set select [expr {($select + $step) % $tabCount}]
}
@@ -71,6 +95,41 @@ proc ttk::notebook::CycleTab {w dir} {
}
}
+# CondCycleTab1 --
+# Conditionally invoke the ttk::notebook::CycleTab proc.
+#
+proc ttk::notebook::CondCycleTab1 {w axis dir {factor 1.0}} {
+ # Count both the <MouseWheel> and <Shift-MouseWheel>
+ # events, and ignore the non-dominant ones
+
+ variable ::tk::Priv
+ incr Priv(${axis}Events)
+ if {($Priv(xEvents) + $Priv(yEvents) > 10) &&
+ ($axis eq "x" && $Priv(xEvents) < $Priv(yEvents) ||
+ $axis eq "y" && $Priv(yEvents) < $Priv(xEvents))} {
+ return
+ }
+
+ CycleTab $w $dir $factor
+}
+
+# CondCycleTab2 --
+# Conditionally invoke the ttk::notebook::CycleTab proc.
+#
+proc ttk::notebook::CondCycleTab2 {w dxdy} {
+ if {[set style [$w cget -style]] eq ""} {
+ set style TNotebook
+ }
+ set tabSide [string index [ttk::style lookup $style -tabposition {} nw] 0]
+
+ lassign [tk::PreciseScrollDeltas $dxdy] deltaX deltaY
+ if {$tabSide in {n s} && $deltaX != 0} {
+ CycleTab $w [expr {$deltaX < 0 ? -1 : 1}]
+ } elseif {$tabSide in {w e} && $deltaY != 0} {
+ CycleTab $w [expr {$deltaY < 0 ? -1 : 1}]
+ }
+}
+
# MnemonicTab $nb $key --
# Scan all tabs in the specified notebook for one with the
# specified mnemonic. If found, returns path name of tab;
@@ -116,13 +175,8 @@ proc ttk::notebook::enableTraversal {nb} {
catch {
bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
}
- if {[tk windowingsystem] eq "aqua"} {
- bind $top <Option-Key> \
- +[list ttk::notebook::MnemonicActivation $top %K]
- } else {
- bind $top <Alt-Key> \
- +[list ttk::notebook::MnemonicActivation $top %K]
- }
+ bind $top <Option-Key> \
+ +[list ttk::notebook::MnemonicActivation $top %K]
bind $top <Destroy> {+ttk::notebook::TLCleanup %W}
}
diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl
index e2682f1..d5e25cd 100644
--- a/library/ttk/panedwindow.tcl
+++ b/library/ttk/panedwindow.tcl
@@ -6,7 +6,7 @@ namespace eval ttk::panedwindow {
variable State
array set State {
pressed 0
- pressX -
+ pressX -
pressY -
sash -
sashPos -
@@ -30,7 +30,7 @@ proc ttk::panedwindow::Press {w x y} {
set sash [$w identify $x $y]
if {$sash eq ""} {
- set State(pressed) 0
+ set State(pressed) 0
return
}
set State(pressed) 1
@@ -77,7 +77,7 @@ proc ttk::panedwindow::SetCursor {w x y} {
set cursor $State(userConfCursor)
if {[llength [$w identify $x $y]]} {
- # Assume we're over a sash.
+ # Assume we're over a sash.
switch -glob -- [$w cget -orient] {
h* { set cursor hresize }
v* { set cursor vresize }
diff --git a/library/ttk/progress.tcl b/library/ttk/progress.tcl
index 34dce72..929f0e6 100644
--- a/library/ttk/progress.tcl
+++ b/library/ttk/progress.tcl
@@ -13,13 +13,13 @@ proc ttk::progressbar::Autoincrement {pb steptime stepsize} {
variable Timers
if {![winfo exists $pb]} {
- # widget has been destroyed -- cancel timer
+ # widget has been destroyed -- cancel timer
unset -nocomplain Timers($pb)
return
}
set Timers($pb) [after $steptime \
- [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ]
+ [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ]
$pb step $stepsize
}
@@ -32,6 +32,9 @@ proc ttk::progressbar::start {pb {steptime 50} {stepsize 1}} {
if {![info exists Timers($pb)]} {
Autoincrement $pb $steptime $stepsize
}
+ if {[tk windowingsystem] eq "aqua"} {
+ $pb state selected
+ }
}
# ttk::progressbar::stop --
@@ -44,6 +47,9 @@ proc ttk::progressbar::stop {pb} {
unset Timers($pb)
}
$pb configure -value 0
+ if {[tk windowingsystem] eq "aqua"} {
+ $pb state !selected
+ }
}
diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl
index 61c4136..a97440d 100644
--- a/library/ttk/scale.tcl
+++ b/library/ttk/scale.tcl
@@ -1,4 +1,4 @@
-# scale.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+# scale.tcl - Copyright © 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# Bindings for the TScale widget
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
index 51edadf..7c31511 100644
--- a/library/ttk/scrollbar.tcl
+++ b/library/ttk/scrollbar.tcl
@@ -17,24 +17,17 @@ bind TScrollbar <Button-2> { ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
-# Redirect scrollwheel bindings to the scrollbar widget
+# Copy the mouse wheel event bindings from Scrollbar to TScrollbar
#
-# The shift-bindings scroll left/right (not up/down)
-# if a widget has both possibilities
-set eventList [list <MouseWheel> <Shift-MouseWheel>]
-switch [tk windowingsystem] {
- aqua {
- lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel>
- }
- x11 {
- lappend eventList <Button-4> <Button-5> \
- <Shift-Button-4> <Shift-Button-5>
- }
+bind TScrollbar <Enter> {
+ set tk::Priv(xEvents) 0; set tk::Priv(yEvents) 0
}
-foreach event $eventList {
+foreach event {<MouseWheel> <Option-MouseWheel>
+ <Shift-MouseWheel> <Shift-Option-MouseWheel>
+ <TouchpadScroll>} {
bind TScrollbar $event [bind Scrollbar $event]
}
-unset eventList event
+unset event
proc ttk::scrollbar::Scroll {w n units} {
set cmd [$w cget -command]
@@ -88,9 +81,9 @@ proc ttk::scrollbar::Press {w x y} {
proc ttk::scrollbar::Drag {w x y} {
variable State
if {![info exists State(first)]} {
- # Initial buttonpress was not on the thumb,
+ # Initial buttonpress was not on the thumb,
# or something screwy has happened. In either case, ignore:
- return
+ return;
}
set xDelta [expr {$x - $State(xPress)}]
set yDelta [expr {$y - $State(yPress)}]
diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl
index 6be65e8..2a49451 100644
--- a/library/ttk/sizegrip.tcl
+++ b/library/ttk/sizegrip.tcl
@@ -12,7 +12,7 @@ switch -- [tk windowingsystem] {
option add *TSizegrip.cursor [ttk::cursor seresize] widgetDefault
}
aqua {
- # Aqua sizegrips use default Arrow cursor.
+ # Aqua sizegrips use default Arrow cursor.
}
}
@@ -54,7 +54,7 @@ proc ttk::sizegrip::Press {W X Y} {
# just bail out -- there's no way to handle this cleanly.
#
if {[scan [wm geometry $top] "%dx%d+%d+%d" width height x y] != 4} {
- return
+ return;
}
# Account for gridded geometry:
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
index 8aba5e1..96d8acf 100644
--- a/library/ttk/spinbox.tcl
+++ b/library/ttk/spinbox.tcl
@@ -23,7 +23,17 @@ bind TSpinbox <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]
+ttk::bindMouseWheel TSpinbox { ttk::spinbox::Spin %W }
+bind TSpinbox <Shift-MouseWheel> {
+ # Ignore the event
+}
+bind TSpinbox <TouchpadScroll> {
+ lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ # TouchpadScroll events fire about 60 times per second.
+ if {$deltaY != 0 && %# %% 12 == 0} {
+ ttk::spinbox::Spin %W [expr {$deltaY > 0 ? -1 : 1}]
+ }
+}
## Motion --
# Sets cursor.
@@ -80,13 +90,13 @@ proc ttk::spinbox::Release {w} {
## MouseWheel --
# Mousewheel callback. Turn these into <<Increment>> (-1, up)
-# or <<Decrement> (+1, down) events.
+# or <<Decrement> (+1, down) events. Not used any more.
#
-proc ttk::spinbox::MouseWheel {w dir} {
+proc ttk::spinbox::MouseWheel {w dir {factor 1.0}} {
if {[$w instate disabled]} { return }
- if {$dir < 0} {
+ if {($dir < 0) ^ ($factor < 0)} {
event generate $w <<Increment>>
- } else {
+ } elseif {$dir != 0} {
event generate $w <<Decrement>>
}
}
@@ -134,7 +144,7 @@ proc ttk::spinbox::Adjust {w v min max} {
# Otherwise cycle through numeric range based on
# -from, -to, and -increment.
#
-proc ttk::spinbox::Spin {w dir} {
+proc ttk::spinbox::Spin {w dir {factor -1.0}} {
variable State
if {[$w instate disabled]} { return }
@@ -146,6 +156,8 @@ proc ttk::spinbox::Spin {w dir} {
set State($w,values) [$w cget -values]
set State($w,values.length) [llength $State($w,values)]
+ set d [expr {-($dir/$factor)}]
+ set d [expr {int($d > 0 ? ceil($d) : floor($d))}]
if {$State($w,values.length) > 0} {
set value [$w get]
set current $State($w,values.index)
@@ -153,13 +165,13 @@ proc ttk::spinbox::Spin {w dir} {
set current [lsearch -exact $State($w,values) $value]
if {$current < 0} {set current -1}
}
- set State($w,values.index) [Adjust $w [expr {$current + $dir}] 0 \
+ set State($w,values.index) [Adjust $w [expr {$current + $d}] 0 \
[expr {$State($w,values.length) - 1}]]
set State($w,values.last) [lindex $State($w,values) $State($w,values.index)]
$w set $State($w,values.last)
} else {
if {[catch {
- set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
+ set v [expr {[scan [$w get] %f] + $d * [$w cget -increment]}]
}]} {
set v [$w cget -from]
}
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl
index 62fc630..e9fc5ad 100644
--- a/library/ttk/treeview.tcl
+++ b/library/ttk/treeview.tcl
@@ -20,6 +20,9 @@ namespace eval ttk::treeview {
# For pressmode == "heading"
set State(heading) {}
+
+ set State(cellAnchor) {}
+ set State(cellAnchorOp) "set"
}
### Widget bindings.
@@ -56,9 +59,20 @@ ttk::copyBindings TtkScrollable Treeview
# @@@ TODO: verify/rewrite up and down code.
#
proc ttk::treeview::Keynav {w dir} {
+ variable State
set focus [$w focus]
if {$focus eq ""} { return }
+ set cells [expr {[$w cget -selecttype] eq "cell"}]
+
+ if {$cells} {
+ lassign $State(cellAnchor) _ colAnchor
+ # Just in case, give it a valid value
+ if {$colAnchor eq ""} {
+ set colAnchor "#1"
+ }
+ }
+
switch -- $dir {
up {
if {[set up [$w prev $focus]] eq ""} {
@@ -82,19 +96,46 @@ proc ttk::treeview::Keynav {w dir} {
}
}
left {
- if {[$w item $focus -open] && [llength [$w children $focus]]} {
- CloseItem $w $focus
+ if {$cells} {
+ # This assumes that colAnchor is of the "#N" format.
+ set colNo [string range $colAnchor 1 end]
+ set firstCol [expr {"tree" ni [$w cget -show]}]
+ if {$colNo > $firstCol} {
+ incr colNo -1
+ set colAnchor "#$colNo"
+ }
+ } elseif {[$w item $focus -open] && [llength [$w children $focus]]} {
+ CloseItem $w $focus
} else {
- set focus [$w parent $focus]
+ set focus [$w parent $focus]
}
}
right {
- OpenItem $w $focus
+ if {$cells} {
+ set colNo [string range $colAnchor 1 end]
+ set dispCol [$w cget -displaycolumns]
+ if {$dispCol eq "#all"} {
+ set lastCol [llength [$w cget -columns]]
+ } else {
+ set lastCol [llength $dispCol]
+ }
+ if {$colNo < ($lastCol - 1)} {
+ incr colNo
+ set colAnchor "#$colNo"
+ }
+ } else {
+ OpenItem $w $focus
+ }
}
}
if {$focus != {}} {
- SelectOp $w $focus choose
+ if {$cells} {
+ set cell [list $focus $colAnchor]
+ SelectOp $w $focus $cell choose
+ } else {
+ SelectOp $w $focus "" choose
+ }
}
}
@@ -145,13 +186,27 @@ proc ttk::treeview::ActivateHeading {w heading} {
}
}
+## IndentifyCell -- Locate the cell at coordinate
+# Only active when -selecttype is "cell", and leaves cell empty otherwise.
+# Down the call chain it is enough to check cell to know the selecttype.
+proc ttk::treeview::IdentifyCell {w x y} {
+ set cell {}
+ if {[$w cget -selecttype] eq "cell"} {
+ # Later handling assumes that the column in the cell ID is of the
+ # format #N, which is always the case from "identify cell"
+ set cell [$w identify cell $x $y]
+ }
+ return $cell
+}
+
## Select $w $x $y $selectop
# Binding procedure for selection operations.
# See "Selection modes", below.
#
proc ttk::treeview::Select {w x y op} {
if {[set item [$w identify row $x $y]] ne "" } {
- SelectOp $w $item $op
+ set cell [IdentifyCell $w $x $y]
+ SelectOp $w $item $cell $op
}
}
@@ -176,7 +231,9 @@ proc ttk::treeview::Press {w x y} {
tree -
cell {
set item [$w identify item $x $y]
- SelectOp $w $item choose
+ set cell [IdentifyCell $w $x $y]
+
+ SelectOp $w $item $cell choose
switch -glob -- [$w identify element $x $y] {
*indicator -
*disclosure { Toggle $w $item }
@@ -238,9 +295,9 @@ proc ttk::treeview::heading.drag {w x y} {
if { [$w identify region $x $y] eq "heading"
&& [$w identify column $x $y] eq $State(heading)
} {
- $w heading $State(heading) state pressed
+ $w heading $State(heading) state pressed
} else {
- $w heading $State(heading) state !pressed
+ $w heading $State(heading) state !pressed
}
}
@@ -259,35 +316,51 @@ proc ttk::treeview::heading.release {w} {
# Dispatch to appropriate selection operation
# depending on current value of -selectmode.
#
-proc ttk::treeview::SelectOp {w item op} {
- select.$op.[$w cget -selectmode] $w $item
+proc ttk::treeview::SelectOp {w item cell op} {
+ select.$op.[$w cget -selectmode] $w $item $cell
}
## -selectmode none:
#
-proc ttk::treeview::select.choose.none {w item} { $w focus $item; $w see $item }
-proc ttk::treeview::select.toggle.none {w item} { $w focus $item; $w see $item }
-proc ttk::treeview::select.extend.none {w item} { $w focus $item; $w see $item }
+proc ttk::treeview::select.choose.none {w item cell} { $w focus $item; $w see $item }
+proc ttk::treeview::select.toggle.none {w item cell} { $w focus $item; $w see $item }
+proc ttk::treeview::select.extend.none {w item cell} { $w focus $item; $w see $item }
## -selectmode browse:
#
-proc ttk::treeview::select.choose.browse {w item} { BrowseTo $w $item }
-proc ttk::treeview::select.toggle.browse {w item} { BrowseTo $w $item }
-proc ttk::treeview::select.extend.browse {w item} { BrowseTo $w $item }
+proc ttk::treeview::select.choose.browse {w item cell} { BrowseTo $w $item $cell }
+proc ttk::treeview::select.toggle.browse {w item cell} { BrowseTo $w $item $cell }
+proc ttk::treeview::select.extend.browse {w item cell} { BrowseTo $w $item $cell }
## -selectmode multiple:
#
-proc ttk::treeview::select.choose.extended {w item} {
- BrowseTo $w $item
+proc ttk::treeview::select.choose.extended {w item cell} {
+ BrowseTo $w $item $cell
}
-proc ttk::treeview::select.toggle.extended {w item} {
- $w selection toggle [list $item]
+proc ttk::treeview::select.toggle.extended {w item cell} {
+ variable State
+ if {$cell ne ""} {
+ $w cellselection toggle [list $cell]
+ set State(cellAnchor) $cell
+ set State(cellAnchorOp) add
+ } else {
+ $w selection toggle [list $item]
+ }
}
-proc ttk::treeview::select.extend.extended {w item} {
- if {[set anchor [$w focus]] ne ""} {
- $w selection set [between $w $anchor $item]
+proc ttk::treeview::select.extend.extended {w item cell} {
+ variable State
+ if {$cell ne ""} {
+ if {$State(cellAnchor) ne ""} {
+ $w cellselection $State(cellAnchorOp) $State(cellAnchor) $cell
+ } else {
+ BrowseTo $w $item $cell
+ }
} else {
- BrowseTo $w $item
+ if {[set anchor [$w focus]] ne ""} {
+ $w selection set [between $w $anchor $item]
+ } else {
+ BrowseTo $w $item $cell
+ }
}
}
@@ -319,10 +392,10 @@ proc ttk::treeview::ScanBetween {tv item1 item2 item} {
variable selectingBetween
if {$item eq $item1 || $item eq $item2} {
- lappend between $item
+ lappend between $item
set selectingBetween [expr {!$selectingBetween}]
} elseif {$selectingBetween} {
- lappend between $item
+ lappend between $item
}
foreach child [$tv children $item] {
ScanBetween $tv $item1 $item2 $child
@@ -368,16 +441,24 @@ proc ttk::treeview::Toggle {w item} {
proc ttk::treeview::ToggleFocus {w} {
set item [$w focus]
if {$item ne ""} {
- Toggle $w $item
+ Toggle $w $item
}
}
## BrowseTo -- navigate to specified item; set focus and selection
#
-proc ttk::treeview::BrowseTo {w item} {
+proc ttk::treeview::BrowseTo {w item cell} {
+ variable State
+
$w see $item
$w focus $item
- $w selection set [list $item]
+ set State(cellAnchor) $cell
+ set State(cellAnchorOp) set
+ if {$cell ne ""} {
+ $w cellselection set [list $cell]
+ } else {
+ $w selection set [list $item]
+ }
}
#*EOF*
diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl
index 73ee3d9..cbf1303 100644
--- a/library/ttk/ttk.tcl
+++ b/library/ttk/ttk.tcl
@@ -95,6 +95,34 @@ proc ::ttk::setTheme {theme} {
set currentTheme $theme
}
+## ttk::setTreeviewRowHeight --
+# Sets the default height of the ttk::treeview rows for the current theme.
+# To be invoked from within the library files for the built-in themes.
+#
+proc ::ttk::setTreeviewRowHeight {} {
+ set font [::ttk::style lookup Treeview -font]
+ if {$font eq {}} {
+ set font TkDefaultFont
+ }
+
+ ::ttk::style configure Treeview -rowheight \
+ [expr {[font metrics $font -linespace] + 2}]
+}
+
+# Applications should make sure that the ttk::setTreeviewRowHeight
+# procedure will be invoked whenever the virtual event <<ThemeChanged>>
+# is received (e.g., because the value of the Treeview style's -font
+# option has changed), or the virtual event <<TkWorldChanged>> with
+# the user_data field (%d) set to "FontChanged" is received. Example:
+#
+# bindtags . [linsert [bindtags .] 1 MyMainWin]
+# bind MyMainWin <<ThemeChanged>> ttk::setTreeviewRowHeight
+# bind MyMainWin <<TkWorldChanged>> {
+# if {"%d" eq "FontChanged"} {
+# ttk::setTreeviewRowHeight
+# }
+# }
+
### Load widget bindings.
#
source -encoding utf-8 [file join $::ttk::library button.tcl]
@@ -173,4 +201,8 @@ proc ttk::DefaultTheme {} {
ttk::setTheme [ttk::DefaultTheme] ; rename ttk::DefaultTheme {}
+# Scale the default ttk::scale and ttk::progressbar length
+option add *TScale.length 75p widgetDefault
+option add *TProgressbar.length 75p widgetDefault
+
#*EOF*
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index ebb42d0..3f6446d 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -37,12 +37,12 @@ proc ttk::GuessTakeFocus {w} {
# Allow traversal to widgets with explicit key or focus bindings:
#
if {[regexp {Key|Focus} [concat [bind $w] [bind [winfo class $w]]]]} {
- return 1
+ return 1;
}
# Default is nontraversable:
#
- return 0
+ return 0;
}
## ttk::traverseTo $w --
@@ -73,7 +73,7 @@ proc ttk::clickToFocus {w} {
#
proc ttk::takesFocus {w} {
if {![winfo viewable $w]} {
- return 0
+ return 0
} elseif {[catch {$w cget -takefocus} takefocus]} {
return [GuessTakeFocus $w]
} else {
@@ -144,7 +144,7 @@ proc ttk::SaveGrab {w} {
set grabbed [grab current $w]
if {[winfo exists $grabbed]} {
- switch [grab status $grabbed] {
+ switch [grab status $grabbed] {
global { set restoreGrab [list grab -global $grabbed] }
local { set restoreGrab [list grab $grabbed] }
none { ;# grab window is really in a different interp }
@@ -153,7 +153,7 @@ proc ttk::SaveGrab {w} {
set focus [focus]
if {$focus ne ""} {
- set restoreFocus [list focus -force $focus]
+ set restoreFocus [list focus -force $focus]
}
set Grab($w) [list $restoreGrab $restoreFocus]
@@ -168,7 +168,7 @@ proc ttk::RestoreGrab {w} {
variable Grab
if {![info exists Grab($w)]} { # Ignore
- return
+ return;
}
# The previous grab/focus window may have been destroyed,
@@ -273,18 +273,6 @@ proc ttk::copyBindings {from to} {
#
# Platform inconsistencies:
#
-# On X11, the server typically maps the mouse wheel to Button4 and Button5.
-#
-# On OSX, Tk generates sensible values for the %D field in <MouseWheel> events.
-#
-# On Windows, %D must be scaled by a factor of 120.
-#
-# OSX conventionally uses Shift+MouseWheel for horizontal scrolling,
-# and Option+MouseWheel for accelerated scrolling.
-#
-# The Shift+MouseWheel behavior is not conventional on Windows or most
-# X11 toolkits, but it's useful.
-#
# MouseWheel scrolling is accelerated on X11, which is conventional
# for Tk and appears to be conventional for other toolkits (although
# Gtk+ and Qt do not appear to use as large a factor).
@@ -292,46 +280,39 @@ proc ttk::copyBindings {from to} {
## 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).
+# $command will be passed two additional arguments
+# specifying the mousewheel change and a factor.
#
proc ttk::bindMouseWheel {bindtag callback} {
- if {[tk windowingsystem] eq "x11"} {
- bind $bindtag <Button-4> "$callback -1"
- bind $bindtag <Button-5> "$callback +1"
- }
- if {[tk windowingsystem] eq "aqua"} {
- bind $bindtag <MouseWheel> "$callback \[expr {-%D}\]"
- bind $bindtag <Option-MouseWheel> "$callback \[expr {-10 * %D}\]"
- } else {
- bind $bindtag <MouseWheel> "$callback \[expr {-%D / 120}\]"
- }
+ bind $bindtag <MouseWheel> "$callback %D -120.0"
+ bind $bindtag <Option-MouseWheel> "$callback %D -12.0"
}
## Mousewheel bindings for standard scrollable widgets.
#
-if {[tk windowingsystem] eq "x11"} {
- bind TtkScrollable <Button-4> { %W yview scroll -5 units }
- bind TtkScrollable <Button-5> { %W yview scroll 5 units }
- bind TtkScrollable <Shift-Button-4> { %W xview scroll -5 units }
- bind TtkScrollable <Shift-Button-5> { %W xview scroll 5 units }
-}
-if {[tk windowingsystem] eq "aqua"} {
- bind TtkScrollable <MouseWheel> \
- { %W yview scroll [expr {-%D}] units }
- 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 }
-} else {
- bind TtkScrollable <MouseWheel> \
- { %W yview scroll [expr {-%D / 120}] units }
- bind TtkScrollable <Shift-MouseWheel> \
- { %W xview scroll [expr {-%D / 120}] units }
-}
+bind TtkScrollable <MouseWheel> \
+ { tk::MouseWheel %W y %D -40.0 }
+bind TtkScrollable <Option-MouseWheel> \
+ { tk::MouseWheel %W y %D -12.0 }
+bind TtkScrollable <Shift-MouseWheel> \
+ { tk::MouseWheel %W x %D -40.0 }
+bind TtkScrollable <Shift-Option-MouseWheel> \
+ { tk::MouseWheel %W x %D -12.0 }
+## Touchpad scrolling
+#
+bind TtkScrollable <TouchpadScroll> {
+ if {%# %% 5 != 0} {
+ return
+ }
+ lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ if {$deltaX != 0} {
+ %W xview scroll [expr {-$deltaX}] units
+ }
+ if {$deltaY != 0} {
+ %W yview scroll [expr {-$deltaY}] units
+ }
+}
#*EOF*
diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl
index fe41f60..4105a1a 100644
--- a/library/ttk/vistaTheme.tcl
+++ b/library/ttk/vistaTheme.tcl
@@ -24,13 +24,12 @@ namespace eval ttk::theme::vista {
-insertcolor SystemWindowText \
-font TkDefaultFont
- ttk::style map "." \
- -foreground [list disabled SystemGrayText]
+ ttk::style map "." -foreground {disabled SystemGrayText}
- ttk::style configure TButton -anchor center -padding {1 1} -width -11
- ttk::style configure TRadiobutton -padding 2
- ttk::style configure TCheckbutton -padding 2
- ttk::style configure TMenubutton -padding {8 4}
+ ttk::style configure TButton -anchor center -padding 0.75p -width -11
+ ttk::style configure TRadiobutton -padding 1.5p
+ ttk::style configure TCheckbutton -padding 1.5p
+ ttk::style configure TMenubutton -padding {6p 3p}
ttk::style element create Menubutton.dropdown vsapi \
TOOLBAR 4 {{selected active} 6 {selected !active} 5
@@ -38,12 +37,14 @@ namespace eval ttk::theme::vista {
-syssize {SM_CXVSCROLL SM_CYVSCROLL}
ttk::style configure TNotebook -tabmargins {2 2 2 0}
- ttk::style map TNotebook.Tab \
- -expand [list selected {2 2 2 2}]
+ ttk::style map TNotebook.Tab -expand {selected {2 2 2 2}}
# Treeview:
ttk::style configure Heading -font TkHeadingFont
- ttk::style configure Treeview -background SystemWindow
+ ttk::style configure Treeview -background SystemWindow \
+ -stripedbackground System3dLight
+ ttk::style configure Treeview.Separator \
+ -background System3dLight
ttk::style map Treeview \
-background [list disabled SystemButtonFace \
selected SystemHighlight] \
@@ -53,10 +54,10 @@ namespace eval ttk::theme::vista {
# Label and Toolbutton
ttk::style configure TLabelframe.Label -foreground SystemButtonText
- ttk::style configure Toolbutton -padding {4 4}
+ ttk::style configure Toolbutton -padding 3p
# Combobox
- ttk::style configure TCombobox -padding 2
+ ttk::style configure TCombobox -padding 1.5p
ttk::style element create Combobox.border vsapi \
COMBOBOX 4 {disabled 4 focus 3 active 2 hover 2 {} 1}
ttk::style element create Combobox.background vsapi \
@@ -89,7 +90,7 @@ namespace eval ttk::theme::vista {
-selectforeground [list !focus SystemWindowText] \
-foreground [list \
disabled SystemGrayText \
- {readonly focus} SystemHighlightText \
+ {readonly focus} SystemHighlightText \
] \
-focusfill [list {readonly focus} SystemHighlight]
@@ -182,6 +183,7 @@ namespace eval ttk::theme::vista {
ttk::style layout Horizontal.TProgressbar {
Horizontal.Progressbar.trough -sticky nswe -children {
Horizontal.Progressbar.pbar -side left -sticky ns
+ Horizontal.Progressbar.ctext -sticky nesw
}
}
ttk::style element create Vertical.Progressbar.pbar vsapi \
@@ -217,7 +219,9 @@ namespace eval ttk::theme::vista {
}
# Treeview
- ttk::style configure Item -padding {4 0 0 0}
+ ttk::style configure Item -padding {3p 0 0 0}
+ ttk::style configure Treeview -indent 15p
+ ttk::setTreeviewRowHeight
package provide ttk::theme::vista 1.0
}
diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl
index 6b3cce2..3be8add 100644
--- a/library/ttk/winTheme.tcl
+++ b/library/ttk/winTheme.tcl
@@ -3,6 +3,7 @@
#
namespace eval ttk::theme::winnative {
+
ttk::style theme settings winnative {
ttk::style configure "." \
@@ -15,60 +16,65 @@ namespace eval ttk::theme::winnative {
-troughcolor SystemScrollbar \
-font TkDefaultFont
- ttk::style map "." -foreground [list disabled SystemGrayText]
- ttk::style map "." -embossed [list disabled 1]
+ ttk::style map "." -foreground {disabled SystemGrayText}
+ ttk::style map "." -embossed {disabled 1}
ttk::style configure TButton \
-anchor center -width -11 -relief raised -shiftrelief 1
- ttk::style configure TCheckbutton -padding "2 4"
- ttk::style configure TRadiobutton -padding "2 4"
- ttk::style configure TMenubutton \
- -padding "8 4" -arrowsize 3 -relief raised
-
ttk::style map TButton -relief {{!disabled pressed} sunken}
+ ttk::style configure TCheckbutton -padding {1.5p 3p}
+ ttk::style configure TRadiobutton -padding {1.5p 3p}
+
+ ttk::style configure TMenubutton \
+ -padding {6p 3p} -arrowsize 2.25p -relief raised
+
ttk::style configure TEntry \
-padding 2 -insertwidth 1
ttk::style map TEntry \
-fieldbackground \
- [list readonly SystemButtonFace disabled SystemButtonFace] \
- -selectbackground [list !focus SystemWindow] \
- -selectforeground [list !focus SystemWindowText]
+ {readonly SystemButtonFace disabled SystemButtonFace} \
+ -selectbackground {!focus SystemWindow} \
+ -selectforeground {!focus SystemWindowText}
- ttk::style configure TCombobox -padding 2
+ ttk::style configure TCombobox -padding 1.5p
ttk::style map TCombobox \
-selectbackground [list !focus SystemWindow] \
-selectforeground [list !focus SystemWindowText] \
-fieldbackground [list \
- readonly SystemButtonFace \
+ readonly SystemButtonFace \
disabled SystemButtonFace] \
-foreground [list \
disabled SystemGrayText \
- {readonly focus} SystemHighlightText \
+ {readonly focus} SystemHighlightText \
] \
- -focusfill [list {readonly focus} SystemHighlight]
+ -focusfill {{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 TSpinbox -padding {1.5p 0 12p 0}
ttk::style configure TLabelframe -borderwidth 2 -relief groove
- ttk::style configure Toolbutton -relief flat -padding {8 4}
+ ttk::style configure Toolbutton -relief flat -padding {6p 3p}
ttk::style map Toolbutton -relief \
- {disabled flat selected sunken pressed sunken active raised}
+ {disabled flat selected sunken pressed sunken active raised}
- ttk::style configure TScale -groovewidth 4
+ ttk::style configure TScale -groovewidth 3p
ttk::style configure TNotebook -tabmargins {2 2 2 0}
- ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1
- ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}]
+ ttk::style configure TNotebook.Tab -padding {2.25p 0.75p} -borderwidth 1
+ ttk::style map TNotebook.Tab -expand {selected {2 2 2 0}}
# Treeview:
ttk::style configure Heading -font TkHeadingFont -relief raised
- ttk::style configure Treeview -background SystemWindow
+ ttk::style configure Item \
+ -indicatormargins {1.5p 1.5p 3p 1.5p}
+ ttk::style configure Treeview -background SystemWindow \
+ -stripedbackground System3dLight -indent 15p
+ ttk::setTreeviewRowHeight
ttk::style map Treeview \
-background [list disabled SystemButtonFace \
selected SystemHighlight] \
@@ -76,6 +82,7 @@ namespace eval ttk::theme::winnative {
selected SystemHighlightText]
ttk::style configure TProgressbar \
- -background SystemHighlight -borderwidth 0
+ -background SystemHighlight -borderwidth 0 \
+ -barsize 22.5p -thickness 11.25p
}
}
diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl
index fb73262..1c900ba 100644
--- a/library/ttk/xpTheme.tcl
+++ b/library/ttk/xpTheme.tcl
@@ -14,17 +14,15 @@ namespace eval ttk::theme::xpnative {
-insertcolor SystemWindowText \
-font TkDefaultFont
- ttk::style map "." \
- -foreground [list disabled SystemGrayText]
+ ttk::style map "." -foreground [list disabled SystemGrayText]
- ttk::style configure TButton -anchor center -padding {1 1} -width -11
- ttk::style configure TRadiobutton -padding 2
- ttk::style configure TCheckbutton -padding 2
- ttk::style configure TMenubutton -padding {8 4}
+ ttk::style configure TButton -anchor center -padding 0.75p -width -11
+ ttk::style configure TRadiobutton -padding 1.5p
+ ttk::style configure TCheckbutton -padding 1.5p
+ ttk::style configure TMenubutton -padding {6p 3p}
ttk::style configure TNotebook -tabmargins {2 2 2 0}
- ttk::style map TNotebook.Tab \
- -expand [list selected {2 2 2 2}]
+ ttk::style map TNotebook.Tab -expand {selected {2 2 2 2}}
ttk::style configure TLabelframe.Label -foreground "#0046d5"
@@ -33,26 +31,30 @@ namespace eval ttk::theme::xpnative {
ttk::style map TEntry \
-selectbackground [list !focus SystemWindow] \
-selectforeground [list !focus SystemWindowText]
- ttk::style configure TCombobox -padding 2
+ ttk::style configure TCombobox -padding 1.5p
ttk::style map TCombobox \
-selectbackground [list !focus SystemWindow] \
-selectforeground [list !focus SystemWindowText] \
-foreground [list \
disabled SystemGrayText \
- {readonly focus} SystemHighlightText \
+ {readonly focus} SystemHighlightText \
] \
-focusfill [list {readonly focus} SystemHighlight]
- ttk::style configure TSpinbox -padding {2 0 14 0}
+ ttk::style configure TSpinbox -padding {1.5p 0 10.5p 0}
ttk::style map TSpinbox \
-selectbackground [list !focus SystemWindow] \
-selectforeground [list !focus SystemWindowText]
- ttk::style configure Toolbutton -padding {4 4}
+ ttk::style configure Toolbutton -padding 3p
# Treeview:
ttk::style configure Heading -font TkHeadingFont -relief raised
- ttk::style configure Treeview -background SystemWindow
+ ttk::style configure Item \
+ -indicatormargins {1.5p 1.5p 3p 1.5p}
+ ttk::style configure Treeview -background SystemWindow \
+ -stripedbackground System3dLight -indent 15p
+ ttk::setTreeviewRowHeight
ttk::style map Treeview \
-background [list disabled SystemButtonFace \
selected SystemHighlight] \