mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
changed to return a gboolean (gtk_ctree_insert_gnode): new function for
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org> * gtk/gtkctree.h: * gtk/gtkctree.c: (gtk_ctree_find): changed to return a gboolean (gtk_ctree_insert_gnode): new function for recursive insertion of a GNode tree. (gtk_ctree_real_select_recursive): fix for extended selection (gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too. (gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
This commit is contained in:
parent
c4b3014e09
commit
e3b8e18524
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/gtkctree.h:
|
||||
* gtk/gtkctree.c:
|
||||
(gtk_ctree_find): changed to return a gboolean
|
||||
(gtk_ctree_insert_gnode): new function for recursive insertion of a
|
||||
GNode tree.
|
||||
(gtk_ctree_real_select_recursive): fix for extended selection
|
||||
(gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too.
|
||||
(gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
|
||||
|
||||
Tue Aug 4 16:18:26 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: version bump to 1.1.1, binary age 0, interface age 0.
|
||||
|
@ -1,3 +1,14 @@
|
||||
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/gtkctree.h:
|
||||
* gtk/gtkctree.c:
|
||||
(gtk_ctree_find): changed to return a gboolean
|
||||
(gtk_ctree_insert_gnode): new function for recursive insertion of a
|
||||
GNode tree.
|
||||
(gtk_ctree_real_select_recursive): fix for extended selection
|
||||
(gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too.
|
||||
(gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
|
||||
|
||||
Tue Aug 4 16:18:26 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: version bump to 1.1.1, binary age 0, interface age 0.
|
||||
|
@ -1,3 +1,14 @@
|
||||
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/gtkctree.h:
|
||||
* gtk/gtkctree.c:
|
||||
(gtk_ctree_find): changed to return a gboolean
|
||||
(gtk_ctree_insert_gnode): new function for recursive insertion of a
|
||||
GNode tree.
|
||||
(gtk_ctree_real_select_recursive): fix for extended selection
|
||||
(gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too.
|
||||
(gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
|
||||
|
||||
Tue Aug 4 16:18:26 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: version bump to 1.1.1, binary age 0, interface age 0.
|
||||
|
@ -1,3 +1,14 @@
|
||||
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/gtkctree.h:
|
||||
* gtk/gtkctree.c:
|
||||
(gtk_ctree_find): changed to return a gboolean
|
||||
(gtk_ctree_insert_gnode): new function for recursive insertion of a
|
||||
GNode tree.
|
||||
(gtk_ctree_real_select_recursive): fix for extended selection
|
||||
(gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too.
|
||||
(gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
|
||||
|
||||
Tue Aug 4 16:18:26 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: version bump to 1.1.1, binary age 0, interface age 0.
|
||||
|
@ -1,3 +1,14 @@
|
||||
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/gtkctree.h:
|
||||
* gtk/gtkctree.c:
|
||||
(gtk_ctree_find): changed to return a gboolean
|
||||
(gtk_ctree_insert_gnode): new function for recursive insertion of a
|
||||
GNode tree.
|
||||
(gtk_ctree_real_select_recursive): fix for extended selection
|
||||
(gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too.
|
||||
(gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
|
||||
|
||||
Tue Aug 4 16:18:26 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: version bump to 1.1.1, binary age 0, interface age 0.
|
||||
|
@ -1,3 +1,14 @@
|
||||
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/gtkctree.h:
|
||||
* gtk/gtkctree.c:
|
||||
(gtk_ctree_find): changed to return a gboolean
|
||||
(gtk_ctree_insert_gnode): new function for recursive insertion of a
|
||||
GNode tree.
|
||||
(gtk_ctree_real_select_recursive): fix for extended selection
|
||||
(gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too.
|
||||
(gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
|
||||
|
||||
Tue Aug 4 16:18:26 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: version bump to 1.1.1, binary age 0, interface age 0.
|
||||
|
@ -1,3 +1,14 @@
|
||||
Wed Aug 5 02:57:20 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/gtkctree.h:
|
||||
* gtk/gtkctree.c:
|
||||
(gtk_ctree_find): changed to return a gboolean
|
||||
(gtk_ctree_insert_gnode): new function for recursive insertion of a
|
||||
GNode tree.
|
||||
(gtk_ctree_real_select_recursive): fix for extended selection
|
||||
(gtk_ctree_sort_recursive): in case node == NULL, sort root nodes too.
|
||||
(gtk_ctree_set_node_info) (set_node_info): few fixes for expanded flag
|
||||
|
||||
Tue Aug 4 16:18:26 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: version bump to 1.1.1, binary age 0, interface age 0.
|
||||
|
1
NEWS
1
NEWS
@ -4,6 +4,7 @@ What is new in GTK+ 1.1.1:
|
||||
* Key binding support for GtkListItems and GtkList.
|
||||
* Extended selection mode and autoscrolling for GtkLists.
|
||||
* A GtkCtree now operates on GtkCTreeNode* structures rather than GList*.
|
||||
* GtkCTreeNodes can now be created from GNode trees.
|
||||
* Bug fixes for GtkNotebook, GtkCList, GtkCombo and GdkWindow reparentation.
|
||||
|
||||
|
||||
|
120
gtk/gtkctree.c
120
gtk/gtkctree.c
@ -3079,7 +3079,7 @@ set_node_info (GtkCTree *ctree,
|
||||
tree_cell->text = g_strdup (text);
|
||||
tree_cell->spacing = spacing;
|
||||
|
||||
if (expanded)
|
||||
if (GTK_CTREE_ROW (node)->expanded)
|
||||
{
|
||||
tree_cell->pixmap = pixmap_opened;
|
||||
tree_cell->mask = mask_opened;
|
||||
@ -3763,6 +3763,75 @@ gtk_ctree_insert (GtkCTree *ctree,
|
||||
return node;
|
||||
}
|
||||
|
||||
GtkCTreeNode *
|
||||
gtk_ctree_insert_gnode (GtkCTree *ctree,
|
||||
GtkCTreeNode *parent,
|
||||
GtkCTreeNode *sibling,
|
||||
GNode *gnode,
|
||||
GtkCTreeGNodeFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCTreeNode *cnode = NULL;
|
||||
GtkCTreeNode *child = NULL;
|
||||
GtkCTreeNode *new_child;
|
||||
GtkCTreeRow *new_row;
|
||||
gboolean thaw;
|
||||
GNode *work;
|
||||
guint depth = 1;
|
||||
|
||||
g_return_val_if_fail (ctree != NULL, NULL);
|
||||
g_return_val_if_fail (gnode != NULL, NULL);
|
||||
g_return_val_if_fail (func != NULL, NULL);
|
||||
if (sibling)
|
||||
g_return_val_if_fail (GTK_CTREE_ROW (sibling)->parent == parent, NULL);
|
||||
|
||||
if (parent)
|
||||
depth = GTK_CTREE_ROW (parent)->level + 1;
|
||||
|
||||
if (!(new_row = row_new (ctree)))
|
||||
return NULL;
|
||||
if (!(cnode = GTK_CTREE_NODE (g_list_alloc ())))
|
||||
return NULL;
|
||||
GTK_CTREE_ROW (cnode) = new_row;
|
||||
|
||||
set_node_info (ctree, cnode, "", 0, NULL, NULL, NULL, NULL, TRUE, FALSE);
|
||||
|
||||
if (!func (ctree, depth, gnode, cnode, data))
|
||||
{
|
||||
tree_delete_row (ctree, cnode, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((thaw = !GTK_CLIST_FROZEN (GTK_CLIST (ctree))))
|
||||
gtk_clist_freeze (GTK_CLIST (ctree));
|
||||
|
||||
if (ctree->auto_sort)
|
||||
{
|
||||
if (parent)
|
||||
sibling = GTK_CTREE_ROW (parent)->children;
|
||||
else
|
||||
sibling = GTK_CTREE_NODE (GTK_CLIST (ctree)->row_list);
|
||||
|
||||
while (sibling && ctree->node_compare (ctree, cnode, sibling) > 0)
|
||||
sibling = GTK_CTREE_ROW (sibling)->sibling;
|
||||
}
|
||||
|
||||
gtk_ctree_link (ctree, cnode, parent, sibling, TRUE);
|
||||
|
||||
for (work = g_node_last_child (gnode); work; work = work->prev)
|
||||
{
|
||||
new_child = gtk_ctree_insert_gnode (ctree, cnode, child,
|
||||
work, func, data);
|
||||
if (new_child)
|
||||
child = new_child;
|
||||
}
|
||||
|
||||
if (thaw)
|
||||
gtk_clist_thaw (GTK_CLIST (ctree));
|
||||
|
||||
return cnode;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_ctree_remove (GtkCTree *ctree,
|
||||
GtkCTreeNode *node)
|
||||
@ -3847,6 +3916,7 @@ gtk_ctree_post_recursive (GtkCTree *ctree,
|
||||
|
||||
g_return_if_fail (ctree != NULL);
|
||||
g_return_if_fail (GTK_IS_CTREE (ctree));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (node)
|
||||
work = GTK_CTREE_ROW (node)->children;
|
||||
@ -3876,6 +3946,7 @@ gtk_ctree_post_recursive_to_depth (GtkCTree *ctree,
|
||||
|
||||
g_return_if_fail (ctree != NULL);
|
||||
g_return_if_fail (GTK_IS_CTREE (ctree));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (depth < 0)
|
||||
{
|
||||
@ -3913,6 +3984,7 @@ gtk_ctree_pre_recursive (GtkCTree *ctree,
|
||||
|
||||
g_return_if_fail (ctree != NULL);
|
||||
g_return_if_fail (GTK_IS_CTREE (ctree));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (node)
|
||||
{
|
||||
@ -3942,6 +4014,7 @@ gtk_ctree_pre_recursive_to_depth (GtkCTree *ctree,
|
||||
|
||||
g_return_if_fail (ctree != NULL);
|
||||
g_return_if_fail (GTK_IS_CTREE (ctree));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (depth < 0)
|
||||
{
|
||||
@ -4030,11 +4103,17 @@ gtk_ctree_find_glist_ptr (GtkCTree *ctree,
|
||||
return node;
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gtk_ctree_find (GtkCTree *ctree,
|
||||
GtkCTreeNode *node,
|
||||
GtkCTreeNode *child)
|
||||
{
|
||||
if (!child)
|
||||
return FALSE;
|
||||
|
||||
if (!node)
|
||||
node = GTK_CTREE_NODE (GTK_CLIST (ctree)->row_list);
|
||||
|
||||
while (node)
|
||||
{
|
||||
if (node == child)
|
||||
@ -4054,6 +4133,8 @@ gtk_ctree_is_ancestor (GtkCTree *ctree,
|
||||
GtkCTreeNode *node,
|
||||
GtkCTreeNode *child)
|
||||
{
|
||||
g_return_val_if_fail (node != NULL, FALSE);
|
||||
|
||||
return gtk_ctree_find (ctree, GTK_CTREE_ROW (node)->children, child);
|
||||
}
|
||||
|
||||
@ -4064,6 +4145,9 @@ gtk_ctree_find_by_row_data (GtkCTree *ctree,
|
||||
{
|
||||
GtkCTreeNode *work;
|
||||
|
||||
if (!node)
|
||||
node = GTK_CTREE_NODE (GTK_CLIST (ctree)->row_list);
|
||||
|
||||
while (node)
|
||||
{
|
||||
if (GTK_CTREE_ROW (node)->row.data == data)
|
||||
@ -4085,6 +4169,11 @@ gtk_ctree_find_by_row_data_custom (GtkCTree *ctree,
|
||||
{
|
||||
GtkCTreeNode *work;
|
||||
|
||||
g_return_val_if_fail (func != NULL, NULL);
|
||||
|
||||
if (!node)
|
||||
node = GTK_CTREE_NODE (GTK_CLIST (ctree)->row_list);
|
||||
|
||||
while (node)
|
||||
{
|
||||
if (!func (GTK_CTREE_ROW (node)->row.data, data))
|
||||
@ -4377,8 +4466,8 @@ gtk_ctree_real_select_recursive (GtkCTree *ctree,
|
||||
clist = GTK_CLIST (ctree);
|
||||
|
||||
if ((state &&
|
||||
(clist->selection_mode != GTK_SELECTION_MULTIPLE ||
|
||||
clist->selection_mode == GTK_SELECTION_EXTENDED)) ||
|
||||
(clist->selection_mode == GTK_SELECTION_BROWSE ||
|
||||
clist->selection_mode == GTK_SELECTION_SINGLE)) ||
|
||||
(!state && clist->selection_mode == GTK_SELECTION_BROWSE))
|
||||
return;
|
||||
|
||||
@ -4389,6 +4478,17 @@ gtk_ctree_real_select_recursive (GtkCTree *ctree,
|
||||
thaw = TRUE;
|
||||
}
|
||||
|
||||
if (clist->selection_mode == GTK_SELECTION_EXTENDED)
|
||||
{
|
||||
if (clist->anchor != -1)
|
||||
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
|
||||
|
||||
g_list_free (clist->undo_selection);
|
||||
g_list_free (clist->undo_unselection);
|
||||
clist->undo_selection = NULL;
|
||||
clist->undo_unselection = NULL;
|
||||
}
|
||||
|
||||
if (state)
|
||||
gtk_ctree_post_recursive (ctree, node,
|
||||
GTK_CTREE_FUNC (tree_select), NULL);
|
||||
@ -4513,17 +4613,18 @@ gtk_ctree_set_node_info (GtkCTree *ctree,
|
||||
}
|
||||
|
||||
set_node_info (ctree, node, text, spacing, pixmap_closed, mask_closed,
|
||||
pixmap_opened, mask_opened, is_leaf, old_expanded);
|
||||
pixmap_opened, mask_opened, is_leaf, expanded);
|
||||
|
||||
if (!is_leaf && !old_leaf)
|
||||
{
|
||||
GTK_CTREE_ROW (node)->expanded = old_expanded;
|
||||
if (expanded && !old_expanded)
|
||||
gtk_ctree_expand (ctree, node);
|
||||
else if (!expanded && old_expanded)
|
||||
gtk_ctree_collapse (ctree, node);
|
||||
}
|
||||
|
||||
GTK_CTREE_ROW (node)->expanded = expanded;
|
||||
GTK_CTREE_ROW (node)->expanded = (is_leaf) ? FALSE : expanded;
|
||||
|
||||
tree_draw_node (ctree, node);
|
||||
}
|
||||
@ -4973,12 +5074,15 @@ gtk_ctree_sort_recursive (GtkCTree *ctree,
|
||||
clist->undo_unselection = NULL;
|
||||
}
|
||||
|
||||
if (node && gtk_ctree_is_visible (ctree, node))
|
||||
if (!node || (node && gtk_ctree_is_visible (ctree, node)))
|
||||
focus_node =
|
||||
GTK_CTREE_NODE (g_list_nth (clist->row_list, clist->focus_row));
|
||||
|
||||
gtk_ctree_post_recursive (ctree, node, GTK_CTREE_FUNC (tree_sort), NULL);
|
||||
|
||||
if (!node)
|
||||
tree_sort (ctree, NULL, NULL);
|
||||
|
||||
if (focus_node)
|
||||
{
|
||||
clist->focus_row = g_list_position (clist->row_list,(GList *)focus_node);
|
||||
@ -5019,7 +5123,7 @@ gtk_ctree_sort (GtkCTree *ctree,
|
||||
clist->undo_unselection = NULL;
|
||||
}
|
||||
|
||||
if (node && gtk_ctree_is_visible (ctree, node))
|
||||
if (!node || (node && gtk_ctree_is_visible (ctree, node)))
|
||||
focus_node = GTK_CTREE_NODE
|
||||
(g_list_nth (clist->row_list, clist->focus_row));
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GTK_TYPE_CTREE (gtk_ctree_get_type ())
|
||||
@ -84,16 +85,23 @@ typedef gint (*GtkCTreeCompareFunc) (GtkCTree *ctree,
|
||||
const GtkCTreeNode *node1,
|
||||
const GtkCTreeNode *node2);
|
||||
|
||||
typedef gboolean (*GtkCTreeGNodeFunc) (GtkCTree *ctree,
|
||||
guint depth,
|
||||
GNode *gnode,
|
||||
GtkCTreeNode *cnode,
|
||||
gpointer data);
|
||||
|
||||
|
||||
struct _GtkCTree
|
||||
{
|
||||
GtkCList clist;
|
||||
|
||||
|
||||
GdkGC *xor_gc;
|
||||
GdkGC *lines_gc;
|
||||
GdkWindow *drag_icon;
|
||||
gint icon_width;
|
||||
gint icon_height;
|
||||
|
||||
|
||||
gint tree_indent;
|
||||
gint tree_column;
|
||||
gint drag_row;
|
||||
@ -101,7 +109,7 @@ struct _GtkCTree
|
||||
GtkCTreeNode *drag_target;
|
||||
gint insert_pos;
|
||||
GtkCTreeCompareFunc node_compare;
|
||||
|
||||
|
||||
guint auto_sort : 1;
|
||||
guint reorderable : 1;
|
||||
guint use_icons : 1;
|
||||
@ -113,7 +121,7 @@ struct _GtkCTree
|
||||
struct _GtkCTreeClass
|
||||
{
|
||||
GtkCListClass parent_class;
|
||||
|
||||
|
||||
void (*tree_select_row) (GtkCTree *ctree,
|
||||
GtkCTreeNode *row,
|
||||
gint column);
|
||||
@ -135,18 +143,18 @@ struct _GtkCTreeClass
|
||||
struct _GtkCTreeRow
|
||||
{
|
||||
GtkCListRow row;
|
||||
|
||||
|
||||
GtkCTreeNode *parent;
|
||||
GtkCTreeNode *sibling;
|
||||
GtkCTreeNode *children;
|
||||
|
||||
|
||||
GdkPixmap *pixmap_closed;
|
||||
GdkBitmap *mask_closed;
|
||||
GdkPixmap *pixmap_opened;
|
||||
GdkBitmap *mask_opened;
|
||||
|
||||
|
||||
guint16 level;
|
||||
|
||||
|
||||
guint is_leaf : 1;
|
||||
guint expanded : 1;
|
||||
};
|
||||
@ -181,6 +189,12 @@ GtkCTreeNode * gtk_ctree_insert (GtkCTree *ctree,
|
||||
GdkBitmap *mask_opened,
|
||||
gboolean is_leaf,
|
||||
gboolean expanded);
|
||||
GtkCTreeNode * gtk_ctree_insert_gnode (GtkCTree *ctree,
|
||||
GtkCTreeNode *parent,
|
||||
GtkCTreeNode *sibling,
|
||||
GNode *gnode,
|
||||
GtkCTreeGNodeFunc func,
|
||||
gpointer data);
|
||||
void gtk_ctree_remove (GtkCTree *ctree,
|
||||
GtkCTreeNode *node);
|
||||
|
||||
@ -213,7 +227,7 @@ GtkCTreeNode * gtk_ctree_last (GtkCTree *ctree,
|
||||
GtkCTreeNode *node);
|
||||
GtkCTreeNode * gtk_ctree_find_glist_ptr (GtkCTree *ctree,
|
||||
GtkCTreeRow *ctree_row);
|
||||
gint gtk_ctree_find (GtkCTree *ctree,
|
||||
gboolean gtk_ctree_find (GtkCTree *ctree,
|
||||
GtkCTreeNode *node,
|
||||
GtkCTreeNode *child);
|
||||
gboolean gtk_ctree_is_ancestor (GtkCTree *ctree,
|
||||
@ -378,7 +392,6 @@ void gtk_ctree_sort (GtkCTree *ctree,
|
||||
GtkCTreeNode *node);
|
||||
void gtk_ctree_sort_recursive (GtkCTree *ctree,
|
||||
GtkCTreeNode *node);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
Loading…
Reference in New Issue
Block a user