Implementing a Tree Representation Model
Graphic Classes
Our tree representation is implemented by two graphic classes, TreeGadget and TreeGadgetItem.
TreeGadget
The class TreeGadget defines a gadget that displays the label of the tree root. This class provides the following methods:
-
a constructor that takes the root label as its parameter;
-
the function setLabel, which modifies the root label;
-
the function addItem, which takes a label as its argument and creates a new item with this label in the tree;
-
the function removeItem, which suppresses the item passed as its argument;
-
the function setCallback, which allows a callback and data to be associated with a specific graphic event occurring on the tree gadget.
Below is the synopsis of the class TreeGadget:
class TreeGadget
{
public:
TreeGadget(const char* label);
void setLabel(IlsString label);
TreeGadgetItem* addItem(const char* itemLabel);
void removeItem(TreeGadgetItem&);
void setCallback(GraphicEvent&,Callback,CallbackData);
};
TreeGadgetItem
The class TreeGadgetItem implements an item in the tree. It can also be attached to other sub-items. Its API is similar to the TreeGadget API.
Note that the classes TreeGadget and TreeGadgetItem are implemented independently from any server classes.