Upgrade to Tcl/Tk 8.5b2
[msysgit.git] / mingw / lib / tk8.5 / ttk / panedwindow.tcl
blob9cb046d36b27c4b8a3a191784d2f982b46114125
2 # $Id: panedwindow.tcl,v 1.4 2007/06/09 21:45:45 jenglish Exp $
4 # Bindings for ttk::panedwindow widget.
7 namespace eval ttk::panedwindow {
8 variable State
9 array set State {
10 pressed 0
11 pressX -
12 pressY -
13 sash -
14 sashPos -
18 ## Bindings:
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 }
31 ## Sash movement:
33 proc ttk::panedwindow::Press {w x y} {
34 variable State
36 set sash [$w identify $x $y]
37 if {$sash eq ""} {
38 set State(pressed) 0
39 return
41 set State(pressed) 1
42 set State(pressX) $x
43 set State(pressY) $y
44 set State(sash) $sash
45 set State(sashPos) [$w sashpos $sash]
48 proc ttk::panedwindow::Drag {w x y} {
49 variable State
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} {
59 variable State
60 set State(pressed) 0
61 SetCursor $w $x $y
64 ## Cursor management:
66 proc ttk::panedwindow::ResetCursor {w} {
67 variable State
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]]} {
77 ResetCursor $w
78 } else {
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) }
87 #*EOF*