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:
10
ChangeLog
10
ChangeLog
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
139
gtk/gtkclist.c
139
gtk/gtkclist.c
@ -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,7 +4962,15 @@ 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)
|
||||||
select_row (clist, clist->focus_row, -1, (GdkEvent *) event);
|
{
|
||||||
|
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);
|
||||||
|
else
|
||||||
|
gtk_widget_draw_focus (widget);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_draw_focus (widget);
|
gtk_widget_draw_focus (widget);
|
||||||
|
|
||||||
@ -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,30 +5345,36 @@ 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;
|
||||||
clist_row->state = GTK_STATE_SELECTED;
|
if (clist_row->selectable)
|
||||||
unselect_row (clist, row, -1, event);
|
{
|
||||||
clist->undo_selection = g_list_prepend
|
clist_row->state = GTK_STATE_SELECTED;
|
||||||
(clist->undo_selection, GINT_TO_POINTER (row));
|
unselect_row (clist, row, -1, event);
|
||||||
|
clist->undo_selection = g_list_prepend
|
||||||
|
(clist->undo_selection, GINT_TO_POINTER (row));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (g_list_find (clist->selection, GINT_TO_POINTER(i)))
|
if (GTK_CLIST_ROW (list)->selectable)
|
||||||
{
|
{
|
||||||
if (GTK_CLIST_ROW (list)->state == GTK_STATE_NORMAL)
|
if (g_list_find (clist->selection, GINT_TO_POINTER(i)))
|
||||||
{
|
{
|
||||||
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
|
if (GTK_CLIST_ROW (list)->state == GTK_STATE_NORMAL)
|
||||||
unselect_row (clist, i, -1, event);
|
{
|
||||||
clist->undo_selection = g_list_prepend (clist->undo_selection,
|
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
|
||||||
GINT_TO_POINTER (i));
|
unselect_row (clist, i, -1, event);
|
||||||
|
clist->undo_selection = g_list_prepend (clist->undo_selection,
|
||||||
|
GINT_TO_POINTER (i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (GTK_CLIST_ROW (list)->state == GTK_STATE_SELECTED)
|
||||||
|
{
|
||||||
|
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
|
||||||
|
clist->undo_unselection = g_list_prepend (clist->undo_unselection,
|
||||||
|
GINT_TO_POINTER (i));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (GTK_CLIST_ROW (list)->state == GTK_STATE_SELECTED)
|
|
||||||
{
|
|
||||||
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
|
|
||||||
clist->undo_unselection = g_list_prepend (clist->undo_unselection,
|
|
||||||
GINT_TO_POINTER (i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list = clist->undo_unselection; list; list = list->next)
|
for (list = clist->undo_unselection; list; list = list->next)
|
||||||
@ -5397,12 +5468,13 @@ 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))
|
{
|
||||||
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
|
if (GTK_CLIST_CLASS_FW (clist)->selection_find (clist, i, list))
|
||||||
else
|
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
|
||||||
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
|
else
|
||||||
}
|
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
top = ROW_TOP_YPIXEL (clist, clist->focus_row);
|
top = ROW_TOP_YPIXEL (clist, clist->focus_row);
|
||||||
|
|
||||||
@ -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);
|
||||||
@ -5459,7 +5532,7 @@ update_extended_selection (GtkCList *clist,
|
|||||||
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);
|
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);
|
||||||
|
|
||||||
y2 = ROW_TOP_YPIXEL (clist, s2);
|
y2 = ROW_TOP_YPIXEL (clist, s2);
|
||||||
h2 = (e2-s2+1) * (clist->row_height + CELL_SPACING);
|
h2 = (e2 - s2 + 1) * (clist->row_height + CELL_SPACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
area.y = MAX (0, MIN (y1, y2));
|
area.y = MAX (0, MIN (y1, y2));
|
||||||
@ -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)
|
||||||
|
@ -275,8 +275,9 @@ struct _GtkCListRow
|
|||||||
gpointer data;
|
gpointer data;
|
||||||
GtkDestroyNotify destroy;
|
GtkDestroyNotify destroy;
|
||||||
|
|
||||||
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
|
||||||
*/
|
*/
|
||||||
|
125
gtk/gtkctree.c
125
gtk/gtkctree.c
@ -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);
|
||||||
}
|
}
|
||||||
@ -3315,11 +3316,12 @@ row_new (GtkCTree *ctree)
|
|||||||
|
|
||||||
GTK_CELL_PIXTEXT (ctree_row->row.cell[ctree->tree_column])->text = NULL;
|
GTK_CELL_PIXTEXT (ctree_row->row.cell[ctree->tree_column])->text = NULL;
|
||||||
|
|
||||||
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.state = GTK_STATE_NORMAL;
|
ctree_row->row.selectable = TRUE;
|
||||||
ctree_row->row.data = NULL;
|
ctree_row->row.state = GTK_STATE_NORMAL;
|
||||||
ctree_row->row.destroy = NULL;
|
ctree_row->row.data = NULL;
|
||||||
|
ctree_row->row.destroy = NULL;
|
||||||
|
|
||||||
ctree_row->level = 0;
|
ctree_row->level = 0;
|
||||||
ctree_row->expanded = FALSE;
|
ctree_row->expanded = FALSE;
|
||||||
@ -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,8 +4559,9 @@ 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);
|
||||||
|
|
||||||
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
|
if (GTK_CTREE_ROW (node)->row.selectable)
|
||||||
node, -1);
|
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
|
||||||
|
node, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -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,21 +5485,24 @@ 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 (g_list_find (clist->selection, node))
|
if (GTK_CTREE_ROW (node)->row.selectable)
|
||||||
{
|
{
|
||||||
if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL)
|
if (g_list_find (clist->selection, node))
|
||||||
{
|
{
|
||||||
GTK_CTREE_ROW (node)->row.state = GTK_STATE_SELECTED;
|
if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL)
|
||||||
gtk_ctree_unselect (ctree, node);
|
{
|
||||||
clist->undo_selection = g_list_prepend (clist->undo_selection,
|
GTK_CTREE_ROW (node)->row.state = GTK_STATE_SELECTED;
|
||||||
node);
|
gtk_ctree_unselect (ctree, node);
|
||||||
|
clist->undo_selection = g_list_prepend (clist->undo_selection,
|
||||||
|
node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
|
||||||
|
{
|
||||||
|
GTK_CTREE_ROW (node)->row.state = GTK_STATE_NORMAL;
|
||||||
|
clist->undo_unselection = g_list_prepend (clist->undo_unselection,
|
||||||
|
node);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
|
|
||||||
{
|
|
||||||
GTK_CTREE_ROW (node)->row.state = GTK_STATE_NORMAL;
|
|
||||||
clist->undo_unselection = g_list_prepend (clist->undo_unselection,
|
|
||||||
node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list = clist->undo_unselection; list; list = list->next)
|
for (list = clist->undo_unselection; list; list = list->next)
|
||||||
@ -5471,10 +5536,12 @@ 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)
|
||||||
gtk_ctree_select (ctree, GTK_CTREE_NODE (work->data));
|
if (GTK_CTREE_ROW (work->data)->row.selectable)
|
||||||
|
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)
|
||||||
gtk_ctree_unselect (ctree, GTK_CTREE_NODE (work->data));
|
if (GTK_CTREE_ROW (work->data)->row.selectable)
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
|
Reference in New Issue
Block a user