GTK+ Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
"n-columns" guint : Read / Write / Construct Only "tree-column" guint : Read / Write / Construct Only "indent" guint : Read / Write "spacing" guint : Read / Write "show-stub" gboolean : Read / Write "line-style" GtkCTreeLineStyle : Read / Write "expander-style" GtkCTreeExpanderStyle : Read / Write |
"tree-select-row" void user_function (GtkCTree *ctree, GList *node, gint column, gpointer user_data); "tree-unselect-row" void user_function (GtkCTree *ctree, GList *node, gint column, gpointer user_data); "tree-expand" void user_function (GtkCTree *ctree, GList *node, gpointer user_data); "tree-collapse" void user_function (GtkCTree *ctree, GList *node, gpointer user_data); "tree-move" void user_function (GtkCTree *ctree, GList *node, GList *new_parent, GList *new_sibling, gpointer user_data); "change-focus-row-expansion" void user_function (GtkCTree *ctree, GtkCTreeExpansionType expansion, gpointer user_data); |
The GtkCTree widget is used for showing a hierarchical tree to the user, for example a directory tree.
The tree is internally represented as a set of GtkCTreeNode structures.
The interface has much in common with the GtkCList widget: rows (nodes) can be selected by the user etc.
Positions in the tree are often indicated by two arguments, a parent and a sibling, both GtkCTreeNode pointers. If the parent is NULL, the position is at the root of the tree and if the sibling is NULL, it will be the last child of parent, otherwise it will be inserted just before the sibling.
struct GtkCTree; |
The GtkCTree contains the following user-accessible fields. These fields should be considered read-only; to set the values, use the methods below.
gint tree_indent; | The number of pixels each successive level of the tree is indented in the display. |
gint tree_spacing; | The space in pixels between the graphical tree and the text in the node. |
gint tree_column; | The index of the column for which the tree graphics is drawn. |
GtkCTreeLineStyle line_style; | The style in which the lines in the tree graphics are drawn. |
GtkCTreeExpanderStyle expander_style; | The style in which the expander buttons are drawn. |
GtkCTreeExpanderStyle expander_style; | FIXME. |
#define GTK_CTREE_ROW(_node_) ((GtkCTreeRow *)(((GList *)(_node_))->data)) |
Used to get the GtkCTreeRow structure corresponding to the given GtkCTreeNode.
#define GTK_CTREE_NODE_NEXT(_nnode_) ((GtkCTreeNode *)(((GList *)(_nnode_))->next)) |
FIXME
#define GTK_CTREE_NODE_PREV(_pnode_) ((GtkCTreeNode *)(((GList *)(_pnode_))->prev)) |
FIXME
typedef enum { GTK_CTREE_POS_BEFORE, GTK_CTREE_POS_AS_CHILD, GTK_CTREE_POS_AFTER } GtkCTreePos; |
A value specifying the position of a new node relative to an old one.
typedef enum { GTK_CTREE_LINES_NONE, GTK_CTREE_LINES_SOLID, GTK_CTREE_LINES_DOTTED, GTK_CTREE_LINES_TABBED } GtkCTreeLineStyle; |
The appearance of the lines in the tree graphics.
typedef enum { GTK_CTREE_EXPANDER_NONE, GTK_CTREE_EXPANDER_SQUARE, GTK_CTREE_EXPANDER_TRIANGLE, GTK_CTREE_EXPANDER_CIRCULAR } GtkCTreeExpanderStyle; |
The appearance of the expander buttons, i.e. the small buttons which expand or contract parts of the tree when pressed.
typedef enum { GTK_CTREE_EXPANSION_EXPAND, GTK_CTREE_EXPANSION_EXPAND_RECURSIVE, GTK_CTREE_EXPANSION_COLLAPSE, GTK_CTREE_EXPANSION_COLLAPSE_RECURSIVE, GTK_CTREE_EXPANSION_TOGGLE, GTK_CTREE_EXPANSION_TOGGLE_RECURSIVE } GtkCTreeExpansionType; |
How to expand or collapse a part of a tree.
GTK_CTREE_EXPANSION_EXPAND | Expand this node. |
GTK_CTREE_EXPANSION_EXPAND_RECURSIVE | Expand this node and everything below it in the hierarchy. |
GTK_CTREE_EXPANSION_COLLAPSE | Collapse this node. |
GTK_CTREE_EXPANSION_COLLAPSE_RECURSIVE | Collapse this node and everything below it in the hierarchy. |
GTK_CTREE_EXPANSION_TOGGLE | Toggle this node (i.e. expand if collapsed and vice versa). |
GTK_CTREE_EXPANSION_TOGGLE_RECURSIVE | Toggle this node and everything below it in the hierarchy. |
void (*GtkCTreeFunc) (GtkCTree *ctree, GtkCTreeNode *node, gpointer data); |
A generic callback type to do something with a particular node.
ctree : | The GtkCTree object. |
node : | The GtkCTreeNode in the tree. |
data : | The user data associated with the node. |
gboolean (*GtkCTreeGNodeFunc) (GtkCTree *ctree, guint depth, GNode *gnode, GtkCTreeNode *cnode, gpointer data); |
FIXME
gboolean (*GtkCTreeCompareDragFunc) (GtkCTree *ctree, GtkCTreeNode *source_node, GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling); |
FIXME
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; }; |
A structure representing a single row in the tree graph. The values inside the structure should be considered read-only. This structure is derived from the GtkCListRow structure.
GtkCTreeNode *parent; | The parent node of the node corresponding to this row. |
GtkCTreeNode *sibling; | The next sibling node of the node corresponding to this row. |
GtkCTreeNode *children; | The first child node corresponding to this row; to access the other children, just use the siblings of that node. |
GdkPixmap *pixmap_closed; | The pixmap to be shown when the node is collapsed. |
GdkBitmap *mask_closed; | The mask for the above pixmap. |
GdkPixmap *pixmap_opened; | The pixmap to be shown when the node is expanded. |
GdkBitmap *mask_opened; | The mask for the above pixmap. |
guint16 level; | The level of this node in the tree. |
guint is_leaf : 1; | Whether this row is a leaf. |
guint expanded : 1; | Whether the children of this row are visible. |
struct GtkCTreeNode { GList list; }; |
This structure is opaque - you should use the macros GTK_CTREE_ROW, GTK_CTREE_NODE_NEXT etc. as well as the functions below to access it.
void gtk_ctree_construct (GtkCTree *ctree, gint columns, gint tree_column, gchar *titles[]); |
This function is not usually used by users.
GtkWidget* gtk_ctree_new_with_titles (gint columns, gint tree_column, gchar *titles[]); |
Create a new GtkCTree widget with the given titles for the columns.
columns : | Number of columns. |
tree_column : | Which column has the tree graphic; 0 = leftmost. |
titles : | The titles for the columns. |
Returns : | The GtkCTree widget. |
GtkWidget* gtk_ctree_new (gint columns, gint tree_column); |
Create a new GtkCTree widget.
columns : | Number of columns. |
tree_column : | Which columns has the tree graphic. |
Returns : | The new GtkCTree widget. |
GtkCTreeNode* gtk_ctree_insert_node (GtkCTree *ctree, GtkCTreeNode *parent, GtkCTreeNode *sibling, gchar *text[], guint8 spacing, GdkPixmap *pixmap_closed, GdkBitmap *mask_closed, GdkPixmap *pixmap_opened, GdkBitmap *mask_opened, gboolean is_leaf, gboolean expanded); |
Insert a new node to the tree. The position is specified through the parent-sibling notation, as explained in the introduction above.
ctree : | The GtkCTree widget. |
parent : | The parent node to be. |
sibling : | The sibling node to be. |
text : | The texts to be shown in each column. |
spacing : | The extra space between the pixmap and the text. |
pixmap_closed : | The pixmap to be used when the node is collapsed. Can be NULL. |
mask_closed : | The mask for the above pixmap. Can be NULL. |
pixmap_opened : | The pixmap to be used when the children are visible. Can be NULL. |
mask_opened : | The mask for the above pixmap. Can be NULL. |
is_leaf : | Whether this node is going to be a leaf. |
expanded : | Whether this node should start out expanded or not. |
Returns : |
void gtk_ctree_remove_node (GtkCTree *ctree, GtkCTreeNode *node); |
Remove the node and all nodes underneath it from the tree.
GtkCTreeNode* gtk_ctree_insert_gnode (GtkCTree *ctree, GtkCTreeNode *parent, GtkCTreeNode *sibling, GNode *gnode, GtkCTreeGNodeFunc func, gpointer data); |
FIXME
GNode* gtk_ctree_export_to_gnode (GtkCTree *ctree, GNode *parent, GNode *sibling, GtkCTreeNode *node, GtkCTreeGNodeFunc func, gpointer data); |
FIXME
void gtk_ctree_post_recursive (GtkCTree *ctree, GtkCTreeNode *node, GtkCTreeFunc func, gpointer data); |
Recursively apply a function to all nodes of the tree at or below a certain node. The function is called for each node after it has been called for that node's children.
void gtk_ctree_post_recursive_to_depth (GtkCTree *ctree, GtkCTreeNode *node, gint depth, GtkCTreeFunc func, gpointer data); |
Recursively apply a function to nodes up to a certain depth. The function is called for each node after it has been called for that node's children.
ctree : | |
node : | The node where to start. |
depth : | The maximum absolute depth for applying the function. If depth is negative, this function just calls gtk_ctree_post_recursive. |
func : | The function to apply to each node. |
data : | A closure argument given to each invocation of the function. |
void gtk_ctree_pre_recursive (GtkCTree *ctree, GtkCTreeNode *node, GtkCTreeFunc func, gpointer data); |
Recursively apply a function to all nodes of the tree at or below a certain node. The function is called for each node after it has been called for its parent.
void gtk_ctree_pre_recursive_to_depth (GtkCTree *ctree, GtkCTreeNode *node, gint depth, GtkCTreeFunc func, gpointer data); |
Recursively apply a function to nodes up to a certain depth. The function is called for each node after it has been called for that node's children.
ctree : | |
node : | The node where to start. |
depth : | The maximum absolute depth for applying the function. If depth is negative, this function just calls gtk_ctree_post_recursive. |
func : | The function to apply to each node. |
data : | A closure argument given to each invocation of the function. |
gboolean gtk_ctree_is_viewable (GtkCTree *ctree, GtkCTreeNode *node); |
This function checks whether the given node is viewable i.e. so that all of its parent nodes are expanded. This is different from being actually visible: the node can be viewable but outside the scrolling area of the window.
GtkCTreeNode* gtk_ctree_last (GtkCTree *ctree, GtkCTreeNode *node); |
Returns the last child of the last child of the last child... of the given node.
GtkCTreeNode* gtk_ctree_find_node_ptr (GtkCTree *ctree, GtkCTreeRow *ctree_row); |
Finds the node pointer given a GtkCTreeRow structure.
gboolean gtk_ctree_find (GtkCTree *ctree, GtkCTreeNode *node, GtkCTreeNode *child); |
gboolean gtk_ctree_is_ancestor (GtkCTree *ctree, GtkCTreeNode *node, GtkCTreeNode *child); |
GtkCTreeNode* gtk_ctree_find_by_row_data (GtkCTree *ctree, GtkCTreeNode *node, gpointer data); |
Finds a node in the tree under node that has the given user data pointer.
GList* gtk_ctree_find_all_by_row_data (GtkCTree *ctree, GtkCTreeNode *node, gpointer data); |
Finds all nodes in the tree under node that have the given user data pointer.
GtkCTreeNode* gtk_ctree_find_by_row_data_custom (GtkCTree *ctree, GtkCTreeNode *node, gpointer data, GCompareFunc func); |
Find the first node under node whose row data pointer fulfills a custom criterion.
GList* gtk_ctree_find_all_by_row_data_custom (GtkCTree *ctree, GtkCTreeNode *node, gpointer data, GCompareFunc func); |
Find all nodes under node whose row data pointer fulfills a custom criterion.
void gtk_ctree_move (GtkCTree *ctree, GtkCTreeNode *node, GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling); |
Move a node in the tree to another location.
void gtk_ctree_expand_recursive (GtkCTree *ctree, GtkCTreeNode *node); |
Expand one node and all nodes underneath.
void gtk_ctree_expand_to_depth (GtkCTree *ctree, GtkCTreeNode *node, gint depth); |
Expand a node and its children up to the depth given.
void gtk_ctree_collapse (GtkCTree *ctree, GtkCTreeNode *node); |
Collapse one node.
void gtk_ctree_collapse_recursive (GtkCTree *ctree, GtkCTreeNode *node); |
Collapse one node and all its subnodes.
void gtk_ctree_collapse_to_depth (GtkCTree *ctree, GtkCTreeNode *node, gint depth); |
Collapse a node and its children up to the depth given.
void gtk_ctree_toggle_expansion (GtkCTree *ctree, GtkCTreeNode *node); |
Toggle a node, i.e. if it is collapsed, expand it and vice versa.
void gtk_ctree_toggle_expansion_recursive (GtkCTree *ctree, GtkCTreeNode *node); |
Toggle the expansion of a node and all its children.
void gtk_ctree_select (GtkCTree *ctree, GtkCTreeNode *node); |
Cause the given node to be selected and emit the appropriate signal.
void gtk_ctree_select_recursive (GtkCTree *ctree, GtkCTreeNode *node); |
Cause the given node and its subnodes to be selected and emit the appropriate signal(s).
void gtk_ctree_unselect (GtkCTree *ctree, GtkCTreeNode *node); |
Unselect the given node and emit the appropriate signal.
void gtk_ctree_unselect_recursive (GtkCTree *ctree, GtkCTreeNode *node); |
Unselect the given node and its subnodes and emit the appropriate signal(s).
void gtk_ctree_real_select_recursive (GtkCTree *ctree, GtkCTreeNode *node, gint state); |
The function that implements both gtk_ctree_select_recursive and gtk_ctree_unselect_recursive.
void gtk_ctree_node_set_text (GtkCTree *ctree, GtkCTreeNode *node, gint column, const gchar *text); |
Set the text in a node.
void gtk_ctree_node_set_pixmap (GtkCTree *ctree, GtkCTreeNode *node, gint column, GdkPixmap *pixmap, GdkBitmap *mask); |
FIXME
void gtk_ctree_node_set_pixtext (GtkCTree *ctree, GtkCTreeNode *node, gint column, const gchar *text, guint8 spacing, GdkPixmap *pixmap, GdkBitmap *mask); |
FIXME
void gtk_ctree_set_node_info (GtkCTree *ctree, GtkCTreeNode *node, const gchar *text, guint8 spacing, GdkPixmap *pixmap_closed, GdkBitmap *mask_closed, GdkPixmap *pixmap_opened, GdkBitmap *mask_opened, gboolean is_leaf, gboolean expanded); |
Change the information. Most parameters correspond to the parameters of gtk_ctree_insert_node.
void gtk_ctree_node_set_shift (GtkCTree *ctree, GtkCTreeNode *node, gint column, gint vertical, gint horizontal); |
Shift the given cell the given amounts in pixels.
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, GtkCTreeNode *node, gint column); |
gint gtk_ctree_node_get_text (GtkCTree *ctree, GtkCTreeNode *node, gint column, gchar **text); |
gint gtk_ctree_node_get_pixmap (GtkCTree *ctree, GtkCTreeNode *node, gint column, GdkPixmap **pixmap, GdkBitmap **mask); |
gint gtk_ctree_node_get_pixtext (GtkCTree *ctree, GtkCTreeNode *node, gint column, gchar **text, guint8 *spacing, GdkPixmap **pixmap, GdkBitmap **mask); |
Get the parameters of a cell containing both a pixmap and text.
gint gtk_ctree_get_node_info (GtkCTree *ctree, GtkCTreeNode *node, gchar **text, guint8 *spacing, GdkPixmap **pixmap_closed, GdkBitmap **mask_closed, GdkPixmap **pixmap_opened, GdkBitmap **mask_opened, gboolean *is_leaf, gboolean *expanded); |
Get information corresponding to a node. Any of the return parameters can be null.
void gtk_ctree_node_set_row_style (GtkCTree *ctree, GtkCTreeNode *node, GtkStyle *style); |
Set the style of a row.
GtkStyle* gtk_ctree_node_get_row_style (GtkCTree *ctree, GtkCTreeNode *node); |
Get the style of a row.
void gtk_ctree_node_set_cell_style (GtkCTree *ctree, GtkCTreeNode *node, gint column, GtkStyle *style); |
Set the style of an individual cell.
GtkStyle* gtk_ctree_node_get_cell_style (GtkCTree *ctree, GtkCTreeNode *node, gint column); |
Get the style of an individual cell.
void gtk_ctree_node_set_foreground (GtkCTree *ctree, GtkCTreeNode *node, GdkColor *color); |
void gtk_ctree_node_set_background (GtkCTree *ctree, GtkCTreeNode *node, GdkColor *color); |
void gtk_ctree_node_set_row_data (GtkCTree *ctree, GtkCTreeNode *node, gpointer data); |
Set the custom data associated with a node.
void gtk_ctree_node_set_row_data_full (GtkCTree *ctree, GtkCTreeNode *node, gpointer data, GtkDestroyNotify destroy); |
This is the full interface to setting row data, so that a destructor can be given for the data.
gpointer gtk_ctree_node_get_row_data (GtkCTree *ctree, GtkCTreeNode *node); |
void gtk_ctree_node_moveto (GtkCTree *ctree, GtkCTreeNode *node, gint column, gfloat row_align, gfloat col_align); |
This function makes the given column of the given node visible by scrolling.
GtkVisibility gtk_ctree_node_is_visible (GtkCTree *ctree, GtkCTreeNode *node); |
void gtk_ctree_set_spacing (GtkCTree *ctree, gint spacing); |
The spacing between the tree graphic and the actual node content.
#define gtk_ctree_set_reorderable(t,r) gtk_clist_set_reorderable((GtkCList*) (t),(r)) |
void gtk_ctree_set_line_style (GtkCTree *ctree, GtkCTreeLineStyle line_style); |
void gtk_ctree_set_expander_style (GtkCTree *ctree, GtkCTreeExpanderStyle expander_style); |
void gtk_ctree_set_drag_compare_func (GtkCTree *ctree, GtkCTreeCompareDragFunc cmp_func); |
FIXME
void gtk_ctree_sort_node (GtkCTree *ctree, GtkCTreeNode *node); |
Sort the children of a node. See GtkCList for how to set the sorting criteria etc.
void gtk_ctree_sort_recursive (GtkCTree *ctree, GtkCTreeNode *node); |
Sort the descendants of a node. See GtkCList for how to set the sorting criteria etc.
The number of pixels to indent the tree levels.
The number of pixels between the tree and the columns.
void user_function (GtkCTree *ctree, GList *node, gint column, gpointer user_data); |
Emitted when a row is selected.
void user_function (GtkCTree *ctree, GList *node, gint column, gpointer user_data); |
Emitted when a node is unselected.
void user_function (GtkCTree *ctree, GList *node, gpointer user_data); |
Emitted when a node is expanded.
void user_function (GtkCTree *ctree, GList *node, gpointer user_data); |
Emitted when a node is collapsed.
void user_function (GtkCTree *ctree, GList *node, GList *new_parent, GList *new_sibling, gpointer user_data); |
Emitted when a node is moved.
void user_function (GtkCTree *ctree, GtkCTreeExpansionType expansion, gpointer user_data); |
The row which has the focus is either collapsed or expanded or toggled.