summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2008-04-04 14:18:30 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2008-04-04 14:18:30 (GMT)
commit71c2e7e5d1b9156ee1ca34123a863a594c730b31 (patch)
treeac50fe8f4abdc68c44b36ce7202a1f8304b4fe54 /library
parent4aaeef4ab3e62901320ee961372c34e4527092e7 (diff)
downloadtk-71c2e7e5d1b9156ee1ca34123a863a594c730b31.zip
tk-71c2e7e5d1b9156ee1ca34123a863a594c730b31.tar.gz
tk-71c2e7e5d1b9156ee1ca34123a863a594c730b31.tar.bz2
Don't resize the window if the toplevel is not resizable or the sizegrip is disabled
Diffstat (limited to 'library')
-rw-r--r--library/ttk/sizegrip.tcl22
1 files changed, 19 insertions, 3 deletions
diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl
index f1b87b1..51667dd 100644
--- a/library/ttk/sizegrip.tcl
+++ b/library/ttk/sizegrip.tcl
@@ -1,5 +1,5 @@
#
-# $Id: sizegrip.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
+# $Id: sizegrip.tcl,v 1.2 2008/04/04 14:18:30 patthoyts Exp $
#
# Ttk widget set -- sizegrip widget bindings.
#
@@ -20,6 +20,8 @@ namespace eval ttk::sizegrip {
height 0
widthInc 1
heightInc 1
+ resizeX 1
+ resizeY 1
toplevel {}
}
}
@@ -31,8 +33,16 @@ bind TSizegrip <ButtonRelease-1> { ttk::sizegrip::Release %W %X %Y }
proc ttk::sizegrip::Press {W X Y} {
variable State
+ if {[$W instate disabled]} { return }
+
set top [winfo toplevel $W]
+ # If the toplevel is not resizable then bail
+ foreach {State(resizeX) State(resizeY)} [wm resizable $top] break
+ if {!$State(resizeX) && !$State(resizeY)} {
+ return
+ }
+
# Sanity-checks:
# If a negative X or Y position was specified for [wm geometry],
# just bail out -- there's no way to handle this cleanly.
@@ -62,8 +72,14 @@ proc ttk::sizegrip::Press {W X Y} {
proc ttk::sizegrip::Drag {W X Y} {
variable State
if {!$State(pressed)} { return }
- set w [expr {$State(width) + ($X - $State(pressX))/$State(widthInc)}]
- set h [expr {$State(height) + ($Y - $State(pressY))/$State(heightInc)}]
+ set w $State(width)
+ set h $State(height)
+ if {$State(resizeX)} {
+ set w [expr {$w + ($X - $State(pressX))/$State(widthInc)}]
+ }
+ if {$State(resizeY)} {
+ set h [expr {$h + ($Y - $State(pressY))/$State(heightInc)}]
+ }
if {$w <= 0} { set w 1 }
if {$h <= 0} { set h 1 }
wm geometry $State(toplevel) ${w}x${h}