Can you follow ? :) :
class CCsOpcValue;
class CTrend
{
CArray<CCsOpcValue*,CCsOpcValue*> m_arDisplayItems;
..
public:
~CTrend() { RemoveDisplayItems(); };
void FillDiasplayItems(..);
void RemoveDisplayItems(int iHowMuch = -1);
void DrawDisplayItems(CDC* pcDC, const CRect& crBounds, ...);
..
};
void CTrend::FillDisplayItems(..)
{
for (..) {
CCsOpcValue* pcMin = new CCsOpcValue(this, CCsOpcValue::minItem, ..);
CCsOpcValue* pcMax = new CCsOpcValue(this, CCsOpcValue::maxItem, ..);
while (..) {
}
m_arDisplayItems.Add(pcMin);
m_arDisplayItems.Add(pcMax);
}
}
void CTrend::RemoveDisplayItems(int iHowMuch )
{
int iCount = m_arDisplayItems.GetCount();
int iUntil = (iHowMuch < 0 || iCount < iHowMuch) ?
iCount :
iHowMuch;
for (int i = 0; i < iUntil; i++) {
delete m_arDisplayItems[i];
m_arDisplayItems.RemoveAt(i);
}
}
void CTrend::DrawDisplayItems(CDC* pcDC, const CRect& crBounds, ...)
{
for (int i = 0; i < m_arDisplayItems.GetCount(); i++) {
}
}