summaryrefslogtreecommitdiffstats
path: root/generic/tkTreeCtrl.c
diff options
context:
space:
mode:
authortreectrl <treectrl>2008-07-21 18:49:31 (GMT)
committertreectrl <treectrl>2008-07-21 18:49:31 (GMT)
commit70d0d3be91f655f8ae97ec29b70c2a415acc39e9 (patch)
tree3f743a0ad58c5ddb2fef451c72655ccdc36f9a26 /generic/tkTreeCtrl.c
parentf160c8079bfbc9a8aa616f18bf02d9e7b58a9a9e (diff)
downloadtktreectrl-70d0d3be91f655f8ae97ec29b70c2a415acc39e9.zip
tktreectrl-70d0d3be91f655f8ae97ec29b70c2a415acc39e9.tar.gz
tktreectrl-70d0d3be91f655f8ae97ec29b70c2a415acc39e9.tar.bz2
Added option -showrootchildbuttons.
Bumped version to 2.2.7.
Diffstat (limited to 'generic/tkTreeCtrl.c')
-rw-r--r--generic/tkTreeCtrl.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/generic/tkTreeCtrl.c b/generic/tkTreeCtrl.c
index adbc543..26d8eb0 100644
--- a/generic/tkTreeCtrl.c
+++ b/generic/tkTreeCtrl.c
@@ -7,7 +7,7 @@
* Copyright (c) 2002-2003 Christian Krone
* Copyright (c) 2003-2005 ActiveState, a division of Sophos
*
- * RCS: @(#) $Id: tkTreeCtrl.c,v 1.107 2008/01/22 01:03:02 treectrl Exp $
+ * RCS: @(#) $Id: tkTreeCtrl.c,v 1.108 2008/07/21 18:49:32 treectrl Exp $
*/
#include "tkTreeCtrl.h"
@@ -236,6 +236,9 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BOOLEAN, "-showrootbutton", "showRootButton",
"ShowRootButton", "0", -1, Tk_Offset(TreeCtrl, showRootButton),
0, (ClientData) NULL, TREE_CONF_RELAYOUT},
+ {TK_OPTION_BOOLEAN, "-showrootchildbuttons", "showRootChildButtons",
+ "ShowRootChildButtons", "1", -1, Tk_Offset(TreeCtrl, showRootChildButtons),
+ 0, (ClientData) NULL, TREE_CONF_RELAYOUT},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_LISTBOX_TAKE_FOCUS, -1, Tk_Offset(TreeCtrl, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
@@ -905,12 +908,18 @@ static int TreeWidgetCmd(
sprintf(buf, "item %s%d", tree->itemPrefix, TreeItem_GetID(tree, item)); /* TreeItem_ToObj() */
depth = TreeItem_GetDepth(tree, item);
- if (tree->showRoot || tree->showButtons || tree->showLines)
- depth++;
- if (tree->showRoot && tree->showButtons && tree->showRootButton)
- depth++;
if (item == tree->root)
depth = (tree->showButtons && tree->showRootButton) ? 1 : 0;
+ else if (tree->showRoot)
+ {
+ depth++;
+ if (tree->showButtons && tree->showRootButton)
+ depth++;
+ }
+ else if (tree->showButtons && tree->showRootChildButtons)
+ depth += 1;
+ else if (tree->showLines && tree->showRootLines)
+ depth += 1;
lock = (hit == TREE_AREA_LEFT) ? COLUMN_LOCK_LEFT :
(hit == TREE_AREA_RIGHT) ? COLUMN_LOCK_RIGHT :
@@ -3229,11 +3238,11 @@ A_YviewCmd(
break;
}
- /* Don't scroll too far left */
+ /* Don't scroll too far up */
if (index < 0)
index = 0;
- /* Don't scroll too far right */
+ /* Don't scroll too far down */
if (index > indexMax)
index = indexMax;