## IdeTreeNode IdeTreeNode — a node within the tree |

## Functions

IdeTreeNodeVisit | (*IdeTreeTraverseFunc) ()
int | (*IdeTreeNodeCompare) ()
IdeTreeNode * | ide_tree_node_new ()
gboolean | ide_tree_node_get_has_error ()
void | ide_tree_node_set_has_error ()
const gchar * | ide_tree_node_get_tag ()
void | ide_tree_node_set_tag ()
gboolean | ide_tree_node_is_tag ()
GtkTreePath * | ide_tree_node_get_path ()
const gchar * | ide_tree_node_get_display_name ()
void | ide_tree_node_set_display_name ()
gboolean | ide_tree_node_get_is_header ()
void | ide_tree_node_set_is_header ()
GIcon * | ide_tree_node_get_icon ()
void | ide_tree_node_set_icon ()
void | ide_tree_node_set_icon_name ()
GIcon * | ide_tree_node_get_expanded_icon ()
void | ide_tree_node_set_expanded_icon ()
void | ide_tree_node_set_expanded_icon_name ()
gpointer | ide_tree_node_get_item ()
void | ide_tree_node_set_item ()
gboolean | ide_tree_node_get_children_possible ()
void | ide_tree_node_set_children_possible ()
gboolean | ide_tree_node_is_empty ()
gboolean | ide_tree_node_has_child ()
guint | ide_tree_node_get_n_children ()
IdeTreeNode * | ide_tree_node_get_next ()
IdeTreeNode * | ide_tree_node_get_previous ()
guint | ide_tree_node_get_index ()
IdeTreeNode * | ide_tree_node_get_nth_child ()
void | ide_tree_node_prepend ()
void | ide_tree_node_append ()
void | ide_tree_node_insert_sorted ()
void | ide_tree_node_insert_before ()
void | ide_tree_node_insert_after ()
void | ide_tree_node_remove ()
IdeTreeNode * | ide_tree_node_get_parent ()
gboolean | ide_tree_node_is_root ()
gboolean | ide_tree_node_is_first ()
gboolean | ide_tree_node_is_last ()
IdeTreeNode * | ide_tree_node_get_root ()
gboolean | ide_tree_node_holds ()
void | ide_tree_node_traverse ()
void | ide_tree_node_add_emblem ()
gboolean | ide_tree_node_get_reset_on_collapse ()
void | ide_tree_node_set_reset_on_collapse ()
const GdkRGBA * | ide_tree_node_get_background_rgba ()
void | ide_tree_node_set_background_rgba ()
const GdkRGBA * | ide_tree_node_get_foreground_rgba ()
void | ide_tree_node_set_foreground_rgba ()
gboolean | ide_tree_node_is_selected ()
gboolean | ide_tree_node_get_use_markup ()
void | ide_tree_node_set_use_markup ()
void | ide_tree_node_set_flags ()
IdeTreeNodeFlags | ide_tree_node_get_flags ()

## Properties

gboolean | children-possible | Read / Write
gboolean | destroy-item | Read / Write
gchar * | display-name | Read / Write
GIcon * | expanded-icon | Read / Write
gchar * | expanded-icon-name | Write
gboolean | has-error | Read / Write
GIcon * | icon | Read / Write
gchar * | icon-name | Write
gboolean | is-header | Read / Write
GObject * | item | Read / Write
gboolean | reset-on-collapse | Read / Write
gchar * | tag | Read / Write
gboolean | use-markup | Read / Write

## Types and Values

#define | IDE_TYPE_TREE_NODE
enum | IdeTreeNodeVisit
enum | IdeTreeNodeFlags
| IdeTreeNode

## Object Hierarchy

        GObject
        ╰── IdeTreeNode

## Description

The IdeTreeNode class is used to represent an item that should be displayed in the tree of the Ide application. The IdeTreeAddin plugins create and maintain these nodes during the lifetime of the program.

Plugins that want to add items to the tree should implement the IdeTreeAddin interface and register it during plugin initialization.

## Functions

### IdeTreeTraverseFunc ()

    IdeTreeNodeVisit
    (*IdeTreeTraverseFunc) (IdeTreeNode *node,
                            gpointer user_data);

This function prototype is used to traverse a tree of IdeTreeNode.

#### Parameters

node | an IdeTreeNode |
user_data | closure data provided to `ide_tree_node_traverse()` |

#### Returns

IdeTreeNodeVisit, `IDE_TREE_NODE_VISIT_BREAK` to stop traversal.

Since: 3.32

