www.pudn.com > WinGOS.rar > GosTypes.cpp


#include "gos.h" 
#include "gostypes.h" 
 
BOOL CRect::SubtractRect(LPCRECT pRect) 
{ 
	int nState=0; 
 
	if(pRect->left<=left) 
		nState|=1; 
	if(pRect->right>=right) 
		nState|=2; 
	if(pRect->top<=top) 
		nState|=4; 
	if(pRect->bottom>=bottom) 
		nState|=8; 
 
	switch(nState) 
	{ 
	case 7: 
		top=pRect->bottom; 
		break; 
	case 11: 
		bottom=pRect->top; 
		break; 
	case 13: 
		left=pRect->right; 
		break; 
	case 14: 
		right=pRect->left; 
	case 15: 
		bottom=top; 
		right=left; 
		break; 
	default: 
		nState=0; 
	} 
	return nState; 
} 
 
void CPlex:: FreeDataChain() 
{ 
	CPlex *pNext, *p = this; 
	while (p) 
	{ 
		pNext = p->m_pNext; 
		free(p); 
		p = pNext; 
	} 
} 
PVOID CPlex::CreateHead(CPlex* &pHead,int nBytes) 
{ 
	CPlex* p = (CPlex*) malloc(sizeof(CPlex) + nBytes); 
	p->m_pNext = pHead; 
	pHead = p; 
	return p+1; 
} 
 
PVOID CPlex::CreateTail(CPlex* &pTail,int nBytes) 
{ 
	CPlex* p = (CPlex*) malloc(sizeof(CPlex) + nBytes); 
	pTail->m_pNext = p; 
	pTail = p; 
	return p+1; 
}