⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parentsection.cpp

📁 hl2 source code. Do not use it illegal.
💻 CPP
字号:
/*----------------------------------------------------------------------
Copyright (c) 1998,1999 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.
File:	ParentSection.cpp
Owner:	russf@gipsysoft.com
Purpose:	<Description of module>.
----------------------------------------------------------------------*/
#include "stdafx.h"
#include "ParentSection.h"

CParentSection::CParentSection( CParentSection *pParent )
	: CSectionABC( pParent )
{

}

CParentSection::~CParentSection()
{

}


void CParentSection::OnDraw( CDrawContext &dc )
{
	const CRect &rcClip = dc.GetClipRect();
	const UINT uSize = m_arrSections.GetSize();

	for( UINT n = 0; n < uSize; n++ )
	{
		CSectionABC *psect = m_arrSections[ n ];
		if( rcClip.Intersect( *psect ) )
		{
			psect->OnDraw( dc );
		}
	}
}


void CParentSection::Transparent( bool bTransparent )
{
	CSectionABC::Transparent( bTransparent );

	const UINT uSize = m_arrSections.GetSize();

	for( UINT n = 0; n < uSize; n++ )
	{
		m_arrSections[ n ]->Transparent( bTransparent );
	}
}

void CParentSection::AddSection( CSectionABC *pSect )
{
	m_arrSections.Add( pSect );
}


void CParentSection::RemoveAllSections()
{
	const UINT uSize = m_arrSections.GetSize();
	for( UINT n = 0; n < uSize; n++ )
	{
		delete m_arrSections[ n ];
	}

	m_arrSections.RemoveAll();
}


CSectionABC * CParentSection::FindSectionFromPoint(const CPoint &pt) const
//
//	Given a point return pointer to a section if the pointer is within a section
//	Can return NULL if there is no section at the point.
{
	CSectionABC *pSect = NULL;
	const UINT uSize = m_arrSections.GetSize();
	for( UINT n = 0; n < uSize; n++ )
	{
		CSectionABC *psect = m_arrSections[ n ];
		if( psect->IsPointInSection( pt ) )
		{
			pSect = psect;
			CSectionABC *pSect2 = pSect->FindSectionFromPoint( pt );
			if( pSect2 )
			{
				pSect = pSect2;
			}
			break;
		}
	}
	return pSect;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -