本文整理汇总了C++中CObList::AddTail方法的典型用法代码示例。如果您正苦于以下问题:C++ CObList::AddTail方法的具体用法?C++ CObList::AddTail怎么用?C++ CObList::AddTail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObList
的用法示例。
在下文中一共展示了CObList::AddTail方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBegindrag
void CExplorerTestView::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
int nItem = -1;
CObList fileList;
LIST_VIEW* pListView;
CListCtrl& listCtrl = GetListCtrl();
CSharedFile sharedFile;
COleDataSource* dataSource = new COleDataSource;
while((nItem = listCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
{
pListView = (LIST_VIEW*)listCtrl.GetItemData(nItem);
fileList.AddTail((CObject*)pListView);
}
CArchive ar(&sharedFile, CArchive::store);
CExplorerTestDoc* pDoc = (CExplorerTestDoc*)GetDocument();
pDoc->SetCopyFileList(&fileList);
pDoc->SerializeCopyFiles(ar);
ar.Close();
dataSource->CacheGlobalData(m_cbFormat, sharedFile.Detach());
dataSource->DoDragDrop();
delete dataSource;
*pResult = 0;
}
示例2: OnInformation
void CExplorerTestView::OnInformation()
{
// TODO: Add your command handler code here
CInfoDlg dlg; // 파일 정보 다이알로그 박스 클래스
LIST_VIEW* pListView;
int nItem = -1;
CObList obList; // 선택된 파일 리스트들
CListCtrl& listCtrl = GetListCtrl();
// 리스트 뷰에서 선택된 항목들만 CObList에 추가시킨다.
while( (nItem = listCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1 )
{
pListView = new LIST_VIEW;
*pListView = *(LIST_VIEW*)listCtrl.GetItemData(nItem);
obList.AddTail((CObject*)pListView);
}
dlg.SetInfo(&obList); // 다이알로그가 화면에 보여지기 전에
// 먼저 파일정보를 다이알로그에 셋팅한다.
dlg.DoModal(); // OnInitDialog를 호출하여 화면에 보이게 한다.
// 모든 선택된 파일 리스트들을 메모리에서 삭제한다.
for(POSITION pos = obList.GetHeadPosition() ; pos != NULL ; )
{
pListView = (LIST_VIEW*)obList.GetNext(pos);
delete pListView;
}
obList.RemoveAll();
}
示例3: GetProfs
void CInfCreature::GetProfs(CObList &list)
{
if (m_plAffects.GetCount() < 1)
return;
INF_AFF *pAff;
POSITION pos = m_plAffects.GetHeadPosition();
while(pos)
{
pAff = (INF_AFF*)m_plAffects.GetNext(pos);
if (pAff->dwAffectType == AFF_TYPE_PROF)
{
CProfData *pProf = new CProfData;
pProf->m_chProf = (BYTE)pAff->nNP2;
if (m_infCre.chDualClass)
{
pProf->m_nFirstClass = HITRIBBLE(pAff->nNP1);
pProf->m_nSecondClass = LOTRIBBLE(pAff->nNP1);
}
else
pProf->m_nFirstClass = pAff->nNP1;
list.AddTail(pProf);
}
}
TRACE("CInfCreautre::GetProfs() - %d profs found.\n",list.GetCount());
}
示例4: GetControlBarList
void CBCGPReBar::GetControlBarList (CObList& lst, CRuntimeClass* pRTCFilter)
{
CReBarCtrl& wndReBar = GetReBarCtrl ();
UINT uiReBarsCount = wndReBar.GetBandCount ();
REBARBANDINFO bandInfo;
bandInfo.cbSize = globalData.GetRebarBandInfoSize ();
bandInfo.fMask = (RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_IDEALSIZE);
for (UINT uiBand = 0; uiBand < uiReBarsCount; uiBand ++)
{
wndReBar.GetBandInfo (uiBand, &bandInfo);
if (bandInfo.hwndChild != NULL)
{
CBCGPBaseControlBar* pBar =
DYNAMIC_DOWNCAST (CBCGPBaseControlBar,
CWnd::FromHandlePermanent (bandInfo.hwndChild));
if (pBar != NULL)
{
ASSERT_VALID (pBar);
if (pRTCFilter == NULL || pBar->GetRuntimeClass () == pRTCFilter)
{
lst.AddTail (pBar);
}
}
}
}
}
示例5: ArrangeWindowsInWindow
//--------------------------------------------------------------------------------
void ArrangeWindowsInWindow (CWnd * pParentWnd, CObArray & arrWnd, DWORD dwOrient)
// Arranges the windows within the rectangle of another window.
//--------------------------------------------------------------------------------
{
if (arrWnd.GetSize() == 0) // no windows to size.. do nothing
return;
CRect ClientRect;
pParentWnd->GetClientRect(&ClientRect);
CSize ParentSize = ClientRect.Size();
if (ParentSize.cy == 0)
return; // no height => not much we can do
CObList SpcList; // list used to keep track of window spacing
// add initial Arrange rectangle to the list;
CWndSpaceElt * pSpcElt = new CWndSpaceElt;
pSpcElt->wd = 0;
pSpcElt->ht = ClientRect.Height();
SpcList.AddTail(pSpcElt);
// sort array of window positions by size so that we position the largest windows first.
// this improves the results quite a bit
CObject ** pArrData = arrWnd.GetData();
ASSERT(pArrData != NULL); // shouldn't be NULL as array is non-empty, but check anyway
qsort(pArrData, arrWnd.GetSize(), sizeof(CObject *), CompareWndRect);
HDWP hDWP = BeginDeferWindowPos(arrWnd.GetSize()); // defer window moves to save on refresh
// iterate thru all the windows in the list looking for a position to put it
for (int nWndNo = 0; nWndNo < arrWnd.GetSize(); nWndNo++)
{
CWnd * pWnd = (CWnd *)arrWnd[nWndNo];
ASSERT(pWnd != NULL);
ASSERT_VALID(pWnd);
PositionInSpcList(pWnd, SpcList, dwOrient, pParentWnd, ParentSize, hDWP);
}
if (hDWP != NULL)
::EndDeferWindowPos(hDWP); // move the windows
// Remove elements from the SpcList;
while (!SpcList.IsEmpty())
{
CWndSpaceElt * pElt = (CWndSpaceElt *) SpcList.GetTail();
delete pElt;
SpcList.RemoveTail();
}
}
示例6: GetProfs
void CTabProfsDlg::GetProfs(CObList &list)
{
CProfData *pProfData;
PROFDATA *pItemData;
int nCount = m_lcProfs.GetItemCount();
for (int i=0;i<nCount;i++)
{
pItemData = (PROFDATA*)m_lcProfs.GetItemData(i);
if (pItemData->nFirstClass || pItemData->nSecondClass)
{
pProfData = new CProfData;
pProfData->m_chProf = pItemData->chProf;
pProfData->m_nFirstClass = pItemData->nFirstClass;
pProfData->m_nSecondClass = pItemData->nSecondClass;
list.AddTail(pProfData);
}
}
}
示例7: UnSetAutoHideMode
//----------------------------------------------------------------------------------//
void CBCGPAutoHideDockBar::UnSetAutoHideMode (CBCGPAutoHideToolBar* pAutohideToolbar)
{
if (pAutohideToolbar == NULL)
{
CObList lstBars;
lstBars.AddTail (&m_lstControlBars);
POSITION posSave = NULL;
POSITION pos = NULL;
for (pos = lstBars.GetHeadPosition (); pos != NULL;)
{
posSave = pos;
CBCGPAutoHideToolBar* pToolBar = (CBCGPAutoHideToolBar*) lstBars.GetNext (pos);
if (!pToolBar->m_bFirstInGroup)
{
lstBars.RemoveAt (posSave);
}
}
for (pos = lstBars.GetHeadPosition (); pos != NULL;)
{
CBCGPAutoHideToolBar* pToolBar = (CBCGPAutoHideToolBar*) lstBars.GetNext (pos);
UnSetAutoHideMode (pToolBar);
}
return;
}
// find the group;
CBCGPDockBarRow* pRow = RowFromControlBar (pAutohideToolbar);
CObList lstGroup;
if (pRow != NULL)
{
pRow->GetGroupFromBar (pAutohideToolbar, lstGroup);
}
if (lstGroup.IsEmpty ())
{
pAutohideToolbar->UnSetAutoHideMode (NULL);
}
else
{
BOOL bFirstBar = TRUE;
CBCGPDockingControlBar* pFirstBar = NULL;
for (POSITION pos = lstGroup.GetHeadPosition (); pos != NULL;)
{
CBCGPAutoHideToolBar* pNextBar =
DYNAMIC_DOWNCAST (CBCGPAutoHideToolBar, lstGroup.GetNext (pos));
if (pNextBar != NULL)
{
if (bFirstBar)
{
pFirstBar = pNextBar->GetFirstAHWindow ();
pNextBar->UnSetAutoHideMode (NULL);
bFirstBar = FALSE;
}
else
{
pNextBar->UnSetAutoHideMode (pFirstBar);
}
}
}
}
}
示例8: DoUpdateOffsets
//************************************************************************************
void CBCGPOutlineParser::DoUpdateOffsets (const CString& strBuffer,
const int nStartOffset, const int nEndOffset,
CObList& lstBlocks)
{
// Update name offsets, start offsets and end offsets:
CBCGPOutlineNode* pPreviousNode = NULL;
CObList lstIgnoreBlocks;
for (POSITION pos = lstBlocks.GetHeadPosition (); pos != NULL; )
{
CBCGPOutlineNode* pNode = (CBCGPOutlineNode*) lstBlocks.GetNext (pos);
ASSERT_VALID (pNode);
const BlockType* pBlockType = GetBlockType (pNode->m_nBlockType);
if (pBlockType != NULL && !pBlockType->m_bIgnore)
{
// --------------------------------------
// Update name offsets and start offsets:
// --------------------------------------
CString strName;
int nSearchTo = nStartOffset;
if (pPreviousNode != NULL &&
pPreviousNode->m_nEnd < pNode->m_nStart &&
pPreviousNode->m_nEnd > nStartOffset)
{
nSearchTo = pPreviousNode->m_nEnd;
}
pNode->m_nNameOffset = GetNameOffset (strBuffer, pNode->m_nStart, nSearchTo,
pBlockType, lstIgnoreBlocks, strName);
int nNewStart = GetStartOffset (strBuffer, pNode->m_nStart, pNode->m_nStart - pNode->m_nNameOffset, lstIgnoreBlocks);
ASSERT (nNewStart >= nSearchTo);
int nDelta = nNewStart - pNode->m_nStart;
pNode->m_nNameOffset += nDelta;
pNode->m_nStart = nNewStart;
// strName = strName.Left (strName.GetLength () + nDelta);
// pNode->m_strName = strName;
// -------------------
// Update end offsets:
// -------------------
nSearchTo = nEndOffset;
if (pos != NULL)
{
CBCGPOutlineNode* pNextNode = (CBCGPOutlineNode*) lstBlocks.GetAt (pos);
ASSERT_VALID (pNextNode);
if (pNextNode->m_nStart > pNode->m_nEnd &&
pNextNode->m_nStart < nEndOffset)
{
nSearchTo = pNextNode->m_nStart;
}
}
int nNewEnd = GetEndOffset (strBuffer, pNode->m_nEnd, nSearchTo);
ASSERT (nNewEnd <= nSearchTo);
pNode->m_nEnd = nNewEnd;
pPreviousNode = pNode;
lstIgnoreBlocks.AddTail (pNode);
}
else
{
lstIgnoreBlocks.AddTail (pNode);
}
}
}
示例9: PushResult
//************************************************************************************
void CBCGPOutlineParser::PushResult (Lexeme lexem, CObList& lstResults)
{
#ifdef _DEBUG
CString str;
#endif // _DEBUG
const BlockType* pBlockType = GetBlockType (lexem.m_nBlockType);
ASSERT (pBlockType != NULL);
switch (lexem.m_nType)
{
case LT_CompleteBlock:
{
CBCGPOutlineBaseNode block;
block.m_nStart = lexem.m_nStart;
block.m_nEnd = lexem.m_nEnd;
block.m_nNameOffset;
block.m_strReplace = pBlockType->m_strReplace;
block.m_nBlockType = lexem.m_nBlockType;
block.m_dwFlags = g_dwOBFComplete;
CBCGPOutlineNode* pNode = new CBCGPOutlineNode (block);
ASSERT_VALID (pNode);
lstResults.AddTail (pNode);
}
DEBUG_ONLY (str.Format (_T("%s_%d_%d, "), pBlockType->m_strReplace, lexem.m_nStart, lexem.m_nEnd));
break;
case LT_BlockStart:
{
CBCGPOutlineBaseNode block;
block.m_nStart = lexem.m_nStart;
block.m_nEnd = lexem.m_nEnd;
block.m_nNameOffset;
block.m_strReplace = pBlockType->m_strReplace;
block.m_nBlockType = lexem.m_nBlockType;
block.m_dwFlags = g_dwOBFLeft;
CBCGPOutlineNode* pNode = new CBCGPOutlineNode (block);
ASSERT_VALID (pNode);
lstResults.AddTail (pNode);
}
DEBUG_ONLY (str.Format (_T("{_%d, "), lexem.m_nStart));
break;
case LT_BlockEnd:
{
CBCGPOutlineBaseNode block;
block.m_nStart = lexem.m_nStart;
block.m_nEnd = lexem.m_nEnd;
block.m_nNameOffset;
block.m_strReplace = pBlockType->m_strReplace;
block.m_nBlockType = lexem.m_nBlockType;
block.m_dwFlags = g_dwOBFRight;
CBCGPOutlineNode* pNode = new CBCGPOutlineNode (block);
ASSERT_VALID (pNode);
lstResults.AddTail (pNode);
}
DEBUG_ONLY (str.Format (_T("}_%d, "), lexem.m_nEnd));
break;
case LT_Eps:
DEBUG_ONLY (str = _T("Finished"));
break;
default:
DEBUG_ONLY (str = _T("Error! "));
}
DEBUG_ONLY (m_strOut += str);
}
示例10: PositionInSpcList
//.........这里部分代码省略.........
#ifdef _DEBUG_WNDPOS
TRACE("No insert position found\n");
#endif
return; // ignore this for now
}
ASSERT(MinListPos != NULL && nMinX < 0xffff);
// work out the new position for the window
// Might want to delay window positioning in future
CPoint WndPt;
WndPt.x = ((dwOrient & CBRS_ARRANGE_LEFT) ? nMinX : ParentSize.cx - nMinX - WndSize.cx);
WndPt.y = ((dwOrient & CBRS_ARRANGE_TOP) ? nMinY : ParentSize.cy - nMinY - WndSize.cy);
ASSERT(WndPt.y >= -1);
#ifdef _DEBUG_WNDPOS
TRACE("Positioning at: (%d, %d) nMinY=%d, nMinX=%d\n", WndPt.x, WndPt.y, nMinY, nMinX);
#endif
// if not child of requested window, convert co-ords to Screen
if ((pWnd->GetStyle() & WS_POPUP) || pWnd->GetParent() != pParentWnd)
pParentWnd->ClientToScreen(&WndPt);
CRect rcWnd;
pWnd->GetWindowRect(rcWnd);
// attempt to optimize by only moving windows that have changed position...
if (rcWnd.TopLeft() != WndPt || rcWnd.Size() != WndSize)
{
if (hDwp == NULL)
pWnd->SetWindowPos(NULL, WndPt.x, WndPt.y, WndSize.cx, WndSize.cy,
SWP_NOSIZE | SWP_NOZORDER);
else
::DeferWindowPos(hDwp, pWnd->m_hWnd, NULL, WndPt.x, WndPt.y, WndSize.cx, WndSize.cy,
SWP_NOSIZE | SWP_NOZORDER);
}
// now update the SpcList.
nHtLeft = nHt;
ASSERT(nHt > 0);
pos = MinListPos;
ASSERT(MinListPos != NULL); // can't actually happen
CWndSpaceElt * pSpcElt;
POSITION InsertPos = NULL;
while (pos != NULL)
{
POSITION Oldpos = pos;
pSpcElt = (CWndSpaceElt *) SpcList.GetNext(pos);
ASSERT_VALID(pSpcElt);
if (pSpcElt->ht > nHtLeft)
{
pSpcElt->ht -= nHtLeft;
nHtLeft = 0;
InsertPos = Oldpos; // position to insert before
break;
}
nHtLeft -= pSpcElt->ht;
CWndSpaceElt * pOldElt = (CWndSpaceElt *)SpcList.GetAt(Oldpos);
ASSERT(pOldElt != NULL && pOldElt->IsKindOf(RUNTIME_CLASS(CWndSpaceElt)));
SpcList.RemoveAt(Oldpos); // remove that element
ASSERT(pSpcElt != NULL && pSpcElt->IsKindOf(RUNTIME_CLASS(CWndSpaceElt)));
delete pOldElt;
}
ASSERT(nHtLeft == 0);
// should now be looking at the element we need to shrink...
// NB: If pos = NULL then we removed to the end of the list...
pSpcElt = new CWndSpaceElt;
pSpcElt->wd = nMinX + nWd;
pSpcElt->ht = nHt;
if (InsertPos == NULL)
SpcList.AddTail(pSpcElt);
else
SpcList.InsertBefore(InsertPos, pSpcElt);
#ifdef _DEBUG
#ifdef _DEBUG_WNDPOS
TRACE("After insert:\n");
#endif
pos = SpcList.GetHeadPosition();
int nTotalHeightAfter = 0;
while (pos != NULL)
{
CWndSpaceElt * pSpcElt = (CWndSpaceElt *)SpcList.GetNext(pos);
ASSERT(pSpcElt != NULL);
ASSERT_VALID(pSpcElt);
nTotalHeightAfter += pSpcElt->ht;
#ifdef _DEBUG_WNDPOS
TRACE(" ht= %d w=%d\n", pSpcElt->ht, pSpcElt->wd);
#endif
}
ASSERT(nTotalHeightAfter == ParentSize.cy);
ASSERT(nTotalHeightBefore == nTotalHeightAfter);
#endif
}
示例11:
CDDEObject::CDDEObject(void)
{
service_name = "";
DDEObjects.AddTail(this);
}
示例12: main
int main(){
system("chcp 1251 > nul");
list<double> l1(2);
list<double> l2(4, 5);
list<double> l3(l2);
list<double> l4;
lPrint(l2);
for (int i = 0; i < 6; ++i){
l4.push_back(9.0034 + i);
}
int i = 0;
for (list<double>::iterator it = l4.begin(); it != l4.end(); ++it){
cout << "l(" << i++ << ") = " << *it << endl;
}
cout << endl;
l4.push_front(0.234);
lPrint(l4);
cout << '\n';
LPrint<double>(l4);
cout << endl;
double_list l5;
l5.assign(l4.begin(), l4.end());
lPrint(l5);
cout << endl;
double_list::iterator iter;
iter = l5.begin();
l5.insert(iter, 65.5434);
lPrint(l5);
cout << endl;
l5.erase(iter);
lPrint(l5);
l5.remove(65.5434);
cout << endl;
lPrint(l5);
cout << endl;
l5.remove_if(is_greater_ten);
lPrint(l5);
cout << "\nSorting\n";
l4.sort();
l4.sort(less<double>());
lPrint(l4);
cout << endl;
l4.sort(greater);
lPrint(l4);
cout << "\nIs list empty? " << ((l4.empty()) ? "Yes" : "No") << endl;
l4.clear();
cout << "Is list empty? " << ((l4.empty()) ? "Yes" : "No") << endl;
std::list<Event<>*> myList;
myList.push_back(new Event<>("Тест 1", "Москва", 0, EVENT_TYPE_CONFERENCE));
myList.push_back(new Event<>("Тест 2", "Москва", 0, EVENT_TYPE_CONFERENCE));
myList.reverse();
for (auto i = myList.begin(); i != myList.end(); ++i) {
cout << **i << endl;
}
myList.sort(comp);
myList.remove_if(is_test);
myList.reverse();
myList.insert(myList.begin(), new Event<>("Тест 3", "Москва", 0, EVENT_TYPE_CONFERENCE));
myList.pop_front();
myList.erase(myList.begin());
myList.push_back(new Event<>("Тест 4", "Москва", 0, EVENT_TYPE_CONFERENCE));
myList.clear();
cout << "Is list empty? " << ((myList.empty()) ? "Yes" : "No") << endl;
CObList list;
list.AddTail(new Event<>("Тест 1", "Москва", 0, EVENT_TYPE_CONFERENCE));
list.AddTail(new Event<>("Тест 2", "Москва", 0, EVENT_TYPE_CONFERENCE));
list.AddHead(new Event<>("Тест 3", "Москва", 0, EVENT_TYPE_CONFERENCE));
list.InsertAfter(list.GetHeadPosition(), new Event<>("Тест 4", "Москва", 0, EVENT_TYPE_CONFERENCE));
list.InsertBefore(list.GetTailPosition(), new Event<>("Тест 5", "Москва", 0, EVENT_TYPE_CONFERENCE));
POSITION pos;
for (pos = list.GetHeadPosition(); pos != NULL;)
{
cout << *((Event<>*) list.GetNext(pos)) << endl << endl;
}
for (pos = list.GetTailPosition(); pos != NULL;)
{
cout << *((Event<>*) list.GetPrev(pos)) << endl << endl;
}
//.........这里部分代码省略.........