### IdeTreeNodeCompare ()

    int
    (*IdeTreeNodeCompare) (IdeTreeNode *node,
                           IdeTreeNode *child);

This callback function is a convenience wrapper around GCompareFunc

#### Parameters

node | an IdeTreeNode that iterate over children |
child | an IdeTreeNode to be inserted |

#### Returns

int

Since: 3.32

### ide_tree_node_new ()

    IdeTreeNode *
    ide_tree_node_new (void);

Create a new IdeTreeNode.

#### Returns

a newly created IdeTreeNode.

[transfer full]

Since: 3.32

### ide_tree_node_get_has_error ()

    gboolean
    ide_tree_node_get_has_error (IdeTreeNode *self);

### ide_tree_node_set_has_error ()

    void
    ide_tree_node_set_has_error (IdeTreeNode *self,
                                 gboolean has_error);

### ide_tree_node_get_tag ()

    const gchar *
    ide_tree_node_get_tag (IdeTreeNode *self);

### ide_tree_node_set_tag ()

    void
    ide_tree_node_set_tag (IdeTreeNode *self,
                           const gchar *tag);

### ide_tree_node_is_tag ()

    gboolean
    ide_tree_node_is_tag (IdeTreeNode *self,
                          const gchar *tag);

### ide_tree_node_get_path ()

    GtkTreePath *
    ide_tree_node_get_path (IdeTreeNode *self);

Gets the path for the tree node.

#### Parameters

self | a IdeTreeNode |

#### Returns

a path or `NULL`.

[transfer full][nullable]

Since: 3.32

### ide_tree_node_get_display_name ()

    const gchar *
    ide_tree_node_get_display_name (IdeTreeNode *self);

Gets the “display-name” property.

#### Parameters

self | a IdeTreeNode |

#### Returns

a string containing the display name.

[nullable]

Since: 3.32

### ide_tree_node_set_display_name ()

    void
    ide_tree_node_set_display_name (IdeTreeNode *self,
                                    const gchar *display_name);

Sets the “display-name” property, which is the text to use when displaying the item in the tree.

Since: 3.32

### ide_tree_node_get_is_header ()

    gboolean
    ide_tree_node_get_is_header (IdeTreeNode *self);

Gets the “is-header” property.

If this is `TRUE`, then the node will be rendered with alternate styling for group headers.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if `self` is a header.

Since: 3.32

### ide_tree_node_set_is_header ()

    void
    ide_tree_node_set_is_header (IdeTreeNode *self,
                                 gboolean header);

Sets the “is-header” property.

#### Parameters

self | a IdeTreeNode |

Since: 3.32

### ide_tree_node_get_icon ()

    GIcon *
    ide_tree_node_get_icon (IdeTreeNode *self);

Gets the icon associated with the tree node.

#### Parameters

self | a IdeTree |

#### Returns

a GIcon or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_tree_node_set_icon ()

    void
    ide_tree_node_set_icon (IdeTreeNode *self,
                            GIcon *icon);

Sets the icon for the tree node.

#### Parameters

self | a `IdeTreeNode` |
icon | a GIcon or `NULL`. | [nullable]

Since: 3.32

### ide_tree_node_set_icon_name ()

    void
    ide_tree_node_set_icon_name (IdeTreeNode *self,
                                 const gchar *icon_name);

Sets the “icon” property using an icon-name.

#### Parameters

self | a IdeTreeNode |
icon_name | the name of the icon, or `NULL`. | [nullable]

Since: 3.32

### ide_tree_node_get_expanded_icon ()

    GIcon *
    ide_tree_node_get_expanded_icon (IdeTreeNode *self);

Gets the expanded icon associated with the tree node.

#### Parameters

self | a IdeTree |

#### Returns

a GIcon or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_tree_node_set_expanded_icon ()

    void
    ide_tree_node_set_expanded_icon (IdeTreeNode *self,
                                     GIcon *expanded_icon);

Sets the expanded icon for the tree node.

#### Parameters

self | a `IdeTreeNode` |
expanded_icon | a GIcon or `NULL`. | [nullable]

Since: 3.32

### ide_tree_node_set_expanded_icon_name ()

    void
    ide_tree_node_set_expanded_icon_name (IdeTreeNode *self,
                                          const gchar *expanded_icon_name);

Sets the “icon” property using an icon-name.

#### Parameters

self | a IdeTreeNode |
expanded_icon_name | the name of the icon, or `NULL`. | [nullable]

Since: 3.32

### ide_tree_node_get_item ()

    gpointer
    ide_tree_node_get_item (IdeTreeNode *self);

