branchobj.cpp
changeset 604 f2aab2a9b6cb
parent 598 60f019156464
child 611 a1ae877b438d
     1.1 --- a/branchobj.cpp	Tue Oct 16 11:42:21 2007 +0000
     1.2 +++ b/branchobj.cpp	Mon Oct 22 09:50:03 2007 +0000
     1.3 @@ -1238,6 +1238,27 @@
     1.4  		return NULL;
     1.5  }
     1.6  
     1.7 +void BranchObj::sortChildren()
     1.8 +{
     1.9 +	int childCount=branch.count();
    1.10 +	int curChildIndex;
    1.11 +	bool madeChanges=false;
    1.12 +	do
    1.13 +	{
    1.14 +		madeChanges=false;
    1.15 +		for(curChildIndex=1;curChildIndex<childCount;curChildIndex++){
    1.16 +			BranchObj* curChild=(BranchObj*)branch.at(curChildIndex);
    1.17 +			BranchObj* prevChild=(BranchObj*)branch.at(curChildIndex-1);
    1.18 +			if(prevChild->heading->text().compare(curChild->heading->text())>0)
    1.19 +			{
    1.20 +				this->moveBranchUp(curChild);
    1.21 +				madeChanges=true;
    1.22 +			}
    1.23 +		}
    1.24 +	}while(madeChanges);
    1.25 +}
    1.26 +
    1.27 +
    1.28  BranchObj* BranchObj::linkTo (BranchObj* dst, int pos)
    1.29  {
    1.30  	// Find current parent and