new function to set/unset the selectable flag of a single row.

* gtk/gtkclist.c (gtk_clist_set_selectable): new function
  to set/unset the selectable flag of a single row.
  (gtk_clist_get_selectable): new function
  to get the state of the selectable flag

* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
  (gtk_ctree_node_get_selectable): clist analogons
This commit is contained in:
Lars Hamann
1998-09-11 13:52:42 +00:00
parent 6d13f0f9b3
commit cb7c4d6c7f
11 changed files with 288 additions and 63 deletions

View File

@ -1,3 +1,13 @@
Fri Sep 11 15:25:10 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_set_selectable): new function
to set/unset the selectable flag of a single row.
(gtk_clist_get_selectable): new function
to get the state of the selectable flag
* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
(gtk_ctree_node_get_selectable): clist analogons
Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org> Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org>
* gtk/testrgb.c (testrgb_rgb_test): Small changes to the test * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test

View File

@ -1,3 +1,13 @@
Fri Sep 11 15:25:10 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_set_selectable): new function
to set/unset the selectable flag of a single row.
(gtk_clist_get_selectable): new function
to get the state of the selectable flag
* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
(gtk_ctree_node_get_selectable): clist analogons
Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org> Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org>
* gtk/testrgb.c (testrgb_rgb_test): Small changes to the test * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test

View File

@ -1,3 +1,13 @@
Fri Sep 11 15:25:10 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_set_selectable): new function
to set/unset the selectable flag of a single row.
(gtk_clist_get_selectable): new function
to get the state of the selectable flag
* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
(gtk_ctree_node_get_selectable): clist analogons
Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org> Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org>
* gtk/testrgb.c (testrgb_rgb_test): Small changes to the test * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test

View File

@ -1,3 +1,13 @@
Fri Sep 11 15:25:10 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_set_selectable): new function
to set/unset the selectable flag of a single row.
(gtk_clist_get_selectable): new function
to get the state of the selectable flag
* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
(gtk_ctree_node_get_selectable): clist analogons
Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org> Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org>
* gtk/testrgb.c (testrgb_rgb_test): Small changes to the test * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test

View File

@ -1,3 +1,13 @@
Fri Sep 11 15:25:10 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_set_selectable): new function
to set/unset the selectable flag of a single row.
(gtk_clist_get_selectable): new function
to get the state of the selectable flag
* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
(gtk_ctree_node_get_selectable): clist analogons
Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org> Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org>
* gtk/testrgb.c (testrgb_rgb_test): Small changes to the test * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test

View File

@ -1,3 +1,13 @@
Fri Sep 11 15:25:10 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_set_selectable): new function
to set/unset the selectable flag of a single row.
(gtk_clist_get_selectable): new function
to get the state of the selectable flag
* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
(gtk_ctree_node_get_selectable): clist analogons
Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org> Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org>
* gtk/testrgb.c (testrgb_rgb_test): Small changes to the test * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test

View File

@ -1,3 +1,13 @@
Fri Sep 11 15:25:10 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_set_selectable): new function
to set/unset the selectable flag of a single row.
(gtk_clist_get_selectable): new function
to get the state of the selectable flag
* gtk/gtkctree.c (gtk_ctree_node_set_selectable)
(gtk_ctree_node_get_selectable): clist analogons
Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org> Thu Sep 10 17:04:03 1998 Raph Levien <raph@gimp.org>
* gtk/testrgb.c (testrgb_rgb_test): Small changes to the test * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test

View File