Gets the item that has been associated with the node.

#### Parameters

self | a IdeTreeNode |

#### Returns

a GObject if the item has been previously set.

[transfer none][type GObject.Object][nullable]

Since: 3.32

### ide_tree_node_set_item ()

    void
    ide_tree_node_set_item (IdeTreeNode *self,
                            gpointer item);

### ide_tree_node_get_children_possible ()

    gboolean
    ide_tree_node_get_children_possible (IdeTreeNode *self);

Checks if the node can have children, and if so, returns `TRUE`. It may not actually have children yet.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if the children may have children

Since: 3.32

### ide_tree_node_set_children_possible ()

    void
    ide_tree_node_set_children_possible (IdeTreeNode *self,
                                         gboolean children_possible);

Sets if the children are possible for the node.

#### Parameters

self | a IdeTreeNode |
children_possible | if children are possible |

Since: 3.32

### ide_tree_node_is_empty ()

    gboolean
    ide_tree_node_is_empty (IdeTreeNode *self);

This function checks if `self` is a synthesized "empty" node.

Empty nodes are added to IdeTreeNode that may have children in the future, but are currently empty. It allows the tree to display the "(Empty)" contents and show a proper expander arrow.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if `self` is a synthesized empty node.

Since: 3.32

### ide_tree_node_has_child ()

    gboolean
    ide_tree_node_has_child (IdeTreeNode *self);

Checks if `self` has any children.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if `self` has one or more children.

Since: 3.32

### ide_tree_node_get_n_children ()

    guint
    ide_tree_node_get_n_children (IdeTreeNode *self);

Gets the number of children that `self` contains.

#### Parameters

self | a IdeTreeNode |

#### Returns

the number of children

Since: 3.32

### ide_tree_node_get_next ()

    IdeTreeNode *
    ide_tree_node_get_next (IdeTreeNode *self);

Gets the next sibling after `self` .

#### Parameters

self | a IdeTreeNode |

#### Returns

a IdeTreeNode or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_tree_node_get_previous ()

    IdeTreeNode *
    ide_tree_node_get_previous (IdeTreeNode *self);

Gets the previous sibling before `self` .

#### Parameters

self | a IdeTreeNode |

#### Returns

a IdeTreeNode or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_tree_node_get_index ()

    guint
    ide_tree_node_get_index (IdeTreeNode *self);

Gets the position of the `self` .

#### Parameters

self | a IdeTreeNode |

#### Returns

the offset of `self` with it's siblings.

Since: 3.32

### ide_tree_node_get_nth_child ()

    IdeTreeNode *
    ide_tree_node_get_nth_child (IdeTreeNode *self,
                                 guint index_);

Gets the `nth` child of the tree node or `NULL` if it does not exist.

#### Parameters

self | a IdeTreeNode |
index_ | the index of the child |

#### Returns

a IdeTreeNode or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_tree_node_prepend ()

    void
    ide_tree_node_prepend (IdeTreeNode *self,
                           IdeTreeNode *child);

Prepends `child` as a child of `self` at the 0 index.

This operation is O(1).

#### Parameters

self | a IdeTreeNode |
child | a IdeTreeNode |

Since: 3.32

### ide_tree_node_append ()

    void
    ide_tree_node_append (IdeTreeNode *self,
                          IdeTreeNode *child);

Appends `child` as a child of `self` at the last position.

This operation is O(1).

#### Parameters

self | a IdeTreeNode |
child | a IdeTreeNode |

Since: 3.32

### ide_tree_node_insert_sorted ()

    void
    ide_tree_node_insert_sorted (IdeTreeNode *self,
                                 IdeTreeNode *child,
                                 IdeTreeNodeCompare cmpfn);

Insert `child` as a child of `self` at the sorted position determined by `cmpfn`

This operation is O(n).

#### Parameters

self | an IdeTreeNode |
child | an IdeTreeNode |
cmpfn | an IdeTreeNodeCompare. | [scope call]

Since: 3.32

### ide_tree_node_insert_before ()

    void
    ide_tree_node_insert_before (IdeTreeNode *self,
                                 IdeTreeNode *child);

Inserts `child` directly before `self` by adding it to the parent of `self` .

This operation is O(1).

#### Parameters

self | a IdeTreeNode |
child | a IdeTreeNode |

Since: 3.32

### ide_tree_node_insert_after ()

    void
    ide_tree_node_insert_after (IdeTreeNode *self,
                                IdeTreeNode *child);

Inserts `child` directly after `self` by adding it to the parent of `self` .

