summaryrefslogtreecommitdiffstats
path: root/generic/tkTreeItem.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/tkTreeItem.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/tkTreeItem.c')
-rw-r--r--generic/tkTreeItem.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/generic/tkTreeItem.c b/generic/tkTreeItem.c
index 8f9b0a7..32e9e72 100644
--- a/generic/tkTreeItem.c
+++ b/generic/tkTreeItem.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 2002-2008 Tim Baker
*
- * RCS: @(#) $Id: tkTreeItem.c,v 1.105 2008/02/29 20:49:22 treectrl Exp $
+ * RCS: @(#) $Id: tkTreeItem.c,v 1.106 2008/07/21 18:49:33 treectrl Exp $
*/
#include "tkTreeCtrl.h"
@@ -946,7 +946,8 @@ TreeItem_UndefineState(
*
* Determine whether an item should have a button displayed next to
* it. This considers the value of the item option -button as well
- * as the treectrl options -showbuttons and -showrootbutton.
+ * as the treectrl options -showbuttons, -showrootchildbuttons and
+ * -showrootbutton.
*
* Results:
* None.
@@ -965,6 +966,8 @@ TreeItem_HasButton(
{
if (!tree->showButtons || (IS_ROOT(item) && !tree->showRootButton))
return 0;
+ if (item->parent == tree->root && !tree->showRootChildButtons)
+ return 0;
if (item->flags & ITEM_FLAG_BUTTON)
return 1;
if (item->flags & ITEM_FLAG_BUTTON_AUTO) {
@@ -3610,19 +3613,27 @@ int TreeItem_Indent(
TreeItem item /* Item token. */
)
{
- int indent;
+ int depth;
if (IS_ROOT(item))
- return (tree->showRoot && tree->showButtons && tree->showRootButton) ? tree->useIndent : 0;
+ return (tree->showRoot && tree->showButtons && tree->showRootButton)
+ ? tree->useIndent : 0;
Tree_UpdateItemIndex(tree);
- indent = tree->useIndent * item->depth;
- if (tree->showRoot || tree->showButtons || tree->showLines)
- indent += tree->useIndent;
- if (tree->showRoot && tree->showButtons && tree->showRootButton)
- indent += tree->useIndent;
- return indent;
+ depth = item->depth;
+ if (tree->showRoot)
+ {
+ depth += 1;
+ if (tree->showButtons && tree->showRootButton)
+ depth += 1;
+ }
+ else if (tree->showButtons && tree->showRootChildButtons)
+ depth += 1;
+ else if (tree->showLines && tree->showRootLines)
+ depth += 1;
+
+ return tree->useIndent * depth;
}
/*