DzlTree: Dazzle Reference Manual

## DzlTree DzlTree |

## Functions

gboolean | (*DzlTreeFindFunc) ()
gboolean | (*DzlTreeFilterFunc) ()
void | dzl_tree_add_builder ()
void | dzl_tree_remove_builder ()
DzlTreeNode * | dzl_tree_find_item ()
DzlTreeNode * | dzl_tree_find_custom ()
DzlTreeNode * | dzl_tree_get_selected ()
void | dzl_tree_unselect_all ()
void | dzl_tree_rebuild ()
void | dzl_tree_set_root ()
DzlTreeNode * | dzl_tree_get_root ()
void | dzl_tree_set_show_icons ()
gboolean | dzl_tree_get_show_icons ()
void | dzl_tree_scroll_to_node ()
void | dzl_tree_expand_to_node ()
DzlTreeNode * | dzl_tree_find_child_node ()
void | dzl_tree_set_filter ()
GMenuModel * | dzl_tree_get_context_menu ()
void | dzl_tree_set_context_menu ()

## Types and Values

| DzlTreeClass

## Description

## Functions

### DzlTreeFindFunc ()

    gboolean
    (*DzlTreeFindFunc) (DzlTree *tree,
                        DzlTreeNode *node,
                        DzlTreeNode *child,
                        gpointer user_data);

Callback to check `child` , a child of `node` , matches a lookup request. Returns `TRUE` if `child` matches, `FALSE` if not.

#### Returns

`TRUE` if `child` matched

### DzlTreeFilterFunc ()

    gboolean
    (*DzlTreeFilterFunc) (DzlTree *tree,
                          DzlTreeNode *node,
                          gpointer user_data);

Callback to check if `node` should be visible.

#### Returns

`TRUE` if `node` should be visible.

### dzl_tree_add_builder ()

    void
    dzl_tree_add_builder (DzlTree *self,
                          DzlTreeBuilder *builder);

Add a builder to the tree.

#### Parameters

self | A DzlTree. |
builder | A DzlTreeBuilder to add. |

### dzl_tree_remove_builder ()

    void
    dzl_tree_remove_builder (DzlTree *self,
                             DzlTreeBuilder *builder);

Removes a builder from the tree.

#### Parameters

self | A DzlTree. | [in]
builder | A DzlTreeBuilder to remove. | [in]

### dzl_tree_find_item ()

    DzlTreeNode *
    dzl_tree_find_item (DzlTree *self,
                        GObject *item);

Finds a DzlTreeNode with an item property matching `item` .

#### Parameters

self | A DzlTree. |
item | A GObject or `NULL`. | [allow-none]

#### Returns

A DzlTreeNode or `NULL`.

[transfer none][nullable]

### dzl_tree_find_custom ()

    DzlTreeNode *
    dzl_tree_find_custom (DzlTree *self,
                          GEqualFunc equal_func,
                          gpointer key);

Walks the entire tree looking for the first item that matches given `equal_func` and `key` .

The first parameter to `equal_func` will always be `key` . The second parameter will be the nodes “item” property.

#### Parameters

self | A DzlTree |
equal_func | A GEqualFunc. | [scope call]
key | the key for `equal_func` |

#### Returns

A DzlTreeNode or `NULL`.

[nullable][transfer none]

### dzl_tree_get_selected ()

    DzlTreeNode *
    dzl_tree_get_selected (DzlTree *self);

Gets the currently selected node in the tree.

#### Parameters

self | A DzlTree. | [in]

#### Returns

A DzlTreeNode.

[transfer none]

### dzl_tree_unselect_all ()

    void
    dzl_tree_unselect_all (DzlTree *self);

Unselects the currently selected node in the tree.

#### Parameters

self | A DzlTree. | [in]

### dzl_tree_rebuild ()

    void
    dzl_tree_rebuild (DzlTree *self);

### dzl_tree_set_root ()

    void
    dzl_tree_set_root (DzlTree *self,
                       DzlTreeNode *node);

Sets the root node of the DzlTree widget. This is used to build the items within the treeview. The item itself will not be added to the self, but the direct children will be.

#### Parameters

self | A DzlTree. |
node | A DzlTreeNode. |

### dzl_tree_get_root ()

    DzlTreeNode *
    dzl_tree_get_root (DzlTree *self);

Retrieves the root node of the tree. The root node is not a visible node in the self, but a placeholder for all other builders to build upon.

#### Returns

A DzlTreeNode or `NULL`.

[transfer none][nullable]

### dzl_tree_set_show_icons ()

    void
    dzl_tree_set_show_icons (DzlTree *self,
                             gboolean show_icons);

### dzl_tree_get_show_icons ()

    gboolean
    dzl_tree_get_show_icons (DzlTree *self);

### dzl_tree_scroll_to_node ()

    void
    dzl_tree_scroll_to_node (DzlTree *self,
                             DzlTreeNode *node);

### dzl_tree_expand_to_node ()

    void
    dzl_tree_expand_to_node (DzlTree *self,
                             DzlTreeNode *node);

### dzl_tree_find_child_node ()

    DzlTreeNode *
    dzl_tree_find_child_node (DzlTree *self,
                              DzlTreeNode *node,
                              DzlTreeFindFunc find_func,
                              gpointer user_data);

Searches through the direct children of `node` for a matching child. `find_func` should return `TRUE` if the child matches, otherwise `FALSE`.

#### Parameters

self | A DzlTree |
node | A DzlTreeNode |
find_func | A callback to locate the child. | [scope call]
user_data | user data for `find_func` |

#### Returns

A DzlTreeNode or `NULL`.

[transfer none][nullable]

### dzl_tree_set_filter ()

    void
    dzl_tree_set_filter (DzlTree *self,
                         DzlTreeFilterFunc filter_func,
                         gpointer filter_data,
                         GDestroyNotify filter_data_destroy);

Sets the filter function to be used to determine visability of a tree node.

#### Parameters

self | A DzlTree |
filter_func | A callback to determien visibility. | [scope notified]
filter_data | User data for `filter_func` . |
filter_data_destroy | Destroy notify for `filter_data` . |

### dzl_tree_get_context_menu ()

    GMenuModel *
    dzl_tree_get_context_menu (DzlTree *self);

#### Returns

A GMenuModel or `NULL`.

[transfer none][nullable]

### dzl_tree_set_context_menu ()

    void
    dzl_tree_set_context_menu (DzlTree *self,
                               GMenuModel *context_menu);

## Types and Values

### DzlTreeClass

    typedef struct {
    	GtkTreeViewClass parent_class;

      void (*action)         (DzlTree     *self,
                              const gchar *action_group,
                              const gchar *action_name,
                              const gchar *param);
      void (*populate_popup) (DzlTree     *self,
                              GtkWidget   *widget);
    } DzlTreeClass;