This operation is O(1).

#### Parameters

self | a IdeTreeNode |
child | a IdeTreeNode |

Since: 3.32

### ide_tree_node_remove ()

    void
    ide_tree_node_remove (IdeTreeNode *self,
                          IdeTreeNode *child);

Removes the child node `child` from `self` . `self` must be the parent of `child` .

This function is O(1).

#### Parameters

self | a IdeTreeNode |
child | a IdeTreeNode |

Since: 3.32

### ide_tree_node_get_parent ()

    IdeTreeNode *
    ide_tree_node_get_parent (IdeTreeNode *self);

Gets the parent node of `self` .

#### Parameters

self | a IdeTreeNode |

#### Returns

a IdeTreeNode or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_tree_node_is_root ()

    gboolean
    ide_tree_node_is_root (IdeTreeNode *self);

Checks if `self` is the root node, meaning it has no parent.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if `self` has no parent.

Since: 3.32

### ide_tree_node_is_first ()

    gboolean
    ide_tree_node_is_first (IdeTreeNode *self);

Checks if `self` is the first sibling.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if `self` is the first sibling

Since: 3.32

### ide_tree_node_is_last ()

    gboolean
    ide_tree_node_is_last (IdeTreeNode *self);

Checks if `self` is the last sibling.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if `self` is the last sibling

Since: 3.32

### ide_tree_node_get_root ()

    IdeTreeNode *
    ide_tree_node_get_root (IdeTreeNode *self);

Gets the root IdeTreeNode by following the “parent” properties of each node.

#### Parameters

self | a IdeTreeNode |

#### Returns

a IdeTreeNode or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_tree_node_holds ()

    gboolean
    ide_tree_node_holds (IdeTreeNode *self,
                         GType type);

Checks to see if the “item” property matches `type` or is a subclass of `type` .

#### Parameters

self | a IdeTreeNode |
type | a GType |

#### Returns

`TRUE` if `self` holds a `type` item

Since: 3.32

### ide_tree_node_traverse ()

    void
    ide_tree_node_traverse (IdeTreeNode *self,
                            GTraverseType traverse_type,
                            GTraverseFlags traverse_flags,
                            gint max_depth,
                            IdeTreeTraverseFunc traverse_func,
                            gpointer user_data);

Calls `traverse_func` for each node that matches the requested type, flags, and depth.

Traversal is stopped if `traverse_func` returns `TRUE`.

#### Parameters

self | a IdeTreeNode |
traverse_type | the type of traversal, pre and post supported |
traverse_flags | the flags for what nodes to match |
max_depth | the max depth for the traversal or -1 for all |
traverse_func | the callback for each matching node. | [scope call]
user_data | user data for `traverse_func` |

Since: 3.32

### ide_tree_node_add_emblem ()

    void
    ide_tree_node_add_emblem (IdeTreeNode *self,
                              GEmblem *emblem);

### ide_tree_node_get_reset_on_collapse ()

    gboolean
    ide_tree_node_get_reset_on_collapse (IdeTreeNode *self);

Checks if the node should have all children removed when collapsed.

#### Parameters

self | a IdeTreeNode |

#### Returns

`TRUE` if children are removed on collapse

Since: 3.32

### ide_tree_node_set_reset_on_collapse ()

    void
    ide_tree_node_set_reset_on_collapse (IdeTreeNode *self,
                                         gboolean reset_on_collapse);

If `TRUE`, then children will be removed when the row is collapsed.

#### Parameters

self | a IdeTreeNode |
reset_on_collapse | if the children should be removed on collapse |

Since: 3.32

### ide_tree_node_get_background_rgba ()

    const GdkRGBA *
    ide_tree_node_get_background_rgba (IdeTreeNode *self);

### ide_tree_node_set_background_rgba ()

    void
    ide_tree_node_set_background_rgba (IdeTreeNode *self,
                                       const GdkRGBA *background_rgba);

### ide_tree_node_get_foreground_rgba ()

    const GdkRGBA *
    ide_tree_node_get_foreground_rgba (IdeTreeNode *self);

### ide_tree_node_set_foreground_rgba ()

    void
    ide_tree_node_set_foreground_rgba (IdeTreeNode *self,
                                       const GdkRGBA *foreground_rgba);

### ide_tree_node_is_selected ()

    gboolean
    ide_tree_node_is_selected (IdeTreeNode *self);

### ide_tree_node_get_use_markup ()

    gboolean
    ide_tree_node_get_use_markup (IdeTreeNode *self);

