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


C++ CGUIStaticItemPtr::UpdateVisibility方法代码示例

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


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

示例1: UpdateVisibility

void CGUIBaseContainer::UpdateVisibility(const CGUIListItem *item)
{
  CGUIControl::UpdateVisibility(item);

  if (!IsVisible() && !CGUIControl::CanFocus())
    return; // no need to update the content if we're not visible and we can't focus

  // check whether we need to update our layouts
  if ((m_layout && !m_layout->CheckCondition()) ||
      (m_focusedLayout && !m_focusedLayout->CheckCondition()))
  {
    // and do it
    int item = GetSelectedItem();
    UpdateLayout(true); // true to refresh all items
    SelectItem(item);
  }

  if (m_staticContent)
  { // update our item list with our new content, but only add those items that should
    // be visible.  Save the previous item and keep it if we are adding that one.
    CGUIListItem *lastItem = m_lastItem;
    int selected = GetSelectedItem();
    CGUIListItem* selectedItem = (selected >= 0 && (unsigned int)selected < m_items.size()) ? m_items[selected].get() : NULL;
    Reset();
    bool updateItems = false;
    if (!m_staticUpdateTime)
      m_staticUpdateTime = CTimeUtils::GetFrameTime();
    if (CTimeUtils::GetFrameTime() - m_staticUpdateTime > 1000)
    {
      m_staticUpdateTime = CTimeUtils::GetFrameTime();
      updateItems = true;
    }
    for (unsigned int i = 0; i < m_staticItems.size(); ++i)
    {
      CGUIStaticItemPtr item = boost::static_pointer_cast<CGUIStaticItem>(m_staticItems[i]);
      if (item->UpdateVisibility(GetParentID()))
        MarkDirtyRegion();
      if (item->IsVisible())
      {
        m_items.push_back(item);
        if (item.get() == lastItem)
          m_lastItem = lastItem;
        // if item is selected and it changed position, re-select it
        if (item.get() == selectedItem && selected != (int)m_items.size() - 1)
          SelectItem(m_items.size() - 1);
      }
      // update any properties
      if (updateItems)
        item->UpdateProperties(GetParentID());
    }
    UpdateScrollByLetter();
  }
}
开发者ID:OldFrank,项目名称:xbmc,代码行数:53,代码来源:GUIBaseContainer.cpp

示例2: UpdateVisibility

void CGUIBaseContainer::UpdateVisibility(const CGUIListItem *item)
{
  CGUIControl::UpdateVisibility(item);

  if (!IsVisible())
    return; // no need to update the content if we're not visible

  // check whether we need to update our layouts
  if ((m_layout && m_layout->GetCondition() && !g_infoManager.GetBool(m_layout->GetCondition(), GetParentID())) ||
      (m_focusedLayout && m_focusedLayout->GetCondition() && !g_infoManager.GetBool(m_focusedLayout->GetCondition(), GetParentID())))
  {
    // and do it
    int item = GetSelectedItem();
    UpdateLayout(true); // true to refresh all items
    SelectItem(item);
  }

  if (m_staticContent)
  { // update our item list with our new content, but only add those items that should
    // be visible.  Save the previous item and keep it if we are adding that one.
    CGUIListItem *lastItem = m_lastItem;
    Reset();
    bool updateItems = false;
    if (!m_staticUpdateTime)
      m_staticUpdateTime = CTimeUtils::GetFrameTime();
    if (CTimeUtils::GetFrameTime() - m_staticUpdateTime > 1000)
    {
      m_staticUpdateTime = CTimeUtils::GetFrameTime();
      updateItems = true;
    }
    for (unsigned int i = 0; i < m_staticItems.size(); ++i)
    {
      CGUIStaticItemPtr item = boost::static_pointer_cast<CGUIStaticItem>(m_staticItems[i]);
      if (item->UpdateVisibility(GetParentID()))
        MarkDirtyRegion();
      if (item->IsVisible())
      {
        m_items.push_back(item);
        if (item.get() == lastItem)
          m_lastItem = lastItem;
      }
      // update any properties
      if (updateItems)
        item->UpdateProperties(GetParentID());
    }
    UpdateScrollByLetter();
  }
}
开发者ID:Kzibi,项目名称:xbmc,代码行数:48,代码来源:GUIBaseContainer.cpp


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