branchitem.cpp
changeset 749 9ff332964015
parent 748 edb78a44240b
child 750 ff3b01ce0960
     1.1 --- a/branchitem.cpp	Tue Mar 31 15:36:10 2009 +0000
     1.2 +++ b/branchitem.cpp	Wed Apr 01 15:06:57 2009 +0000
     1.3 @@ -6,7 +6,10 @@
     1.4  
     1.5  BranchItem::BranchItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
     1.6  {
     1.7 -	cout << "Constr. BranchItem\n";
     1.8 +	//cout << "Constr. BranchItem\n";
     1.9 +
    1.10 +	scrolled=false;
    1.11 +	tmpUnscrolled=false;
    1.12  }
    1.13  
    1.14  BranchItem::~BranchItem()
    1.15 @@ -15,6 +18,12 @@
    1.16      qDeleteAll(childItems);
    1.17  }
    1.18  
    1.19 +void BranchItem::copy (BranchItem *other)
    1.20 +{
    1.21 +	scrolled=other->scrolled;
    1.22 +	tmpUnscrolled=other->tmpUnscrolled;
    1.23 +}
    1.24 +
    1.25  QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
    1.26  {
    1.27  	// Cloudy stuff can be hidden during exports
    1.28 @@ -113,4 +122,87 @@
    1.29      return s;
    1.30  }
    1.31  
    1.32 +void BranchItem::unScroll()
    1.33 +{
    1.34 +	if (tmpUnscrolled) resetTmpUnscroll();
    1.35 +	if (scrolled) toggleScroll();
    1.36 +}
    1.37  
    1.38 +void BranchItem::toggleScroll()
    1.39 +{
    1.40 +	if (scrolled)
    1.41 +	{
    1.42 +		scrolled=false;
    1.43 +		//FIXME-1 systemFlags->deactivate("scrolledright");
    1.44 +		/*
    1.45 +		for (int i=0; i<branch.size(); ++i)
    1.46 +			branch.at(i)->setVisibility(true);
    1.47 +		*/	
    1.48 +	} else
    1.49 +	{
    1.50 +		scrolled=true;
    1.51 +		/*
    1.52 +		//FIXME-1 systemFlags->activate("scrolledright");
    1.53 +		for (int i=0; i<branch.size(); ++i)
    1.54 +			branch.at(i)->setVisibility(false);
    1.55 +		*/	
    1.56 +	}
    1.57 +	/*
    1.58 +	calcBBoxSize();
    1.59 +	positionBBox();	
    1.60 +	move (absPos.x(), absPos.y() );
    1.61 +	forceReposition();
    1.62 +	*/
    1.63 +}
    1.64 +
    1.65 +bool BranchItem::isScrolled()
    1.66 +{
    1.67 +	return scrolled;
    1.68 +}
    1.69 +
    1.70 +bool BranchItem::hasScrolledParent(BranchItem *start)
    1.71 +{
    1.72 +	// Calls parents recursivly to
    1.73 +	// find out, if we are scrolled at all.
    1.74 +	// But ignore myself, just look at parents.
    1.75 +
    1.76 +	if (this !=start && scrolled) return true;
    1.77 +
    1.78 +	BranchItem* bi=(BranchItem*)parentItem;
    1.79 +	if (bi) 
    1.80 +		return bi->hasScrolledParent(start);
    1.81 +	else
    1.82 +		return false;
    1.83 +}
    1.84 +
    1.85 +void BranchItem::tmpUnscroll()
    1.86 +{
    1.87 +	// Unscroll parent (recursivly)
    1.88 +	BranchItem * bi=(BranchItem*)parentItem;
    1.89 +	if (bi) bi->tmpUnscroll();
    1.90 +		
    1.91 +	// Unscroll myself
    1.92 +	if (scrolled)
    1.93 +	{
    1.94 +		tmpUnscrolled=true;
    1.95 +		// FIXME-1 systemFlags->activate("tmpUnscrolledright");
    1.96 +		toggleScroll();
    1.97 +	}	
    1.98 +}
    1.99 +
   1.100 +void BranchItem::resetTmpUnscroll()
   1.101 +{
   1.102 +	// Unscroll parent (recursivly)
   1.103 +	BranchItem * bi=(BranchItem*)parentItem;
   1.104 +	if (bi) bi->resetTmpUnscroll();
   1.105 +		
   1.106 +	// Unscroll myself
   1.107 +	if (tmpUnscrolled)
   1.108 +	{
   1.109 +		tmpUnscrolled=false;
   1.110 +		// FIXME-1 systemFlags->deactivate("tmpUnscrolledright");
   1.111 +		toggleScroll();
   1.112 +	}	
   1.113 +}
   1.114 +
   1.115 +