# mode_tree_add

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/mode-tree.c#L553
- **Page:** https://libtmux.org/en/tmux/3.2a/reference/c-function-mode_tree_add/

```c
struct mode_tree_item * mode_tree_add(struct mode_tree_data *mtd, struct mode_tree_item *parent, void *itemdata, uint64_t tag, const char *name, const char *text, int expanded)
```

## Parameters

- `mtd` (`struct mode_tree_data *`)
- `parent` (`struct mode_tree_item *`)
- `itemdata` (`void *`)
- `tag` (`uint64_t`)
- `name` (`const char *`)
- `text` (`const char *`)
- `expanded` (`int`)

## Called by

- [`window_buffer_build`](/en/tmux/3.2a/reference/c-function-window-buffer-c-window_buffer_build/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-buffer.c#L217)
- [`window_client_build`](/en/tmux/3.2a/reference/c-function-window-client-c-window_client_build/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-client.c#L210)
- [`window_customize_build_array`](/en/tmux/3.2a/reference/c-function-window-customize-c-window_customize_build_array/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-customize.c#L259)
- [`window_customize_build_keys`](/en/tmux/3.2a/reference/c-function-window-customize-c-window_customize_build_keys/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-customize.c#L457)
- [`window_customize_build_option`](/en/tmux/3.2a/reference/c-function-window-customize-c-window_customize_build_option/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-customize.c#L333)
- [`window_customize_build_options`](/en/tmux/3.2a/reference/c-function-window-customize-c-window_customize_build_options/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-customize.c#L384)
- [`window_tree_build_pane`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_build_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L313)
- [`window_tree_build_session`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_build_session/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L426)
- [`window_tree_build_window`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_build_window/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L362)

## Calls

- [`log_debug`](/en/tmux/3.2a/reference/c-function-log_debug/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/mode-tree.c#L559)
- [`mode_tree_find_item`](/en/tmux/3.2a/reference/c-function-mode-tree-c-mode_tree_find_item/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/mode-tree.c#L571)
- [`xcalloc`](/en/tmux/3.2a/reference/c-function-xcalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/mode-tree.c#L562)
- [`xstrdup`](/en/tmux/3.2a/reference/c-function-xstrdup/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/mode-tree.c#L567)

## Referenced declarations

- [`mode_tree_data.children`](/en/tmux/3.2a/reference/c-struct-mode_tree_data-children/) (attribute)
- [`mode_tree_item.children`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-children/) (attribute)
- [`mode_tree_item.entry`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-entry/) (attribute)
- [`mode_tree_item.expanded`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-expanded/) (attribute)
- [`mode_tree_item.itemdata`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-itemdata/) (attribute)
- [`mode_tree_data`](/en/tmux/3.2a/reference/c-struct-mode_tree_data/) (struct)
- [`mode_tree_item`](/en/tmux/3.2a/reference/c-struct-mode_tree_item/) (struct)
- [`mode_tree_item.name`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-name/) (attribute)
- [`mode_tree_item.parent`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-parent/) (attribute)
- [`mode_tree_data.saved`](/en/tmux/3.2a/reference/c-struct-mode_tree_data-saved/) (attribute)
- [`mode_tree_item.tag`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-tag/) (attribute)
- [`mode_tree_item.tagged`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-tagged/) (attribute)
- [`mode_tree_item.text`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-text/) (attribute)
