From 28acece888967f7a375694dcdf35787448d6c5e2 Mon Sep 17 00:00:00 2001 From: treectrl Date: Fri, 27 May 2005 20:03:34 +0000 Subject: New option -columnresizemode. --- doc/What's New in TkTreeCtrl.html | 4 ++++ doc/treectrl.html | 15 +++++++++++++-- doc/treectrl.man | 9 ++++++++- doc/treectrl.n | 15 ++++++++++++++- generic/tkTreeCtrl.c | 9 ++++++++- generic/tkTreeCtrl.h | 3 ++- library/treectrl.tcl | 17 +++++++++++++---- 7 files changed, 62 insertions(+), 10 deletions(-) diff --git a/doc/What's New in TkTreeCtrl.html b/doc/What's New in TkTreeCtrl.html index d2553d8..67af297 100644 --- a/doc/What's New in TkTreeCtrl.html +++ b/doc/What's New in TkTreeCtrl.html @@ -65,6 +65,10 @@ buttons/lines. + -columnresizemode + + + -itemprefix diff --git a/doc/treectrl.html b/doc/treectrl.html index 8f2a26e..c46cf3f 100644 --- a/doc/treectrl.html +++ b/doc/treectrl.html @@ -1,10 +1,10 @@ - treectrl - Tk Commands - @@ -332,6 +332,17 @@ This line can be used to give the user a visual feedback during column resizing.

+
Command-Line Switch: -columnresizemode
+Database Name: columnResizeMode
+Database Class: ColumnResizeMode
+
+Specifies the visual feedback used when resizing columns. The value should be +one of proxy or realtime. For proxy, a 1-pixel thick +vertical line is drawn representing where the right edge of the column will +be after resizing. For realtime, the column's size is changed while +the user is dragging the right edge of the column. + +

