PtTreeCreateItem()

Create a tree item with attributes

Synopsis:

PtTreeItem_t *PtTreeCreateItem(
  PtWidget_t const *tree,
  const char *string,
  PtTreeItemAttributes_t const *attr
  );

Arguments:

tree
A pointer to the PtTree widget that this item will be added to.
string
The text to display for the item.
attr
A pointer to a PtTreeItemAttributes_t structure which defines the attributes for the item. Set to NULL to set no images for the item, and to use the widget-defined font and colors.

Description:

This function creates a new tree item. The item's string is copied from string.

Attributes are set with a PtTreeItemAttributes_t structure, passed as attr. The item's Pt_TREE_ITEM_HAS_ATTRS is set whether attr is passed as a pointer or NULL.

Both PtTreeAllocItem() and PtTreeCreateItem() create a tree item. PtTreeCreateItem() lets you specify set and unset images that are not already present in the widget's Pt_ARG_TREE_IMAGES array. In general, if you want to use images in this array, you should use PtTreeAllocItem().


Note: An item created with PtTreeCreateItem(widget,string,NULL) behaves identically to an item created with PtTreeAllocItem(widgetmstring,-1,-1), except it has the Pt_TREE_ITEM_HAS_ATTRS flag set, whereas the latter does not.

Using PtTreeCreateItem() you can also specify text and fill color attributes for selected and unselected items.


Note: Use PtTreeAddFirst() and PtTreeAddAfter() to add the new item to a tree structure.

Returns:

A pointer to a PtTreeItem_t
Success.
NULL
Error

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(), PtTreeChangeItem(), PtTreeFreeAllItems(), PtTreeFreeItems(), PtTreeItem_t, PtTreeItemAttributes_t, PtTreeRootItem()