Import Tk 8.6.11
This commit is contained in:
@@ -15,7 +15,7 @@ namespace eval ttk::theme::aqua {
|
||||
-insertwidth 1
|
||||
|
||||
ttk::style map . \
|
||||
-foreground {
|
||||
-foreground {
|
||||
disabled systemDisabledControlTextColor
|
||||
background systemLabelColor} \
|
||||
-selectbackground {
|
||||
@@ -35,21 +35,38 @@ namespace eval ttk::theme::aqua {
|
||||
ttk::style configure TMenubutton -anchor center -padding {2 0 0 2}
|
||||
ttk::style configure Toolbutton -anchor center
|
||||
|
||||
# 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
|
||||
# the window does not have focus. (The background state implies !focus
|
||||
# so we only need to specify !focus.)
|
||||
|
||||
# Entry
|
||||
ttk::style configure TEntry \
|
||||
-foreground systemTextColor \
|
||||
-background systemTextBackgroundColor
|
||||
ttk::style map TEntry \
|
||||
-foreground {
|
||||
disabled systemDisabledControlTextColor
|
||||
} \
|
||||
-selectforeground {
|
||||
background systemTextColor
|
||||
-selectbackground {
|
||||
!focus systemUnemphasizedSelectedTextBackgroundColor
|
||||
}
|
||||
|
||||
# Combobox:
|
||||
ttk::style map TCombobox \
|
||||
-foreground {
|
||||
disabled systemDisabledControlTextColor
|
||||
} \
|
||||
-selectbackground {
|
||||
background systemTextBackgroundColor
|
||||
!focus systemUnemphasizedSelectedTextBackgroundColor
|
||||
}
|
||||
|
||||
# Spinbox
|
||||
ttk::style map TSpinbox \
|
||||
-foreground {
|
||||
disabled systemDisabledControlTextColor
|
||||
} \
|
||||
-selectbackground {
|
||||
!focus systemUnemphasizedSelectedTextBackgroundColor
|
||||
}
|
||||
|
||||
|
||||
# Workaround for #1100117:
|
||||
# Actually, on Aqua we probably shouldn't stipple images in
|
||||
@@ -67,40 +84,6 @@ namespace eval ttk::theme::aqua {
|
||||
disabled systemDisabledControlTextColor
|
||||
selected systemSelectedTabTextColor}
|
||||
|
||||
# Combobox:
|
||||
ttk::style configure TCombobox \
|
||||
-foreground systemTextColor \
|
||||
-background systemTransparent
|
||||
ttk::style map TCombobox \
|
||||
-foreground {
|
||||
disabled systemDisabledControlTextColor
|
||||
} \
|
||||
-selectforeground {
|
||||
background systemTextColor
|
||||
} \
|
||||
-selectbackground {
|
||||
background systemTransparent
|
||||
}
|
||||
|
||||
# Spinbox
|
||||
ttk::style configure TSpinbox \
|
||||
-foreground systemTextColor \
|
||||
-background systemTextBackgroundColor \
|
||||
-selectforeground systemSelectedTextColor \
|
||||
-selectbackground systemSelectedTextBackgroundColor
|
||||
ttk::style map TSpinbox \
|
||||
-foreground {
|
||||
disabled systemDisabledControlTextColor
|
||||
} \
|
||||
-selectforeground {
|
||||
!active systemTextColor
|
||||
} \
|
||||
-selectbackground {
|
||||
!active systemTextBackgroundColor
|
||||
!focus systemTextBackgroundColor
|
||||
focus systemSelectedTextBackgroundColor
|
||||
}
|
||||
|
||||
# Treeview:
|
||||
ttk::style configure Heading \
|
||||
-font TkHeadingFont \
|
||||
@@ -116,7 +99,7 @@ namespace eval ttk::theme::aqua {
|
||||
}
|
||||
|
||||
# Enable animation for ttk::progressbar widget:
|
||||
ttk::style configure TProgressbar -period 100 -maxphase 255
|
||||
ttk::style configure TProgressbar -period 100 -maxphase 120
|
||||
|
||||
# For Aqua, labelframe labels should appear outside the border,
|
||||
# with a 14 pixel inset and 4 pixels spacing between border and label
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
# (If the button is released off the widget, the grab deactivates and
|
||||
# we get a <Leave> event then, which turns off the "active" state)
|
||||
#
|
||||
# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are
|
||||
# delivered to the widget which received the initial <ButtonPress>
|
||||
# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are
|
||||
# delivered to the widget which received the initial <Button>
|
||||
# event. However, Tk [grab]s (#1223103) and menu interactions
|
||||
# (#1222605) can interfere with this. To guard against spurious
|
||||
# <Button1-Enter> events, the <Button1-Enter> binding only sets
|
||||
@@ -20,10 +20,10 @@ namespace eval ttk::button {}
|
||||
|
||||
bind TButton <Enter> { %W instate !disabled {%W state active} }
|
||||
bind TButton <Leave> { %W state !active }
|
||||
bind TButton <Key-space> { ttk::button::activate %W }
|
||||
bind TButton <space> { ttk::button::activate %W }
|
||||
bind TButton <<Invoke>> { ttk::button::activate %W }
|
||||
|
||||
bind TButton <ButtonPress-1> \
|
||||
bind TButton <Button-1> \
|
||||
{ %W instate !disabled { ttk::clickToFocus %W; %W state pressed } }
|
||||
bind TButton <ButtonRelease-1> \
|
||||
{ %W instate pressed { %W state !pressed; %W instate !disabled { %W invoke } } }
|
||||
@@ -39,11 +39,11 @@ ttk::copyBindings TButton TRadiobutton
|
||||
|
||||
# ...plus a few more:
|
||||
|
||||
bind TRadiobutton <KeyPress-Up> { ttk::button::RadioTraverse %W -1 }
|
||||
bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 }
|
||||
bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 }
|
||||
bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 }
|
||||
|
||||
# bind TCheckbutton <KeyPress-plus> { %W select }
|
||||
# bind TCheckbutton <KeyPress-minus> { %W deselect }
|
||||
# bind TCheckbutton <plus> { %W select }
|
||||
# bind TCheckbutton <minus> { %W deselect }
|
||||
|
||||
# activate --
|
||||
# Simulate a button press: temporarily set the state to 'pressed',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
|
||||
namespace eval ttk::theme::clam {
|
||||
variable colors
|
||||
variable colors
|
||||
array set colors {
|
||||
-disabledfg "#999999"
|
||||
-frame "#dcdad5"
|
||||
|
||||
@@ -45,13 +45,13 @@ namespace eval ttk::combobox {
|
||||
|
||||
ttk::copyBindings TEntry TCombobox
|
||||
|
||||
bind TCombobox <KeyPress-Down> { ttk::combobox::Post %W }
|
||||
bind TCombobox <KeyPress-Escape> { ttk::combobox::Unpost %W }
|
||||
bind TCombobox <Down> { ttk::combobox::Post %W }
|
||||
bind TCombobox <Escape> { ttk::combobox::Unpost %W }
|
||||
|
||||
bind TCombobox <ButtonPress-1> { ttk::combobox::Press "" %W %x %y }
|
||||
bind TCombobox <Shift-ButtonPress-1> { ttk::combobox::Press "s" %W %x %y }
|
||||
bind TCombobox <Double-ButtonPress-1> { ttk::combobox::Press "2" %W %x %y }
|
||||
bind TCombobox <Triple-ButtonPress-1> { ttk::combobox::Press "3" %W %x %y }
|
||||
bind TCombobox <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 <B1-Motion> { ttk::combobox::Drag %W %x }
|
||||
bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y }
|
||||
|
||||
@@ -62,9 +62,9 @@ bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W }
|
||||
### Combobox listbox bindings.
|
||||
#
|
||||
bind ComboboxListbox <ButtonRelease-1> { ttk::combobox::LBSelected %W }
|
||||
bind ComboboxListbox <KeyPress-Return> { ttk::combobox::LBSelected %W }
|
||||
bind ComboboxListbox <KeyPress-Escape> { ttk::combobox::LBCancel %W }
|
||||
bind ComboboxListbox <KeyPress-Tab> { ttk::combobox::LBTab %W next }
|
||||
bind ComboboxListbox <Return> { ttk::combobox::LBSelected %W }
|
||||
bind ComboboxListbox <Escape> { ttk::combobox::LBCancel %W }
|
||||
bind ComboboxListbox <Tab> { ttk::combobox::LBTab %W next }
|
||||
bind ComboboxListbox <<PrevWindow>> { ttk::combobox::LBTab %W prev }
|
||||
bind ComboboxListbox <Destroy> { ttk::combobox::LBCleanup %W }
|
||||
bind ComboboxListbox <Motion> { ttk::combobox::LBHover %W %x %y }
|
||||
@@ -82,7 +82,7 @@ switch -- [tk windowingsystem] {
|
||||
#
|
||||
bind ComboboxPopdown <Map> { ttk::combobox::MapPopdown %W }
|
||||
bind ComboboxPopdown <Unmap> { ttk::combobox::UnmapPopdown %W }
|
||||
bind ComboboxPopdown <ButtonPress> \
|
||||
bind ComboboxPopdown <Button> \
|
||||
{ ttk::combobox::Unpost [winfo parent %W] }
|
||||
|
||||
### Option database settings.
|
||||
@@ -106,7 +106,7 @@ switch -- [tk windowingsystem] {
|
||||
### Binding procedures.
|
||||
#
|
||||
|
||||
## Press $mode $x $y -- ButtonPress binding for comboboxes.
|
||||
## Press $mode $x $y -- Button binding for comboboxes.
|
||||
# Either post/unpost the listbox, or perform Entry widget binding,
|
||||
# depending on widget state and location of button press.
|
||||
#
|
||||
@@ -135,7 +135,7 @@ proc ttk::combobox::Press {mode w x y} {
|
||||
}
|
||||
|
||||
## Drag -- B1-Motion binding for comboboxes.
|
||||
# If the initial ButtonPress event was handled by Entry binding,
|
||||
# If the initial Button event was handled by Entry binding,
|
||||
# perform Entry widget drag binding; otherwise nothing.
|
||||
#
|
||||
proc ttk::combobox::Drag {w x} {
|
||||
@@ -149,12 +149,14 @@ proc ttk::combobox::Drag {w x} {
|
||||
# Set cursor.
|
||||
#
|
||||
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}]
|
||||
} {
|
||||
ttk::setCursor $w text
|
||||
} else {
|
||||
ttk::setCursor $w ""
|
||||
ttk::setCursor $w $State(userConfCursor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,6 +357,9 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
|
||||
set w [winfo width $cb]
|
||||
set h [winfo height $cb]
|
||||
set style [$cb cget -style]
|
||||
if { $style eq {} } {
|
||||
set style TCombobox
|
||||
}
|
||||
set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
|
||||
foreach var {x y w h} delta $postoffset {
|
||||
incr $var $delta
|
||||
|
||||
@@ -140,8 +140,30 @@ proc ttk::cursor {name} {
|
||||
|
||||
proc ttk::setCursor {w name} {
|
||||
variable Cursors
|
||||
if {[$w cget -cursor] ne $Cursors($name)} {
|
||||
$w configure -cursor $Cursors($name)
|
||||
if {[info exists Cursors($name)]} {
|
||||
set cursorname $Cursors($name)
|
||||
} else {
|
||||
set cursorname $name
|
||||
}
|
||||
if {[$w cget -cursor] ne $cursorname} {
|
||||
$w configure -cursor $cursorname
|
||||
}
|
||||
}
|
||||
|
||||
## ttk::saveCursor $w $saveVar $excludeList --
|
||||
# Set variable $saveVar to the -cursor value from widget $w,
|
||||
# if either:
|
||||
# a. $saveVar does not yet exist
|
||||
# b. the currently user-specified cursor for $w is not in
|
||||
# $excludeList
|
||||
|
||||
proc ttk::saveCursor {w saveVar excludeList} {
|
||||
upvar $saveVar sv
|
||||
if {![info exists sv]} {
|
||||
set sv [$w cget -cursor]
|
||||
}
|
||||
if {[$w cget -cursor] ni $excludeList} {
|
||||
set sv [$w cget -cursor]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace eval ttk::theme::default {
|
||||
ttk::style configure TButton \
|
||||
-anchor center -padding "3 3" -width -9 \
|
||||
-relief raised -shiftrelief 1
|
||||
ttk::style map TButton -relief [list {!disabled pressed} sunken]
|
||||
ttk::style map TButton -relief [list {!disabled pressed} sunken]
|
||||
|
||||
ttk::style configure TCheckbutton \
|
||||
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
|
||||
|
||||
@@ -40,20 +40,20 @@ option add *TEntry.cursor [ttk::cursor text] widgetDefault
|
||||
#
|
||||
# Removed the following standard Tk bindings:
|
||||
#
|
||||
# <Control-Key-space>, <Control-Shift-Key-space>,
|
||||
# <Key-Select>, <Shift-Key-Select>:
|
||||
# <Control-space>, <Control-Shift-space>,
|
||||
# <Select>, <Shift-Select>:
|
||||
# Ttk entry widget doesn't use selection anchor.
|
||||
# <Key-Insert>:
|
||||
# <Insert>:
|
||||
# Inserts PRIMARY selection (on non-Windows platforms).
|
||||
# This is inconsistent with typical platform bindings.
|
||||
# <Double-Shift-ButtonPress-1>, <Triple-Shift-ButtonPress-1>:
|
||||
# <Double-Shift-Button-1>, <Triple-Shift-Button-1>:
|
||||
# These don't do the right thing to start with.
|
||||
# <Meta-Key-b>, <Meta-Key-d>, <Meta-Key-f>,
|
||||
# <Meta-Key-BackSpace>, <Meta-Key-Delete>:
|
||||
# <Meta-b>, <Meta-d>, <Meta-f>,
|
||||
# <Meta-BackSpace>, <Meta-Delete>:
|
||||
# Judgment call. If <Meta> happens to be assigned to the Alt key,
|
||||
# these could conflict with application accelerators.
|
||||
# (Plus, who has a Meta key these days?)
|
||||
# <Control-Key-t>:
|
||||
# <Control-t>:
|
||||
# Another judgment call. If anyone misses this, let me know
|
||||
# and I'll put it back.
|
||||
#
|
||||
@@ -68,27 +68,34 @@ bind TEntry <<Clear>> { ttk::entry::Clear %W }
|
||||
## Button1 bindings:
|
||||
# Used for selection and navigation.
|
||||
#
|
||||
bind TEntry <ButtonPress-1> { ttk::entry::Press %W %x }
|
||||
bind TEntry <Shift-ButtonPress-1> { ttk::entry::Shift-Press %W %x }
|
||||
bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word }
|
||||
bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line }
|
||||
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 <B1-Motion> { ttk::entry::Drag %W %x }
|
||||
|
||||
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 }
|
||||
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 }
|
||||
|
||||
bind TEntry <<ToggleSelection>> {
|
||||
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
|
||||
}
|
||||
|
||||
## Button2 bindings:
|
||||
## Button2 (Button3 on Aqua) bindings:
|
||||
# Used for scanning and primary transfer.
|
||||
# Note: ButtonRelease-2 is mapped to <<PasteSelection>> in tk.tcl.
|
||||
# Note: ButtonRelease-2 (ButtonRelease-3 on Aqua)
|
||||
# is mapped to <<PasteSelection>> in tk.tcl.
|
||||
#
|
||||
bind TEntry <ButtonPress-2> { ttk::entry::ScanMark %W %x }
|
||||
bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
|
||||
bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
|
||||
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 <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
|
||||
|
||||
## Keyboard navigation bindings:
|
||||
@@ -114,26 +121,26 @@ bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end }
|
||||
|
||||
## Edit bindings:
|
||||
#
|
||||
bind TEntry <KeyPress> { ttk::entry::Insert %W %A }
|
||||
bind TEntry <Key-Delete> { ttk::entry::Delete %W }
|
||||
bind TEntry <Key-BackSpace> { ttk::entry::Backspace %W }
|
||||
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.
|
||||
# Otherwise, the <KeyPress> class binding will fire and insert the character.
|
||||
# Otherwise, the <Key> class binding will fire and insert the character.
|
||||
# Ditto for Escape, Return, and Tab.
|
||||
#
|
||||
bind TEntry <Alt-KeyPress> {# nothing}
|
||||
bind TEntry <Meta-KeyPress> {# nothing}
|
||||
bind TEntry <Control-KeyPress> {# nothing}
|
||||
bind TEntry <Key-Escape> {# nothing}
|
||||
bind TEntry <Key-Return> {# nothing}
|
||||
bind TEntry <Key-KP_Enter> {# nothing}
|
||||
bind TEntry <Key-Tab> {# nothing}
|
||||
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}
|
||||
|
||||
# Argh. Apparently on Windows, the NumLock modifier is interpreted
|
||||
# as a Command modifier.
|
||||
if {[tk windowingsystem] eq "aqua"} {
|
||||
bind TEntry <Command-KeyPress> {# nothing}
|
||||
bind TEntry <Command-Key> {# nothing}
|
||||
}
|
||||
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
|
||||
bind TEntry <<PrevLine>> {# nothing}
|
||||
@@ -141,9 +148,9 @@ bind TEntry <<NextLine>> {# nothing}
|
||||
|
||||
## Additional emacs-like bindings:
|
||||
#
|
||||
bind TEntry <Control-Key-d> { ttk::entry::Delete %W }
|
||||
bind TEntry <Control-Key-h> { ttk::entry::Backspace %W }
|
||||
bind TEntry <Control-Key-k> { %W delete insert end }
|
||||
bind TEntry <Control-d> { ttk::entry::Delete %W }
|
||||
bind TEntry <Control-h> { ttk::entry::Backspace %W }
|
||||
bind TEntry <Control-k> { %W delete insert end }
|
||||
|
||||
# Bindings for IME text input.
|
||||
|
||||
@@ -351,7 +358,7 @@ proc ttk::entry::Extend {w where} {
|
||||
# Triple-clicking enters "line-select" mode.
|
||||
#
|
||||
|
||||
## Press -- ButtonPress-1 binding.
|
||||
## Press -- Button-1 binding.
|
||||
# Set the insertion cursor, claim the input focus, set up for
|
||||
# future drag operations.
|
||||
#
|
||||
@@ -368,7 +375,7 @@ proc ttk::entry::Press {w x} {
|
||||
set State(anchor) [$w index insert]
|
||||
}
|
||||
|
||||
## Shift-Press -- Shift-ButtonPress-1 binding.
|
||||
## Shift-Press -- Shift-Button-1 binding.
|
||||
# Extends the selection, sets anchor for future drag operations.
|
||||
#
|
||||
proc ttk::entry::Shift-Press {w x} {
|
||||
@@ -517,7 +524,7 @@ proc ttk::entry::LineSelect {w _ _} {
|
||||
### Button 2 binding procedures.
|
||||
#
|
||||
|
||||
## ScanMark -- ButtonPress-2 binding.
|
||||
## ScanMark -- Button-2 binding.
|
||||
# Marks the start of a scan or primary transfer operation.
|
||||
#
|
||||
proc ttk::entry::ScanMark {w x} {
|
||||
|
||||
@@ -82,7 +82,7 @@ switch -- [tk windowingsystem] {
|
||||
set F(family) "MS Sans Serif"
|
||||
}
|
||||
} else {
|
||||
if {[lsearch -exact [font families] Tahoma] != -1} {
|
||||
if {[lsearch -exact [font families] Tahoma] >= 0} {
|
||||
set F(family) "Tahoma"
|
||||
} else {
|
||||
set F(family) "MS Sans Serif"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#
|
||||
# Pulldown: Press menubutton, drag over menu, release to activate menu entry
|
||||
# Popdown: Click menubutton to post menu
|
||||
# Keyboard: <Key-space> or accelerator key to post menu
|
||||
# Keyboard: <space> or accelerator key to post menu
|
||||
#
|
||||
# (In addition, when menu system is active, "dropdown" -- menu posts
|
||||
# on mouse-over. Ttk menubuttons don't implement this).
|
||||
#
|
||||
# For keyboard and popdown mode, we hand off to tk_popup and let
|
||||
# For keyboard and popdown mode, we hand off to tk_popup and let
|
||||
# the built-in Tk bindings handle the rest of the interaction.
|
||||
#
|
||||
# ON X11:
|
||||
@@ -19,16 +19,16 @@
|
||||
# This won't work for Ttk menubuttons in pulldown mode,
|
||||
# since we need to process the final <ButtonRelease> event,
|
||||
# and this might be delivered to the menu. So instead we
|
||||
# rely on the passive grab that occurs on <ButtonPress> events,
|
||||
# rely on the passive grab that occurs on <Button> events,
|
||||
# and transition to popdown mode when the mouse is released
|
||||
# or dragged outside the menubutton.
|
||||
#
|
||||
#
|
||||
# ON WINDOWS:
|
||||
#
|
||||
# I'm not sure what the hell is going on here. [$menu post] apparently
|
||||
# I'm not sure what the hell is going on here. [$menu post] apparently
|
||||
# sets up some kind of internal grab for native menus.
|
||||
# On this platform, just use [tk_popup] for all menu actions.
|
||||
#
|
||||
#
|
||||
# ON MACOS:
|
||||
#
|
||||
# Same probably applies here.
|
||||
@@ -46,15 +46,15 @@ namespace eval ttk {
|
||||
|
||||
bind TMenubutton <Enter> { %W instate !disabled {%W state active } }
|
||||
bind TMenubutton <Leave> { %W state !active }
|
||||
bind TMenubutton <Key-space> { ttk::menubutton::Popdown %W }
|
||||
bind TMenubutton <space> { ttk::menubutton::Popdown %W }
|
||||
bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W }
|
||||
|
||||
if {[tk windowingsystem] eq "x11"} {
|
||||
bind TMenubutton <ButtonPress-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 }
|
||||
} else {
|
||||
bind TMenubutton <ButtonPress-1> \
|
||||
bind TMenubutton <Button-1> \
|
||||
{ %W state pressed ; ttk::menubutton::Popdown %W }
|
||||
bind TMenubutton <ButtonRelease-1> \
|
||||
{ if {[winfo exists %W]} { %W state !pressed } }
|
||||
@@ -97,7 +97,7 @@ if {[tk windowingsystem] eq "aqua"} {
|
||||
}
|
||||
below {
|
||||
set entry ""
|
||||
incr y $bh
|
||||
incr y $bh
|
||||
}
|
||||
left {
|
||||
incr y $menuPad
|
||||
@@ -105,7 +105,7 @@ if {[tk windowingsystem] eq "aqua"} {
|
||||
}
|
||||
right {
|
||||
incr y $menuPad
|
||||
incr x $bw
|
||||
incr x $bw
|
||||
}
|
||||
default {
|
||||
incr y $bbh
|
||||
@@ -182,7 +182,7 @@ proc ttk::menubutton::Popdown {mb} {
|
||||
|
||||
# Pulldown (X11 only) --
|
||||
# Called when Button1 is pressed on a menubutton.
|
||||
# Posts the menu; a subsequent ButtonRelease
|
||||
# Posts the menu; a subsequent ButtonRelease
|
||||
# or Leave event will set a grab on the menu.
|
||||
#
|
||||
proc ttk::menubutton::Pulldown {mb} {
|
||||
@@ -224,11 +224,11 @@ proc ttk::menubutton::TransferGrab {mb} {
|
||||
# FindMenuEntry --
|
||||
# Hack to support tk_optionMenus.
|
||||
# Returns the index of the menu entry with a matching -label,
|
||||
# -1 if not found.
|
||||
# "" if not found.
|
||||
#
|
||||
proc ttk::menubutton::FindMenuEntry {menu s} {
|
||||
set last [$menu index last]
|
||||
if {$last eq "none"} {
|
||||
if {$last eq "none" || $last eq ""} {
|
||||
return ""
|
||||
}
|
||||
for {set i 0} {$i <= $last} {incr i} {
|
||||
|
||||
@@ -6,11 +6,11 @@ namespace eval ttk::notebook {
|
||||
variable TLNotebooks ;# See enableTraversal
|
||||
}
|
||||
|
||||
bind TNotebook <ButtonPress-1> { ttk::notebook::Press %W %x %y }
|
||||
bind TNotebook <Key-Right> { ttk::notebook::CycleTab %W 1; break }
|
||||
bind TNotebook <Key-Left> { ttk::notebook::CycleTab %W -1; break }
|
||||
bind TNotebook <Control-Key-Tab> { ttk::notebook::CycleTab %W 1; break }
|
||||
bind TNotebook <Control-Shift-Key-Tab> { ttk::notebook::CycleTab %W -1; break }
|
||||
bind TNotebook <Button-1> { ttk::notebook::Press %W %x %y }
|
||||
bind TNotebook <Right> { ttk::notebook::CycleTab %W 1; break }
|
||||
bind TNotebook <Left> { ttk::notebook::CycleTab %W -1; break }
|
||||
bind TNotebook <Control-Tab> { ttk::notebook::CycleTab %W 1; break }
|
||||
bind TNotebook <Control-Shift-Tab> { ttk::notebook::CycleTab %W -1; break }
|
||||
catch {
|
||||
bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break }
|
||||
}
|
||||
@@ -43,7 +43,7 @@ proc ttk::notebook::ActivateTab {w tab} {
|
||||
}
|
||||
|
||||
# Press $nb $x $y --
|
||||
# ButtonPress-1 binding for notebook widgets.
|
||||
# Button-1 binding for notebook widgets.
|
||||
# Activate the tab under the mouse cursor, if any.
|
||||
#
|
||||
proc ttk::notebook::Press {w x y} {
|
||||
@@ -70,7 +70,7 @@ proc ttk::notebook::CycleTab {w dir} {
|
||||
}
|
||||
|
||||
# MnemonicTab $nb $key --
|
||||
# Scan all tabs in the specified notebook for one with the
|
||||
# Scan all tabs in the specified notebook for one with the
|
||||
# specified mnemonic. If found, returns path name of tab;
|
||||
# otherwise returns ""
|
||||
#
|
||||
@@ -94,8 +94,8 @@ proc ttk::notebook::MnemonicTab {nb key} {
|
||||
# Enable keyboard traversal for a notebook widget
|
||||
# by adding bindings to the containing toplevel window.
|
||||
#
|
||||
# TLNotebooks($top) keeps track of the list of all traversal-enabled
|
||||
# notebooks contained in the toplevel
|
||||
# TLNotebooks($top) keeps track of the list of all traversal-enabled
|
||||
# notebooks contained in the toplevel
|
||||
#
|
||||
proc ttk::notebook::enableTraversal {nb} {
|
||||
variable TLNotebooks
|
||||
@@ -105,18 +105,18 @@ proc ttk::notebook::enableTraversal {nb} {
|
||||
if {![info exists TLNotebooks($top)]} {
|
||||
# Augment $top bindings:
|
||||
#
|
||||
bind $top <Control-Key-Next> {+ttk::notebook::TLCycleTab %W 1}
|
||||
bind $top <Control-Key-Prior> {+ttk::notebook::TLCycleTab %W -1}
|
||||
bind $top <Control-Key-Tab> {+ttk::notebook::TLCycleTab %W 1}
|
||||
bind $top <Control-Shift-Key-Tab> {+ttk::notebook::TLCycleTab %W -1}
|
||||
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-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1}
|
||||
catch {
|
||||
bind $top <Control-Key-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
|
||||
bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
|
||||
}
|
||||
if {[tk windowingsystem] eq "aqua"} {
|
||||
bind $top <Option-KeyPress> \
|
||||
bind $top <Option-Key> \
|
||||
+[list ttk::notebook::MnemonicActivation $top %K]
|
||||
} else {
|
||||
bind $top <Alt-KeyPress> \
|
||||
bind $top <Alt-Key> \
|
||||
+[list ttk::notebook::MnemonicActivation $top %K]
|
||||
}
|
||||
bind $top <Destroy> {+ttk::notebook::TLCleanup %W}
|
||||
@@ -145,7 +145,7 @@ proc ttk::notebook::Cleanup {nb} {
|
||||
}
|
||||
}
|
||||
|
||||
# EnclosingNotebook $w --
|
||||
# EnclosingNotebook $w --
|
||||
# Return the nearest traversal-enabled notebook widget
|
||||
# that contains $w.
|
||||
#
|
||||
@@ -171,7 +171,7 @@ proc ttk::notebook::EnclosingNotebook {w} {
|
||||
|
||||
# TLCycleTab --
|
||||
# toplevel binding procedure for Control-Tab / Control-Shift-Tab
|
||||
# Select the next/previous tab in the nearest ancestor notebook.
|
||||
# Select the next/previous tab in the nearest ancestor notebook.
|
||||
#
|
||||
proc ttk::notebook::TLCycleTab {w dir} {
|
||||
set nb [EnclosingNotebook $w]
|
||||
@@ -182,7 +182,7 @@ proc ttk::notebook::TLCycleTab {w dir} {
|
||||
}
|
||||
|
||||
# MnemonicActivation $nb $key --
|
||||
# Alt-KeyPress binding procedure for mnemonic activation.
|
||||
# Alt-Key binding procedure for mnemonic activation.
|
||||
# Scan all notebooks in specified toplevel for a tab with the
|
||||
# the specified mnemonic. If found, activate it and return TCL_BREAK.
|
||||
#
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace eval ttk::panedwindow {
|
||||
|
||||
## Bindings:
|
||||
#
|
||||
bind TPanedwindow <ButtonPress-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 }
|
||||
|
||||
@@ -62,13 +62,22 @@ proc ttk::panedwindow::Release {w x y} {
|
||||
#
|
||||
proc ttk::panedwindow::ResetCursor {w} {
|
||||
variable State
|
||||
|
||||
ttk::saveCursor $w State(userConfCursor) \
|
||||
[list [ttk::cursor hresize] [ttk::cursor vresize]]
|
||||
|
||||
if {!$State(pressed)} {
|
||||
ttk::setCursor $w {}
|
||||
ttk::setCursor $w $State(userConfCursor)
|
||||
}
|
||||
}
|
||||
|
||||
proc ttk::panedwindow::SetCursor {w x y} {
|
||||
set cursor ""
|
||||
variable State
|
||||
|
||||
ttk::saveCursor $w State(userConfCursor) \
|
||||
[list [ttk::cursor hresize] [ttk::cursor vresize]]
|
||||
|
||||
set cursor $State(userConfCursor)
|
||||
if {[llength [$w identify $x $y]]} {
|
||||
# Assume we're over a sash.
|
||||
switch -- [$w cget -orient] {
|
||||
|
||||
@@ -9,15 +9,15 @@ namespace eval ttk::scale {
|
||||
}
|
||||
}
|
||||
|
||||
bind TScale <ButtonPress-1> { ttk::scale::Press %W %x %y }
|
||||
bind TScale <Button-1> { ttk::scale::Press %W %x %y }
|
||||
bind TScale <B1-Motion> { ttk::scale::Drag %W %x %y }
|
||||
bind TScale <ButtonRelease-1> { ttk::scale::Release %W %x %y }
|
||||
|
||||
bind TScale <ButtonPress-2> { ttk::scale::Jump %W %x %y }
|
||||
bind TScale <Button-2> { ttk::scale::Jump %W %x %y }
|
||||
bind TScale <B2-Motion> { ttk::scale::Drag %W %x %y }
|
||||
bind TScale <ButtonRelease-2> { ttk::scale::Release %W %x %y }
|
||||
|
||||
bind TScale <ButtonPress-3> { ttk::scale::Jump %W %x %y }
|
||||
bind TScale <Button-3> { ttk::scale::Jump %W %x %y }
|
||||
bind TScale <B3-Motion> { ttk::scale::Drag %W %x %y }
|
||||
bind TScale <ButtonRelease-3> { ttk::scale::Release %W %x %y }
|
||||
|
||||
@@ -52,7 +52,7 @@ proc ttk::scale::Press {w x y} {
|
||||
}
|
||||
}
|
||||
|
||||
# scale::Jump -- ButtonPress-2/3 binding for scale acts like
|
||||
# scale::Jump -- Button-2/3 binding for scale acts like
|
||||
# Press except that clicking in the trough jumps to the
|
||||
# clicked position.
|
||||
proc ttk::scale::Jump {w x y} {
|
||||
|
||||
@@ -9,14 +9,35 @@ namespace eval ttk::scrollbar {
|
||||
# State(first) -- value of -first at start of drag.
|
||||
}
|
||||
|
||||
bind TScrollbar <ButtonPress-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 <ButtonPress-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 }
|
||||
|
||||
# Redirect scrollwheel bindings to the scrollbar widget
|
||||
#
|
||||
# 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>
|
||||
# For tk 8.7, the event list will be extended by
|
||||
# <Button-6> <Button-7>
|
||||
}
|
||||
}
|
||||
foreach event $eventList {
|
||||
bind TScrollbar $event [bind Scrollbar $event]
|
||||
}
|
||||
unset eventList event
|
||||
|
||||
proc ttk::scrollbar::Scroll {w n units} {
|
||||
set cmd [$w cget -command]
|
||||
if {$cmd ne ""} {
|
||||
@@ -38,7 +59,7 @@ proc ttk::scrollbar::Press {w x y} {
|
||||
set State(yPress) $y
|
||||
|
||||
switch -glob -- [$w identify $x $y] {
|
||||
*uparrow -
|
||||
*uparrow -
|
||||
*leftarrow {
|
||||
ttk::Repeatedly Scroll $w -1 units
|
||||
}
|
||||
@@ -46,6 +67,7 @@ proc ttk::scrollbar::Press {w x y} {
|
||||
*rightarrow {
|
||||
ttk::Repeatedly Scroll $w 1 units
|
||||
}
|
||||
*grip -
|
||||
*thumb {
|
||||
set State(first) [lindex [$w get] 0]
|
||||
}
|
||||
@@ -68,7 +90,7 @@ 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;
|
||||
}
|
||||
@@ -83,7 +105,7 @@ proc ttk::scrollbar::Release {w x y} {
|
||||
ttk::CancelRepeat
|
||||
}
|
||||
|
||||
# scrollbar::Jump -- ButtonPress-2 binding for scrollbars.
|
||||
# scrollbar::Jump -- Button-2 binding for scrollbars.
|
||||
# Behaves exactly like scrollbar::Press, except that
|
||||
# clicking in the trough jumps to the the selected position.
|
||||
#
|
||||
@@ -91,6 +113,7 @@ proc ttk::scrollbar::Jump {w x y} {
|
||||
variable State
|
||||
|
||||
switch -glob -- [$w identify $x $y] {
|
||||
*grip -
|
||||
*thumb -
|
||||
*trough {
|
||||
set State(first) [$w fraction $x $y]
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace eval ttk::sizegrip {
|
||||
}
|
||||
}
|
||||
|
||||
bind TSizegrip <ButtonPress-1> { ttk::sizegrip::Press %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 }
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@ namespace eval ttk::spinbox { }
|
||||
ttk::copyBindings TEntry TSpinbox
|
||||
|
||||
bind TSpinbox <Motion> { ttk::spinbox::Motion %W %x %y }
|
||||
bind TSpinbox <ButtonPress-1> { ttk::spinbox::Press %W %x %y }
|
||||
bind TSpinbox <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 <KeyPress-Up> { event generate %W <<Increment>> }
|
||||
bind TSpinbox <KeyPress-Down> { event generate %W <<Decrement>> }
|
||||
bind TSpinbox <Up> { event generate %W <<Increment>> }
|
||||
bind TSpinbox <Down> { event generate %W <<Decrement>> }
|
||||
|
||||
bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 }
|
||||
bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 }
|
||||
@@ -29,12 +29,14 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W]
|
||||
# Sets cursor.
|
||||
#
|
||||
proc ttk::spinbox::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 {
|
||||
ttk::setCursor $w ""
|
||||
ttk::setCursor $w $State(userConfCursor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,16 +46,16 @@ proc ttk::spinbox::Press {w x y} {
|
||||
if {[$w instate disabled]} { return }
|
||||
focus $w
|
||||
switch -glob -- [$w identify $x $y] {
|
||||
*textarea { ttk::entry::Press $w $x }
|
||||
*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>> }
|
||||
*downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
|
||||
*spinbutton {
|
||||
if {$y * 2 >= [winfo height $w]} {
|
||||
set event <<Decrement>>
|
||||
set event <<Decrement>>
|
||||
} else {
|
||||
set event <<Increment>>
|
||||
set event <<Increment>>
|
||||
}
|
||||
ttk::Repeatedly event generate $w $event
|
||||
}
|
||||
@@ -67,7 +69,7 @@ proc ttk::spinbox::DoubleClick {w x y} {
|
||||
if {[$w instate disabled]} { return }
|
||||
|
||||
switch -glob -- [$w identify $x $y] {
|
||||
*textarea { SelectAll $w }
|
||||
*textarea { SelectAll $w }
|
||||
* { Press $w $x $y }
|
||||
}
|
||||
}
|
||||
@@ -133,16 +135,31 @@ proc ttk::spinbox::Adjust {w v min max} {
|
||||
# -from, -to, and -increment.
|
||||
#
|
||||
proc ttk::spinbox::Spin {w dir} {
|
||||
variable State
|
||||
|
||||
if {[$w instate disabled]} { return }
|
||||
set nvalues [llength [set values [$w cget -values]]]
|
||||
set value [$w get]
|
||||
if {$nvalues} {
|
||||
set current [lsearch -exact $values $value]
|
||||
set index [Adjust $w [expr {$current + $dir}] 0 [expr {$nvalues - 1}]]
|
||||
$w set [lindex $values $index]
|
||||
|
||||
if {![info exists State($w,values.length)]} {
|
||||
set State($w,values.index) -1
|
||||
set State($w,values.last) {}
|
||||
}
|
||||
set State($w,values) [$w cget -values]
|
||||
set State($w,values.length) [llength $State($w,values)]
|
||||
|
||||
if {$State($w,values.length) > 0} {
|
||||
set value [$w get]
|
||||
set current $State($w,values.index)
|
||||
if {$value ne $State($w,values.last)} {
|
||||
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 \
|
||||
[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]}]
|
||||
if {[catch {
|
||||
set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
|
||||
}]} {
|
||||
set v [$w cget -from]
|
||||
}
|
||||
@@ -160,7 +177,7 @@ proc ttk::spinbox::FormatValue {w val} {
|
||||
if {$fmt eq ""} {
|
||||
# Try to guess a suitable -format based on -increment.
|
||||
set delta [expr {abs([$w cget -increment])}]
|
||||
if {0 < $delta && $delta < 1} {
|
||||
if {0 < $delta && $delta < 1} {
|
||||
# NB: This guesses wrong if -increment has more than 1
|
||||
# significant digit itself, e.g., -increment 0.25
|
||||
set nsd [expr {int(ceil(-log10($delta)))}]
|
||||
|
||||
@@ -28,25 +28,25 @@ namespace eval ttk::treeview {
|
||||
bind Treeview <Motion> { ttk::treeview::Motion %W %x %y }
|
||||
bind Treeview <B1-Leave> { #nothing }
|
||||
bind Treeview <Leave> { ttk::treeview::ActivateHeading {} {}}
|
||||
bind Treeview <ButtonPress-1> { ttk::treeview::Press %W %x %y }
|
||||
bind Treeview <Double-ButtonPress-1> { ttk::treeview::DoubleClick %W %x %y }
|
||||
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 <KeyPress-Up> { ttk::treeview::Keynav %W up }
|
||||
bind Treeview <KeyPress-Down> { ttk::treeview::Keynav %W down }
|
||||
bind Treeview <KeyPress-Right> { ttk::treeview::Keynav %W right }
|
||||
bind Treeview <KeyPress-Left> { ttk::treeview::Keynav %W left }
|
||||
bind Treeview <KeyPress-Prior> { %W yview scroll -1 pages }
|
||||
bind Treeview <KeyPress-Next> { %W yview scroll 1 pages }
|
||||
bind Treeview <KeyPress-Return> { ttk::treeview::ToggleFocus %W }
|
||||
bind Treeview <KeyPress-space> { ttk::treeview::ToggleFocus %W }
|
||||
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 <Return> { ttk::treeview::ToggleFocus %W }
|
||||
bind Treeview <space> { ttk::treeview::ToggleFocus %W }
|
||||
|
||||
bind Treeview <Shift-ButtonPress-1> \
|
||||
bind Treeview <Shift-Button-1> \
|
||||
{ ttk::treeview::Select %W %x %y extend }
|
||||
bind Treeview <<ToggleSelection>> \
|
||||
{ ttk::treeview::Select %W %x %y toggle }
|
||||
|
||||
ttk::copyBindings TtkScrollable Treeview
|
||||
ttk::copyBindings TtkScrollable Treeview
|
||||
|
||||
### Binding procedures.
|
||||
#
|
||||
@@ -102,7 +102,11 @@ proc ttk::treeview::Keynav {w dir} {
|
||||
# Sets cursor, active element ...
|
||||
#
|
||||
proc ttk::treeview::Motion {w x y} {
|
||||
set cursor {}
|
||||
variable State
|
||||
|
||||
ttk::saveCursor $w State(userConfCursor) [ttk::cursor hresize]
|
||||
|
||||
set cursor $State(userConfCursor)
|
||||
set activeHeading {}
|
||||
|
||||
switch -- [$w identify region $x $y] {
|
||||
@@ -127,7 +131,7 @@ proc ttk::treeview::ActivateHeading {w heading} {
|
||||
# triggers a <Leave> event. A proc checking if the display column
|
||||
# $State(activeHeading) is really still present or not could be
|
||||
# written but it would need to check several special cases:
|
||||
# a. -displaycolumns "#all" or being an explicit columns list
|
||||
# a. -displaycolumns "#all" or being an explicit columns list
|
||||
# b. column #0 display is not governed by the -displaycolumn
|
||||
# list but by the value of the -show option
|
||||
# --> Let's rather catch the following line.
|
||||
@@ -151,7 +155,7 @@ proc ttk::treeview::Select {w x y op} {
|
||||
}
|
||||
}
|
||||
|
||||
## DoubleClick -- Double-ButtonPress-1 binding.
|
||||
## DoubleClick -- Double-Button-1 binding.
|
||||
#
|
||||
proc ttk::treeview::DoubleClick {w x y} {
|
||||
if {[set row [$w identify row $x $y]] ne ""} {
|
||||
@@ -161,7 +165,7 @@ proc ttk::treeview::DoubleClick {w x y} {
|
||||
}
|
||||
}
|
||||
|
||||
## Press -- ButtonPress binding.
|
||||
## Press -- Button binding.
|
||||
#
|
||||
proc ttk::treeview::Press {w x y} {
|
||||
focus $w
|
||||
@@ -261,9 +265,9 @@ proc ttk::treeview::SelectOp {w item op} {
|
||||
|
||||
## -selectmode none:
|
||||
#
|
||||
proc ttk::treeview::select.choose.none {w item} { $w focus $item }
|
||||
proc ttk::treeview::select.toggle.none {w item} { $w focus $item }
|
||||
proc ttk::treeview::select.extend.none {w item} { $w focus $item }
|
||||
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 }
|
||||
|
||||
## -selectmode browse:
|
||||
#
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace eval ::ttk {
|
||||
}
|
||||
}
|
||||
|
||||
source [file join $::ttk::library fonts.tcl]
|
||||
source [file join $::ttk::library cursors.tcl]
|
||||
source [file join $::ttk::library utils.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library fonts.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library cursors.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library utils.tcl]
|
||||
|
||||
## ttk::deprecated $old $new --
|
||||
# Define $old command as a deprecated alias for $new command
|
||||
@@ -97,18 +97,18 @@ proc ::ttk::setTheme {theme} {
|
||||
|
||||
### Load widget bindings.
|
||||
#
|
||||
source [file join $::ttk::library button.tcl]
|
||||
source [file join $::ttk::library menubutton.tcl]
|
||||
source [file join $::ttk::library scrollbar.tcl]
|
||||
source [file join $::ttk::library scale.tcl]
|
||||
source [file join $::ttk::library progress.tcl]
|
||||
source [file join $::ttk::library notebook.tcl]
|
||||
source [file join $::ttk::library panedwindow.tcl]
|
||||
source [file join $::ttk::library entry.tcl]
|
||||
source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
|
||||
source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
|
||||
source [file join $::ttk::library treeview.tcl]
|
||||
source [file join $::ttk::library sizegrip.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library button.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library menubutton.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library scrollbar.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library scale.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library progress.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library notebook.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library panedwindow.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library entry.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
|
||||
source -encoding utf-8 [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
|
||||
source -encoding utf-8 [file join $::ttk::library treeview.tcl]
|
||||
source -encoding utf-8 [file join $::ttk::library sizegrip.tcl]
|
||||
|
||||
## Label and Labelframe bindings:
|
||||
# (not enough to justify their own file...)
|
||||
@@ -122,7 +122,7 @@ proc ttk::LoadThemes {} {
|
||||
variable library
|
||||
|
||||
# "default" always present:
|
||||
uplevel #0 [list source [file join $library defaults.tcl]]
|
||||
uplevel #0 [list source -encoding utf-8 [file join $library defaults.tcl]]
|
||||
|
||||
set builtinThemes [style theme names]
|
||||
foreach {theme scripts} {
|
||||
@@ -135,7 +135,7 @@ proc ttk::LoadThemes {} {
|
||||
} {
|
||||
if {[lsearch -exact $builtinThemes $theme] >= 0} {
|
||||
foreach script $scripts {
|
||||
uplevel #0 [list source [file join $library $script]]
|
||||
uplevel #0 [list source -encoding utf-8 [file join $library $script]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ proc ttk::traverseTo {w} {
|
||||
}
|
||||
|
||||
## ttk::clickToFocus $w --
|
||||
# Utility routine, used in <ButtonPress-1> bindings --
|
||||
# Utility routine, used in <Button-1> bindings --
|
||||
# Assign keyboard focus to the specified widget if -takefocus is enabled.
|
||||
#
|
||||
proc ttk::clickToFocus {w} {
|
||||
@@ -278,9 +278,6 @@ proc ttk::copyBindings {from to} {
|
||||
# On OSX, Tk generates sensible values for the %D field in <MouseWheel> events.
|
||||
#
|
||||
# On Windows, %D must be scaled by a factor of 120.
|
||||
# In addition, Tk redirects mousewheel events to the window with
|
||||
# keyboard focus instead of sending them to the window under the pointer.
|
||||
# We do not attempt to fix that here, see also TIP#171.
|
||||
#
|
||||
# OSX conventionally uses Shift+MouseWheel for horizontal scrolling,
|
||||
# and Option+MouseWheel for accelerated scrolling.
|
||||
@@ -301,14 +298,14 @@ proc ttk::copyBindings {from to} {
|
||||
|
||||
proc ttk::bindMouseWheel {bindtag callback} {
|
||||
if {[tk windowingsystem] eq "x11"} {
|
||||
bind $bindtag <ButtonPress-4> "$callback -1"
|
||||
bind $bindtag <ButtonPress-5> "$callback +1"
|
||||
bind $bindtag <Button-4> "$callback -1"
|
||||
bind $bindtag <Button-5> "$callback +1"
|
||||
}
|
||||
if {[tk windowingsystem] eq "aqua"} {
|
||||
bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
|
||||
bind $bindtag <Option-MouseWheel> [append callback { [expr {-10 *(%D)}]} ]
|
||||
bind $bindtag <MouseWheel> "$callback \[expr {-%D}\]"
|
||||
bind $bindtag <Option-MouseWheel> "$callback \[expr {-10*%D}\]"
|
||||
} else {
|
||||
bind $bindtag <MouseWheel> [append callback { [expr {-(%D / 120)}]}]
|
||||
bind $bindtag <MouseWheel> "$callback \[expr {-%D/120}\]"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,10 +318,10 @@ proc ttk::bindMouseWheel {bindtag callback} {
|
||||
#
|
||||
|
||||
if {[tk windowingsystem] eq "x11"} {
|
||||
bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units }
|
||||
bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units }
|
||||
bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units }
|
||||
bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units }
|
||||
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> \
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
# The Vista theme can only be defined on Windows Vista and above. The theme
|
||||
# is created in C due to the need to assign a theme-enabled function for
|
||||
# is created in C due to the need to assign a theme-enabled function for
|
||||
# detecting when themeing is disabled. On systems that cannot support the
|
||||
# Vista theme, there will be no such theme created and we must not
|
||||
# evaluate this script.
|
||||
@@ -69,9 +69,9 @@ namespace eval ttk::theme::vista {
|
||||
ttk::style layout TCombobox {
|
||||
Combobox.border -sticky nswe -border 0 -children {
|
||||
Combobox.rightdownarrow -side right -sticky ns
|
||||
Combobox.padding -expand 1 -sticky nswe -children {
|
||||
Combobox.padding -sticky nswe -children {
|
||||
Combobox.background -sticky nswe -children {
|
||||
Combobox.focus -expand 1 -sticky nswe -children {
|
||||
Combobox.focus -sticky nswe -children {
|
||||
Combobox.textarea -sticky nswe
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace eval ttk::theme::vista {
|
||||
Spinbox.background -sticky news -children {
|
||||
Spinbox.padding -sticky news -children {
|
||||
Spinbox.innerbg -sticky news -children {
|
||||
Spinbox.textarea -expand 1
|
||||
Spinbox.textarea
|
||||
}
|
||||
}
|
||||
Spinbox.uparrow -side top -sticky ens
|
||||
@@ -151,7 +151,7 @@ namespace eval ttk::theme::vista {
|
||||
-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} \
|
||||
@@ -196,14 +196,14 @@ namespace eval ttk::theme::vista {
|
||||
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 -expand 1 -sticky nswe -children {
|
||||
Horizontal.Scale.trough -expand 1 -sticky nswe -children {
|
||||
Scale.focus -sticky nswe -children {
|
||||
Horizontal.Scale.trough -sticky nswe -children {
|
||||
Horizontal.Scale.track -sticky we
|
||||
Horizontal.Scale.slider -side left -sticky {}
|
||||
}
|
||||
@@ -213,17 +213,17 @@ namespace eval ttk::theme::vista {
|
||||
TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
|
||||
-width 12 -height 6
|
||||
ttk::style layout Vertical.TScale {
|
||||
Scale.focus -expand 1 -sticky nswe -children {
|
||||
Vertical.Scale.trough -expand 1 -sticky nswe -children {
|
||||
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 {4 0 0 0}
|
||||
|
||||
|
||||
package provide ttk::theme::vista 1.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,6 @@ namespace eval ttk::theme::xpnative {
|
||||
ttk::style map TNotebook.Tab \
|
||||
-expand [list selected {2 2 2 2}]
|
||||
|
||||
# Treeview:
|
||||
ttk::style configure Heading -font TkHeadingFont
|
||||
ttk::style configure Treeview -background SystemWindow
|
||||
ttk::style map Treeview \
|
||||
-background [list selected SystemHighlight] \
|
||||
-foreground [list selected SystemHighlightText] ;
|
||||
|
||||
ttk::style configure TLabelframe.Label -foreground "#0046d5"
|
||||
|
||||
# OR: -padding {3 3 3 6}, which some apps seem to use.
|
||||
|
||||
Reference in New Issue
Block a user