diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
commit | 0d5336db012f45753abace489f18f0ca299c6961 (patch) | |
tree | b1bf3280a9046df99226158978502eeb26f5b0a3 /library/ttk | |
parent | e97381a6d921de403516d5b761539a450f4af83c (diff) | |
parent | 1320b8a2a9c1269a345d44d673a7a35707fbbe9c (diff) | |
download | tk-core-tip-626.zip tk-core-tip-626.tar.gz tk-core-tip-626.tar.bz2 |
Merge 9.0core-tip-626
Diffstat (limited to 'library/ttk')
-rw-r--r-- | library/ttk/altTheme.tcl | 60 | ||||
-rw-r--r-- | library/ttk/aquaTheme.tcl | 6 | ||||
-rw-r--r-- | library/ttk/button.tcl | 10 | ||||
-rw-r--r-- | library/ttk/clamTheme.tcl | 44 | ||||
-rw-r--r-- | library/ttk/classicTheme.tcl | 12 | ||||
-rw-r--r-- | library/ttk/combobox.tcl | 36 | ||||
-rw-r--r-- | library/ttk/cursors.tcl | 48 | ||||
-rw-r--r-- | library/ttk/defaults.tcl | 28 | ||||
-rw-r--r-- | library/ttk/entry.tcl | 52 | ||||
-rw-r--r-- | library/ttk/fonts.tcl | 28 | ||||
-rw-r--r-- | library/ttk/menubutton.tcl | 8 | ||||
-rw-r--r-- | library/ttk/notebook.tcl | 4 | ||||
-rw-r--r-- | library/ttk/panedwindow.tcl | 28 | ||||
-rw-r--r-- | library/ttk/scale.tcl | 32 | ||||
-rw-r--r-- | library/ttk/scrollbar.tcl | 6 | ||||
-rw-r--r-- | library/ttk/sizegrip.tcl | 28 | ||||
-rw-r--r-- | library/ttk/spinbox.tcl | 24 | ||||
-rw-r--r-- | library/ttk/treeview.tcl | 148 | ||||
-rw-r--r-- | library/ttk/ttk.tcl | 29 | ||||
-rw-r--r-- | library/ttk/utils.tcl | 21 | ||||
-rw-r--r-- | library/ttk/vistaTheme.tcl | 331 | ||||
-rw-r--r-- | library/ttk/winTheme.tcl | 35 | ||||
-rw-r--r-- | library/ttk/xpTheme.tcl | 31 |
23 files changed, 616 insertions, 433 deletions
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index 2d1b6b9..1dfb5b2 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -6,12 +6,12 @@ namespace eval ttk::theme::alt { variable colors array set colors { - -frame "#d9d9d9" + -frame "#d9d9d9" -window "#ffffff" -alternate "#f0f0f0" - -darker "#c3c3c3" + -darker "#c3c3c3" -border "#414141" - -activebg "#ececec" + -activebg "#ececec" -disabledfg "#a3a3a3" -selectbg "#4a6984" -selectfg "#ffffff" @@ -21,18 +21,18 @@ namespace eval ttk::theme::alt { ttk::style theme settings alt { ttk::style configure "." \ - -background $colors(-frame) \ - -foreground black \ + -background $colors(-frame) \ + -foreground black \ -troughcolor $colors(-darker) \ -bordercolor $colors(-border) \ - -selectbackground $colors(-selectbg) \ - -selectforeground $colors(-selectfg) \ - -font TkDefaultFont + -selectbackground $colors(-selectbg) \ + -selectforeground $colors(-selectfg) \ + -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] + ttk::style map "." -embossed [list disabled 1] ttk::style configure TButton \ -anchor center -width -11 -padding 0.75p \ @@ -49,12 +49,12 @@ namespace eval ttk::theme::alt { -indicatormargin {0 1.5p 3p 1.5p} -padding 1.5p ttk::style map TCheckbutton -indicatorcolor \ [list pressed $colors(-frame) \ - alternate $colors(-altindicator) \ - disabled $colors(-frame)] + alternate $colors(-altindicator) \ + disabled $colors(-frame)] ttk::style map TRadiobutton -indicatorcolor \ [list pressed $colors(-frame) \ - alternate $colors(-altindicator) \ - disabled $colors(-frame)] + alternate $colors(-altindicator) \ + disabled $colors(-frame)] ttk::style configure TMenubutton \ -width -11 -padding 2.25p -arrowsize 3.75p -relief raised @@ -100,7 +100,8 @@ namespace eval ttk::theme::alt { ttk::style configure Item \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background $colors(-window) \ - -stripedbackground $colors(-alternate) -indent 15p + -stripedbackground $colors(-alternate) -indent 15p \ + -focuswidth 1 -focuscolor $colors(-selectbg) ttk::setTreeviewRowHeight ttk::style configure Treeview.Separator \ -background $colors(-alternate) @@ -119,3 +120,34 @@ namespace eval ttk::theme::alt { -barsize 22.5p -thickness 11.25p } } + +# ttk::theme::alt::configureNotebookStyle -- +# +# Sets theme-specific option values for the ttk::notebook style $style and the +# style $style.Tab. Invoked by ::ttk::configureNotebookStyle. + +proc ttk::theme::alt::configureNotebookStyle {style} { + set tabPos [ttk::style lookup $style -tabposition {} nw] + switch -- [string index $tabPos 0] { + n { + ttk::style configure $style -tabmargins {1.5p 1.5p 0.75p 0} + ttk::style map $style.Tab -expand {selected {1.5p 1.5p 0.75p 0}} + } + s { + ttk::style configure $style -tabmargins {1.5p 0 0.75p 1.5p} + ttk::style map $style.Tab -expand {selected {1.5p 0 0.75p 1.5p}} + } + w { + ttk::style configure $style -tabmargins {1.5p 1.5p 0 0.75p} + ttk::style map $style.Tab -expand {selected {1.5p 1.5p 0 0.75p}} + } + e { + ttk::style configure $style -tabmargins {0 1.5p 1.5p 0.75p} + ttk::style map $style.Tab -expand {selected {0 1.5p 1.5p 0.75p}} + } + default { + ttk::style configure $style -tabmargins {1.5p 1.5p 0.75p 0} + ttk::style map $style.Tab -expand {selected {1.5p 1.5p 0.75p 0}} + } + } +} diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index a631376..dfefbbd 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -30,8 +30,8 @@ namespace eval ttk::theme::aqua { ttk::style map TButton \ -foreground { pressed white - {alternate !pressed !background} white - disabled systemDisabledControlTextColor} + {alternate !pressed !background} white + disabled systemDisabledControlTextColor} # Menubutton ttk::style configure TMenubutton -anchor center -padding {2 0 0 2} @@ -152,7 +152,7 @@ namespace eval ttk::theme::aqua { ttk::style configure Treeview -rowheight 18 \ -background systemControlBackgroundColor \ -stripedbackground systemControlAlternatingRowColor \ - -foreground systemTextColor \ + -foreground systemTextColor \ -fieldbackground systemTextBackgroundColor ttk::style map Treeview \ -background { diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl index a14a53b..541a0f2 100644 --- a/library/ttk/button.tcl +++ b/library/ttk/button.tcl @@ -18,10 +18,10 @@ namespace eval ttk::button {} -bind TButton <Enter> { %W instate !disabled {%W state active} } +bind TButton <Enter> { %W instate !disabled {%W state active} } bind TButton <Leave> { %W state !active } bind TButton <space> { ttk::button::activate %W } -bind TButton <<Invoke>> { ttk::button::activate %W } +bind TButton <<Invoke>> { ttk::button::activate %W } bind TButton <Button-1> \ { %W instate !disabled { ttk::clickToFocus %W; %W state pressed } } @@ -39,8 +39,8 @@ ttk::copyBindings TButton TRadiobutton # ...plus a few more: -bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 } -bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 } +bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 } +bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 } # bind TCheckbutton <+> { %W select } # bind TCheckbutton <minus> { %W deselect } @@ -58,7 +58,7 @@ proc ttk::button::activate {w} { } # RadioTraverse -- up/down keyboard traversal for radiobutton groups. -# Set focus to previous/next radiobutton in a group. +# Set focus to previous/next radiobutton in a group. # A radiobutton group consists of all the radiobuttons with # the same parent and -variable; this is a pretty good heuristic # that works most of the time. diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl index be72290..0674b81 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -9,13 +9,13 @@ namespace eval ttk::theme::clam { variable colors array set colors { -disabledfg "#999999" - -frame "#dcdad5" - -window "#ffffff" + -frame "#dcdad5" + -window "#ffffff" -dark "#cfcdc8" - -darker "#bab5ab" + -darker "#bab5ab" -darkest "#9e9a91" -lighter "#eeebe7" - -lightest "#ffffff" + -lightest "#ffffff" -selectbg "#4a6984" -selectfg "#ffffff" -altindicator "#5895bc" @@ -115,7 +115,7 @@ namespace eval ttk::theme::clam { ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0} ttk::style map TSpinbox \ -background [list readonly $colors(-frame)] \ - -arrowcolor [list disabled $colors(-disabledfg)] \ + -arrowcolor [list disabled $colors(-disabledfg)] \ -bordercolor [list focus $colors(-selectbg)] ttk::style configure TNotebook.Tab -padding {4.5p 1.5p 4.5p 1.5p} @@ -138,7 +138,8 @@ namespace eval ttk::theme::clam { -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ - selected $colors(-selectfg)] + selected $colors(-selectfg)] \ + -bordercolor [list focus $colors(-selectbg)] ttk::style configure TLabelframe \ -labeloutside true -labelmargins {0 0 0 3p} \ @@ -156,3 +157,34 @@ namespace eval ttk::theme::clam { ttk::style configure Sash -sashthickness 4.5p -gripsize 15p } } + +# ttk::theme::clam::configureNotebookStyle -- +# +# Sets theme-specific option values for the ttk::notebook tab style $style.Tab. +# Invoked by ::ttk::configureNotebookStyle. + +proc ttk::theme::clam::configureNotebookStyle {style} { + set tabPos [ttk::style lookup $style -tabposition {} nw] + switch -- [string index $tabPos 0] { + n { + ttk::style configure $style.Tab -padding {4.5p 1.5p 4.5p 1.5p} + ttk::style map $style.Tab -padding {selected {4.5p 3p 4.5p 1.5p}} + } + s { + ttk::style configure $style.Tab -padding {4.5p 1.5p 4.5p 1.5p} + ttk::style map $style.Tab -padding {selected {4.5p 1.5p 4.5p 3p }} + } + w { + ttk::style configure $style.Tab -padding {1.5p 4.5p 1.5p 4.5p} + ttk::style map $style.Tab -padding {selected {3p 4.5p 1.5p 4.5p}} + } + e { + ttk::style configure $style.Tab -padding {1.5p 4.5p 1.5p 4.5p} + ttk::style map $style.Tab -padding {selected {1.5p 4.5p 3p 4.5p}} + } + default { + ttk::style configure $style.Tab -padding {4.5p 1.5p 4.5p 1.5p} + ttk::style map $style.Tab -padding {selected {4.5p 3p 4.5p 1.5p}} + } + } +} diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index 7964034..b65dfac 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -123,7 +123,17 @@ namespace eval ttk::theme::classic { # # Toolbar buttons: # - ttk::style configure Toolbutton -padding 1.5p -relief flat -shiftrelief 2 + ttk::style layout Toolbutton { + Toolbutton.focus -children { + Toolbutton.border -children { + Toolbutton.padding -children { + Toolbutton.label + } + } + } + } + ttk::style configure Toolbutton -padding 1.5p -relief flat \ + -shiftrelief 2 -focussolid 1 ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} ttk::style map Toolbutton -background \ diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 1b9d4cb..b225277 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -42,13 +42,13 @@ namespace eval ttk::combobox { ttk::copyBindings TEntry TCombobox -bind TCombobox <Down> { ttk::combobox::Post %W } -bind TCombobox <Escape> { ttk::combobox::Unpost %W } +bind TCombobox <Down> { ttk::combobox::Post %W } +bind TCombobox <Escape> { ttk::combobox::Unpost %W } -bind TCombobox <Button-1> { ttk::combobox::Press "" %W %x %y } +bind TCombobox <Button-1> { ttk::combobox::Press "" %W %x %y } bind TCombobox <Shift-Button-1> { ttk::combobox::Press "s" %W %x %y } -bind TCombobox <Double-Button-1> { ttk::combobox::Press "2" %W %x %y } -bind TCombobox <Triple-Button-1> { ttk::combobox::Press "3" %W %x %y } +bind TCombobox <Double-Button-1> { ttk::combobox::Press "2" %W %x %y } +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 } @@ -57,13 +57,13 @@ bind TCombobox <Shift-MouseWheel> { # Ignore the event } bind TCombobox <TouchpadScroll> { - lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + lassign [tk::PreciseScrollDeltas %D] tk::Priv(deltaX) tk::Priv(deltaY) # TouchpadScroll events fire about 60 times per second. - if {$deltaY != 0 && %# %% 15 == 0} { - ttk::combobox::Scroll %W [expr {$deltaY > 0 ? -1 : 1}] + if {$tk::Priv(deltaY) != 0 && %# %% 15 == 0} { + ttk::combobox::Scroll %W [expr {$tk::Priv(deltaY) > 0 ? -1 : 1}] } } -bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W } +bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W } ### Combobox listbox bindings. # @@ -129,9 +129,9 @@ proc ttk::combobox::Press {mode w x y} { focus $w if {$State(entryPress)} { switch -- $mode { - s { ttk::entry::Shift-Press $w $x ; # Shift } - 2 { ttk::entry::Select $w $x word ; # Double click} - 3 { ttk::entry::Select $w $x line ; # Triple click } + s { ttk::entry::Shift-Press $w $x ; # Shift } + 2 { ttk::entry::Select $w $x word ; # Double click} + 3 { ttk::entry::Select $w $x line ; # Triple click } "" - default { ttk::entry::Press $w $x } } @@ -158,7 +158,7 @@ proc ttk::combobox::Motion {w x y} { variable State ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" - && [$w instate {!readonly !disabled}] + && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { @@ -356,7 +356,7 @@ proc ttk::combobox::ConfigureListbox {cb} { set values [$cb cget -values] set current [$cb current] if {$current < 0} { - set current 0 ;# no current entry, highlight first one + set current 0 ;# no current entry, highlight first one } set Values($cb) $values $popdown.l selection clear 0 end @@ -367,10 +367,10 @@ proc ttk::combobox::ConfigureListbox {cb} { if {$height > [$cb cget -height]} { set height [$cb cget -height] grid $popdown.sb - grid configure $popdown.l -padx {1 0} + grid configure $popdown.l -padx {1 0} } else { grid remove $popdown.sb - grid configure $popdown.l -padx 1 + grid configure $popdown.l -padx 1 } $popdown.l configure -height $height } @@ -380,7 +380,7 @@ proc ttk::combobox::ConfigureAquaMenu {cb width} { set values [$cb cget -values] set current [$cb current] if {$current < 0} { - set current 0 ;# no current entry, highlight first one + set current 0 ;# no current entry, highlight first one } $cb.popdown.menu delete 0 end $cb.spacer configure -width [expr {$width - 40}] -height 1 @@ -444,7 +444,7 @@ proc ttk::combobox::AquaPlacePopdown {cb popdown} { 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 + incr $var $delta } wm geometry $popdown ${w}x${h}+${x}+${y} return [list $x $y $w $h] diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index 9d1e1ae..f185276 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -47,19 +47,19 @@ namespace eval ttk { none none standard left_ptr - text xterm + text xterm link hand2 crosshair crosshair busy watch forbidden pirate - hresize sb_h_double_arrow - vresize sb_v_double_arrow + hresize sb_h_double_arrow + vresize sb_v_double_arrow - nresize top_side - sresize bottom_side - wresize left_side - eresize right_side + nresize top_side + sresize bottom_side + wresize left_side + eresize right_side nwresize top_left_corner neresize top_right_corner swresize bottom_left_corner @@ -82,13 +82,13 @@ namespace eval ttk { busy wait forbidden no - vresize size_ns - nresize size_ns + vresize size_ns + nresize size_ns sresize size_ns wresize size_we eresize size_we - hresize size_we + hresize size_we nwresize size_nw_se swresize size_ne_sw @@ -101,18 +101,18 @@ namespace eval ttk { "aqua" { array set Cursors { standard arrow - text ibeam - link pointinghand + text ibeam + link pointinghand crosshair crosshair - busy watch + busy watch forbidden notallowed - hresize resizeleftright - vresize resizeupdown - nresize resizeup - sresize resizedown - wresize resizeleft - eresize resizeright + hresize resizeleftright + vresize resizeupdown + nresize resizeup + sresize resizedown + wresize resizeleft + eresize resizeright } } } @@ -138,12 +138,12 @@ proc ttk::cursor {name} { proc ttk::setCursor {w name} { variable Cursors if {[info exists Cursors($name)]} { - set cursorname $Cursors($name) + set cursorname $Cursors($name) } else { - set cursorname $name + set cursorname $name } if {[$w cget -cursor] ne $cursorname} { - $w configure -cursor $cursorname + $w configure -cursor $cursorname } } @@ -157,10 +157,10 @@ proc ttk::setCursor {w name} { proc ttk::saveCursor {w saveVar excludeList} { upvar $saveVar sv if {![info exists sv]} { - set sv [$w cget -cursor] + set sv [$w cget -cursor] } if {[$w cget -cursor] ni $excludeList} { - set sv [$w cget -cursor] + set sv [$w cget -cursor] } } diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index 226bd39..3f6320e 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -10,11 +10,11 @@ namespace eval ttk::theme::default { -foreground "#000000" -window "#ffffff" -alternate "#e8e8e8" - -text "#000000" + -text "#000000" -activebg "#ececec" -selectbg "#4a6984" -selectfg "#ffffff" - -darker "#c3c3c3" + -darker "#c3c3c3" -disabledfg "#a3a3a3" -indicator "#4a6984" -disabledindicator "#a3a3a3" @@ -85,14 +85,14 @@ proc ttk::theme::default::reconfigureDefaultTheme {} { ttk::style theme settings default { ttk::style configure "." \ - -borderwidth 1 \ - -background $colors(-frame) \ - -foreground $colors(-foreground) \ - -troughcolor $colors(-darker) \ - -font TkDefaultFont \ + -borderwidth 1 \ + -background $colors(-frame) \ + -foreground $colors(-foreground) \ + -troughcolor $colors(-darker) \ + -font TkDefaultFont \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ - -insertwidth 1 \ + -insertwidth 1 \ -insertcolor $colors(-foreground) \ -focuscolor $colors(-text) @@ -189,7 +189,8 @@ proc ttk::theme::default::reconfigureDefaultTheme {} { -stripedbackground $colors(-alternate) \ -fieldbackground $colors(-window) \ -foreground $colors(-text) \ - -indent 15p + -indent 15p \ + -focuswidth 1 -focuscolor $colors(-selectbg) ttk::setTreeviewRowHeight ttk::style configure Treeview.Separator \ -background $colors(-alternate) @@ -203,7 +204,7 @@ proc ttk::theme::default::reconfigureDefaultTheme {} { ttk::style layout ComboboxPopdownFrame { ComboboxPopdownFrame.border -sticky nswe } - ttk::style configure ComboboxPopdownFrame \ + ttk::style configure ComboboxPopdownFrame \ -borderwidth 1 -relief solid # @@ -211,12 +212,13 @@ proc ttk::theme::default::reconfigureDefaultTheme {} { # ttk::style layout Toolbutton { Toolbutton.border -children { - Toolbutton.padding -children { - Toolbutton.label + Toolbutton.focus -children { + Toolbutton.padding -children { + Toolbutton.label + } } } } - ttk::style configure Toolbutton \ -padding 1.5p -relief flat ttk::style map Toolbutton -relief \ diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index 3d2ef90..813ae91 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -60,21 +60,21 @@ option add *TEntry.cursor [ttk::cursor text] widgetDefault ## Clipboard events: # -bind TEntry <<Cut>> { ttk::entry::Cut %W } -bind TEntry <<Copy>> { ttk::entry::Copy %W } -bind TEntry <<Paste>> { ttk::entry::Paste %W } -bind TEntry <<Clear>> { ttk::entry::Clear %W } +bind TEntry <<Cut>> { ttk::entry::Cut %W } +bind TEntry <<Copy>> { ttk::entry::Copy %W } +bind TEntry <<Paste>> { ttk::entry::Paste %W } +bind TEntry <<Clear>> { ttk::entry::Clear %W } ## Button1 bindings: # Used for selection and navigation. # -bind TEntry <Button-1> { ttk::entry::Press %W %x } +bind TEntry <Button-1> { ttk::entry::Press %W %x } bind TEntry <Shift-Button-1> { ttk::entry::Shift-Press %W %x } -bind TEntry <Double-Button-1> { ttk::entry::Select %W %x word } -bind TEntry <Triple-Button-1> { ttk::entry::Select %W %x line } +bind TEntry <Double-Button-1> { ttk::entry::Select %W %x word } +bind TEntry <Triple-Button-1> { ttk::entry::Select %W %x line } bind TEntry <B1-Motion> { ttk::entry::Drag %W %x } -bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m } +bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m } bind TEntry <B1-Enter> { ttk::entry::DragIn %W } bind TEntry <ButtonRelease-1> { ttk::entry::Release %W } @@ -87,37 +87,37 @@ bind TEntry <<ToggleSelection>> { # Note: ButtonRelease-2 # is mapped to <<PasteSelection>> in tk.tcl. # -bind TEntry <Button-2> { ttk::entry::ScanMark %W %x } -bind TEntry <B2-Motion> { ttk::entry::ScanDrag %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: # bind TEntry <<PrevChar>> { ttk::entry::Move %W prevchar } -bind TEntry <<NextChar>> { ttk::entry::Move %W nextchar } +bind TEntry <<NextChar>> { ttk::entry::Move %W nextchar } bind TEntry <<PrevWord>> { ttk::entry::Move %W prevword } bind TEntry <<NextWord>> { ttk::entry::Move %W nextword } bind TEntry <<LineStart>> { ttk::entry::Move %W home } bind TEntry <<LineEnd>> { ttk::entry::Move %W end } -bind TEntry <<SelectPrevChar>> { ttk::entry::Extend %W prevchar } +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 selectnextword } bind TEntry <<SelectLineStart>> { ttk::entry::Extend %W home } bind TEntry <<SelectLineEnd>> { ttk::entry::Extend %W end } -bind TEntry <<SelectAll>> { %W selection range 0 end } -bind TEntry <<SelectNone>> { %W selection clear } +bind TEntry <<SelectAll>> { %W selection range 0 end } +bind TEntry <<SelectNone>> { %W selection clear } -bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end } +bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end } ## Edit bindings: # -bind TEntry <Key> { ttk::entry::Insert %W %A } +bind TEntry <Key> { ttk::entry::Insert %W %A } bind TEntry <Delete> { ttk::entry::Delete %W } -bind TEntry <BackSpace> { ttk::entry::Backspace %W } +bind TEntry <BackSpace> { ttk::entry::Backspace %W } # Ignore all Alt, Meta, Control, Command, and Fn keypresses unless explicitly bound. # Otherwise, the <Key> class binding will fire and insert the character. @@ -125,11 +125,11 @@ bind TEntry <BackSpace> { ttk::entry::Backspace %W } # bind TEntry <Alt-Key> {# nothing} bind TEntry <Meta-Key> {# nothing} -bind TEntry <Control-Key> {# nothing} -bind TEntry <Escape> {# nothing} -bind TEntry <Return> {# nothing} -bind TEntry <KP_Enter> {# nothing} -bind TEntry <Tab> {# nothing} +bind TEntry <Control-Key> {# nothing} +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} @@ -227,7 +227,7 @@ proc ttk::entry::Cut {w} { # ## ClosestGap -- Find closest boundary between characters. -# Returns the index of the character just after the boundary. +# Returns the index of the character just after the boundary. # proc ttk::entry::ClosestGap {w x} { set pos [$w index @$x] @@ -323,7 +323,7 @@ proc ttk::entry::PrevChar {w start} { proc ttk::entry::RelIndex {w where {index insert}} { switch -- $where { prevchar { PrevChar $w $index } - nextchar { NextChar $w $index } + nextchar { NextChar $w $index } prevword { PrevWord $w $index } nextword { NextWord $w $index } selectnextword { SelectNextWord $w $index } @@ -485,7 +485,7 @@ proc ttk::entry::DragOut {w mode} { } ## <B1-Enter> binding -# Suspend autoscroll. +# Suspend autoscroll. # proc ttk::entry::DragIn {w} { ttk::CancelRepeat @@ -496,7 +496,7 @@ proc ttk::entry::DragIn {w} { proc ttk::entry::Release {w} { variable State set State(selectMode) none - ttk::CancelRepeat ;# suspend autoscroll + ttk::CancelRepeat ;# suspend autoscroll } ## AutoScroll diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl index 5138c89..4c4c207 100644 --- a/library/ttk/fonts.tcl +++ b/library/ttk/fonts.tcl @@ -20,7 +20,7 @@ # # Windows: # The default system font changed from "MS Sans Serif" to "Tahoma" -# in Windows XP/Windows 2000. +# in Windows XP/Windows 2000. # # MS documentation says to use "Tahoma 8" in Windows 2000/XP, # although many MS programs still use "MS Sans Serif 8" @@ -67,20 +67,20 @@ if {!$tip145} {apply {{} { global tcl_platform switch -- [tk windowingsystem] { win32 { - # In safe interps there is no osVersion element. + # In safe interps there is no osVersion element. if {[info exists tcl_platform(osVersion)]} { - if {$tcl_platform(osVersion) >= 5.0} { - set family "Tahoma" - } else { - set family "MS Sans Serif" - } - } else { - if {[lsearch -exact [font families] Tahoma] >= 0} { - set family "Tahoma" - } else { - set family "MS Sans Serif" - } - } + if {$tcl_platform(osVersion) >= 5.0} { + set family "Tahoma" + } else { + set family "MS Sans Serif" + } + } else { + if {[lsearch -exact [font families] Tahoma] >= 0} { + set family "Tahoma" + } else { + set family "MS Sans Serif" + } + } set size 8 font configure TkDefaultFont -family $family -size $size diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl index 8ef8937..10bbe5a 100644 --- a/library/ttk/menubutton.tcl +++ b/library/ttk/menubutton.tcl @@ -47,12 +47,12 @@ namespace eval ttk { bind TMenubutton <Enter> { %W instate !disabled {%W state active } } bind TMenubutton <Leave> { %W state !active } bind TMenubutton <space> { ttk::menubutton::Popdown %W } -bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W } +bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W } if {[tk windowingsystem] eq "x11"} { - bind TMenubutton <Button-1> { ttk::menubutton::Pulldown %W } + bind TMenubutton <Button-1> { ttk::menubutton::Pulldown %W } bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W } - bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W } + bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W } } else { bind TMenubutton <Button-1> \ { %W state pressed ; ttk::menubutton::Popdown %W } @@ -138,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 { diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl index 1d59d1e..fedb1be 100644 --- a/library/ttk/notebook.tcl +++ b/library/ttk/notebook.tcl @@ -170,7 +170,7 @@ proc ttk::notebook::enableTraversal {nb} { # bind $top <Control-Next> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Prior> {+ttk::notebook::TLCycleTab %W -1} - bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1} + bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1} catch { bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1} @@ -199,7 +199,7 @@ proc ttk::notebook::Cleanup {nb} { set top [winfo toplevel $nb] if {[info exists TLNotebooks($top)]} { set index [lsearch -exact $TLNotebooks($top) $nb] - set TLNotebooks($top) [lreplace $TLNotebooks($top) $index $index] + set TLNotebooks($top) [lreplace $TLNotebooks($top) $index $index] } } diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index d5e25cd..131c07c 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -8,20 +8,20 @@ namespace eval ttk::panedwindow { pressed 0 pressX - pressY - - sash - + sash - sashPos - } } ## Bindings: # -bind TPanedwindow <Button-1> { ttk::panedwindow::Press %W %x %y } +bind TPanedwindow <Button-1> { ttk::panedwindow::Press %W %x %y } bind TPanedwindow <B1-Motion> { ttk::panedwindow::Drag %W %x %y } -bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y } +bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y } -bind TPanedwindow <Motion> { ttk::panedwindow::SetCursor %W %x %y } -bind TPanedwindow <Enter> { ttk::panedwindow::SetCursor %W %x %y } -bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W } +bind TPanedwindow <Motion> { ttk::panedwindow::SetCursor %W %x %y } +bind TPanedwindow <Enter> { ttk::panedwindow::SetCursor %W %x %y } +bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W } ## Sash movement: # @@ -33,10 +33,10 @@ proc ttk::panedwindow::Press {w x y} { set State(pressed) 0 return } - set State(pressed) 1 - set State(pressX) $x - set State(pressY) $y - set State(sash) $sash + set State(pressed) 1 + set State(pressX) $x + set State(pressY) $y + set State(sash) $sash set State(sashPos) [$w sashpos $sash] } @@ -44,8 +44,8 @@ proc ttk::panedwindow::Drag {w x y} { variable State if {!$State(pressed)} { return } switch -glob -- [$w cget -orient] { - h* { set delta [expr {$x - $State(pressX)}] } - v* { set delta [expr {$y - $State(pressY)}] } + h* { set delta [expr {$x - $State(pressX)}] } + v* { set delta [expr {$y - $State(pressY)}] } } $w sashpos $State(sash) [expr {$State(sashPos) + $delta}] } @@ -62,7 +62,7 @@ proc ttk::panedwindow::ResetCursor {w} { variable State ttk::saveCursor $w State(userConfCursor) \ - [list [ttk::cursor hresize] [ttk::cursor vresize]] + [list [ttk::cursor hresize] [ttk::cursor vresize]] if {!$State(pressed)} { ttk::setCursor $w $State(userConfCursor) @@ -73,7 +73,7 @@ proc ttk::panedwindow::SetCursor {w x y} { variable State ttk::saveCursor $w State(userConfCursor) \ - [list [ttk::cursor hresize] [ttk::cursor vresize]] + [list [ttk::cursor hresize] [ttk::cursor vresize]] set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl index a97440d..1b6882a 100644 --- a/library/ttk/scale.tcl +++ b/library/ttk/scale.tcl @@ -41,14 +41,14 @@ proc ttk::scale::Press {w x y} { switch -glob -- [$w identify $x $y] { *track - - *trough { - set inc [expr {([$w get $x $y] <= [$w get]) ^ ([$w cget -from] > [$w cget -to]) ? -1 : 1}] - ttk::Repeatedly Increment $w $inc - } - *slider { - set State(dragging) 1 - set State(initial) [$w get] - } + *trough { + set inc [expr {([$w get $x $y] <= [$w get]) ^ ([$w cget -from] > [$w cget -to]) ? -1 : 1}] + ttk::Repeatedly Increment $w $inc + } + *slider { + set State(dragging) 1 + set State(initial) [$w get] + } } } @@ -61,14 +61,14 @@ proc ttk::scale::Jump {w x y} { switch -glob -- [$w identify $x $y] { *track - - *trough { - $w set [$w get $x $y] - set State(dragging) 1 - set State(initial) [$w get] - } - *slider { - Press $w $x $y - } + *trough { + $w set [$w get $x $y] + set State(dragging) 1 + set State(initial) [$w get] + } + *slider { + Press $w $x $y + } } } diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl index 7c31511..1a73fd7 100644 --- a/library/ttk/scrollbar.tcl +++ b/library/ttk/scrollbar.tcl @@ -9,11 +9,11 @@ namespace eval ttk::scrollbar { # State(first) -- value of -first at start of drag. } -bind TScrollbar <Button-1> { ttk::scrollbar::Press %W %x %y } +bind TScrollbar <Button-1> { ttk::scrollbar::Press %W %x %y } bind TScrollbar <B1-Motion> { ttk::scrollbar::Drag %W %x %y } bind TScrollbar <ButtonRelease-1> { ttk::scrollbar::Release %W %x %y } -bind TScrollbar <Button-2> { ttk::scrollbar::Jump %W %x %y } +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 } @@ -97,7 +97,7 @@ proc ttk::scrollbar::Release {w x y} { } # scrollbar::Jump -- Button-2 binding for scrollbars. -# Behaves exactly like scrollbar::Press, except that +# Behaves exactly like scrollbar::Press, except that # clicking in the trough jumps to the the selected position. # proc ttk::scrollbar::Jump {w x y} { diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl index 2a49451..a4a596b 100644 --- a/library/ttk/sizegrip.tcl +++ b/library/ttk/sizegrip.tcl @@ -19,22 +19,22 @@ switch -- [tk windowingsystem] { namespace eval ttk::sizegrip { variable State array set State { - pressed 0 - pressX 0 - pressY 0 - width 0 - height 0 + pressed 0 + pressX 0 + pressY 0 + width 0 + height 0 widthInc 1 heightInc 1 - resizeX 1 - resizeY 1 - toplevel {} + resizeX 1 + resizeY 1 + toplevel {} } } -bind TSizegrip <Button-1> { ttk::sizegrip::Press %W %X %Y } -bind TSizegrip <B1-Motion> { ttk::sizegrip::Drag %W %X %Y } -bind TSizegrip <ButtonRelease-1> { ttk::sizegrip::Release %W %X %Y } +bind TSizegrip <Button-1> { ttk::sizegrip::Press %W %X %Y } +bind TSizegrip <B1-Motion> { ttk::sizegrip::Drag %W %X %Y } +bind TSizegrip <ButtonRelease-1> { ttk::sizegrip::Release %W %X %Y } proc ttk::sizegrip::Press {W X Y} { variable State @@ -46,7 +46,7 @@ proc ttk::sizegrip::Press {W X Y} { # If the toplevel is not resizable then bail foreach {State(resizeX) State(resizeY)} [wm resizable $top] break if {!$State(resizeX) && !$State(resizeY)} { - return + return } # Sanity-checks: @@ -83,10 +83,10 @@ proc ttk::sizegrip::Drag {W X Y} { set w $State(width) set h $State(height) if {$State(resizeX)} { - set w [expr {$w + ($X - $State(pressX))/$State(widthInc)}] + set w [expr {$w + ($X - $State(pressX))/$State(widthInc)}] } if {$State(resizeY)} { - set h [expr {$h + ($Y - $State(pressY))/$State(heightInc)}] + set h [expr {$h + ($Y - $State(pressY))/$State(heightInc)}] } if {$w <= 0} { set w 1 } if {$h <= 0} { set h 1 } diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index 96d8acf..f8d0d31 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -12,26 +12,26 @@ namespace eval ttk::spinbox { } ttk::copyBindings TEntry TSpinbox bind TSpinbox <Motion> { ttk::spinbox::Motion %W %x %y } -bind TSpinbox <Button-1> { ttk::spinbox::Press %W %x %y } -bind TSpinbox <ButtonRelease-1> { ttk::spinbox::Release %W } -bind TSpinbox <Double-Button-1> { ttk::spinbox::DoubleClick %W %x %y } -bind TSpinbox <Triple-Button-1> {} ;# disable TEntry triple-click +bind TSpinbox <Button-1> { ttk::spinbox::Press %W %x %y } +bind TSpinbox <ButtonRelease-1> { ttk::spinbox::Release %W } +bind TSpinbox <Double-Button-1> { ttk::spinbox::DoubleClick %W %x %y } +bind TSpinbox <Triple-Button-1> {} ;# disable TEntry triple-click bind TSpinbox <Up> { event generate %W <<Increment>> } -bind TSpinbox <Down> { event generate %W <<Decrement>> } +bind TSpinbox <Down> { event generate %W <<Decrement>> } bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 } -bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 } +bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 } -ttk::bindMouseWheel TSpinbox { ttk::spinbox::Spin %W } +ttk::bindMouseWheel TSpinbox { ttk::spinbox::Spin %W } bind TSpinbox <Shift-MouseWheel> { # Ignore the event } bind TSpinbox <TouchpadScroll> { - lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + lassign [tk::PreciseScrollDeltas %D] tk::Priv(deltaX) tk::Priv(deltaY) # TouchpadScroll events fire about 60 times per second. - if {$deltaY != 0 && %# %% 12 == 0} { - ttk::spinbox::Spin %W [expr {$deltaY > 0 ? -1 : 1}] + if {$tk::Priv(deltaY) != 0 && %# %% 12 == 0} { + ttk::spinbox::Spin %W [expr {$tk::Priv(deltaY) > 0 ? -1 : 1}] } } @@ -58,7 +58,7 @@ proc ttk::spinbox::Press {w x y} { switch -glob -- [$w identify $x $y] { *textarea { ttk::entry::Press $w $x } *rightarrow - - *uparrow { ttk::Repeatedly event generate $w <<Increment>> } + *uparrow { ttk::Repeatedly event generate $w <<Increment>> } *leftarrow - *downarrow { ttk::Repeatedly event generate $w <<Decrement>> } *spinbutton { @@ -90,7 +90,7 @@ proc ttk::spinbox::Release {w} { ## MouseWheel -- # Mousewheel callback. Turn these into <<Increment>> (-1, up) -# or <<Decrement> (+1, down) events. Not used any more. +# or <<Decrement> (+1, down) events. Not used any more. # proc ttk::spinbox::MouseWheel {w dir {factor 1.0}} { if {[$w instate disabled]} { return } diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index e9fc5ad..5b95054 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -7,19 +7,19 @@ namespace eval ttk::treeview { # Enter/Leave/Motion # - set State(activeWidget) {} - set State(activeHeading) {} + set State(activeWidget) {} + set State(activeHeading) {} # Press/drag/release: # - set State(pressMode) none + set State(pressMode) none set State(pressX) 0 # For pressMode == "resize" set State(resizeColumn) #0 # For pressmode == "heading" - set State(heading) {} + set State(heading) {} set State(cellAnchor) {} set State(cellAnchorOp) "set" @@ -28,19 +28,19 @@ namespace eval ttk::treeview { ### Widget bindings. # -bind Treeview <Motion> { ttk::treeview::Motion %W %x %y } +bind Treeview <Motion> { ttk::treeview::Motion %W %x %y } bind Treeview <B1-Leave> { #nothing } bind Treeview <Leave> { ttk::treeview::ActivateHeading {} {}} -bind Treeview <Button-1> { ttk::treeview::Press %W %x %y } -bind Treeview <Double-Button-1> { ttk::treeview::DoubleClick %W %x %y } -bind Treeview <ButtonRelease-1> { ttk::treeview::Release %W %x %y } -bind Treeview <B1-Motion> { ttk::treeview::Drag %W %x %y } -bind Treeview <Up> { ttk::treeview::Keynav %W up } -bind Treeview <Down> { ttk::treeview::Keynav %W down } -bind Treeview <Right> { ttk::treeview::Keynav %W right } -bind Treeview <Left> { ttk::treeview::Keynav %W left } +bind Treeview <Button-1> { ttk::treeview::Press %W %x %y } +bind Treeview <Double-Button-1> { ttk::treeview::DoubleClick %W %x %y } +bind Treeview <ButtonRelease-1> { ttk::treeview::Release %W %x %y } +bind Treeview <B1-Motion> { ttk::treeview::Drag %W %x %y } +bind Treeview <Up> { ttk::treeview::Keynav %W up } +bind Treeview <Down> { ttk::treeview::Keynav %W down } +bind Treeview <Right> { ttk::treeview::Keynav %W right } +bind Treeview <Left> { ttk::treeview::Keynav %W left } bind Treeview <Prior> { %W yview scroll -1 pages } -bind Treeview <Next> { %W yview scroll 1 pages } +bind Treeview <Next> { %W yview scroll 1 pages } bind Treeview <Return> { ttk::treeview::ToggleFocus %W } bind Treeview <space> { ttk::treeview::ToggleFocus %W } @@ -66,17 +66,17 @@ proc ttk::treeview::Keynav {w dir} { 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" - } + 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 ""} { - set focus [$w parent $focus] + set focus [$w parent $focus] } else { while {[$w item $up -open] && [llength [$w children $up]]} { set up [lindex [$w children $up] end] @@ -86,7 +86,7 @@ proc ttk::treeview::Keynav {w dir} { } down { if {[$w item $focus -open] && [llength [$w children $focus]]} { - set focus [lindex [$w children $focus] 0] + set focus [lindex [$w children $focus] 0] } else { set up $focus while {$up ne "" && [set down [$w next $up]] eq ""} { @@ -96,46 +96,46 @@ proc ttk::treeview::Keynav {w dir} { } } left { - 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]]} { + 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] } } right { - 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 {$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 != {}} { - if {$cells} { - set cell [list $focus $colAnchor] - SelectOp $w $focus $cell choose - } else { - SelectOp $w $focus "" choose - } + if {$cells} { + set cell [list $focus $colAnchor] + SelectOp $w $focus $cell choose + } else { + SelectOp $w $focus "" choose + } } } @@ -192,9 +192,9 @@ proc ttk::treeview::ActivateHeading {w heading} { 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] + # 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 } @@ -205,7 +205,7 @@ proc ttk::treeview::IdentifyCell {w x y} { # proc ttk::treeview::Select {w x y op} { if {[set item [$w identify row $x $y]] ne "" } { - set cell [IdentifyCell $w $x $y] + set cell [IdentifyCell $w $x $y] SelectOp $w $item $cell $op } } @@ -231,7 +231,7 @@ proc ttk::treeview::Press {w x y} { tree - cell { set item [$w identify item $x $y] - set cell [IdentifyCell $w $x $y] + set cell [IdentifyCell $w $x $y] SelectOp $w $item $cell choose switch -glob -- [$w identify element $x $y] { @@ -293,7 +293,7 @@ proc ttk::treeview::heading.press {w x y} { proc ttk::treeview::heading.drag {w x y} { variable State if { [$w identify region $x $y] eq "heading" - && [$w identify column $x $y] eq $State(heading) + && [$w identify column $x $y] eq $State(heading) } { $w heading $State(heading) state pressed } else { @@ -340,27 +340,27 @@ proc ttk::treeview::select.choose.extended {w item cell} { 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 + $w cellselection toggle [list $cell] + set State(cellAnchor) $cell + set State(cellAnchorOp) add } else { - $w selection toggle [list $item] + $w selection toggle [list $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 - } + if {$State(cellAnchor) ne ""} { + $w cellselection $State(cellAnchorOp) $State(cellAnchor) $cell + } else { + BrowseTo $w $item $cell + } } else { - if {[set anchor [$w focus]] ne ""} { - $w selection set [between $w $anchor $item] - } else { - BrowseTo $w $item $cell - } + if {[set anchor [$w focus]] ne ""} { + $w selection set [between $w $anchor $item] + } else { + BrowseTo $w $item $cell + } } } @@ -426,7 +426,7 @@ proc ttk::treeview::Toggle {w item} { # don't allow toggling on indicators that # are not present in front of leaf items if {[$w children $item] == {}} { - return + return } # not a leaf, toggle! if {[$w item $item -open]} { @@ -455,9 +455,9 @@ proc ttk::treeview::BrowseTo {w item cell} { set State(cellAnchor) $cell set State(cellAnchorOp) set if {$cell ne ""} { - $w cellselection set [list $cell] + $w cellselection set [list $cell] } else { - $w selection set [list $item] + $w selection set [list $item] } } diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl index cbf1303..e5bfc42 100644 --- a/library/ttk/ttk.tcl +++ b/library/ttk/ttk.tcl @@ -95,6 +95,21 @@ proc ::ttk::setTheme {theme} { set currentTheme $theme } +## ttk::configureNotebookStyle $style -- +# Sets theme-specific option values for the ttk::notebook style $style +# and/or the style $style.Tab. To be invoked if the -tabposition option +# of $style has a non-default value (like "sw", "wn", or "en"). +# +proc ::ttk::configureNotebookStyle {style} { + set theme [ttk::style theme use] + if {[llength [info procs theme::${theme}::configureNotebookStyle]] > 0} { + theme::${theme}::configureNotebookStyle $style + return 1 + } else { + return 0 + } +} + ## 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. @@ -154,17 +169,17 @@ proc ttk::LoadThemes {} { set builtinThemes [style theme names] foreach {theme scripts} { - classic classicTheme.tcl - alt altTheme.tcl - clam clamTheme.tcl + classic classicTheme.tcl + alt altTheme.tcl + clam clamTheme.tcl winnative winTheme.tcl xpnative {xpTheme.tcl vistaTheme.tcl} - aqua aquaTheme.tcl + aqua aquaTheme.tcl } { if {[lsearch -exact $builtinThemes $theme] >= 0} { - foreach script $scripts { - uplevel #0 [list source -encoding utf-8 [file join $library $script]] - } + foreach script $scripts { + uplevel #0 [list source -encoding utf-8 [file join $library $script]] + } } } } diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index 3f6446d..a0af39d 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -46,7 +46,7 @@ proc ttk::GuessTakeFocus {w} { } ## ttk::traverseTo $w -- -# Set the keyboard focus to the specified window. +# Set the keyboard focus to the specified window. # proc ttk::traverseTo {w} { set focus [focus] @@ -119,7 +119,7 @@ proc ttk::focusFirst {w} { # See #1239190 and #1411983 for more discussion. # namespace eval ttk { - variable Grab ;# map: window name -> grab token + variable Grab ;# map: window name -> grab token # grab token details: # Two-element list containing: @@ -304,15 +304,14 @@ bind TtkScrollable <Shift-Option-MouseWheel> \ ## 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 + if {%# %% 5 == 0} { + lassign [tk::PreciseScrollDeltas %D] tk::Priv(deltaX) tk::Priv(deltaY) + if {$tk::Priv(deltaX) != 0} { + %W xview scroll [expr {-$tk::Priv(deltaX)}] units + } + if {$tk::Priv(deltaY) != 0} { + %W yview scroll [expr {-$tk::Priv(deltaY)}] units + } } } #*EOF* diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index 4105a1a..5a30837 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -16,7 +16,7 @@ namespace eval ttk::theme::vista { ttk::style theme settings vista { - ttk::style configure . \ + ttk::style configure . \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ @@ -42,49 +42,49 @@ namespace eval ttk::theme::vista { # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -background SystemWindow \ - -stripedbackground System3dLight + -stripedbackground System3dLight ttk::style configure Treeview.Separator \ - -background System3dLight + -background System3dLight ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText] - # Label and Toolbutton + # Label and Toolbutton ttk::style configure TLabelframe.Label -foreground SystemButtonText ttk::style configure Toolbutton -padding 3p - # Combobox + # Combobox 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 \ - EDIT 3 {disabled 3 readonly 5 focus 4 hover 2 {} 1} - ttk::style element create Combobox.rightdownarrow vsapi \ - COMBOBOX 6 {disabled 4 pressed 3 active 2 {} 1} \ - -syssize {SM_CXVSCROLL SM_CYVSCROLL} - ttk::style layout TCombobox { - Combobox.border -sticky nswe -border 0 -children { - Combobox.rightdownarrow -side right -sticky ns - Combobox.padding -sticky nswe -children { - Combobox.background -sticky nswe -children { - Combobox.focus -sticky nswe -children { - Combobox.textarea -sticky nswe - } - } - } - } - } - # Vista.Combobox droplist frame - ttk::style element create ComboboxPopdownFrame.background vsapi\ - LISTBOX 3 {disabled 4 active 3 focus 2 {} 1} - ttk::style layout ComboboxPopdownFrame { - ComboboxPopdownFrame.background -sticky news -border 1 -children { - ComboboxPopdownFrame.padding -sticky news - } - } + 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 \ + EDIT 3 {disabled 3 readonly 5 focus 4 hover 2 {} 1} + ttk::style element create Combobox.rightdownarrow vsapi \ + COMBOBOX 6 {disabled 4 pressed 3 active 2 {} 1} \ + -syssize {SM_CXVSCROLL SM_CYVSCROLL} + ttk::style layout TCombobox { + Combobox.border -sticky nswe -border 0 -children { + Combobox.rightdownarrow -side right -sticky ns + Combobox.padding -sticky nswe -children { + Combobox.background -sticky nswe -children { + Combobox.focus -sticky nswe -children { + Combobox.textarea -sticky nswe + } + } + } + } + } + # Vista.Combobox droplist frame + ttk::style element create ComboboxPopdownFrame.background vsapi\ + LISTBOX 3 {disabled 4 active 3 focus 2 {} 1} + ttk::style layout ComboboxPopdownFrame { + ComboboxPopdownFrame.background -sticky news -border 1 -children { + ComboboxPopdownFrame.padding -sticky news + } + } ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ @@ -94,135 +94,166 @@ namespace eval ttk::theme::vista { ] \ -focusfill [list {readonly focus} SystemHighlight] - # Entry - ttk::style configure TEntry -padding {1 1 1 1} ;# Needs lookup - ttk::style element create Entry.field vsapi \ - EDIT 6 {disabled 4 focus 3 hover 2 {} 1} -padding {2 2 2 2} - ttk::style element create Entry.background vsapi \ - EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1} - ttk::style layout TEntry { - Entry.field -sticky news -border 0 -children { - Entry.background -sticky news -children { - Entry.padding -sticky news -children { - Entry.textarea -sticky news - } - } - } - } + # Entry + ttk::style configure TEntry -padding {1 1 1 1} ;# Needs lookup + ttk::style element create Entry.field vsapi \ + EDIT 6 {disabled 4 focus 3 hover 2 {} 1} -padding {2 2 2 2} + ttk::style element create Entry.background vsapi \ + EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1} + ttk::style layout TEntry { + Entry.field -sticky news -border 0 -children { + Entry.background -sticky news -children { + Entry.padding -sticky news -children { + Entry.textarea -sticky news + } + } + } + } ttk::style map TEntry \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] - # Spinbox - ttk::style configure TSpinbox -padding 0 - ttk::style element create Spinbox.field vsapi \ - EDIT 9 {disabled 4 focus 3 hover 2 {} 1} -padding {1 1 1 2} - ttk::style element create Spinbox.background vsapi \ - EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1} - ttk::style element create Spinbox.innerbg vsapi \ - EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}\ - -padding {2 0 15 2} - ttk::style element create Spinbox.uparrow vsapi \ - SPIN 1 {disabled 4 pressed 3 active 2 {} 1} \ - -padding 1 -halfheight 1 \ - -syssize { SM_CXVSCROLL SM_CYVSCROLL } - ttk::style element create Spinbox.downarrow vsapi \ - SPIN 2 {disabled 4 pressed 3 active 2 {} 1} \ - -padding 1 -halfheight 1 \ - -syssize { SM_CXVSCROLL SM_CYVSCROLL } - ttk::style layout TSpinbox { - Spinbox.field -sticky nswe -children { - Spinbox.background -sticky news -children { - Spinbox.padding -sticky news -children { - Spinbox.innerbg -sticky news -children { - Spinbox.textarea - } - } - Spinbox.uparrow -side top -sticky ens - Spinbox.downarrow -side bottom -sticky ens - } - } - } + # Spinbox + ttk::style configure TSpinbox -padding 0 + ttk::style element create Spinbox.field vsapi \ + EDIT 9 {disabled 4 focus 3 hover 2 {} 1} -padding {1 1 1 2} + ttk::style element create Spinbox.background vsapi \ + EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1} + ttk::style element create Spinbox.innerbg vsapi \ + EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}\ + -padding {2 0 15 2} + ttk::style element create Spinbox.uparrow vsapi \ + SPIN 1 {disabled 4 pressed 3 active 2 {} 1} \ + -padding 1 -halfheight 1 \ + -syssize { SM_CXVSCROLL SM_CYVSCROLL } + ttk::style element create Spinbox.downarrow vsapi \ + SPIN 2 {disabled 4 pressed 3 active 2 {} 1} \ + -padding 1 -halfheight 1 \ + -syssize { SM_CXVSCROLL SM_CYVSCROLL } + ttk::style layout TSpinbox { + Spinbox.field -sticky nswe -children { + Spinbox.background -sticky news -children { + Spinbox.padding -sticky news -children { + Spinbox.innerbg -sticky news -children { + Spinbox.textarea + } + } + Spinbox.uparrow -side top -sticky ens + Spinbox.downarrow -side bottom -sticky ens + } + } + } ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] - # SCROLLBAR elements (Vista includes a state for 'hover') - ttk::style element create Vertical.Scrollbar.uparrow vsapi \ - SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \ - -syssize {SM_CXVSCROLL SM_CYVSCROLL} - ttk::style element create Vertical.Scrollbar.downarrow vsapi \ - SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5} \ - -syssize {SM_CXVSCROLL SM_CYVSCROLL} - ttk::style element create Vertical.Scrollbar.trough vsapi \ - SCROLLBAR 7 {disabled 4 pressed 3 active 2 hover 5 {} 1} - ttk::style element create Vertical.Scrollbar.thumb vsapi \ - SCROLLBAR 3 {disabled 4 pressed 3 active 2 hover 5 {} 1} \ - -syssize {SM_CXVSCROLL SM_CYVSCROLL} - ttk::style element create Vertical.Scrollbar.grip vsapi \ - SCROLLBAR 9 {disabled 4 pressed 3 active 2 hover 5 {} 1} \ - -syssize {SM_CXVSCROLL SM_CYVSCROLL} - ttk::style element create Horizontal.Scrollbar.leftarrow vsapi \ - SCROLLBAR 1 {disabled 12 pressed 11 active 10 hover 19 {} 9} \ - -syssize {SM_CXHSCROLL SM_CYHSCROLL} - ttk::style element create Horizontal.Scrollbar.rightarrow vsapi \ - SCROLLBAR 1 {disabled 16 pressed 15 active 14 hover 20 {} 13} \ - -syssize {SM_CXHSCROLL SM_CYHSCROLL} - ttk::style element create Horizontal.Scrollbar.trough vsapi \ - SCROLLBAR 5 {disabled 4 pressed 3 active 2 hover 5 {} 1} - ttk::style element create Horizontal.Scrollbar.thumb vsapi \ - SCROLLBAR 2 {disabled 4 pressed 3 active 2 hover 5 {} 1} \ - -syssize {SM_CXHSCROLL SM_CYHSCROLL} - ttk::style element create Horizontal.Scrollbar.grip vsapi \ - SCROLLBAR 8 {disabled 4 pressed 3 active 2 hover 5 {} 1} - - # Progressbar - ttk::style element create Horizontal.Progressbar.pbar vsapi \ - PROGRESS 3 {{} 1} -padding 8 - 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 \ - PROGRESS 3 {{} 1} -padding 8 - ttk::style layout Vertical.TProgressbar { - Vertical.Progressbar.trough -sticky nswe -children { - Vertical.Progressbar.pbar -side bottom -sticky we - } - } - - # Scale - ttk::style element create Horizontal.Scale.slider vsapi \ - TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ - -width 6 -height 12 - ttk::style layout Horizontal.TScale { - Scale.focus -sticky nswe -children { - Horizontal.Scale.trough -sticky nswe -children { - Horizontal.Scale.track -sticky we - Horizontal.Scale.slider -side left -sticky {} - } - } - } - ttk::style element create Vertical.Scale.slider vsapi \ - TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ - -width 12 -height 6 - ttk::style layout Vertical.TScale { - Scale.focus -sticky nswe -children { - Vertical.Scale.trough -sticky nswe -children { - Vertical.Scale.track -sticky ns - Vertical.Scale.slider -side top -sticky {} - } - } - } - - # Treeview - ttk::style configure Item -padding {3p 0 0 0} + # SCROLLBAR elements (Vista includes a state for 'hover') + ttk::style element create Vertical.Scrollbar.uparrow vsapi \ + SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \ + -syssize {SM_CXVSCROLL SM_CYVSCROLL} + ttk::style element create Vertical.Scrollbar.downarrow vsapi \ + SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5} \ + -syssize {SM_CXVSCROLL SM_CYVSCROLL} + ttk::style element create Vertical.Scrollbar.trough vsapi \ + SCROLLBAR 7 {disabled 4 pressed 3 active 2 hover 5 {} 1} + ttk::style element create Vertical.Scrollbar.thumb vsapi \ + SCROLLBAR 3 {disabled 4 pressed 3 active 2 hover 5 {} 1} \ + -syssize {SM_CXVSCROLL SM_CYVSCROLL} + ttk::style element create Vertical.Scrollbar.grip vsapi \ + SCROLLBAR 9 {disabled 4 pressed 3 active 2 hover 5 {} 1} \ + -syssize {SM_CXVSCROLL SM_CYVSCROLL} + ttk::style element create Horizontal.Scrollbar.leftarrow vsapi \ + SCROLLBAR 1 {disabled 12 pressed 11 active 10 hover 19 {} 9} \ + -syssize {SM_CXHSCROLL SM_CYHSCROLL} + ttk::style element create Horizontal.Scrollbar.rightarrow vsapi \ + SCROLLBAR 1 {disabled 16 pressed 15 active 14 hover 20 {} 13} \ + -syssize {SM_CXHSCROLL SM_CYHSCROLL} + ttk::style element create Horizontal.Scrollbar.trough vsapi \ + SCROLLBAR 5 {disabled 4 pressed 3 active 2 hover 5 {} 1} + ttk::style element create Horizontal.Scrollbar.thumb vsapi \ + SCROLLBAR 2 {disabled 4 pressed 3 active 2 hover 5 {} 1} \ + -syssize {SM_CXHSCROLL SM_CYHSCROLL} + ttk::style element create Horizontal.Scrollbar.grip vsapi \ + SCROLLBAR 8 {disabled 4 pressed 3 active 2 hover 5 {} 1} + + # Progressbar + ttk::style element create Horizontal.Progressbar.pbar vsapi \ + PROGRESS 3 {{} 1} -padding 8 + 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 \ + PROGRESS 3 {{} 1} -padding 8 + ttk::style layout Vertical.TProgressbar { + Vertical.Progressbar.trough -sticky nswe -children { + Vertical.Progressbar.pbar -side bottom -sticky we + } + } + + # Scale + ttk::style element create Horizontal.Scale.slider vsapi \ + TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ + -width 6 -height 12 + ttk::style layout Horizontal.TScale { + Scale.focus -sticky nswe -children { + Horizontal.Scale.trough -sticky nswe -children { + Horizontal.Scale.track -sticky we + Horizontal.Scale.slider -side left -sticky {} + } + } + } + ttk::style element create Vertical.Scale.slider vsapi \ + TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ + -width 12 -height 6 + ttk::style layout Vertical.TScale { + Scale.focus -sticky nswe -children { + Vertical.Scale.trough -sticky nswe -children { + Vertical.Scale.track -sticky ns + Vertical.Scale.slider -side top -sticky {} + } + } + } + + # Treeview + ttk::style configure Item -padding {3p 0 0 0} ttk::style configure Treeview -indent 15p ttk::setTreeviewRowHeight - package provide ttk::theme::vista 1.0 + package provide ttk::theme::vista 1.0 + } +} + +# ttk::theme::vista::configureNotebookStyle -- +# +# Sets theme-specific option values for the ttk::notebook style $style and the +# style $style.Tab. Invoked by ::ttk::configureNotebookStyle. + +proc ttk::theme::vista::configureNotebookStyle {style} { + set tabPos [ttk::style lookup $style -tabposition {} nw] + switch -- [string index $tabPos 0] { + n { + ttk::style configure $style -tabmargins {2 2 2 0} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + s { + ttk::style configure $style -tabmargins {2 0 2 2} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + w { + ttk::style configure $style -tabmargins {2 2 0 2} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + e { + ttk::style configure $style -tabmargins {0 2 2 2} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + default { + ttk::style configure $style -tabmargins {2 2 2 0} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } } } diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl index 3be8add..9b9812a 100644 --- a/library/ttk/winTheme.tcl +++ b/library/ttk/winTheme.tcl @@ -17,7 +17,7 @@ namespace eval ttk::theme::winnative { -font TkDefaultFont ttk::style map "." -foreground {disabled SystemGrayText} - ttk::style map "." -embossed {disabled 1} + ttk::style map "." -embossed {disabled 1} ttk::style configure TButton \ -anchor center -width -11 -relief raised -shiftrelief 1 @@ -81,8 +81,39 @@ namespace eval ttk::theme::winnative { -foreground [list disabled SystemGrayText \ selected SystemHighlightText] - ttk::style configure TProgressbar \ + ttk::style configure TProgressbar \ -background SystemHighlight -borderwidth 0 \ -barsize 22.5p -thickness 11.25p } } + +# ttk::theme::winnative::configureNotebookStyle -- +# +# Sets theme-specific option values for the ttk::notebook style $style and the +# style $style.Tab. Invoked by ::ttk::configureNotebookStyle. + +proc ttk::theme::winnative::configureNotebookStyle {style} { + set tabPos [ttk::style lookup $style -tabposition {} nw] + switch -- [string index $tabPos 0] { + n { + ttk::style configure $style -tabmargins {2 2 2 0} + ttk::style map $style.Tab -expand {selected {2 2 2 0}} + } + s { + ttk::style configure $style -tabmargins {2 0 2 2} + ttk::style map $style.Tab -expand {selected {2 0 2 2}} + } + w { + ttk::style configure $style -tabmargins {2 2 0 2} + ttk::style map $style.Tab -expand {selected {2 2 0 2}} + } + e { + ttk::style configure $style -tabmargins {0 2 2 2} + ttk::style map $style.Tab -expand {selected {0 2 2 2}} + } + default { + ttk::style configure $style -tabmargins {2 2 2 0} + ttk::style map $style.Tab -expand {selected {2 2 2 0}} + } + } +} diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl index 1c900ba..60c47b0 100644 --- a/library/ttk/xpTheme.tcl +++ b/library/ttk/xpTheme.tcl @@ -62,3 +62,34 @@ namespace eval ttk::theme::xpnative { selected SystemHighlightText] } } + +# ttk::theme::xpnative::configureNotebookStyle -- +# +# Sets theme-specific option values for the ttk::notebook style $style and the +# style $style.Tab. Invoked by ::ttk::configureNotebookStyle. + +proc ttk::theme::xpnative::configureNotebookStyle {style} { + set tabPos [ttk::style lookup $style -tabposition {} nw] + switch -- [string index $tabPos 0] { + n { + ttk::style configure $style -tabmargins {2 2 2 0} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + s { + ttk::style configure $style -tabmargins {2 0 2 2} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + w { + ttk::style configure $style -tabmargins {2 2 0 2} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + e { + ttk::style configure $style -tabmargins {0 2 2 2} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + default { + ttk::style configure $style -tabmargins {2 2 2 0} + ttk::style map $style.Tab -expand {selected {2 2 2 2}} + } + } +} |