@ -1624,6 +1624,66 @@ gtk_clist_set_shift (GtkCList * clist,
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
} }
void
gtk_clist_set_selectable (GtkCList *clist,
gint row,
gboolean selectable)
{
GtkCListRow *clist_row;
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
if (row < 0 || row >= clist->rows)
return;
clist_row = (g_list_nth (clist->row_list, row))->data;
if (selectable == clist_row->selectable)
return;
clist_row->selectable = selectable;
if (!selectable && clist_row->state == GTK_STATE_SELECTED)
{
if (clist->anchor >= 0 &&
clist->selection_mode == GTK_SELECTION_EXTENDED)
{
if ((gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_FOCUS (clist)))
{
GTK_CLIST_UNSET_FLAG (clist, CLIST_DRAG_SELECTION);
gtk_grab_remove (GTK_WIDGET (clist));
gdk_pointer_ungrab (GDK_CURRENT_TIME);
if (clist->htimer)
{
gtk_timeout_remove (clist->htimer);
clist->htimer = 0;
}
if (clist->vtimer)
{
gtk_timeout_remove (clist->vtimer);
clist->vtimer = 0;
}
}
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
}
unselect_row (clist, row, -1, NULL);
}
}
gboolean
gtk_clist_get_selectable (GtkCList *clist,
gint row)
{
g_return_val_if_fail (clist != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CLIST (clist), FALSE);
if (row < 0 || row >= clist->rows)
return FALSE;
return GTK_CLIST_ROW (g_list_nth (clist->row_list, row))->selectable;
}
gint gint
gtk_clist_append (GtkCList * clist, gtk_clist_append (GtkCList * clist,
gchar * text[]) gchar * text[])
@ -4010,7 +4070,7 @@ real_select_row (GtkCList * clist,
clist_row = (g_list_nth (clist->row_list, row))->data; clist_row = (g_list_nth (clist->row_list, row))->data;
if (clist_row->state != GTK_STATE_NORMAL) if (clist_row->state != GTK_STATE_NORMAL || !clist_row->selectable)
return; return;
clist_row->state = GTK_STATE_SELECTED; clist_row->state = GTK_STATE_SELECTED;
@ -4716,6 +4776,7 @@ row_new (GtkCList * clist)
clist_row->fg_set = FALSE; clist_row->fg_set = FALSE;
clist_row->bg_set = FALSE; clist_row->bg_set = FALSE;
clist_row->selectable = TRUE;
clist_row->state = GTK_STATE_NORMAL; clist_row->state = GTK_STATE_NORMAL;
clist_row->data = NULL; clist_row->data = NULL;
clist_row->destroy = NULL; clist_row->destroy = NULL;
@ -4901,9 +4962,17 @@ gtk_clist_focus_in (GtkWidget *widget,
if (clist->selection_mode == GTK_SELECTION_BROWSE && if (clist->selection_mode == GTK_SELECTION_BROWSE &&
clist->selection == NULL && clist->focus_row > -1) clist->selection == NULL && clist->focus_row > -1)
{
GList *list;
list = g_list_nth (clist->row_list, clist->focus_row);
if (list && GTK_CLIST_ROW (list)->selectable)
select_row (clist, clist->focus_row, -1, (GdkEvent *) event); select_row (clist, clist->focus_row, -1, (GdkEvent *) event);
else else
gtk_widget_draw_focus (widget); gtk_widget_draw_focus (widget);
}
else
gtk_widget_draw_focus (widget);
return FALSE; return FALSE;
} }
@ -4970,10 +5039,8 @@ toggle_focus_row (GtkCList *clist)
{ {
case GTK_SELECTION_SINGLE: case GTK_SELECTION_SINGLE:
case GTK_SELECTION_MULTIPLE: case GTK_SELECTION_MULTIPLE:
toggle_row (clist, clist->focus_row, 0, NULL); toggle_row (clist, clist->focus_row, 0, NULL);
break; break;
case GTK_SELECTION_EXTENDED: case GTK_SELECTION_EXTENDED:
g_list_free (clist->undo_selection); g_list_free (clist->undo_selection);
g_list_free (clist->undo_unselection); g_list_free (clist->undo_unselection);
@ -4991,7 +5058,6 @@ toggle_focus_row (GtkCList *clist)
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
break; break;
default: default:
break; break;
} }
@ -5267,7 +5333,6 @@ resync_selection (GtkCList *clist,
if (clist->undo_selection) if (clist->undo_selection)
{ {
list = clist->selection; list = clist->selection;
clist->selection = clist->undo_selection; clist->selection = clist->undo_selection;
clist->selection_end = g_list_last (clist->selection); clist->selection_end = g_list_last (clist->selection);
@ -5280,6 +5345,8 @@ resync_selection (GtkCList *clist,
if (row < i || row > e) if (row < i || row > e)
{ {
clist_row = g_list_nth (clist->row_list, row)->data; clist_row = g_list_nth (clist->row_list, row)->data;
if (clist_row->selectable)
{
clist_row->state = GTK_STATE_SELECTED; clist_row->state = GTK_STATE_SELECTED;
unselect_row (clist, row, -1, event); unselect_row (clist, row, -1, event);
clist->undo_selection = g_list_prepend clist->undo_selection = g_list_prepend
@ -5287,8 +5354,11 @@ resync_selection (GtkCList *clist,
} }
} }
} }
}
for (list = g_list_nth (clist->row_list, i); i <= e; i++, list = list->next) for (list = g_list_nth (clist->row_list, i); i <= e; i++, list = list->next)
if (GTK_CLIST_ROW (list)->selectable)
{
if (g_list_find (clist->selection, GINT_TO_POINTER(i))) if (g_list_find (clist->selection, GINT_TO_POINTER(i)))
{ {
if (GTK_CLIST_ROW (list)->state == GTK_STATE_NORMAL) if (GTK_CLIST_ROW (list)->state == GTK_STATE_NORMAL)
@ -5305,6 +5375,7 @@ resync_selection (GtkCList *clist,
clist->undo_unselection = g_list_prepend (clist->undo_unselection, clist->undo_unselection = g_list_prepend (clist->undo_unselection,
GINT_TO_POINTER (i)); GINT_TO_POINTER (i));
} }
}
for (list = clist->undo_unselection; list; list = list->next) for (list = clist->undo_unselection; list; list = list->next)
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW], gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
@ -5397,6 +5468,7 @@ update_extended_selection (GtkCList *clist,
{ {
for (i = s1, list = g_list_nth (clist->row_list, i); i <= e1; for (i = s1, list = g_list_nth (clist->row_list, i); i <= e1;
i++, list = list->next) i++, list = list->next)
if (GTK_CLIST_ROW (list)->selectable)
{ {
if (GTK_CLIST_CLASS_FW (clist)->selection_find (clist, i, list)) if (GTK_CLIST_CLASS_FW (clist)->selection_find (clist, i, list))
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED; GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
@ -5434,7 +5506,8 @@ update_extended_selection (GtkCList *clist,
{ {
for (i = s2, list = g_list_nth (clist->row_list, i); i <= e2; for (i = s2, list = g_list_nth (clist->row_list, i); i <= e2;
i++, list = list->next) i++, list = list->next)
if (GTK_CLIST_ROW (list)->state != clist->anchor_state) if (GTK_CLIST_ROW (list)->selectable &&
GTK_CLIST_ROW (list)->state != clist->anchor_state)
GTK_CLIST_ROW (list)->state = clist->anchor_state; GTK_CLIST_ROW (list)->state = clist->anchor_state;
top = ROW_TOP_YPIXEL (clist, clist->focus_row); top = ROW_TOP_YPIXEL (clist, clist->focus_row);
@ -5947,7 +6020,8 @@ fake_unselect_all (GtkCList * clist,
if (row >= 0 && (work = g_list_nth (clist->row_list, row))) if (row >= 0 && (work = g_list_nth (clist->row_list, row)))
{ {
if (GTK_CLIST_ROW (work)->state == GTK_STATE_NORMAL) if (GTK_CLIST_ROW (work)->state == GTK_STATE_NORMAL &&
GTK_CLIST_ROW (work)->selectable)
{ {
GTK_CLIST_ROW (work)->state = GTK_STATE_SELECTED; GTK_CLIST_ROW (work)->state = GTK_STATE_SELECTED;
@ -5982,7 +6056,8 @@ fake_toggle_row (GtkCList *clist,
{ {
GList *work; GList *work;
if (!(work = g_list_nth (clist->row_list, row))) if (!(work = g_list_nth (clist->row_list, row))||
!GTK_CLIST_ROW (work)->selectable)
return; return;
if (GTK_CLIST_ROW (work)->state == GTK_STATE_NORMAL) if (GTK_CLIST_ROW (work)->state == GTK_STATE_NORMAL)

View File

@ -277,6 +277,7 @@ struct _GtkCListRow
gint fg_set : 1; gint fg_set : 1;
gint bg_set : 1; gint bg_set : 1;
gint selectable : 1;
}; };
/* Cell Structures */ /* Cell Structures */
@ -518,6 +519,13 @@ void gtk_clist_set_shift (GtkCList *clist,
gint vertical, gint vertical,
gint horizontal); gint horizontal);
/* set/get selectable flag of a single row */
void gtk_clist_set_selectable (GtkCList *clist,
gint row,
gboolean selectable);
gboolean gtk_clist_get_selectable (GtkCList *clist,
gint row);
/* append returns the index of the row you just added, making /* append returns the index of the row you just added, making
* it easier to append and modify a row * it easier to append and modify a row
*/ */

View File

@ -3239,7 +3239,8 @@ tree_select (GtkCTree *ctree,
GtkCTreeNode *node, GtkCTreeNode *node,
gpointer data) gpointer data)
{ {
if (node && GTK_CTREE_ROW (node)->row.state != GTK_STATE_SELECTED) if (node && GTK_CTREE_ROW (node)->row.state != GTK_STATE_SELECTED &&
GTK_CTREE_ROW (node)->row.selectable)
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
node, -1); node, -1);
} }
@ -3317,6 +3318,7 @@ row_new (GtkCTree *ctree)
ctree_row->row.fg_set = FALSE; ctree_row->row.fg_set = FALSE;
ctree_row->row.bg_set = FALSE; ctree_row->row.bg_set = FALSE;
ctree_row->row.selectable = TRUE;
ctree_row->row.state = GTK_STATE_NORMAL; ctree_row->row.state = GTK_STATE_NORMAL;
ctree_row->row.data = NULL; ctree_row->row.data = NULL;
ctree_row->row.destroy = NULL; ctree_row->row.destroy = NULL;
@ -3379,7 +3381,8 @@ real_select_row (GtkCList *clist,
g_return_if_fail (clist != NULL); g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CTREE (clist)); g_return_if_fail (GTK_IS_CTREE (clist));
if ((node = g_list_nth (clist->row_list, row))) if ((node = g_list_nth (clist->row_list, row)) &&
GTK_CTREE_ROW (node)->row.selectable)
gtk_signal_emit (GTK_OBJECT (clist), ctree_signals[TREE_SELECT_ROW], gtk_signal_emit (GTK_OBJECT (clist), ctree_signals[TREE_SELECT_ROW],
node, column); node, column);
} }
@ -3413,7 +3416,8 @@ real_tree_select (GtkCTree *ctree,
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree)); g_return_if_fail (GTK_IS_CTREE (ctree));
if (!node || GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED) if (!node || GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED ||
!GTK_CTREE_ROW (node)->row.selectable)
return; return;
clist = GTK_CLIST (ctree); clist = GTK_CLIST (ctree);
@ -3502,13 +3506,14 @@ tree_toggle_selection (GtkCTree *ctree,
if (node && GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED) if (node && GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_UNSELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_UNSELECT_ROW],
node, column); node, column);
else if (node) else if (node && GTK_CTREE_ROW (node)->row.selectable)
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
node, column); node, column);
break; break;
case GTK_SELECTION_BROWSE: case GTK_SELECTION_BROWSE:
if (node && GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL) if (node && GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL &&
GTK_CTREE_ROW (node)->row.selectable)
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
node, column); node, column);
break; break;
@ -3523,7 +3528,8 @@ select_row_recursive (GtkCTree *ctree,
GtkCTreeNode *node, GtkCTreeNode *node,
gpointer data) gpointer data)
{ {
if (!node || GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED) if (!node || GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED ||
!GTK_CTREE_ROW (node)->row.selectable)
return; return;
GTK_CLIST (ctree)->undo_unselection = GTK_CLIST (ctree)->undo_unselection =
@ -4553,6 +4559,7 @@ gtk_ctree_select (GtkCTree *ctree,
g_return_if_fail (GTK_IS_CTREE (ctree)); g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
if (GTK_CTREE_ROW (node)->row.selectable)
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
node, -1); node, -1);
} }
@ -4799,6 +4806,60 @@ gtk_ctree_node_set_shift (GtkCTree *ctree,
tree_draw_node (ctree, node); tree_draw_node (ctree, node);
} }
void
gtk_ctree_node_set_selectable (GtkCTree *ctree,
GtkCTreeNode *node,
gboolean selectable)
{
g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL);
if (selectable == GTK_CTREE_ROW (node)->row.selectable)
return;
GTK_CTREE_ROW (node)->row.selectable = selectable;
if (!selectable && GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
{
GtkCList *clist;
clist = GTK_CLIST (ctree);
if (clist->anchor >= 0 &&
clist->selection_mode == GTK_SELECTION_EXTENDED)
{
if ((gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_FOCUS (clist)))
{
GTK_CLIST_UNSET_FLAG (clist, CLIST_DRAG_SELECTION);
gtk_grab_remove (GTK_WIDGET (clist));
gdk_pointer_ungrab (GDK_CURRENT_TIME);
if (clist->htimer)
{
gtk_timeout_remove (clist->htimer);
clist->htimer = 0;
}
if (clist->vtimer)
{
gtk_timeout_remove (clist->vtimer);
clist->vtimer = 0;
}
}
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
}
gtk_ctree_unselect (ctree, node);
}
}
gboolean
gtk_ctree_node_get_selectable (GtkCTree *ctree,
GtkCTreeNode *node)
{
g_return_val_if_fail (node != NULL, FALSE);
return GTK_CTREE_ROW (node)->row.selectable;
}
GtkCellType GtkCellType
gtk_ctree_node_get_cell_type (GtkCTree *ctree, gtk_ctree_node_get_cell_type (GtkCTree *ctree,
GtkCTreeNode *node, GtkCTreeNode *node,
@ -5327,7 +5388,8 @@ fake_unselect_all (GtkCList *clist,
if (row >= 0 && (focus_node = g_list_nth (clist->row_list, row))) if (row >= 0 && (focus_node = g_list_nth (clist->row_list, row)))
{ {
if (GTK_CTREE_ROW (focus_node)->row.state == GTK_STATE_NORMAL) if (GTK_CTREE_ROW (focus_node)->row.state == GTK_STATE_NORMAL &&
GTK_CTREE_ROW (focus_node)->row.selectable)
{ {
GTK_CTREE_ROW (focus_node)->row.state = GTK_STATE_SELECTED; GTK_CTREE_ROW (focus_node)->row.state = GTK_STATE_SELECTED;
@ -5410,7 +5472,7 @@ resync_selection (GtkCList *clist, GdkEvent *event)
if (row >= i && row <= e) if (row >= i && row <= e)
unselect = FALSE; unselect = FALSE;
} }
if (unselect) if (unselect && GTK_CTREE_ROW (node)->row.selectable)
{ {
GTK_CTREE_ROW (node)->row.state = GTK_STATE_SELECTED; GTK_CTREE_ROW (node)->row.state = GTK_STATE_SELECTED;
gtk_ctree_unselect (ctree, node); gtk_ctree_unselect (ctree, node);
@ -5423,6 +5485,8 @@ resync_selection (GtkCList *clist, GdkEvent *event)
for (node = GTK_CTREE_NODE (g_list_nth (clist->row_list, i)); i <= e; for (node = GTK_CTREE_NODE (g_list_nth (clist->row_list, i)); i <= e;
i++, node = GTK_CTREE_NODE_NEXT (node)) i++, node = GTK_CTREE_NODE_NEXT (node))
if (GTK_CTREE_ROW (node)->row.selectable)
{
if (g_list_find (clist->selection, node)) if (g_list_find (clist->selection, node))
{ {
if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL) if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL)
@ -5439,6 +5503,7 @@ resync_selection (GtkCList *clist, GdkEvent *event)
clist->undo_unselection = g_list_prepend (clist->undo_unselection, clist->undo_unselection = g_list_prepend (clist->undo_unselection,
node); node);
} }
}
for (list = clist->undo_unselection; list; list = list->next) for (list = clist->undo_unselection; list; list = list->next)
gtk_ctree_select (ctree, list->data); gtk_ctree_select (ctree, list->data);
@ -5471,9 +5536,11 @@ real_undo_selection (GtkCList *clist)
ctree = GTK_CTREE (clist); ctree = GTK_CTREE (clist);
for (work = clist->undo_selection; work; work = work->next) for (work = clist->undo_selection; work; work = work->next)
if (GTK_CTREE_ROW (work->data)->row.selectable)
gtk_ctree_select (ctree, GTK_CTREE_NODE (work->data)); gtk_ctree_select (ctree, GTK_CTREE_NODE (work->data));
for (work = clist->undo_unselection; work; work = work->next) for (work = clist->undo_unselection; work; work = work->next)
if (GTK_CTREE_ROW (work->data)->row.selectable)
gtk_ctree_unselect (ctree, GTK_CTREE_NODE (work->data)); gtk_ctree_unselect (ctree, GTK_CTREE_NODE (work->data));
if (GTK_WIDGET_HAS_FOCUS (clist) && clist->focus_row != clist->undo_anchor) if (GTK_WIDGET_HAS_FOCUS (clist) && clist->focus_row != clist->undo_anchor)

View File

@ -321,6 +321,11 @@ void gtk_ctree_node_set_shift (GtkCTree *ctree,
gint column, gint column,
gint vertical, gint vertical,
gint horizontal); gint horizontal);
void gtk_ctree_node_set_selectable (GtkCTree *ctree,
GtkCTreeNode *node,
gboolean selectable);
gboolean gtk_ctree_node_get_selectable (GtkCTree *ctree,
GtkCTreeNode *node);
GtkCellType gtk_ctree_node_get_cell_type (GtkCTree *ctree, GtkCellType gtk_ctree_node_get_cell_type (GtkCTree *ctree,
GtkCTreeNode *node, GtkCTreeNode *node,
gint column); gint column);