PtTreeAddFirst()

Add a root item to a tree list

Synopsis:

int PtTreeAddFirst( PtWidget_t *tree, 
                    PtTreeItem_t *item,
                    PtTreeItem_t *parent );

Description:

This function adds the list of PtTreeItem_t structures pointed to by item to the given PtTree widget. The list of items are linked with their brother fields. The item argument can be NULL.

The parent argument identifies the parent item for the added items. The new items are added in front of any existing children of the parent item:


Example of PtTreeAddFirst()


The results of using PtTreeAddFirst().

If parent is NULL, the items are added at the root level of the tree, before any existing items there.

The tree argument can be NULL, provided that parent points to an item that isn't attached to any tree widget.

PtTreeAddFirst() automatically sets the Pt_TREE_ITEM_EXPANDABLE flag in the parent item, whether or not the item argument is NULL.

Returns:

0
Success.
-1
The item is already in a widget.

Examples:

See Allocating items and building a tree in the description of PtTree.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtTree, PtTreeAddAfter(), PtTreeAllocItem(), PtTreeFreeAllItems(), PtTreeFreeItems(), PtTreeItem_t, PtTreeRootItem()