Command-Line Switch: -defaultstyle
Database Name: defaultStyle
Database Class: DefaultStyle
diff --git a/doc/treectrl.man b/doc/treectrl.man index ed51f63..b7d674b 100644 --- a/doc/treectrl.man +++ b/doc/treectrl.man @@ -3,7 +3,7 @@ See the file "license.terms" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. - $Id: treectrl.man,v 1.19 2005/05/24 23:56:27 treectrl Exp $} + $Id: treectrl.man,v 1.20 2005/05/27 20:05:13 treectrl Exp $} ][manpage_begin treectrl n 2.0] [moddesc {Tk Commands}] [titledesc {Create and manipulate hierarchical multicolumn widgets}] @@ -136,6 +136,13 @@ and uses an inverting color This line can be used to give the user a visual feedback during column resizing. +[tkoption_def -columnresizemode columnResizeMode ColumnResizeMode] +Specifies the visual feedback used when resizing columns. The value should be +one of [const proxy] or [const realtime]. For [const proxy], a 1-pixel thick +vertical line is drawn representing where the right edge of the column will +be after resizing. For [const realtime], the column's size is changed while +the user is dragging the right edge of the column. + [tkoption_def -defaultstyle defaultStyle DefaultStyle] Specifies a list of styles, one per column, to apply to each item created by the [cmd "item create"] command. The number of styles in the list can be diff --git a/doc/treectrl.n b/doc/treectrl.n index b85bf0c..d33ec89 100644 --- a/doc/treectrl.n +++ b/doc/treectrl.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" $Id: treectrl.n,v 1.35 2005/05/24 23:56:27 treectrl Exp $ +'\" $Id: treectrl.n,v 1.36 2005/05/27 20:05:13 treectrl Exp $ .so man.macros .TH "treectrl" n 2.0 "Tk Commands" .BS @@ -493,6 +493,19 @@ during column resizing. .LP .nf .ta 6c +Command-Line Switch: \fB-columnresizemode\fR +Database Name: \fBcolumnResizeMode\fR +Database Class: \fBColumnResizeMode\fR +.fi +.IP +Specifies the visual feedback used when resizing columns. The value should be +one of \fBproxy\fR or \fBrealtime\fR. For \fBproxy\fR, a 1-pixel thick +vertical line is drawn representing where the right edge of the column will +be after resizing. For \fBrealtime\fR, the column's size is changed while +the user is dragging the right edge of the column. +.LP +.nf +.ta 6c Command-Line Switch: \fB-defaultstyle\fR Database Name: \fBdefaultStyle\fR Database Class: \fBDefaultStyle\fR diff --git a/generic/tkTreeCtrl.c b/generic/tkTreeCtrl.c index b2a5b9f..13f8726 100644 --- a/generic/tkTreeCtrl.c +++ b/generic/tkTreeCtrl.c @@ -7,7 +7,7 @@ * Copyright (c) 2002-2003 Christian Krone * Copyright (c) 2003-2004 ActiveState, a division of Sophos * - * RCS: @(#) $Id: tkTreeCtrl.c,v 1.39 2005/05/24 23:42:21 treectrl Exp $ + * RCS: @(#) $Id: tkTreeCtrl.c,v 1.40 2005/05/27 20:03:34 treectrl Exp $ */ #include "tkTreeCtrl.h" @@ -31,6 +31,9 @@ static CONST char *bgModeST[] = { "column", "order", "ordervisible", "row", "index", "visindex", (char *) NULL }; +static CONST char *columnResizeModeST[] = { + "proxy", "realtime", (char *) NULL +}; static CONST char *doubleBufferST[] = { "none", "item", "window", (char *) NULL }; @@ -55,6 +58,10 @@ static Tk_OptionSpec optionSpecs[] = { "backgroundMode", "BackgroundMode", "row", -1, Tk_Offset(TreeCtrl, backgroundMode), 0, (ClientData) bgModeST, TREE_CONF_REDISPLAY}, + {TK_OPTION_STRING_TABLE, "-columnresizemode", + "columnResizeMode", "ColumnResizeMode", + "proxy", -1, Tk_Offset(TreeCtrl, columnResizeMode), + 0, (ClientData) columnResizeModeST, 0}, {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL, (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth"}, {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL, diff --git a/generic/tkTreeCtrl.h b/generic/tkTreeCtrl.h index 03f0f59..e874156 100644 --- a/generic/tkTreeCtrl.h +++ b/generic/tkTreeCtrl.h @@ -7,7 +7,7 @@ * Copyright (c) 2002-2003 Christian Krone * Copyright (c) 2003 ActiveState Corporation * - * RCS: @(#) $Id: tkTreeCtrl.h,v 1.30 2005/05/24 23:41:22 treectrl Exp $ + * RCS: @(#) $Id: tkTreeCtrl.h,v 1.31 2005/05/27 20:03:35 treectrl Exp $ */ #include "tkPort.h" @@ -199,6 +199,7 @@ struct TreeCtrl #define BG_MODE_INDEX 4 /* compatibility */ #define BG_MODE_VISINDEX 5 /* compatibility */ int backgroundMode; /* -backgroundmode */ + int columnResizeMode; /* -columnresizemode */ int *itemPadX; /* -itempadx */ Tcl_Obj *itemPadXObj; /* -itempadx */ int *itemPadY; /* -itempady */ diff --git a/library/treectrl.tcl b/library/treectrl.tcl index 1fa6964..725a1a0 100644 --- a/library/treectrl.tcl +++ b/library/treectrl.tcl @@ -456,10 +456,19 @@ proc ::TreeCtrl::Motion1 {w x y} { if {$width == 0} { incr width } - scan [$w column bbox $Priv(column)] "%d %d %d %d" x1 y1 x2 y2 - # Use "ne" because -columnproxy could be "" - if {($x1 + $width - 1) ne [$w cget -columnproxy]} { - $w configure -columnproxy [expr {$x1 + $width - 1}] + switch -- [$w cget -columnresizemode] { + proxy { + scan [$w column bbox $Priv(column)] "%d %d %d %d" x1 y1 x2 y2 + # Use "ne" because -columnproxy could be "" + if {($x1 + $width - 1) ne [$w cget -columnproxy]} { + $w configure -columnproxy [expr {$x1 + $width - 1}] + } + } + realtime { + if {[$w column cget $Priv(column) -width] != $width} { + $w column configure $Priv(column) -width $width + } + } } } } -- cgit v0.12