1 # scale.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
3 # Bindings for the TScale widget
5 # $Id: scale.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
7 namespace eval ttk
::scale {
14 bind TScale
<ButtonPress-1
> { ttk
::scale::Press %W
%x
%y
}
15 bind TScale
<B1-Motion
> { ttk
::scale::Drag %W
%x
%y
}
16 bind TScale
<ButtonRelease-1
> { ttk
::scale::Release %W
%x
%y
}
18 proc ttk
::scale::Press {w x y
} {
22 switch -glob -- [$w identify
$x $y] {
25 if {[$w get
$x $y] <= [$w get
]} {
26 ttk
::Repeatedly Increment
$w -1
28 ttk
::Repeatedly Increment
$w 1
33 set State
(initial
) [$w get
]
38 proc ttk
::scale::Drag {w x y
} {
40 if {$State(dragging
)} {
45 proc ttk
::scale::Release {w x y
} {
51 proc ttk
::scale::Increment {w delta
} {
52 if {![winfo exists
$w]} return
53 $w set [expr {[$w get
] + $delta}]