Ejemplo n.º 1
0
void CWordStyleGallery::AppendL(TInt aIndex)
	{
	TBuf<100> name;
	name = (*iStyleNameList)[aIndex];
	//
	// truncate name if necessary
	CColumnListBoxData* columnData = ListBox()->ItemDrawer()->ColumnData();
	TInt columnWidth = columnData->ColumnWidthPixel(0);
	const CFont* columnFont = columnData->ColumnFont(0);
	if (columnFont->TextWidthInPixels(name) > columnWidth)
		TextUtils::ClipToFit(name, *columnFont, columnWidth);
	//
	TChar key = iData.iNormalStyleHotKey;
	if (name != iNormalName)
		{
		CParagraphStyle* pp = iData.iStyleList.PtrByName(name)->iStyle;
		TInt index = iData.iStyleList.IndexByPtr(pp);
		key = iData.iHotKeyList[index];
		}
	if (key > 0)
		{
		name.Append(KColumnListSeparator);
		name.Append(KColumnListSeparator); // one for empty spacer column
		name.Append(iHotKey);
		name.Append(key);		
		name.Append(KColumnListSeparator);
		}
	iStyleNameKeyList->AppendL(name);
	}
Ejemplo n.º 2
0
// ---------------------------------------------------------------------------
// CBCTestMix50Case::TestCColumnListBoxDataCaseL()
// ( menu item -21- )
// ---------------------------------------------------------------------------
//
void CBCTestMix50Case::TestCColumnListBoxDataCaseL()
    {
    CColumnListBoxData* columnListBoxData = CColumnListBoxData::NewL();
    CleanupStack::PushL( columnListBoxData );

    columnListBoxData->CurrentItemTextWasClipped();
    _LIT( KCurrentItemTextWasClipped,
          "CColumnListBoxData::CurrentItemTextWasClipped()" );
    AssertTrueL( ETrue, KCurrentItemTextWasClipped );

    CleanupStack::PopAndDestroy( columnListBoxData );
    }
Ejemplo n.º 3
0
void CWordStyleGallery::DoCalcColumnWidthsL()
	{
	CColumnListBoxData* columnData = ListBox()->ItemDrawer()->ColumnData();
	const CFont* font;
	//
	// column 0
	font = iEikonEnv->NormalFont();
	columnData->SetColumnFontL(0, font);
	columnData->SetColumnAlignmentL(0, CGraphicsContext::ELeft);
	//
	// column 1
	columnData->SetColumnWidthPixelL(1, KStyleColumnSpacerWidth);
	//
	// column 2
	font = iEikonEnv->LegendFont();
	columnData->SetColumnFontL(2, font);
	TBuf<KMaxStyleHotKeyDescription> hotkey;
	iCoeEnv->ReadResource(hotkey, R_WORD_HOTKEY);
	TInt width2 = font->TextWidthInPixels(hotkey) + font->MaxCharWidthInPixels();
	columnData->SetColumnWidthPixelL(2, width2);
	columnData->SetColumnAlignmentL(2, CGraphicsContext::ELeft);
	//
	// more column 0
	TInt width0 = ListBox()->View()->ViewRect().Width() - KStyleColumnSpacerWidth - width2 - CEikScrollBar::DefaultScrollBarBreadth(); // only works if called from PostLayout...
	columnData->SetColumnWidthPixelL(0, width0);
	}
Ejemplo n.º 4
0
// ----------------------------------------------------------------------------
// CAknExQueryContainer::CreateListBoxL()
// Creates listbox object.
// ----------------------------------------------------------------------------
//
void CAknExQueryContainer::CreateListBoxL()
    {
    DeleteListBoxL();

    TInt resourceId = R_AKNEXQUERY_MULTILINE_TIME_AND_DURATION_LIST_ITEM;
    iHandler = new ( ELeave ) CAknExQueryTimeAndDurationListEventHandler(
                    this );

    TInt flags( CEikListBox::EPopout | CEikListBox::ELeftDownInViewRect );
    iListBox = new ( ELeave ) CEikColumnListBox;
    iListBox->ConstructL( this, flags );

    iListBox->SetListBoxObserver( iHandler );
    iListBox->SetBorder( TGulBorder::EShallowRaised );
    iListBox->CreateScrollBarFrameL( ETrue );
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );

    // Creates list items
    CDesCArray* textArray = iCoeEnv->ReadDesCArrayResourceL( resourceId );
    iListBox->Model()->SetItemTextArray( textArray );
    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );

    // Sets pixel values of width.
    TRect rect( TPoint( KAknExQueryListBoxRectPointX,
        KAknExQueryListBoxRectPointY ),
        TSize( KAknExQueryListBoxRectWidth,
        KAknExQueryListBoxRectHeight )  );

    CColumnListBoxData* columnData = iListBox->ItemDrawer()->ColumnData();
    columnData->SetColumnWidthPixelL( KAknExQueryNameColumnIndex,
                                      rect.Width() );
    columnData->SetColumnWidthPixelL( KAknExQueryNameGapColumnIndex,
                                      rect.Width() );

    // Gets current number of list box items.
    TInt numberOfItems( iListBox->Model()->NumberOfItems() );
    // Gets new height of list box.
    TInt height( iListBox->CalcHeightBasedOnNumOfItems( numberOfItems ) );
    // If new height is less than defined height of list box
    // sets new height to list box height.
    if ( height < rect.Height() )
        {
        rect.SetHeight( height );
        }

    iListBox->SetRect( rect ); // Sets rectangle of list box.
    ActivateL();
    }
