本文整理汇总了C++中CArrayPtr::InsertL方法的典型用法代码示例。如果您正苦于以下问题:C++ CArrayPtr::InsertL方法的具体用法?C++ CArrayPtr::InsertL怎么用?C++ CArrayPtr::InsertL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrayPtr
的用法示例。
在下文中一共展示了CArrayPtr::InsertL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructL
// ---------------------------------------------------------
// CSymTorrentSearchContainer::ConstructL
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSymTorrentSearchContainer::ConstructL(const TRect& aRect,
CSymTorrentAppUi* aAppUi, CSTTorrentManager* aTorrentMgr)
{
iAppUi=aAppUi;
iTorrentMgr=aTorrentMgr;
CreateWindowL();
iListBox = new (ELeave) CAknDoubleGraphicStyleListBox();
iListBox->SetMopParent(this);
iListBox->ConstructL(this, EAknListBoxSelectionList);
iListBox->SetContainerWindowL(*this);
iListBox->View()->SetListEmptyTextL(_L("(empty)"));
//create scrollbar
iListBox->CreateScrollBarFrameL();
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray(1); // must be initialized with the number of icons used by the list!
CleanupStack::PushL(icons);
#ifdef EKA2
{
CGulIcon* chainLinkIcon = CGulIcon::NewL();
CleanupStack::PushL(chainLinkIcon);
CFbsBitmap* chainLinkBmp = NULL;
CFbsBitmap* chainLinkMask = NULL;
AknIconUtils::CreateIconLC(chainLinkBmp, chainLinkMask, KBitmapFile,
EMbmSymtorrentChainlink, EMbmSymtorrentChainlink_mask);
chainLinkIcon->SetBitmap(chainLinkBmp);
chainLinkIcon->SetMask(chainLinkMask);
CleanupStack::Pop(2);
icons->InsertL(0, chainLinkIcon);
CleanupStack::Pop();
}
#else
{
CEikonEnv* eikEnv = CEikonEnv::Static();
icons->AppendL(eikEnv->CreateIconL(KBitmapFile,
EMbmSymtorrentChainlink, EMbmSymtorrentChainlink_mask));
}
#endif
CleanupStack::Pop(icons); // icons
iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);
SetRect(aRect);
CDesCArray* itemArray = static_cast<CDesCArray*>
(iListBox->Model()->ItemTextArray());
itemArray->InsertL(0, _L("0\tFirst line\tSecond line"));
ActivateL();
}
示例2: AddItemL
void CMainMenuGridContainer::AddItemL(TInt aBitmapId, TInt aMaskId,
TInt aIndex)
{
CArrayPtr<CGulIcon>* icons =
iGrid->ItemDrawer()->FormattedCellData()->IconArray();
if (!icons) {
icons = new ( ELeave ) CAknIconArray(9);
iGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
}
CleanupStack::PushL(icons);
CFbsBitmap* bitmap;
CFbsBitmap* mask;
#ifdef NAV2_CLIENT_SERIES60_V3
AknIconUtils::CreateIconL(bitmap, mask, iView->GetMbmName(),
aBitmapId, aMaskId);
AknIconUtils::SetSize(bitmap, iIconRect.Size(),
EAspectRatioPreservedAndUnusedSpaceRemoved);
#else
bitmap = iEikonEnv->CreateBitmapL(iView->GetMbmName(), aBitmapId);
mask = iEikonEnv->CreateBitmapL(iView->GetMbmName(), aMaskId);
#endif
CleanupStack::PushL(bitmap);
CleanupStack::PushL(mask);
if (aIndex >= 0 && aIndex < icons->Count()) {
icons->InsertL(aIndex, CGulIcon::NewL(bitmap, mask));
} else {
icons->AppendL(CGulIcon::NewL(bitmap, mask));
}
CleanupStack::Pop(mask);
CleanupStack::Pop(bitmap);
CleanupStack::Pop(icons);
_LIT(KItem, "%d\t\t0");
TBuf<8> buf;
MDesCArray* array = iGrid->Model()->ItemTextArray();
CDesCArray* cArray = (CDesCArray*)array;
if (aIndex >= 0 && aIndex < icons->Count()) {
buf.Format(KItem, aIndex);
cArray->InsertL(aIndex, buf);
aIndex++;
//We need to delete and re-index the array since we inserted
//a new icon in the icon array.
cArray->Delete(aIndex, icons->Count() - aIndex);
for (TInt i = aIndex; i < icons->Count(); i++) {
buf.Format(KItem, i);
cArray->AppendL(buf);
}
} else {
buf.Format(KItem, (icons->Count() - 1));
cArray->AppendL(buf);
}
//Inform list box that data was added.
iGrid->HandleItemAdditionL();
}