Commit 67c79cda authored by Lars Hamann's avatar Lars Hamann

removed unneeded GtkCTree::draw_lines (gtk_ctree_get_node_info): New

* gtkctree.[ch]: removed unneeded GtkCTree::draw_lines
(gtk_ctree_get_node_info): New funtion to get data of ctree row.
(draw_row): changed drawing order of tree lines, draw triangles
in case of GTK_CTREE_LINES_NONE.
parent c924b9be
......@@ -10,9 +10,9 @@ The GTK+ Team (in alphabetical order)
Shawn T. Amundson <amundson@gtk.org>
Jerome Bolliet <bolliet@in2p3.fr>
Tony Gale <gale@gtk.org>
Lars Hamann <hamann@braunschweig.netsurf.de>
Lars Hamann <lars@gtk.org>
Tim Janik <timj@gtk.org>
Stefan Jeske <jeske@braunschweig.netsurf.de>
Stefan Jeske <stefan@gtk.org>
Elliot Lee <sopwith@gtk.org>
Ian Main <imain@gtk.org>
Fedrerico Mena <quartic@gtk.org>
......
This diff is collapsed.
......@@ -87,7 +87,6 @@ struct _GtkCTree
GtkCTreeCompareFunc node_compare;
guint auto_sort : 1;
guint draw_lines : 1;
guint reorderable : 1;
guint use_icons : 1;
guint in_drag : 1;
......@@ -198,7 +197,7 @@ gboolean gtk_ctree_is_hot_spot (GtkCTree *ctree,
***********************************************************/
void gtk_ctree_move (GtkCTree *ctree,
GList *child,
GList *node,
GList *new_parent,
GList *new_sibling);
void gtk_ctree_expand (GtkCTree *ctree,
......@@ -230,19 +229,19 @@ void gtk_ctree_set_text (GtkCTree *ctree,
gint column,
gchar *text);
void gtk_ctree_set_pixmap (GtkCTree *ctree,
GList *child,
GList *node,
gint column,
GdkPixmap *pixmap,
GdkBitmap *mask);
void gtk_ctree_set_pixtext (GtkCTree *ctree,
GList *child,
GList *node,
gint column,
gchar *text,
guint8 spacing,
GdkPixmap *pixmap,
GdkBitmap *mask);
void gtk_ctree_set_node_info (GtkCTree *ctree,
GList *child,
GList *node,
gchar *text,
guint8 spacing,
GdkPixmap *pixmap_closed,
......@@ -252,46 +251,56 @@ void gtk_ctree_set_node_info (GtkCTree *ctree,
gboolean is_leaf,
gboolean expanded);
void gtk_ctree_set_shift (GtkCTree *ctree,
GList *row,
GList *node,
gint column,
gint vertical,
gint horizontal);
GtkCellType gtk_ctree_get_cell_type (GtkCTree *ctree,
GList *row,
GList *node,
gint column);
gint gtk_ctree_get_text (GtkCTree *ctree,
GList *row,
GList *node,
gint column,
gchar **text);
gint gtk_ctree_get_pixmap (GtkCTree *ctree,
GList *row,
GList *node,
gint column,
GdkPixmap **pixmap,
GdkBitmap **mask);
gint gtk_ctree_get_pixtext (GtkCTree *ctree,
GList *row,
GList *node,
gint column,
gchar **text,
guint8 *spacing,
GdkPixmap **pixmap,
GdkBitmap **mask);
gint gtk_ctree_get_node_info (GtkCTree *ctree,
GList *node,
gchar **text,
guint8 *spacing,
GdkPixmap **pixmap_closed,
GdkBitmap **mask_closed,
GdkPixmap **pixmap_opened,
GdkBitmap **mask_opened,
gboolean *is_leaf,
gboolean *expanded);
void gtk_ctree_set_foreground (GtkCTree *ctree,
GList *row,
GList *node,
GdkColor *color);
void gtk_ctree_set_background (GtkCTree *ctree,
GList *row,
GList *node,
GdkColor *color);
void gtk_ctree_set_selection_mode (GtkCTree *ctree,
GtkSelectionMode mode);
void gtk_ctree_set_row_data (GtkCTree *ctree,
GList *list,
GList *node,
gpointer data);
void gtk_ctree_set_row_data_full (GtkCTree *ctree,
GList *list,
GList *node,
gpointer data,
GtkDestroyNotify destroy);
gpointer gtk_ctree_get_row_data (GtkCTree *ctree,
GList *list);
GList *node);
/***********************************************************
* GtkCTree specific functions *
......
......@@ -3533,11 +3533,14 @@ void after_move (GtkCTree *ctree, GList *child, GList *parent,
char *target1;
char *target2;
gtk_ctree_get_pixtext (ctree, child, 0, &source, NULL, NULL, NULL);
gtk_ctree_get_node_info (ctree, child, &source,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (parent)
gtk_ctree_get_pixtext (ctree, parent, 0, &target1, NULL, NULL, NULL);
gtk_ctree_get_node_info (ctree, parent, &target1,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (sibling)
gtk_ctree_get_pixtext (ctree, sibling, 0, &target2, NULL, NULL, NULL);
gtk_ctree_get_node_info (ctree, sibling, &target2,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
g_print ("Moving \"%s\" to \"%s\" with sibling \"%s\".\n", source,
(parent) ? target1 : "nil", (sibling) ? target2 : "nil");
......@@ -3568,12 +3571,10 @@ gint button_press (GtkCTree *ctree, GdkEventButton *event, gpointer data)
if (GTK_CTREE_ROW (work)->children &&
gtk_ctree_is_hot_spot (ctree, event->x, event->y))
{
gtk_clist_freeze (GTK_CLIST (ctree));
if (GTK_CTREE_ROW (work)->expanded)
gtk_ctree_collapse_recursive (ctree, work);
else
gtk_ctree_expand_recursive (ctree, work);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
gtk_signal_emit_stop_by_name (GTK_OBJECT (ctree),
"button_press_event");
......@@ -3602,12 +3603,10 @@ gint button_release (GtkCTree *ctree, GdkEventButton *event, gpointer data)
if (GTK_CLIST (ctree)->selection_mode == GTK_SELECTION_MULTIPLE &&
event->state & GDK_SHIFT_MASK)
{
gtk_clist_freeze (GTK_CLIST (ctree));
if (GTK_CTREE_ROW (work)->row.state == GTK_STATE_SELECTED)
gtk_ctree_unselect_recursive (ctree, work);
else
gtk_ctree_select_recursive (ctree, work);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
gtk_signal_emit_stop_by_name (GTK_OBJECT (ctree),
"button_release_event");
......@@ -3625,17 +3624,13 @@ void count_items (GtkCTree *ctree, GList *list)
void expand_all (GtkWidget *widget, GtkCTree *ctree)
{
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_expand_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
}
void collapse_all (GtkWidget *widget, GtkCTree *ctree)
{
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_collapse_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
}
......@@ -3643,19 +3638,26 @@ void select_all (GtkWidget *widget, GtkCTree *ctree)
{
if (GTK_CLIST (ctree)->selection_mode != GTK_SELECTION_MULTIPLE)
return;
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_select_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
}
void unselect_all (GtkWidget *widget, GtkCTree *ctree)
{
if (GTK_CLIST (ctree)->selection_mode != GTK_SELECTION_MULTIPLE)
GList *work;
GList *ptr;
if (GTK_CLIST (ctree)->selection_mode == GTK_SELECTION_BROWSE)
return;
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_unselect_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
work = GTK_CLIST (ctree)->selection;
while (work)
{
ptr = work->data;
work = work->next;
gtk_ctree_unselect (ctree, ptr);
}
after_press (ctree, NULL);
}
......@@ -3709,9 +3711,7 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
void sort_all (GtkWidget *widget, GtkCTree *ctree)
{
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_sort_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
}
void change_indent (GtkWidget *widget, GtkCTree *ctree)
......@@ -3783,7 +3783,7 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
for (i = num_pages + num_books; i > num_books; i--)
{
pages++;
sprintf (buf1, "Page %02ld", random() % 100);
sprintf (buf1, "Page %02d", random() % 100);
sprintf (buf2, "Item %d-%d", cur_depth, i);
sibling = gtk_ctree_insert (ctree, parent, sibling, text, 5, pixmap3,
mask3, NULL, NULL, TRUE, FALSE);
......@@ -3795,7 +3795,7 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
for (i = num_books; i > 0; i--)
{
books++;
sprintf (buf1, "Book %02ld", random() % 100);
sprintf (buf1, "Book %02d", random() % 100);
sprintf (buf2, "Item %d-%d", cur_depth, i);
sibling = gtk_ctree_insert (ctree, parent, sibling, text, 5, pixmap1,
mask1, pixmap2, mask2, FALSE, FALSE);
......
......@@ -3533,11 +3533,14 @@ void after_move (GtkCTree *ctree, GList *child, GList *parent,
char *target1;
char *target2;
gtk_ctree_get_pixtext (ctree, child, 0, &source, NULL, NULL, NULL);
gtk_ctree_get_node_info (ctree, child, &source,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (parent)
gtk_ctree_get_pixtext (ctree, parent, 0, &target1, NULL, NULL, NULL);
gtk_ctree_get_node_info (ctree, parent, &target1,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (sibling)
gtk_ctree_get_pixtext (ctree, sibling, 0, &target2, NULL, NULL, NULL);
gtk_ctree_get_node_info (ctree, sibling, &target2,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
g_print ("Moving \"%s\" to \"%s\" with sibling \"%s\".\n", source,
(parent) ? target1 : "nil", (sibling) ? target2 : "nil");
......@@ -3568,12 +3571,10 @@ gint button_press (GtkCTree *ctree, GdkEventButton *event, gpointer data)
if (GTK_CTREE_ROW (work)->children &&
gtk_ctree_is_hot_spot (ctree, event->x, event->y))
{
gtk_clist_freeze (GTK_CLIST (ctree));
if (GTK_CTREE_ROW (work)->expanded)
gtk_ctree_collapse_recursive (ctree, work);
else
gtk_ctree_expand_recursive (ctree, work);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
gtk_signal_emit_stop_by_name (GTK_OBJECT (ctree),
"button_press_event");
......@@ -3602,12 +3603,10 @@ gint button_release (GtkCTree *ctree, GdkEventButton *event, gpointer data)
if (GTK_CLIST (ctree)->selection_mode == GTK_SELECTION_MULTIPLE &&
event->state & GDK_SHIFT_MASK)
{
gtk_clist_freeze (GTK_CLIST (ctree));
if (GTK_CTREE_ROW (work)->row.state == GTK_STATE_SELECTED)
gtk_ctree_unselect_recursive (ctree, work);
else
gtk_ctree_select_recursive (ctree, work);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
gtk_signal_emit_stop_by_name (GTK_OBJECT (ctree),
"button_release_event");
......@@ -3625,17 +3624,13 @@ void count_items (GtkCTree *ctree, GList *list)
void expand_all (GtkWidget *widget, GtkCTree *ctree)
{
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_expand_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
}
void collapse_all (GtkWidget *widget, GtkCTree *ctree)
{
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_collapse_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
}
......@@ -3643,19 +3638,26 @@ void select_all (GtkWidget *widget, GtkCTree *ctree)
{
if (GTK_CLIST (ctree)->selection_mode != GTK_SELECTION_MULTIPLE)
return;
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_select_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
after_press (ctree, NULL);
}
void unselect_all (GtkWidget *widget, GtkCTree *ctree)
{
if (GTK_CLIST (ctree)->selection_mode != GTK_SELECTION_MULTIPLE)
GList *work;
GList *ptr;
if (GTK_CLIST (ctree)->selection_mode == GTK_SELECTION_BROWSE)
return;
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_unselect_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
work = GTK_CLIST (ctree)->selection;
while (work)
{
ptr = work->data;
work = work->next;
gtk_ctree_unselect (ctree, ptr);
}
after_press (ctree, NULL);
}
......@@ -3709,9 +3711,7 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
void sort_all (GtkWidget *widget, GtkCTree *ctree)
{
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_ctree_sort_recursive (ctree, NULL);
gtk_clist_thaw (GTK_CLIST (ctree));
}
void change_indent (GtkWidget *widget, GtkCTree *ctree)
......@@ -3783,7 +3783,7 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
for (i = num_pages + num_books; i > num_books; i--)
{
pages++;
sprintf (buf1, "Page %02ld", random() % 100);
sprintf (buf1, "Page %02d", random() % 100);
sprintf (buf2, "Item %d-%d", cur_depth, i);
sibling = gtk_ctree_insert (ctree, parent, sibling, text, 5, pixmap3,
mask3, NULL, NULL, TRUE, FALSE);
......@@ -3795,7 +3795,7 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
for (i = num_books; i > 0; i--)
{
books++;
sprintf (buf1, "Book %02ld", random() % 100);
sprintf (buf1, "Book %02d", random() % 100);
sprintf (buf2, "Item %d-%d", cur_depth, i);
sibling = gtk_ctree_insert (ctree, parent, sibling, text, 5, pixmap1,
mask1, pixmap2, mask2, FALSE, FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment