Implementing a Tree Representation Model
Graphic Classes
Our tree representation is implemented by two graphic classes, TreeGadget and TreeGadgetItem.
TreeGadget
The class
-
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
Note that the classes TreeGadget and TreeGadgetItem are implemented independently from any server classes.