本文整理汇总了C++中CTreeNode::CalcExpandBoxArea方法的典型用法代码示例。如果您正苦于以下问题:C++ CTreeNode::CalcExpandBoxArea方法的具体用法?C++ CTreeNode::CalcExpandBoxArea怎么用?C++ CTreeNode::CalcExpandBoxArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTreeNode
的用法示例。
在下文中一共展示了CTreeNode::CalcExpandBoxArea方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildNodeShapes
void CTreeWnd::BuildNodeShapes(mtNode* pNode,CRect& area,CRect& clientArea,int indent)
{
//if (m_pTree && m_pTree->numColumns() > 2)
// int x=1;
if (area.bottom > clientArea.bottom+DEF_NODE_HEIGHT)
return;
if (pNode == m_firstVisible->getmtNode())
m_rendering = true;
// add shape for ourselves.
if (m_rendering)
{
CRect colArea = area;
for (int i = 0; i < m_pTree->numColumns(); i++)
{
// Shapes are positioned according to column widths.
// The tree display column also has indents added
// to indicate the hierarchy.
//
int pos = area.left;
for (int col = 0; col < i; col++)
pos += m_pHeader->GetPaneWidth(col);
colArea.left = pos;
colArea.right = colArea.left + m_pHeader->GetPaneWidth(i);
// Create new shape object and populate it.
CShape* pShape = new CShape();
pShape->border.SetPreset(BorderStyleNone);
map<int,COLORREF>::iterator cpos = m_colColours.find(i);
if (cpos != m_colColours.end())
{
pShape->SetFgColour(cpos->second);
}
else
pShape->SetFgColour(m_fgColour);
pShape->SetBgColour(m_bgColour);
LPCTSTR text = pNode->getText(i);
pShape->SetText(text ? text : ""); // don't give NULL text to shapes.
if (i == m_treeColumn)
{
CTreeNode* pTreeNode = NodeFromMTNode(pNode);
colArea.left += DEF_LINE_SPACE;
pShape->SetData(pNode->getData2());
colArea.left += indent;
pShape->SetRect(colArea);
colArea.right -= indent;
SetNodeShapeIcon(pTreeNode,pShape);
//pShape->SetBitmap(m_pImageList);
if (pNode->hasChildren())
{
CTreeNode* pTreeNode = NodeFromMTNode(pNode);
pTreeNode->CalcExpandBoxArea(colArea);
}
// remove left margin if this is the tree col
//
pShape->SetMargins(0,0,5,0);
}
else
{
pShape->SetData(pNode->getData2());
pShape->SetRect(colArea);
CTreeNode* pTreeNode = NodeFromMTNode(pNode);
short iconIdx = -1;//pTreeNode->GetColumnIcon(i);
if (iconIdx != -1)
{
pShape->RemoveAllImages();
pShape->AddImage(m_pImageList,iconIdx,CSize(16,16));
pShape->AddProperty(CShape::SP_ALIGN_LEFT);
}
}
// Set shape alignment if we have one for this column.
//
map<int,DWORD>::iterator mpos = m_colAlignments.find(i);
if (mpos != m_colAlignments.end())
{
pShape->RemoveProperty( CShape::SP_ALIGN_LEFT | CShape::SP_ALIGN_RIGHT | CShape::SP_ALIGN_CENTRE );
pShape->AddProperty(mpos->second);
}
m_shapes.push_back(pShape);
}
}
// do children only if expanded.
mtNode* pChild = pNode->firstChild();
//.........这里部分代码省略.........