2 # $Id: panedwindow.tcl,v 1.5 2007/12/13 15:27:08 dgp Exp $
4 # Bindings for ttk::panedwindow widget.
7 namespace eval ttk
::panedwindow {
20 bind TPanedwindow
<ButtonPress-1
> { ttk
::panedwindow::Press %W
%x
%y
}
21 bind TPanedwindow
<B1-Motion
> { ttk
::panedwindow::Drag %W
%x
%y
}
22 bind TPanedwindow
<ButtonRelease-1
> { ttk
::panedwindow::Release %W
%x
%y
}
24 bind TPanedwindow
<Motion
> { ttk
::panedwindow::SetCursor %W
%x
%y
}
25 bind TPanedwindow
<Enter
> { ttk
::panedwindow::SetCursor %W
%x
%y
}
26 bind TPanedwindow
<Leave
> { ttk
::panedwindow::ResetCursor %W
}
27 # See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>>
28 bind TPanedwindow
<<EnteredChild
>> { ttk
::panedwindow::ResetCursor %W
}
33 proc ttk
::panedwindow::Press {w x y
} {
36 set sash
[$w identify
$x $y]
45 set State
(sashPos
) [$w sashpos
$sash]
48 proc ttk
::panedwindow::Drag {w x y
} {
50 if {!$State(pressed
)} { return }
51 switch -- [$w cget
-orient] {
52 horizontal
{ set delta
[expr {$x - $State(pressX
)}] }
53 vertical
{ set delta
[expr {$y - $State(pressY
)}] }
55 $w sashpos
$State(sash
) [expr {$State(sashPos
) + $delta}]
58 proc ttk
::panedwindow::Release {w x y
} {
66 proc ttk
::panedwindow::ResetCursor {w
} {
68 if {!$State(pressed
)} {
69 $w configure
-cursor {}
73 proc ttk
::panedwindow::SetCursor {w x y
} {
74 variable ::ttk::Cursors
76 if {![llength [$w identify
$x $y]]} {
79 # Assume we're over a sash.
80 switch -- [$w cget
-orient] {
81 horizontal
{ $w configure
-cursor $Cursors(hresize
) }
82 vertical
{ $w configure
-cursor $Cursors(vresize
) }