Views User Guides > Gantt > Using the Gantt Chart Through Examples > Defining Graphic Models for Lines and Nodes
Defining Graphic Models for Lines and Nodes
This code is used to set graphic models to the Gantt objects (lines and nodes):
gantt->setSubNodeGraphicModel(CreateSubNodeGraphicModel(display));
gantt->setLineGraphicModel(CreateLineGraphicModel(display));
In the month example, external functions CreateSubNodeGraphicModel() and CreateLineGraphicModel(), defined in <ILVHOME>/samples/gantt/common/utils.cpp, are used to create the graphic model used for lines as well as for nodes.
// --------------------------------------------------------------------------
IlvGraphic*
CreateSubNodeGraphicModel(IlvDisplay* display)
{
IlvColor* khaki = display->getColor("khaki");
IlvColor* navy = display->getColor("navy");
IlvPalette* palette = display->getPalette(khaki, navy);
palette->lock();
IlvGraphic* model = new IlvShadowLabel(display, "", IlvRect(0, 0, 100, 20),
1, IlvBottomRight, palette);
palette->unLock();
RegisterGanttNameProperty(model);
return model;
}
The subnode graphic model used is an IlvShadowLabel object.
// --------------------------------------------------------------------------
IlvGraphic*
CreateLineGraphicModel(IlvDisplay* display)
{
IlvColor* white = display->getColor("white");
IlvColor* black = display->getColor("black");
IlvPalette* palette = display->getPalette(black, white);
palette->lock();
IlvMessageLabel* model = new IlvMessageLabel(display, "",
IlvRect(0, 0, 100, 20), IlvRight, 0, palette);
palette->unLock();
model->setOpaque(IlFalse);
RegisterGanttNameProperty(model);
return model;
}
The line graphic model used is an IlvMessageLabel object.
Published date: 05/24/2022
Last modified date: 02/24/2022