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


C++ CGUIListItem类代码示例

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


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

示例1: GetSelectedItem

void CGUIBaseContainer::UpdateListProvider(bool forceRefresh /* = false */)
{
  if (m_listProvider)
  {
    if (m_listProvider->Update(forceRefresh))
    {
      // save the current item
      int currentItem = GetSelectedItem();
      CGUIListItem *current = (currentItem >= 0 && currentItem < (int)m_items.size()) ? m_items[currentItem].get() : NULL;
      const std::string prevSelectedPath((current && current->IsFileItem()) ? static_cast<CFileItem *>(current)->GetPath() : "");

      Reset();
      m_listProvider->Fetch(m_items);
      SetPageControlRange();
      // update the newly selected item
      bool found = false;

      // first, try to re-identify selected item by comparing item pointers, though it is not guaranteed that item instances got not recreated on update.
      for (int i = 0; i < (int)m_items.size(); i++)
      {
        if (m_items[i].get() == current)
        {
          found = true;
          if (i != currentItem)
          {
            SelectItem(i);
            break;
          }
        }
      }
      if (!found && !prevSelectedPath.empty())
      {
        // as fallback, try to re-identify selected item by comparing item paths.
        for (int i = 0; i < static_cast<int>(m_items.size()); i++)
        {
          const CGUIListItemPtr c(m_items[i]);
          if (c->IsFileItem())
          {
            const std::string &selectedPath = static_cast<CFileItem *>(c.get())->GetPath();
            if (selectedPath == prevSelectedPath)
            {
              found = true;
              if (i != currentItem)
              {
                SelectItem(i);
                break;
              }
            }
          }
        }
      }
      if (!found && currentItem >= (int)m_items.size())
        SelectItem(m_items.size()-1);
      SetInvalid();
    }
    // always update the scroll by letter, as the list provider may have altered labels
    // while not actually changing the list items.
    UpdateScrollByLetter();
  }
}
开发者ID:FernetMenta,项目名称:xbmc,代码行数:60,代码来源:GUIBaseContainer.cpp

示例2: MoveUp

void CGUIListBox::MoveUp() {
	if (markListItem) {
		CGUIListItem *item = items->GetPrev(markListItem);
		if (item)
			item->Mark();
	}
}
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:7,代码来源:list.cpp

示例3: UpdateList

void CGUIListBox::UpdateList()
{
	CGUIListItem *e;
	CGUIListElement<CGUIListItem>* le = items->GetNextListElement(0);

	float px=-columnWidth-columnGap, py=0;
	int i=0;

	numColumns=0;

	while(le)
	{
		if((e=items->GetObjectFromListElement(le)))
		{
			if((i++)%numLines==0)
			{
				py=0;
				px+=columnWidth+columnGap;
				numColumns++;
			}

			e->Move(px,py);
			if(!e->IsVisible())
				e->SetVisible(1);
			py+=listItemHeight;

		}
		le=items->GetNextListElement(le);
	}	

	SetBackWindowNormalSize(numColumns * (columnWidth+columnGap), listItemHeight*numLines);
}
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:32,代码来源:list.cpp

示例4: MoveDown

void CGUIListBox::MoveDown() {
	if (markListItem) {
		CGUIListItem *item = items->GetNext(markListItem);
		if (item)
			item->Mark();
	}
}
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:7,代码来源:list.cpp

示例5: PlayLevel

int CMMDesktop::PlayLevel(int restart) {
	CGUIListItem *li = levBrowser->GetSelectedItem();
	if (li) {
		return PlayLevel(li->GetData(), restart);
	}
	return 0;
}
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:7,代码来源:MMDesktop.cpp

示例6: MoveRight

void CGUIListBox::MoveRight() {
	if (markListItem) {
		CGUIListItem *item = markListItem;
		for (int f=0; f<numLines && items->GetNext(item); f++) {
			item = items->GetNext(item);
		}
		item->Mark();
	}
}
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:9,代码来源:list.cpp

示例7: GetItem

void CGUIGridList_Impl::SetItemData ( int iRow, int hColumn, const char* pszData )
{
    // Get the current item at that offset and set the text
    CGUIListItem* pItem = GetItem ( iRow, hColumn );
    if ( pItem )
    {
        pItem->SetData ( pszData );
    }
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例8: GetItem

void CGUIGridList_Impl::SetItemData ( int iRow, int hColumn, void* pData, CGUICallback<void,void*> deleteDataCallback )
{
    // Get the current item at that offset and set the text
    CGUIListItem* pItem = GetItem ( iRow, hColumn );
    if ( pItem )
    {
        pItem->SetData ( pData, deleteDataCallback );
    }
}
开发者ID:EagleShen,项目名称:MTA,代码行数:9,代码来源:CGUIGridList_Impl.cpp

示例9: OnDelButtonClick

bool CLocalServer::OnDelButtonClick ( CGUIElement *pElement )
{
    CGUIListItem *pItem = m_pResourcesCur->GetSelectedItem ();
    if ( pItem )
    {
        m_pResourcesAll->SetItemText ( m_pResourcesAll->AddRow (), m_hResourcesAll, &pItem->GetText().c_str()[3] );
        m_pResourcesCur->RemoveRow ( m_pResourcesCur->GetItemRowIndex ( pItem ) );
    }
    return true;
}
开发者ID:EagleShen,项目名称:MTA,代码行数:10,代码来源:CLocalServer.cpp

示例10: GetID

void CGUIBaseContainer::DumpTextureUse()
{
    CLog::Log(LOGDEBUG, "%s for container %u", __FUNCTION__, GetID());
    for (unsigned int i = 0; i < m_items.size(); ++i)
    {
        CGUIListItem *item = m_items[i];
        if (item->GetFocusedLayout()) item->GetFocusedLayout()->DumpTextureUse();
        if (item->GetLayout()) item->GetLayout()->DumpTextureUse();
    }
}
开发者ID:jeppster,项目名称:xbmc-fork,代码行数:10,代码来源:GUIBaseContainer.cpp

示例11: CGUIListItem

CGUIListItem* CGUIListBox::AddItem(char *labelString, UINT color, CMMDirFile* dirFile)
{
	CGUIListItem* ti;

	ti = new CGUIListItem(listIndex++,labelString,color,this);
	ti->AcceptEvent(GetID(),EClicked);
	ti->dirFile = dirFile;

	items->AddToBack(ti);

	AddBackElem(ti);

	return ti;
}
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:14,代码来源:list.cpp

示例12: GetSelectedItem

CStdString CGUIBaseContainer::GetDescription() const
{
    CStdString strLabel;
    int item = GetSelectedItem();
    if (item >= 0 && item < (int)m_items.size())
    {
        CGUIListItem *pItem = m_items[item];
        if (pItem->m_bIsFolder)
            strLabel.Format("[%s]", pItem->GetLabel().c_str());
        else
            strLabel = pItem->GetLabel();
    }
    return strLabel;
}
开发者ID:jeppster,项目名称:xbmc-fork,代码行数:14,代码来源:GUIBaseContainer.cpp

示例13: EditLevel

void CMMDesktop::EditLevel()
{
	mainGUI->SetEditorLevelInit(0);
	CGUIListItem *li = levBrowser->GetSelectedItem();
	if (li) {
		CMMDirFile *file = li->GetData();
		if (file->Tags & eMMLTeditable) {
			mainGUI->SetEditorLevelInit(file->LevelPath);
			eventServer->SendPriorityEvent(ECommand,GetID(),mainGUI->handler->GetID(),2);
		}
	}
	
//	eventServer->SendPriorityEvent(ECommand,GetID(),mainGUI->handler->GetID(),2);

}
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:15,代码来源:MMDesktop.cpp

示例14: GetListItem

CGUIListItemLayout *CGUIBaseContainer::GetFocusedLayout() const
{
    CGUIListItem *item = GetListItem(0);
    if (item) return item->GetFocusedLayout();
    return NULL;
}
开发者ID:jeppster,项目名称:xbmc-fork,代码行数:6,代码来源:GUIBaseContainer.cpp


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