GTK+ 2 Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Signals |
#include <gtk/gtk.h> struct GtkTree; #define GTK_IS_ROOT_TREE (obj) #define GTK_TREE_ROOT_TREE (obj) #define GTK_TREE_SELECTION_OLD (obj) enum GtkTreeViewMode; GtkWidget * gtk_tree_new (void
); void gtk_tree_append (GtkTree *tree
,GtkWidget *tree_item
); void gtk_tree_prepend (GtkTree *tree
,GtkWidget *tree_item
); void gtk_tree_insert (GtkTree *tree
,GtkWidget *tree_item
,gint position
); void gtk_tree_remove_items (GtkTree *tree
,GList *items
); void gtk_tree_clear_items (GtkTree *tree
,gint start
,gint end
); void gtk_tree_select_item (GtkTree *tree
,gint item
); void gtk_tree_unselect_item (GtkTree *tree
,gint item
); void gtk_tree_select_child (GtkTree *tree
,GtkWidget *tree_item
); void gtk_tree_unselect_child (GtkTree *tree
,GtkWidget *tree_item
); gint gtk_tree_child_position (GtkTree *tree
,GtkWidget *child
); void gtk_tree_set_selection_mode (GtkTree *tree
,GtkSelectionMode mode
); void gtk_tree_set_view_mode (GtkTree *tree
,GtkTreeViewMode mode
); void gtk_tree_set_view_lines (GtkTree *tree
,gboolean flag
); void gtk_tree_remove_item (GtkTree *tree
,GtkWidget *child
);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkTree
GtkTree is deprecated and unsupported. It is known to be
buggy. To use it, you must define the symbol GTK_ENABLE_BROKEN
prior to including the GTK+ header files. Use GtkTreeView instead.
The GtkTree widget is a container that shows users a list of items, in a tree format complete with branches and leafnodes. Branches can be expanded to show their child items, or collapsed to hide them.
struct GtkTree;
GtkTree
is deprecated and should not be used in newly-written code.
struct _GtkTree { GtkContainer container; GList *children; GtkTree* root_tree; /* owner of selection list */ GtkWidget* tree_owner; GList *selection; guint level; guint indent_value; guint current_indent; guint selection_mode : 2; guint view_mode : 1; guint view_line : 1; };
#define GTK_IS_ROOT_TREE(obj) ((GtkObject*) GTK_TREE(obj)->root_tree == (GtkObject*)obj)
GTK_IS_ROOT_TREE
is deprecated and should not be used in newly-written code.
A macro that returns a boolean value which indicates if obj
is a root tree or not.
#define GTK_TREE_ROOT_TREE(obj) (GTK_TREE(obj)->root_tree ? GTK_TREE(obj)->root_tree : GTK_TREE(obj))
GTK_TREE_ROOT_TREE
is deprecated and should not be used in newly-written code.
A macro that returns the root tree of obj
.
If obj
is already a root tree, obj
is cast to GtkTree and returned.
#define GTK_TREE_SELECTION_OLD(obj) (GTK_TREE_ROOT_TREE(obj)->selection)
GTK_TREE_SELECTION_OLD
is deprecated and should not be used in newly-written code.
typedef enum { GTK_TREE_VIEW_LINE, /* default view mode */ GTK_TREE_VIEW_ITEM } GtkTreeViewMode;
GtkTreeViewMode
is deprecated and should not be used in newly-written code.
GtkWidget * gtk_tree_new (void
);
gtk_tree_new
is deprecated and should not be used in newly-written code.
Creates a new GtkTree.
Returns : |
A pointer to the newly allocated widget. |
void gtk_tree_append (GtkTree *tree
,GtkWidget *tree_item
);
gtk_tree_append
is deprecated and should not be used in newly-written code.
Adds the GtkTreeItem in tree_item
to the end of the items in tree
.
void gtk_tree_prepend (GtkTree *tree
,GtkWidget *tree_item
);
gtk_tree_prepend
is deprecated and should not be used in newly-written code.
Adds the GtkTreeItem in tree_item
to the start of the items in tree
.
void gtk_tree_insert (GtkTree *tree
,GtkWidget *tree_item
,gint position
);
gtk_tree_insert
is deprecated and should not be used in newly-written code.
Adds the GtkTreeItem in tree_item
to the list of items in tree
at the position indicated by position
.
void gtk_tree_remove_items (GtkTree *tree
,GList *items
);
gtk_tree_remove_items
is deprecated and should not be used in newly-written code.
Removes a list of items from the GtkTree in tree
.
If only one item is to be removed from the GtkTree, gtk_container_remove()
can be used instead.
Removing an item from a GtkTree dereferences the item, and thus usually destroys the item and any subtrees it may contain. If the item is not to be destroyed, use g_object_ref()
before removing it.
void gtk_tree_clear_items (GtkTree *tree
,gint start
,gint end
);
gtk_tree_clear_items
is deprecated and should not be used in newly-written code.
Removes the items at positions between start
and end
from the GtkTree tree
.
Removing an item from a GtkTree dereferences the item, and thus usually destroys the item and any subtrees it may contain. If the item is not to be destroyed, use g_object_ref()
before removing it.
void gtk_tree_select_item (GtkTree *tree
,gint item
);
gtk_tree_select_item
is deprecated and should not be used in newly-written code.
Emits the select_item signal for the child at position item
, and thus selects it (unless it is unselected in a signal handler).
void gtk_tree_unselect_item (GtkTree *tree
,gint item
);
gtk_tree_unselect_item
is deprecated and should not be used in newly-written code.
Emits the unselect_item for the child at position item
, and thus unselects it.
void gtk_tree_select_child (GtkTree *tree
,GtkWidget *tree_item
);
gtk_tree_select_child
is deprecated and should not be used in newly-written code.
Emits the select_item signal for the child tree_item
, and thus selects it (unless it is unselected in a signal handler).
void gtk_tree_unselect_child (GtkTree *tree
,GtkWidget *tree_item
);
gtk_tree_unselect_child
is deprecated and should not be used in newly-written code.
Emits the unselect_item signal for the child tree_item
, and thus unselects it.
gint gtk_tree_child_position (GtkTree *tree
,GtkWidget *child
);
gtk_tree_child_position
is deprecated and should not be used in newly-written code.
Returns the position of child
in the GtkTree tree
.
If child
is not a child of tree
, then -1 is returned.
void gtk_tree_set_selection_mode (GtkTree *tree
,GtkSelectionMode mode
);
gtk_tree_set_selection_mode
is deprecated and should not be used in newly-written code.
Sets the selection mode for the GtkTree tree
.
mode
can be one of
GTK_SELECTION_SINGLE
for when only one item can be selected at a time.
GTK_SELECTION_BROWSE
for when one item must be selected.
GTK_SELECTION_MULTIPLE
for when many items can be selected at once.
GTK_SELECTION_EXTENDED
Reserved for later use.
The selection mode is only defined for a root tree, as the root tree "owns" the selection.
The default mode is GTK_SELECTION_SINGLE
.
|
A pointer to a GtkTree. |
|
A GtkSelectionMode. |
void gtk_tree_set_view_mode (GtkTree *tree
,GtkTreeViewMode mode
);
gtk_tree_set_view_mode
is deprecated and should not be used in newly-written code.
Sets the 'viewmode' for the GtkTree in tree
. The 'viewmode' defines how the tree looks when an item is selected.
mode
can be one of:
GTK_TREE_VIEW_LINE
: When an item is selected the entire GtkTreeItem is highlighted.
GTK_TREE_VIEW_ITEM
: When an item is selected only the selected item's child widget is highlighted.
The default mode is GTK_TREE_VIEW_LINE
.
|
A pointer to a GtkTree. |
|
A GtkTreeViewMode. |
void gtk_tree_set_view_lines (GtkTree *tree
,gboolean flag
);
gtk_tree_set_view_lines
is deprecated and should not be used in newly-written code.
Sets whether or not the connecting lines between branches and children are drawn.
"select-child"
signalvoid user_function (GtkTree *tree,
GtkWidget *widget,
gpointer user_data) : Run First
This signal is emitted by tree
whenever widget
is about to be selected.
|
the object which received the signal. |
|
The child that is about to be selected. |
|
user data set when the signal handler was connected. |
"selection-changed"
signalvoid user_function (GtkTree *tree,
gpointer user_data) : Run First
This signal is emitted by the root tree whenever the selection changes.
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"unselect-child"
signalvoid user_function (GtkTree *tree,
GtkWidget *widget,
gpointer user_data) : Run First
This signal is emitted by tree
whenever widget
is about to be unselected.
|
the object which received the signal. |
|
The child that is about to be unselected. |
|
user data set when the signal handler was connected. |
GtkTreeList for the items to put into a GtkTree.
GtkScrolledWindow for details on how to scroll around a GtkTree.