IupTree - control

IUP - Portable User Interface

IupTree Attributes

General

SCROLLBAR: Associates a horizontal and/or vertical scrollbar to the canvas. Default: "YES".

FONT: Character font of the text displayed on the element.

ADDEXPANDED: Defines if branches will be expanded when created. The root node is always expanded when created. Possible values:

"YES": The branches will be created expanded "NO": The branches will be created collapsed

Default: "NO".

SHOWDRAGDROP: Shows a drag cursor if the user drags a node or branch and enables the DRAGDROP_CB callback. Default: "NO".

SHOWRENAME: Allows the in place rename of a node. The RENAME_CB is called after the user entered a new name, instead of calling RENAME_NODE_CB to notify the user that it should rename a node. Default: "NO".

Marks

VALUE: The selected node. When changed also marks the node, but only if the Control and Shift keys are not used. Possible values:

The node identifier to be selected.

When changed also accepts the values:

"ROOT": the root node
"LAST": the last node
"PGUP": the node one page below
"PGDN": the node one page above
"NEXT": the node following the selected node. If the selected node is the last one, the last one will be used instead
"PREVIOUS": the previous node of the selected node. If the selected node is the root, the root will be used instead

The following values are also accepted but they are independent from the state of the Control and Shift keys, and from the CTRL and SHIFT attributes. And the selected node is not changed. These values are kept here for backward compatibility, but they would fit better in the MARKED attribute.

"INVERT": Inverts the node's marking. Using the "INVERTid" form, where id is the node identifier, it is possible to invert the marking of any node.
"BLOCK": Marks all nodes between the selected node and the initial block-marking node (see Navigation / Multiple Marking)
"CLEARALL": Unmarks all nodes
"MARKALL": Marks all nodes
"INVERTALL": Inverts the marking of all nodes

MARKED: The marking state of the selected node. Using the MARKEDid form, where id is the node identifier, it is possible to retrieve or change the marking state of any node. Possible values:

"YES": The node is marked
"NO": The node is not marked

Returns NULL if the node's id is invalid.

CTRL: Activates or deactivates the Control key function. Possible values:

"YES": Control key activated; allows marking individual nodes
"NO": Control key deactivated; does not allow marking individual nodes

Default: "NO".

SHIFT: Activates or deactivates the Shift key function. Possible values:

"YES": Shift key activated; allows marking adjacent nodes
"NO": Shift key deactivated; does not allow marking adjacent nodes

Default: "NO".

STARTING: Defines the initial node for the block marking.

The value must be the node identifier.

Default: root node.

Images

IMAGELEAF: Defines the image that will be shown for all leaves. Must be a 16x16 image.  

IUP name of the image (see IupImage)

Default: "IMGLEAF".

IMAGEBRANCHCOLLAPSED: Defines the image that will be shown for all collapsed branches. Must be a 16x16 image.

IUP name of the image (see IupImage)

Default: "IMGCOLLAPSED".

IMAGEBRANCHEXPANDED: Defines the image that will be shown for all expanded branches. Must be a 16x16 image.

IUP name of the image (see IupImage)

Default: "IMGEXPANDED".

IMAGEid: Defines the image that will be shown on a specific node. Valid for leaves and for collapsed branches. This attribute must always be used with the id number. This attribute can only be set. Ex. "IMAGE2".

IUP name of the image (see IupImage)

Default: NULL.

IMAGEEXPANDEDid: Defines the image that will be shown on a specific node. It has no effect over leaves and is valid for expanded branches. This attribute must always be used with the id number. This attribute can only be set. Ex. "IMAGEEXPANDED3".

IUP name of the image (see IupImage)

Default: NULL.

Nodes

NAME: Changes or retrieves the name of the selected node. Using the "NAMEid" form, where id is the node identifier, it is possible to change the name of any node.

The value must be a node name.

STATE: Changes or retrieves the state of the selected branch. Using the "STATEid" form, where id is the node identifier, it is possible to change the state of any branch. This attribute only works on branches. If it is used on a leaf, nothing will happen. Possible values:

"EXPANDED": Expanded branch state (shows its children)
"COLLAPSED": Collapsed branch state (hides its children)

DEPTH: If set, it defines the node's depth. Does not verify is the resulting tree is valid. If retrieved, it returns the node's depth. Using the "DEPTHid" form, where id is the node identifier, it is possible to refer to any node.

The value must be the node's depth

KIND: Returns the kind of the selected node. Using the "KINDid" form, where id is the node identifier, it is possible to retrieve the kind of any node. This attribute can only be retrieved. Possible values:

"LEAF": The node is a leaf
"BRANCH": The node is a branch

PARENT: Returns the identifier of the selected node's parent. Using the "PARENTid" form, where id is the node identifier, it is possible to retrieve the identifier of any node. This attribute can only be retrieved.

COLOR: Color of the provided node. Using the form "COLORid", where id is the node identifier, it is possible to set or retrieve the color of any node. The value should be a string in the format "R G B" where R, G, B are numbers from 0 to 255.

Action

ADDLEAF: Adds a new leaf after the selected node. The id of the new leaf will be the id of the selected node + 1. The selected node is marked and all others unmaked. The selected node position remains the same. Using the "ADDLEAFid" form, where id is the node identifier, it is possible to insert a leaf after any node. In this case, the id of the inserted node will be id + 1. If the specified node does not exist, nothing happens. This attribute can only be set.

The value must be a leaf name.

ADDBRANCH: Adds a new branch after the selected node. The id of the new branch will be the id of the selected node + 1. The selected node is marked and all others unmaked. The selected node position remains the same. Using the "ADDBRANCHid" form, where id is the node identifier, it is possible to insert a branch after any node. In this case, the id of the inserted node will be id + 1. By default, all branches created are expanded. If the specified node does not exist, nothing happens. This attribute can only be set.

The value must be a branch name.

DELNODE: Removes the marked node (or its children). Using the "DELNODEid" form, where id is the node identifier, it is possible to remove any node. The root cannot be removed. If the specified node does not exist, nothing happens. This attribute can only be set. Possible values:

"MARKED": Deletes all marked nodes (and all their children)
"SELECTED": Deletes only the selected node (and its children)
"CHILDREN": Deletes only the children of the selected node

Returns the identifier of the marked node's parent.

REDRAW: Forces an immediate redraw. It is necessary to force a redraw whenever the user adds or removes a node or a branch. The value is ignored.