本文整理汇总了C++中CContainer::GetContentHead方法的典型用法代码示例。如果您正苦于以下问题:C++ CContainer::GetContentHead方法的具体用法?C++ CContainer::GetContentHead怎么用?C++ CContainer::GetContentHead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContainer
的用法示例。
在下文中一共展示了CContainer::GetContentHead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cmd_EditItem
void CClient::Cmd_EditItem( CObjBase *pObj, int iSelect )
{
ADDTOCALLSTACK("CClient::Cmd_EditItem");
// ARGS:
// iSelect == -1 = setup.
// m_Targ_Text = what are we doing to it ?
//
if ( !pObj )
return;
CContainer *pContainer = dynamic_cast<CContainer *>(pObj);
if ( !pContainer )
{
addGumpDialogProps(pObj->GetUID());
return;
}
if ( iSelect == 0 ) // cancelled
return;
if ( iSelect > 0 ) // we selected an item
{
if ( static_cast<size_t>(iSelect) >= COUNTOF(m_tmMenu.m_Item) )
return;
if ( m_Targ_Text.IsEmpty() )
addGumpDialogProps(m_tmMenu.m_Item[static_cast<size_t>(iSelect)]);
else
OnTarg_Obj_Set(CGrayUID(m_tmMenu.m_Item[static_cast<size_t>(iSelect)]).ObjFind());
return;
}
CMenuItem item[minimum(COUNTOF(m_tmMenu.m_Item), MAX_MENU_ITEMS)]; // Most as we want to display at one time.
item[0].m_sText.Format("Contents of %s", pObj->GetName());
size_t count = 0;
for ( CItem *pItem = pContainer->GetContentHead(); pItem != NULL; pItem = pItem->GetNext() )
{
count++;
m_tmMenu.m_Item[count] = pItem->GetUID();
item[count].m_sText = pItem->GetName();
ITEMID_TYPE idi = pItem->GetDispID();
item[count].m_id = static_cast<WORD>(idi);
item[count].m_color = 0;
if ( !pItem->IsType(IT_EQ_MEMORY_OBJ) )
{
HUE_TYPE wHue = pItem->GetHue();
if ( wHue != 0 )
{
wHue = (wHue == 1 ? 0x7FF : wHue - 1);
item[count].m_color = wHue;
}
}
if ( count >= (COUNTOF(item) - 1) )
break;
}
ASSERT(count < COUNTOF(item));
addItemMenu(CLIMODE_MENU_EDIT, item, count, pObj);
}