XFrame/old/src/XNode.cpp
//adjust content rect,adjust child node or brother node
adjust content rect,adjust child node or brother node
adjust content rect adjust child node or brother node
int XNode::AdjustRect(RECT rect)
		{
			int	spBarWidth = 0;
			if(GetSpliterbar())
				spBarWidth = GetSpliterbar()->GetBarWidth();
			XNode * pBrother = this->GetBrotherNode();
			if(pBrother)
			{
				DOUBLE	rate = 0;
				if(m_spRate > 0)
					rate = m_spRate;
				else if(pBrother->m_spRate)
					rate = 100 - pBrother->m_spRate;
				if(rate > 0)
				{
					if(m_spStatus & SP_VERT  && pBrother->m_spStatus & SP_VERT)
					{
						if(m_spStatus & SP_LEFT)
							rect.right = rect.left + (long)((rect.right - rect.left - spBarWidth )*rate/100);
						else
							rect.left = rect.right - (long)((rect.right - rect.left - spBarWidth )*rate/100);
					}else
					{
						if(m_spStatus & SP_LEFT)
							rect.bottom = rect.top + (long)((rect.bottom - rect.top - spBarWidth )*rate/100);
						else
							rect.top = rect.bottom - (long)((rect.bottom - rect.top - spBarWidth )*rate/100);
					}
				}else
				{
					if(m_spStatus & SP_VERT && pBrother->m_spStatus & SP_VERT)
					{
						int width = this->m_width;
						if(width==0) width = - pBrother->m_width;
						if(width==0) width = (rect.right - rect.left + 1 - spBarWidth)/2;
						if(width <0) width = rect.right - rect.left + 1 - spBarWidth + width;
						if(m_spStatus & SP_LEFT)
							rect.right = rect.left + width;
						else
							rect.left = rect.right - width;
					}else
					{
						int height = this->m_height;
						if(height==0) height = - pBrother->m_height;
						if(height==0) height = (rect.bottom - rect.top + 1 - spBarWidth)/2;
						if(height <0) height = rect.bottom - rect.top + 1 - spBarWidth + height;
						if(m_spStatus & SP_LEFT)
							rect.bottom = rect.top+ height;
						else
							rect.top = rect.bottom - height;
					}
				}
			}else
			{
				if(this->m_width)
					rect.right = rect.left + m_width;
				if(this->m_height)
					rect.bottom = rect.top + m_height;
				if(m_spRate)
				{
					if(m_spStatus & SP_VERT)
						rect.right = rect.left + (long)((rect.right - rect.left - spBarWidth )*m_spRate/100);
					else
						rect.bottom = rect.top + (long)((rect.bottom - rect.top - spBarWidth )*m_spRate/100);
				}
			}
			m_AreaRect = rect;
			this->CalcContentRect();
			if(this->m_pLeftNode)this->m_pLeftNode->AdjustRect();
			if(this->m_pRightNode)this->m_pRightNode->AdjustRect();
			return 1;
		}
int XNode :: AdjustRect ( RECT rect ) { int spBarWidth = 0 ; if ( GetSpliterbar ( ) ) spBarWidth = GetSpliterbar ( ) -> GetBarWidth ( ) ; XNode * pBrother = this -> GetBrotherNode ( ) ; if ( pBrother ) { DOUBLE rate = 0 ; if ( m_spRate > 0 ) rate = m_spRate ; else if ( pBrother -> m_spRate ) rate = 100 - pBrother -> m_spRate ; if ( rate > 0 ) { if ( m_spStatus & SP_VERT && pBrother -> m_spStatus & SP_VERT ) { if ( m_spStatus & SP_LEFT ) rect . right = rect . left + ( long ) ( ( rect . right - rect . left - spBarWidth ) * rate / 100 ) ; else rect . left = rect . right - ( long ) ( ( rect . right - rect . left - spBarWidth ) * rate / 100 ) ; } else { if ( m_spStatus & SP_LEFT ) rect . bottom = rect . top + ( long ) ( ( rect . bottom - rect . top - spBarWidth ) * rate / 100 ) ; else rect . top = rect . bottom - ( long ) ( ( rect . bottom - rect . top - spBarWidth ) * rate / 100 ) ; } } else { if ( m_spStatus & SP_VERT && pBrother -> m_spStatus & SP_VERT ) { int width = this -> m_width ; if ( width == 0 ) width = - pBrother -> m_width ; if ( width == 0 ) width = ( rect . right - rect . left + 1 - spBarWidth ) / 2 ; if ( width < 0 ) width = rect . right - rect . left + 1 - spBarWidth + width ; if ( m_spStatus & SP_LEFT ) rect . right = rect . left + width ; else rect . left = rect . right - width ; } else { int height = this -> m_height ; if ( height == 0 ) height = - pBrother -> m_height ; if ( height == 0 ) height = ( rect . bottom - rect . top + 1 - spBarWidth ) / 2 ; if ( height < 0 ) height = rect . bottom - rect . top + 1 - spBarWidth + height ; if ( m_spStatus & SP_LEFT ) rect . bottom = rect . top + height ; else rect . top = rect . bottom - height ; } } } else { if ( this -> m_width ) rect . right = rect . left + m_width ; if ( this -> m_height ) rect . bottom = rect . top + m_height ; if ( m_spRate ) { if ( m_spStatus & SP_VERT ) rect . right = rect . left + ( long ) ( ( rect . right - rect . left - spBarWidth ) * m_spRate / 100 ) ; else rect . bottom = rect . top + ( long ) ( ( rect . bottom - rect . top - spBarWidth ) * m_spRate / 100 ) ; } } m_AreaRect = rect ; this -> CalcContentRect ( ) ; if ( this -> m_pLeftNode ) this -> m_pLeftNode -> AdjustRect ( ) ; if ( this -> m_pRightNode ) this -> m_pRightNode -> AdjustRect ( ) ; return 1 ; }
adjust content rect,adjust child node or brother node
adjust content rect adjust child node or brother node
//if(this->m_pLayers)this->m_pLayers->AdjustRect();