当前位置: 首页>>代码示例>>C++>>正文


C++ COptionTreeItem::GetSibling方法代码示例

本文整理汇总了C++中COptionTreeItem::GetSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ COptionTreeItem::GetSibling方法的具体用法?C++ COptionTreeItem::GetSibling怎么用?C++ COptionTreeItem::GetSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COptionTreeItem的用法示例。


在下文中一共展示了COptionTreeItem::GetSibling方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

COptionTreeItem * COptionTree::InsertItem(COptionTreeItem *otiItem, COptionTreeItem *otiParent)
{
	// Declare variables
	COptionTreeItem* otiNext;
	
	// Make sure item is not NULL
	if (otiItem == NULL)
	{
		return NULL;
	}

	// If parent is NULL, becomes root
	if (otiParent == NULL)
	{
		otiParent = &m_otiRoot;
	}

	// Set child
	if (otiParent->GetChild() == NULL)
	{
		otiParent->SetChild(otiItem);
	}
	else
	{
		// -- Add to end of the sibling list	
		otiNext = otiParent->GetChild();
		while (otiNext->GetSibling() != NULL)
		{
			otiNext = otiNext->GetSibling();
		}
		otiNext->SetSibling(otiItem);
	}

	// Auto generate a default ID
	m_uLastUID++;
	otiItem->SetCtrlID(m_uLastUID);

	// Set item information
	otiItem->SetParent(otiParent);
	otiItem->SetOptionsOwner(this);

	// Send notification to user
	SendNotify(OT_NOTIFY_INSERTITEM, otiItem);

	//// Updated items
	//UpdatedItems();

	//// Force redraw
	//Invalidate();

	//// Update window
	//UpdateWindow();

	return otiItem;
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:55,代码来源:OptionTree.cpp

示例2: EnumItems

BOOL COptionTree::EnumItems(COptionTreeItem* otiItem, ENUM_OPTIONITEMPROC enumProc, LPARAM lParam)
{
	// Declare variables
	COptionTreeItem* otiNext;
	BOOL bRet = TRUE;

	// Validate items
	if (!otiItem || !enumProc)
	{
		return FALSE;
	}

	// Don't count the root item in any enumerations
	if (otiItem != &m_otiRoot && !enumProc(this, otiItem, lParam))
	{
		return FALSE;
	}

	// Recurse thru all child items
	otiNext = otiItem->GetChild();
	while (otiNext != NULL)
	{
		if (!EnumItems(otiNext, enumProc, lParam))
		{
			bRet = FALSE;
		}

		otiNext = otiNext->GetSibling();
	}

	return bRet;
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:32,代码来源:OptionTree.cpp

示例3: OnPaint

void COptionTreeList::OnPaint() 
{
	// Make sure valid
	if (m_otOption == NULL)
	{
		return;
	}
	
	// Declare variables
	CPaintDC dc(this);
	CDC* pDCMem = new CDC;
	CBitmap bpMem;
	CBitmap *bmOld;
	COptionTreeItem* otiItem;
	CRect rcClient;
	HGDIOBJ hOldBrush;
	long lTotal, lHeight;
	HRGN hRgn;

	// Get client rectangle
	GetClientRect(rcClient);

	// Clear visible list
	m_otOption->ClearVisibleList();

	// Clear all label rectangle
	m_otOption->ClearAllLabelRect();

	// Create DC
	pDCMem->CreateCompatibleDC(&dc);

	// Create bitmap
	bpMem.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());

	// Select bitmap
	bmOld = pDCMem->SelectObject(&bpMem);

	// Draw control background
	hOldBrush = pDCMem->SelectObject(GetSysColorBrush(COLOR_BTNFACE));
	pDCMem->PatBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), PATCOPY);

	// Draw control inside fill color
	rcClient.DeflateRect(2, 2);
	if (m_otOption->IsWindowEnabled() == TRUE)
	{
		pDCMem->SelectObject(GetSysColorBrush(COLOR_WINDOW));
	}
	else
	{
		pDCMem->SelectObject(GetSysColorBrush(COLOR_3DFACE));
	}
	pDCMem->PatBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), PATCOPY);
	rcClient.InflateRect(2, 2);

	// Draw expand column	
	if (m_otOption->GetShadeExpandColumn() == TRUE || m_otOption->IsWindowEnabled() == FALSE)
	{
		pDCMem->SelectObject(GetSysColorBrush(COLOR_BTNFACE));
	}
	else
	{
		pDCMem->SelectObject(GetSysColorBrush(COLOR_WINDOW));
	}
	pDCMem->PatBlt(0, 0, OT_EXPANDCOLUMN, rcClient.Height(), PATCOPY);

	// Create clip region
	hRgn = CreateRectRgn(rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
	SelectClipRgn(pDCMem->m_hDC, hRgn);

	// Draw all items
	lTotal = 0;
	for (otiItem = m_otOption->GetRootItem()->GetChild(); otiItem != NULL; otiItem = otiItem->GetSibling())
	{
		lHeight = otiItem->DrawItem(pDCMem, rcClient, 0, lTotal);
		lTotal += lHeight;
	}

	// Remove clip region
	SelectClipRgn(pDCMem->GetSafeHdc(), NULL);
	DeleteObject(hRgn);

	// Draw vertical sep
	_DrawDarkVLine(pDCMem->GetSafeHdc(), OT_EXPANDCOLUMN, 0, rcClient.bottom);

	// Draw edge
	pDCMem->DrawEdge(&rcClient, BDR_SUNKENOUTER, BF_RECT);

	// Draw draw column
	if (m_bColDrag == TRUE)
	{
		_DrawXorBar(pDCMem->GetSafeHdc(), m_lColumn - OT_COLRNG / 2, 0, 4, rcClient.bottom);
	}

	// Copy back buffer to the display
	dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), pDCMem, 0, 0, SRCCOPY);
	
	// Select old objects
	pDCMem->SelectObject(hOldBrush);
	pDCMem->SelectObject(bmOld);
	
