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

📄 winrect.cpp

📁 标签控制
💻 CPP
字号:
////////////////////////////////////////////////////////////////

#include "StdAfx.h"
#include "WinMgr.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//////////////////
// Construct from args
//
WINRECT::WINRECT(WORD f, UINT id, LONG p)
{
	memset(this, 0, sizeof(WINRECT));
	flags = f;
	nID = id;
	param = p;
}

//////////////////
// Get the parent of a given WINRECT. To find the parent, chase the prev
// pointer to the start of the list, then take the item before that in
// memory. 
//
WINRECT* WINRECT::Parent()
{
	for (WINRECT* pEntry=this; pEntry->Prev(); pEntry=pEntry->Prev()) {
		; // go backwards to the end
	}
	// the entry before the first child is the group
	WINRECT *parent = pEntry-1;
	ASSERT(parent->IsGroup());
	return parent;
}

//////////////////
// Get group margins
//
BOOL WINRECT::GetMargins(int& w, int& h)
{
	if (IsGroup()) {
		w=(short)LOWORD(param);
		h=(short)HIWORD(param);
		return TRUE;
	}
	w=h=0;
	return FALSE;
}

//////////////////
// Initialize map: set up all the next/prev pointers. This converts the
// linear array to a more convenient linked list. Called from END_WINDOW_MAP.
//
WINRECT* WINRECT::InitMap(WINRECT* pWinMap, WINRECT* parent)
{
	ASSERT(pWinMap);

	WINRECT* pwrc = pWinMap;  // current table entry
	WINRECT* prev = NULL;	  // previous entry starts out none

	while (!pwrc->IsEndGroup()) {
		pwrc->prev=prev;
		pwrc->next=NULL;
		if (prev)
			prev->next = pwrc;
		prev = pwrc;
		if (pwrc->IsGroup()) {
			pwrc = InitMap(pwrc+1,pwrc); // recurse! Returns end-of-grp
			ASSERT(pwrc->IsEndGroup());
		}
		pwrc++;
	}
	// safety checks
	ASSERT(pwrc->IsEndGroup());
	ASSERT(prev);
	ASSERT(prev->next==NULL);
	return parent ? pwrc : NULL;
}

⌨️ 快捷键说明

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