//************************************************************************ // returns the entry for the specified handle //************************************************************************ CListEntry<CContactListEntry*,CContactListGroup*> *CContactList::FindContactInGroup(MCONTACT hContact,CListContainer<CContactListEntry*,CContactListGroup*> *pGroup) { if(hContact == NULL) return NULL; CListItem<CContactListEntry*,CContactListGroup*> *pItemEntry = NULL; CListEntry<CContactListEntry*,CContactListGroup*> *pEntry = NULL; CListContainer<CContactListEntry*,CContactListGroup*> *pGroupEntry = NULL; CListContainer<CContactListEntry*,CContactListGroup*>::iterator iter = pGroup->begin(); while(iter != pGroup->end()) { if((*iter)->GetType() == ITEM) { pItemEntry = (CListItem<CContactListEntry*,CContactListGroup*>*)*iter; if(pItemEntry->GetItemData()->hHandle == hContact) return *iter; } else { pGroupEntry = (CListContainer<CContactListEntry*,CContactListGroup*> *)*iter; if(pGroupEntry->GetGroupData()->hMetaContact == hContact) return *iter; pEntry = FindContactInGroup(hContact,pGroupEntry); if(pEntry) return pEntry; } iter++; } return NULL; }
SLISTITEM* CPlaylist::getSelectedItem() { CListItem<SLISTITEM*>* pListItem = (CListItem<SLISTITEM*>*)GetSelectedEntry(); if(pListItem != NULL) { SLISTITEM *pItem = pListItem->GetItemData(); return pItem; } return NULL; }
CString CExtensionListControl::GetSelectedExtension() { POSITION pos = GetFirstSelectedItemPosition(); if(pos == NULL) { return wds::strEmpty; } else { int i = GetNextSelectedItem(pos); CListItem *item = GetListItem(i); return item->GetExtension(); } }
bool CPlaylist::ScrollUp() { if(m_Position && m_Position->GetIndex() == 1 && m_iStart - 1 >= 0) { CListItem<SLISTITEM*>* pItem = (CListItem<SLISTITEM*>*)(*(--end())); this->RemoveItem(pItem->GetItemData()); m_iEnd--; CHeliumController::getInstance()->requestListItem(this,m_iStart-1); } bool bRes = CLCDList::ScrollUp(); if(bRes) { m_bFocusCurrentTrack = false; m_iPos = m_Position->GetIndex()+m_iStart; } return bRes; }
bool CPlaylist::ScrollDown() { if(m_Position && m_Position->GetIndex() == this->GetEntryCount() - 1 && m_iEnd + 1 < m_iListSize) { CListItem<SLISTITEM*>* pItem = (CListItem<SLISTITEM*>*)(*begin()); this->RemoveItem(pItem->GetItemData()); m_iStart++; CHeliumController::getInstance()->requestListItem(this,m_iEnd+1); } bool bRes = CLCDList::ScrollDown(); if(bRes) { m_bFocusCurrentTrack = false; m_iPos = m_Position->GetIndex()+m_iStart; } return bRes; }
/***************************************************************************** * CList::InsertBefore() ***************************************************************************** * Inserts a given list item before a second list item (which is presumed to * be a list member). Inserts the given list item at the head if there is * no preceding list item. */ void CList::InsertBefore(CListItem *pItem,CListItem *pInsert) { CListItem *prev = GetPrev(pItem); ASSERT(pInsert != pItem); pInsert->SetNext(pItem); if (prev) { ASSERT(pInsert != prev); prev->SetNext(pInsert); } else { m_pHead = pInsert; } }
//************************************************************************ // Called when the configuration has changed //************************************************************************ void CEventScreen::OnConfigChanged() { CScreen::OnConfigChanged(); m_EventLog.SetFont(CConfig::GetFont(FONT_LOG)); m_EventLog.SetSize(GetWidth()-5,GetHeight()-(CConfig::GetBoolSetting(SHOW_LABELS)?6:0)); // Update all timestamps list<CListEntry<CEventLogEntry*>*>::iterator iter = m_EventLog.begin(); CListItem<CEventLogEntry*> *pItem = NULL; while(iter != m_EventLog.end()) { pItem = static_cast<CListItem<CEventLogEntry*>*>(*iter); pItem->GetItemData()->strTimestamp = CAppletManager::GetFormattedTimestamp(&pItem->GetItemData()->Time) + _T(" "); iter++; } m_Scrollbar.SetSize(4,GetHeight()-(CConfig::GetBoolSetting(SHOW_LABELS)?5:0)); }
void CObjMng::checkDelete() { CListItem<CObjBase*>* pRun = _Begin.next(); CObjBase* pInst; for(;pRun != &_End; pRun = pRun->next()) { pInst = pRun->getInst(); if(pInst->getDeleteFlg() == TRUE) { CListItem<CObjBase*>* pNext = pRun->next(); erase(pRun); pRun = pNext; } else { pRun = pRun->next(); } } };