本文整理汇总了C++中TreeNode::arrangeTree方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeNode::arrangeTree方法的具体用法?C++ TreeNode::arrangeTree怎么用?C++ TreeNode::arrangeTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode::arrangeTree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: arrangeAll
void TreeNode::arrangeAll( TreeDirection dir, TreeRootList& roots,
TreeRect& world, OutputDevice *dev )
//----------------------------------------------------------------
{
TreeCoord maxX = 0;
TreeCoord maxY = 0;
TreeCoord sibOff = sibSep;
int i;
for( i = 0; i < roots.count(); i += 1 ) {
if( roots[ i ]->enabled() ) {
TreeCoord sibStart = sibOff;
TreeRect r;
TreeNode * node = roots[ i ]->setNode();
roots[ i ]->setRingEnable();
roots[ i ]->setAllBounding( dev );
node->arrangeTree( sibOff );
// now mop up any nodes isolated by hiding
for( int j = node->getCount( FlatList ); j > 0; j -= 1 ) {
TreeNode * newNode = node->getNode( FlatList, j - 1 );
if( newNode->_flags.placed != Placed ) {
newNode->arrangeTree( sibOff );
}
}
if( dir == TreeVertical ) {
r.x( sibStart );
r.y( sibSep );
} else {
r.y( sibStart );
r.x( sibSep );
}
if( node->resolveChildWard( r ) ) {
roots[ i ]->setBound( r ); // set the roots bounding box
roots[ i ]->sortEdges();
sibOff = ( dir == TreeVertical) ? r.x() + r.w() + sibSep
: r.y() + r.h() + sibSep;
maxX = maxCoord( maxX, r.x() + r.w() );
maxY = maxCoord( maxY, r.y() + r.h() );
} else {
roots[ i ]->setEnable( false );
}
}
}
world.w( maxX );
world.h( maxY );
}
示例2: arrangeTree
void TreeNode::arrangeTree( TreeCoord& sibOff )
//---------------------------------------------
{
TreeCoord startSib = sibOff;
TreeCoord maxDescend = 0;
TreeCoord mySib = sibOff;
bool vert = (_parent->getDirection() == TreeVertical);
int i;
if( !_flags.enabled ) {
_flags.placed = Placed;
return;
}
_flags.placed = Arranging;
_flags.arranging = 1;
// partial results used in getFirstNonContend
TreeCoord offset = sibOff;
TreeCoord width = _sibWidth;
getFirstNonContend( offset, width );
_descend.x( offset );
_descend.y( offset );
_descend.w( width );
_descend.h( width );
// scram through and check for simple children (one parent, no kids)
for( i = 0; i < getCount( ChildList ); i += 1 ) {
TreeNode * node = getNode( ChildList, i );
if( node->_flags.placed < Arranging && node->isSimple( ChildList ) ) {
TreeCoord tmpOff = vert ? _descend.x()
: _descend.y();
node->arrangeTree( tmpOff );
tmpOff += sibSep;
if( getLevel() < 0 || node->getLevel() < 0
|| node->getLevel() == getLevel() + 1 ) {
sibOff = tmpOff;
}
if( node->_flags.enabled > Hidden ) {
maxDescend = maxCoord( maxDescend,
vert ? node->_descend.x() + node->_descend.w()
: node->_descend.y() + node->_descend.h()
);
}
}
}
// do non-simple children
for( i = 0; i < getCount( ChildList ); i += 1 ) {
TreeNode * node = getNode( ChildList, i );
if( node->_flags.placed < Arranging ) {
TreeCoord tmpOff = vert ? _descend.x()
: _descend.y();
node->arrangeTree( tmpOff );
tmpOff += sibSep;
if( getLevel() < 0 || node->getLevel() < 0 ||
node->getLevel() == getLevel() + 1 ) {
sibOff = tmpOff;
}
if( node->_flags.enabled > Hidden ) {
maxDescend = maxCoord( maxDescend,
vert ? node->_descend.x() + node->_descend.w()
: node->_descend.y() + node->_descend.h()
);
}
}
}
place( mySib );
// do simple parents
for( i = 0; i < getCount( ParentList ); i += 1 ) {
TreeNode * node = getNode( ParentList, i );
sibOff = vert ? _descend.x() : _descend.y();
if( node->isSimple( ParentList ) && node->_flags.placed < Arranging ) {
node->arrangeTree( sibOff );
if( node->_flags.enabled > Hidden ) {
maxDescend = maxCoord( maxDescend,
vert ? node->_descend.x() + node->_descend.w()
: node->_descend.y() + node->_descend.h()
);
}
}
//.........这里部分代码省略.........