Update tk to version 8.5.11
[git/jnareb-git.git] / mingw / lib / tk8.5 / ttk / panedwindow.tcl
bloba2e073b44dc04139a09d250bd4ee6cd13a048995
2 # Bindings for ttk::panedwindow widget.
5 namespace eval ttk::panedwindow {
6 variable State
7 array set State {
8 pressed 0
9 pressX -
10 pressY -
11 sash -
12 sashPos -
16 ## Bindings:
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 }
28 ## Sash movement:
30 proc ttk::panedwindow::Press {w x y} {
31 variable State
33 set sash [$w identify $x $y]
34 if {$sash eq ""} {
35 set State(pressed) 0
36 return
38 set State(pressed) 1
39 set State(pressX) $x
40 set State(pressY) $y
41 set State(sash) $sash
42 set State(sashPos) [$w sashpos $sash]
45 proc ttk::panedwindow::Drag {w x y} {
46 variable State
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} {
56 variable State
57 set State(pressed) 0
58 SetCursor $w $x $y
61 ## Cursor management:
63 proc ttk::panedwindow::ResetCursor {w} {
64 variable State
65 if {!$State(pressed)} {
66 ttk::setCursor $w {}
70 proc ttk::panedwindow::SetCursor {w x y} {
71 set cursor ""
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
82 #*EOF*