本文整理汇总了C++中MHRoot::ResetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ MHRoot::ResetPosition方法的具体用法?C++ MHRoot::ResetPosition怎么用?C++ MHRoot::ResetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MHRoot
的用法示例。
在下文中一共展示了MHRoot::ResetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
// Update action - set the position of the cells to be displayed and deactivate those
// which aren't.
void MHListGroup::Update(MHEngine *engine)
{
if (!m_ItemList.size()) // Special cases when the list becomes empty
{
if (m_fFirstItemDisplayed)
{
m_fFirstItemDisplayed = false;
engine->EventTriggered(this, EventFirstItemPresented, false);
}
if (m_fLastItemDisplayed)
{
m_fLastItemDisplayed = false;
engine->EventTriggered(this, EventLastItemPresented, false);
}
}
else // Usual case.
{
for (int i = 0; i < m_ItemList.size(); i++)
{
MHRoot *pVis = m_ItemList.at(i)->m_pVisible;
int nCell = i + 1 - m_nFirstItem; // Which cell does this item map onto?
if (nCell >= 0 && nCell < m_Positions.Size())
{
if (i == 0 && ! m_fFirstItemDisplayed)
{
m_fFirstItemDisplayed = true;
engine->EventTriggered(this, EventFirstItemPresented, true);
}
if (i == m_ItemList.size() - 1 && ! m_fLastItemDisplayed)
{
m_fLastItemDisplayed = true;
engine->EventTriggered(this, EventLastItemPresented, true);
}
try
{
pVis->SetPosition(m_Positions.GetAt(i - m_nFirstItem + 1).x(), m_Positions.GetAt(i - m_nFirstItem + 1).y(), engine);
}
catch (...) {}
if (! pVis->GetRunningStatus())
{
pVis->Activation(engine);
}
}
else
{
if (i == 0 && m_fFirstItemDisplayed)
{
m_fFirstItemDisplayed = false;
engine->EventTriggered(this, EventFirstItemPresented, false);
}
if (i == m_ItemList.size() - 1 && m_fLastItemDisplayed)
{
m_fLastItemDisplayed = false;
engine->EventTriggered(this, EventLastItemPresented, false);
}
if (pVis->GetRunningStatus())
{
pVis->Deactivation(engine);
pVis->ResetPosition();
}
}
}
}
// Generate the HeadItems and TailItems events. Even in the MHEG corrigendum this is unclear.
// I'm not at all sure this is right.
if (m_nLastFirstItem != m_nFirstItem)
{
engine->EventTriggered(this, EventHeadItems, m_nFirstItem);
}
if (m_nLastCount - m_nLastFirstItem != m_ItemList.size() - m_nFirstItem)
{
engine->EventTriggered(this, EventTailItems, m_ItemList.size() - m_nFirstItem);
}
m_nLastCount = m_ItemList.size();
m_nLastFirstItem = m_nFirstItem;
}