Sha256: fbbfb627bf09e183bdb02bc2fdc164dd27e8f42f6c626756b8b169d50bd48b99

Contents?: true

Size: 1.99 KB

Versions: 6

Compression:

Stored size: 1.99 KB

Contents

#
# paned.tcl,v 1.5 2007/06/09 21:45:51 jenglish Exp
#
# Bindings for ttk::panedwindow widget.
#

namespace eval ttk::panedwindow {
    variable State
    array set State {
	pressed 	0
    	pressX		-
	pressY		-
	sash 		-
	sashPos 	-
    }
}

## Bindings:
#
bind TPanedwindow <ButtonPress-1> 	{ ttk::panedwindow::Press %W %x %y }
bind TPanedwindow <B1-Motion> 		{ ttk::panedwindow::Drag %W %x %y }
bind TPanedwindow <ButtonRelease-1> 	{ ttk::panedwindow::Release %W %x %y }

bind TPanedwindow <Motion> 		{ ttk::panedwindow::SetCursor %W %x %y }
bind TPanedwindow <Enter> 		{ ttk::panedwindow::SetCursor %W %x %y }
bind TPanedwindow <Leave> 		{ ttk::panedwindow::ResetCursor %W } 
# See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>>
bind TPanedwindow <<EnteredChild>>	{ ttk::panedwindow::ResetCursor %W }


## Sash movement:
#
proc ttk::panedwindow::Press {w x y} {
    variable State

    set sash [$w identify $x $y]
    if {$sash eq ""} {
    	set State(pressed) 0
	return 
    }
    set State(pressed) 	1
    set State(pressX) 	$x
    set State(pressY) 	$y
    set State(sash) 	$sash
    set State(sashPos)	[$w sashpos $sash]
}

proc ttk::panedwindow::Drag {w x y} {
    variable State
    if {!$State(pressed)} { return }
    switch -- [$w cget -orient] {
    	horizontal 	{ set delta [expr {$x - $State(pressX)}] }
    	vertical 	{ set delta [expr {$y - $State(pressY)}] }
    }
    $w sashpos $State(sash) [expr {$State(sashPos) + $delta}]
}

proc ttk::panedwindow::Release {w x y} {
    variable State
    set State(pressed) 0
    SetCursor $w $x $y
}

## Cursor management:
#
proc ttk::panedwindow::ResetCursor {w} {
    variable State
    if {!$State(pressed)} {
	$w configure -cursor {}
    }
}

proc ttk::panedwindow::SetCursor {w x y} {
    variable ::ttk::Cursors

    if {![llength [$w identify $x $y]]} {
    	ResetCursor $w
    } else {
    	# Assume we're over a sash.
	switch -- [$w cget -orient] {
	    horizontal 	{ $w configure -cursor $Cursors(hresize) }
	    vertical 	{ $w configure -cursor $Cursors(vresize) }
	}
    }
}

#*EOF*

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
Pratt-1.6.8 pkgs/tile-0.8.2/library/paned.tcl
Pratt-1.6.5 pkgs/tile-0.8.2/library/paned.tcl
Pratt-1.6.4 pkgs/tile-0.8.2/library/paned.tcl
Pratt-1.6.2 pkgs/tile-0.8.2/library/paned.tcl
Pratt-1.5.8 pkgs/tile-0.8.2/library/paned.tcl
Pratt-1.5.6 pkgs/tile-0.8.2/library/paned.tcl