2 # Bindings for ttk::panedwindow widget.
5 namespace eval ttk
::panedwindow {
18 bind TPanedwindow
<ButtonPress-1
> { ttk
::panedwindow::Press %W
%x
%y
}
19 bind TPanedwindow
<B1-Motion
> { ttk
::panedwindow::Drag %W
%x
%y
}
20 bind TPanedwindow
<ButtonRelease-1
> { ttk
::panedwindow::Release %W
%x
%y
}
22 bind TPanedwindow
<Motion
> { ttk
::panedwindow::SetCursor %W
%x
%y
}
23 bind TPanedwindow
<Enter
> { ttk
::panedwindow::SetCursor %W
%x
%y
}
24 bind TPanedwindow
<Leave
> { ttk
::panedwindow::ResetCursor %W
}
25 # See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>>
26 bind TPanedwindow
<<EnteredChild
>> { ttk
::panedwindow::ResetCursor %W
}
30 proc ttk
::panedwindow::Press {w x y
} {
33 set sash
[$w identify
$x $y]
42 set State
(sashPos
) [$w sashpos
$sash]
45 proc ttk
::panedwindow::Drag {w x y
} {
47 if {!$State(pressed
)} { return }
48 switch -- [$w cget
-orient] {
49 horizontal
{ set delta
[expr {$x - $State(pressX
)}] }
50 vertical
{ set delta
[expr {$y - $State(pressY
)}] }
52 $w sashpos
$State(sash
) [expr {$State(sashPos
) + $delta}]
55 proc ttk
::panedwindow::Release {w x y
} {
63 proc ttk
::panedwindow::ResetCursor {w
} {
65 if {!$State(pressed
)} {
70 proc ttk
::panedwindow::SetCursor {w x y
} {
72 if {[llength [$w identify
$x $y]]} {
73 # Assume we're over a sash.
74 switch -- [$w cget
-orient] {
75 horizontal
{ set cursor hresize
}
76 vertical
{ set cursor vresize
}
79 ttk
::setCursor $w $cursor