finch/libgnt/gnttree.c

changeset 21804
931ef2cc7cfb
parent 21273
2f91b326b3f0
child 22284
1eaf3526de19
equal deleted inserted replaced
21803:1fa4a4fa5b8f 21804:931ef2cc7cfb
73 gboolean collapsed; 73 gboolean collapsed;
74 gboolean choice; /* Is this a choice-box? 74 gboolean choice; /* Is this a choice-box?
75 If choice is true, then child will be NULL */ 75 If choice is true, then child will be NULL */
76 gboolean isselected; 76 gboolean isselected;
77 GntTextFormatFlags flags; 77 GntTextFormatFlags flags;
78 int color;
78 79
79 GntTreeRow *parent; 80 GntTreeRow *parent;
80 GntTreeRow *child; 81 GntTreeRow *child;
81 GntTreeRow *next; 82 GntTreeRow *next;
82 GntTreeRow *prev; 83 GntTreeRow *prev;
520 attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT_D); 521 attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT_D);
521 } 522 }
522 else 523 else
523 { 524 {
524 if (flags & GNT_TEXT_FLAG_DIM) 525 if (flags & GNT_TEXT_FLAG_DIM)
525 attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED)); 526 if (row->color)
527 attr |= (A_DIM | gnt_color_pair(row->color));
528 else
529 attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED));
526 else if (flags & GNT_TEXT_FLAG_HIGHLIGHT) 530 else if (flags & GNT_TEXT_FLAG_HIGHLIGHT)
527 attr |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT)); 531 attr |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT));
532 else if (row->color)
533 attr |= gnt_color_pair(row->color);
528 else 534 else
529 attr |= gnt_color_pair(GNT_COLOR_NORMAL); 535 attr |= gnt_color_pair(GNT_COLOR_NORMAL);
530 } 536 }
531 537
532 wbkgdset(widget->window, '\0' | attr); 538 wbkgdset(widget->window, '\0' | attr);
1557 1563
1558 row->flags = flags; 1564 row->flags = flags;
1559 redraw_tree(tree); /* XXX: It shouldn't be necessary to redraw the whole darned tree */ 1565 redraw_tree(tree); /* XXX: It shouldn't be necessary to redraw the whole darned tree */
1560 } 1566 }
1561 1567
1568 void gnt_tree_set_row_color(GntTree *tree, void *key, int color)
1569 {
1570 GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
1571 if (!row || row->color == color)
1572 return;
1573
1574 row->color = color;
1575 redraw_tree(tree);
1576 }
1577
1562 void gnt_tree_set_selected(GntTree *tree , void *key) 1578 void gnt_tree_set_selected(GntTree *tree , void *key)
1563 { 1579 {
1564 int dist; 1580 int dist;
1565 GntTreeRow *row = g_hash_table_lookup(tree->hash, key); 1581 GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
1566 if (!row || row == tree->current) 1582 if (!row || row == tree->current)

mercurial