//.........这里部分代码省略.........
开发者ID:ngphloc,项目名称:agmagic,代码行数:101,代码来源:OptionTreeList.cpp

示例4: Delete

void COptionTree::Delete(COptionTreeItem *otiItem)
{
	// Declare variables
	COptionTreeItem* otiIter;
	COptionTreeItem* otiNext;

	// Clear visible list
	ClearVisibleList();

	// Send notify to user
	SendNotify(OT_NOTIFY_DELETEITEM, otiItem);

	// Passing in a NULL deletes frm root
	if (otiItem == NULL)
	{
		otiItem = &m_otiRoot;
	}

	// Delete children
	otiIter = otiItem->GetChild();
	while (otiIter != NULL)
	{
		// -- Get sibling
		otiNext = otiIter->GetSibling();
		
		// -- Delete
		DeleteItem(otiIter);

		// -- Get next
		otiIter = otiNext;
	}

	// Unlink from tree
	if (otiItem->GetParent() != NULL)
	{
		if (otiItem->GetParent()->GetChild() == otiItem)
		{
			otiItem->GetParent()->SetChild(otiItem->GetSibling());
		}
		else
		{
			otiIter = otiItem->GetParent()->GetChild();

			while (otiIter->GetSibling() && otiIter->GetSibling() != otiItem)
			{
				otiIter = otiIter->GetSibling();
			}

			if (otiIter->GetSibling())
			{
				otiIter->SetSibling(otiItem->GetSibling());
			}
		}
	}

	// Delete item
	if (otiItem != &m_otiRoot)
	{
		if (otiItem == GetFocusedItem())
		{
			SetFocusedItem(NULL);
		}

		otiItem->CleanDestroyWindow();

		delete otiItem;
	}
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:68,代码来源:OptionTree.cpp

示例5: SerializeIn

void COptionTreeWrapper::SerializeIn(IArchive &Archive, CHashString name)
{
	CHashString basicType(_T(""));
	CHashString OptionTreeItemType(_T(""));

	// get the first option tree item in tree
	COptionTreeItem *item = m_mTrees[name.GetUniqueID()].m_Root->GetChild();

	if (item == NULL)
	{
		return;
	}

	for (UINT i=0; i<m_mViewOList[name.GetUniqueID()].size(); i++)
	{

		VIEWOBJECTLIST::iterator volIter = m_mViewOList[name.GetUniqueID()][i]->begin();

		for(; volIter != m_mViewOList[name.GetUniqueID()][i]->end(); volIter++)
		{
			ViewFormatObject *vo;
			vo = *volIter;

			basicType = vo->GetBasicType().c_str();
			OptionTreeItemType = vo->GetViewType().c_str();

			MAPTYPETOFUNCMAP::iterator mttfmIter;
			// find the map from basicType to write option tree item
			mttfmIter = m_TypeFuncMap.find(OptionTreeItemType.GetUniqueID());
			if (mttfmIter == m_TypeFuncMap.end())
			{
				// warning, continue....
				// Sorry, that type of item is not known!
				StdString error = _T("COptionTreeItem of this type is unknown: ");
				error += OptionTreeItemType.GetString();
				::MessageBox(NULL, error, _T("INVALID OPERATION"), MB_OK);
				continue;
			}

			MAPTYPECREATEFUNC *createFuncs;
			createFuncs = mttfmIter->second;

			MAPTYPECREATEFUNC::iterator mtcfIter;
			// find the function that writes the option tree item w/ this basicType
			mtcfIter = createFuncs->find(basicType.GetUniqueID());

			if (mtcfIter == createFuncs->end())
			{
				// warning, continue
				// Sorry this item does not accept items of type %s, OptionTreeItemType
				StdString error = _T("This basic type is unknown: ");
				error += basicType.GetString();
				::MessageBox(NULL, error, _T("INVALID OPERATION"), MB_OK);
			}

			OTCREATETYPEFUNC funcPtr;
			funcPtr = mtcfIter->second;
			// call the function that writes the value from option tree item into the archive
			(this->*funcPtr)(Archive, item, true);

			
			item = item->GetSibling();
		}
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:65,代码来源:COptionTreeWrapper.cpp


注:本文中的COptionTreeItem::GetSibling方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。