### ide_tree_node_set_use_markup ()

    void
    ide_tree_node_set_use_markup (IdeTreeNode *self,
                                  gboolean use_markup);

### ide_tree_node_set_flags ()

    void
    ide_tree_node_set_flags (IdeTreeNode *self,
                             IdeTreeNodeFlags flags);

### ide_tree_node_get_flags ()

    IdeTreeNodeFlags
    ide_tree_node_get_flags (IdeTreeNode *self);

## Types and Values

### IDE_TYPE_TREE_NODE

    #define IDE_TYPE_TREE_NODE (ide_tree_node_get_type())

### enum IdeTreeNodeVisit

#### Members

IDE_TREE_NODE_VISIT_BREAK |  |
IDE_TREE_NODE_VISIT_CONTINUE |  |
IDE_TREE_NODE_VISIT_CHILDREN |  |

### enum IdeTreeNodeFlags

#### Members

IDE_TREE_NODE_FLAGS_NONE |  |
IDE_TREE_NODE_FLAGS_DESCENDANT |  |
IDE_TREE_NODE_FLAGS_ADDED |  |
IDE_TREE_NODE_FLAGS_CHANGED |  |
IDE_TREE_NODE_FLAGS_REMOVED |  |

### IdeTreeNode

    typedef struct _IdeTreeNode IdeTreeNode;

## Property Details

### The `“children-possible”` property

      “children-possible”        gboolean

The "children-possible" property denotes if the node may have children even if it doesn't have children yet. This is useful for delayed loading of children nodes.

Owner: IdeTreeNode

Flags: Read / Write

Default value: FALSE

Since: 3.32

### The `“destroy-item”` property

      “destroy-item”             gboolean

If `TRUE` and “item” is an IdeObject, it will be destroyed when the node is destroyed.

Owner: IdeTreeNode

Flags: Read / Write

Default value: FALSE

Since: 3.32

### The `“display-name”` property

      “display-name”             gchar *

The "display-name" property is the name for the node as it should be displayed in the tree.

Owner: IdeTreeNode

Flags: Read / Write

Default value: NULL

Since: 3.32

### The `“expanded-icon”` property

      “expanded-icon”            GIcon *

The "expanded-icon" property is the icon that should be displayed to the user in the tree for this node.

Owner: IdeTreeNode

Flags: Read / Write

Since: 3.32

### The `“expanded-icon-name”` property

      “expanded-icon-name”       gchar *

The "expanded-icon-name" is a convenience property to set the “expanded-icon” property using an icon-name.

Owner: IdeTreeNode

Flags: Write

Default value: NULL

Since: 3.32

### The `“has-error”` property

      “has-error”                gboolean

The "has-error" property is true if the node should be rendered with an error styling. This is useful when errors are known by the diagnostics manager for a given file or folder.

Owner: IdeTreeNode

Flags: Read / Write

Default value: FALSE

Since: 3.32

### The `“icon”` property

      “icon”                     GIcon *

The "icon" property is the icon that should be displayed to the user in the tree for this node.

Owner: IdeTreeNode

Flags: Read / Write

Since: 3.32

### The `“icon-name”` property

      “icon-name”                gchar *

The "icon-name" is a convenience property to set the “icon” property using an icon-name.

Owner: IdeTreeNode

Flags: Write

Default value: NULL

Since: 3.32

### The `“is-header”` property

      “is-header”                gboolean

The "is-header" property denotes the node should be styled as a group header.

Owner: IdeTreeNode

Flags: Read / Write

Default value: FALSE

Since: 3.32

### The `“item”` property

      “item”                     GObject *

The "item" property is an optional GObject that can be used to store information about the node, which is sometimes useful when creating IdeTreeAddin plugins.

Owner: IdeTreeNode

Flags: Read / Write

Since: 3.32

### The `“reset-on-collapse”` property

      “reset-on-collapse”        gboolean

The "reset-on-collapse" denotes that children should be removed when the node is collapsed.

Owner: IdeTreeNode

Flags: Read / Write

Default value: TRUE

Since: 3.32

### The `“tag”` property

      “tag”                      gchar *

The "tag" property can be used to denote the type of node when you do not have an object to assign to “item”.

See `ide_tree_node_is_tag()` to match a tag when building.

Owner: IdeTreeNode

Flags: Read / Write

Default value: NULL

Since: 3.32

### The `“use-markup”` property

      “use-markup”               gboolean

If TRUE, the "use-markup" property denotes that “display-name” contains pango markup.

Owner: IdeTreeNode

Flags: Read / Write

Default value: FALSE

Since: 3.32