diff options
-rw-r--r-- | library/ttk/combobox.tcl | 8 | ||||
-rw-r--r-- | library/ttk/cursors.tcl | 17 | ||||
-rw-r--r-- | library/ttk/panedwindow.tcl | 18 | ||||
-rw-r--r-- | library/ttk/spinbox.tcl | 8 | ||||
-rw-r--r-- | library/ttk/treeview.tcl | 8 |
5 files changed, 24 insertions, 35 deletions
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 30a1599..2770142 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -150,13 +150,7 @@ proc ttk::combobox::Drag {w x} { # proc ttk::combobox::Motion {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ne [ttk::cursor text]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index dacc494..f1f9fa1 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -150,6 +150,23 @@ proc ttk::setCursor {w name} { } } +## 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] + } +} + ## Interactive test harness: # proc ttk::CursorSampler {f} { diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index e23c506..ba47003 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -63,13 +63,8 @@ proc ttk::panedwindow::Release {w x y} { proc ttk::panedwindow::ResetCursor {w} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ni [list [ttk::cursor hresize] [ttk::cursor vresize]]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] if {!$State(pressed)} { ttk::setCursor $w $State(userConfCursor) @@ -79,13 +74,8 @@ proc ttk::panedwindow::ResetCursor {w} { proc ttk::panedwindow::SetCursor {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ni [list [ttk::cursor hresize] [ttk::cursor vresize]]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index b6ed126..9728755 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -30,13 +30,7 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W] # proc ttk::spinbox::Motion {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ne [ttk::cursor text]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index 75ed9be..81ba27e 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -104,13 +104,7 @@ proc ttk::treeview::Keynav {w dir} { proc ttk::treeview::Motion {w x y} { variable State - if {![info exists State(userConfCursor)]} { - set State(userConfCursor) [$w cget -cursor] - } - # the user could have changed the configured cursor - if {[$w cget -cursor] ne [ttk::cursor hresize]} { - set State(userConfCursor) [$w cget -cursor] - } + ttk::saveCursor $w State(userConfCursor) [ttk::cursor hresize] set cursor $State(userConfCursor) set activeHeading {} |