本文整理汇总了C++中CDesCArray::InsertL方法的典型用法代码示例。如果您正苦于以下问题:C++ CDesCArray::InsertL方法的具体用法?C++ CDesCArray::InsertL怎么用?C++ CDesCArray::InsertL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDesCArray
的用法示例。
在下文中一共展示了CDesCArray::InsertL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例3: CreateElement
void CPluginsList::CreateElement(TDes& aFirstLine, TDes& aSecondLine)
{
TChar a = '\t';
TBuf<255> Text;
Text.Append(a);
Text.Append(aFirstLine);
Text.Append(a);
Text.Append(aSecondLine);
Text.Append(a);
CDesCArray* itemArray = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
itemArray->InsertL(0,Text);
iListBox->DrawNow();
}
示例4: ChangeItemSubtitle
void CMainView::ChangeItemSubtitle(TInt aIndex,TDes16& aText)
{
TInt b=iMain->ListBox()->Model()->NumberOfItems();
TBuf<255> prev = iMain->ListBox()->Model()->ItemText(aIndex);
TChar a = '\t';
TInt pos = prev.LocateReverse(a);
if (pos != KErrNotFound)
{
TInt replace_length = prev.Length() - pos;
prev.Delete(pos+1, replace_length);
prev.Insert(pos+1, aText);
}
CDesCArray* itemArray = static_cast<CDesCArray*> (iMain->ListBox()->Model()->ItemTextArray());
itemArray->Delete(aIndex);
itemArray->InsertL(aIndex,prev);
iMain->ListBox()->DrawNow();
}
示例5: RefreshDeviceListL
// ---------------------------------------------------------
// CBTUiDeviceContainer::RefreshDeviceListL
// This function will refresh only the changed parts of the
// screen, if any.
// ---------------------------------------------------------
void CBTUiDeviceContainer::RefreshDeviceListL(const RDeviceArray* aDeviceArray,TInt selectedItem)
{
TRACE_FUNC_ENTRY
MDesCArray* itemTextArray = iDeviceList->Model()->ItemTextArray();
CDesCArray* itemArray = (CDesCArray*) itemTextArray;
TBool removal=EFalse;
TBool addition=EFalse;
TInt previouslySelected=CurrentItemIndex();
TBTDeviceName listItem;
TInt deviceCount = aDeviceArray->Count();
TInt i = 0;
for( ; i < deviceCount; i++)
{
TBTDevice device = *(*aDeviceArray)[i];
CreateListItemL(device, listItem);
if(itemArray->Count()<=i)
{
itemArray->AppendL(listItem);
addition=ETrue;
}
else
if(listItem != (*itemArray)[i] )
{
itemArray->Delete(i);
itemArray->InsertL(i,listItem);
removal=ETrue;
addition=ETrue;
}
}
if(itemArray->Count()-i>=0)
{
itemArray->Delete(i,itemArray->Count()-i);
removal=ETrue;
}
if(removal)
iDeviceList->HandleItemRemovalL();
if(addition)
iDeviceList->HandleItemAdditionL();
if(deviceCount >0 )
iDeviceList->SetCurrentItemIndex( Max(selectedItem,0 )) ;
else
{
HBufC* devEmptyText = NULL;
if(iGroup ==EGroupPaired)
{
devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_PAIRED_DEVICES);
}
else
{
devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_BLOCKED_DEVICES);
}
iDeviceList->View()->SetListEmptyTextL(*devEmptyText );
CleanupStack::PopAndDestroy(devEmptyText);
}
if(addition | removal | previouslySelected!=selectedItem)
iDeviceList->DrawDeferred();
TRACE_FUNC_EXIT
}