void CPhotoModeListBox::SetIconsArray()
{
    CArrayPtr<CGulIcon>* iconArray = new (ELeave)
    CArrayPtrFlat<CGulIcon>(2);

    CleanupStack::PushL(iconArray);

    TBuf<128> path;
    path = CRippleVaultAppUi::ApplicationDriveAndPath();
    path.Append(KSmsMbmFileName);

    for(int i = 0 ; i < 2 ; i++)
    {
        iconArray->AppendL(iEikonEnv->CreateIconL(path,
                           EMbmSmsInbox, EMbmSmsInboxm));
    }

    CleanupStack::Pop(); // iconArray

    // Set the listbox's first column to fill the listbox's whole width
    CColumnListBoxData* colData = iListbox->ItemDrawer()->ColumnData();
    if(colData)
    {
        colData->SetIconArray(iconArray);

        colData->SetGraphicsColumnL(0, ETrue);
        colData->SetColumnWidthPixelL(0, 30);
        colData->SetColumnAlignmentL(0, CGraphicsContext::ELeft);

        colData->SetColumnWidthPixelL(1, 100);
    }

    iListbox->SetItemHeightL(30);
}
void CContactsSubScreenView::ConstructL(CCoeControl* aWindowOwningContainer)
{
    // Application title
    iAppTitle = CCknAppTitle::NewL(CCknAppTitle::EWindow);
    iAppTitle->SetContainerWindowL(*this);

	TBuf<50> titlename;
	TBuf<50> formatBuf;

	titlename.Copy(_L(""));
	formatBuf.Copy(_L(""));
	formatBuf.Append(*(iEikonEnv->AllocReadResourceL(R_STATUSTEXT_CONTACTS_UPLOADED)));
	titlename.Format(formatBuf, 0);

    iAppTitle->SetTextL(titlename, CCknAppTitle::EMainTitle);

    // Search results listbox
    iListbox = new(ELeave)CEikColumnListBox; // Column listbox with one column
    iListbox->ConstructL(aWindowOwningContainer,
        CEikListBox::ENoExtendedSelection);
    iListbox->CreateScrollBarFrameL(ETrue);
    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    iListbox->SetObserver(this); // See HandleControlEventL
    iListbox->SetContainerWindowL(*aWindowOwningContainer);

    SetContainerWindowL(*aWindowOwningContainer);

	// Set the listbox's first column to fill the listbox's whole width
    CColumnListBoxData* colData = iListbox->ItemDrawer()->ColumnData();
    if(colData)
    {
		colData->SetColumnWidthPixelL(0, 200);       
    }

	iListbox->SetItemHeightL(30);

	if(iAppUi.iStoragePath == 1)
	{
	  CDesCArray* smsnames = iAppUi.GetSmsNameList();	

	  CDesCArray* smsmobiles = iAppUi.GetSmsMobileList();

	  if(smsnames->Count() == 0)
	  {
		iContactsArray = new (ELeave) CDesCArrayFlat(1);
		iMobileArray   = new (ELeave) CDesCArrayFlat(1);
	  }
	  else
	  {
		iContactsArray = new (ELeave) CDesCArrayFlat(smsnames->Count());
		iMobileArray   = new (ELeave) CDesCArrayFlat(smsnames->Count());
	  }

	  for(int i = 0 ; i < smsnames->Count() ; i++)
	  {
		 iContactsArray->AppendL(smsnames->MdcaPoint(i)); 
		 iMobileArray->AppendL(smsmobiles->MdcaPoint(i)); 
	  }	

	  SetData();
	}
	else
	{
		iContactsArray = new (ELeave) CDesCArrayFlat(12);
		iMobileArray   = new (ELeave) CDesCArrayFlat(12);
	}
}