summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--library/ttk/sizegrip.tcl22
2 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e687bc..ca91bfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-04 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/sizegrip.tcl: Don't resize if the toplevel is not resizable
+ or the sizegrip has been disabled.
+
2008-04-03 Pat Thoyts <patthoyts@users.sourceforge.net>
* win/makefile.vc: Fixed stubs usage
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}