summaryrefslogtreecommitdiffstats
path: root/generic/tkTreeItem.c
diff options
context:
space:
mode:
authortreectrl <treectrl>2005-03-29 21:05:55 (GMT)
committertreectrl <treectrl>2005-03-29 21:05:55 (GMT)
commit71aac1a8f7fd45283b21a3512ab60eac8687e2b8 (patch)
treeeb32bd97c10374b1e4a0aebec8ac811fbc2c9621 /generic/tkTreeItem.c
parent8b0fa47e1b634cfb4371e0288405ddd3623a4366 (diff)
downloadtktreectrl-71aac1a8f7fd45283b21a3512ab60eac8687e2b8.zip
tktreectrl-71aac1a8f7fd45283b21a3512ab60eac8687e2b8.tar.gz
tktreectrl-71aac1a8f7fd45283b21a3512ab60eac8687e2b8.tar.bz2
New -showrootlines config option.
Don't draw horizontal line to self unless it connects to a vertical line or our button.
Diffstat (limited to 'generic/tkTreeItem.c')
-rw-r--r--generic/tkTreeItem.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/generic/tkTreeItem.c b/generic/tkTreeItem.c
index 26b3710..b821a40 100644
--- a/generic/tkTreeItem.c
+++ b/generic/tkTreeItem.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 2002-2004 Tim Baker
*
- * RCS: @(#) $Id: tkTreeItem.c,v 1.26 2005/02/15 00:48:51 hobbs2 Exp $
+ * RCS: @(#) $Id: tkTreeItem.c,v 1.27 2005/03/29 21:05:55 treectrl Exp $
*/
#include "tkTreeCtrl.h"
@@ -456,6 +456,17 @@ TreeItem TreeItem_GetNextSibling(TreeCtrl *tree, TreeItem item_)
return (TreeItem) item->nextSibling;
}
+TreeItem TreeItem_NextSiblingVisible(TreeCtrl *tree, TreeItem item)
+{
+ item = TreeItem_GetNextSibling(tree, item);
+ while (item != NULL) {
+ if (TreeItem_ReallyVisible(tree, item))
+ return item;
+ item = TreeItem_GetNextSibling(tree, item);
+ }
+ return NULL;
+}
+
TreeItem TreeItem_SetPrevSibling(TreeCtrl *tree, TreeItem item_,
TreeItem prevSibling)
{
@@ -1547,6 +1558,7 @@ void TreeItem_DrawLines(TreeCtrl *tree, TreeItem item_, int x, int y, int width,
Item *item, *parent;
int indent, left, lineLeft, lineTop;
int hasPrev, hasNext;
+ int hasButton;
int i, vert = 0;
indent = TreeItem_Indent(tree, item_);
@@ -1579,6 +1591,10 @@ void TreeItem_DrawLines(TreeCtrl *tree, TreeItem item_, int x, int y, int width,
item = item->nextSibling;
hasNext = (item != NULL);
+ /* Option: Don't connect children of root item */
+ if ((self->parent != NULL) && ISROOT(self->parent) && !tree->showRootLines)
+ hasPrev = hasNext = FALSE;
+
/* Vertical line to parent and/or previous/next sibling */
if (hasPrev || hasNext) {
int top = y, bottom = y + height;
@@ -1606,7 +1622,10 @@ void TreeItem_DrawLines(TreeCtrl *tree, TreeItem item_, int x, int y, int width,
}
/* Horizontal line to self */
- if (!ISROOT(self) || (tree->showRoot && tree->showButtons && tree->showRootButton)) {
+ hasButton = tree->showButtons && self->hasButton;
+ if (ISROOT(self) && !tree->showRootButton)
+ hasButton = FALSE;
+ if (hasButton || hasPrev || hasNext) {
if (tree->lineStyle == LINE_STYLE_DOT) {
for (i = 0; i < tree->lineThickness; i++)
HDotLine(tree, drawable, tree->lineGC,
@@ -1627,6 +1646,10 @@ void TreeItem_DrawLines(TreeCtrl *tree, TreeItem item_, int x, int y, int width,
parent = parent->parent) {
lineLeft -= tree->useIndent;
+ /* Option: Don't connect children of root item */
+ if ((parent->parent != NULL) && ISROOT(parent->parent) && !tree->showRootLines)
+ continue;
+
/* Check for ReallyVisible next sibling */
item = parent->nextSibling;
while ((item != NULL) && !item->isVisible)