void CPreviewPopUpContent::InitialiseL(const TRect& aRect,
                                      const TDesC& aMbmName,
                                      TInt aNbrOfRows, 
                                      TInt aImageId,
                                      TInt aMaskId)
{
   // Do not call CreateWindowL() as parent CAknPreviewPopUpController owns window
   
   InitComponentArrayL();
   
   iMbmName = aMbmName.AllocL();

   MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   TRgb fgcolor(0,0,0);
   AknsUtils::GetCachedColor(skin, fgcolor, KAknsIIDQsnTextColors, 
                             EAknsCIQsnTextColorsCG55);

   if (aImageId != -1 && aMaskId != -1) {
      AknIconUtils::CreateIconL(iBitmap, iMask, *iMbmName, aImageId, aMaskId);
      AknIconUtils::SetSize(iBitmap, TSize(10, 10), 
                            EAspectRatioPreservedAndUnusedSpaceRemoved);
   }

   iStringLengths = new (ELeave) CArrayFixFlat<TInt>(aNbrOfRows);
   iLabelContainer.Reset();
 
   // Create one label with standard font size.
   iStringLengths->AppendL(aRect.Width());
   CEikLabel* label = new (ELeave) CEikLabel();
   label->SetContainerWindowL(*this);
   Components().AppendLC(label);
   label->OverrideColorL(EColorLabelText, fgcolor);
   label->SetTextL(KDefaultText);
   CleanupStack::Pop(label);
   iLabelContainer.AppendL(TLabelData(label));
   // The rest of the labels with a smaller font.
   const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);
   for (TInt i = 0; i < aNbrOfRows-1; ++i) {
      iStringLengths->AppendL(aRect.Width());
      CEikLabel* label = new (ELeave) CEikLabel();
      label->SetContainerWindowL(*this);
      Components().AppendLC(label);
      label->SetFont(font);
      label->OverrideColorL(EColorLabelText, fgcolor);
      label->SetTextL(KDefaultText);
      CleanupStack::Pop(label);
      iLabelContainer.AppendL(TLabelData(label));
   }
   //CEikonEnv::Static()->ScreenDevice()->ReleaseFont(font);
   Components().SetControlsOwnedExternally(EFalse);

   // Set the windows size
   SetRect(aRect);

   // Activate the window, which makes it ready to be drawn
   ActivateL();
}
void CRecognizerContainer::ConstructL(const TRect& aRect, CAknView* View, TBool navi)
{
	CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("ConstructL"));

	iView=View;
	iNavi=navi;
	iCurrentCodeArray=new RPointerArray<CCodeInfo>;
	iScreenMsgBuf = CEikonEnv::Static()->AllocReadResourceL(R_CODE_SCREEN_MSG);

	if (iNavi) {
		CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
		CAknNavigationControlContainer *np = (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)); 
		CLocalNotifyWindow* tp=CLocalNotifyWindow::Global();
		np->PushDefaultL(ETrue);	
		HBufC * t = iEikonEnv->AllocReadResourceL(R_CHOOSE_CODE);
		tp->SetTitleText(t);
	} else {
//		CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
		CLocalNotifyWindow* tp=CLocalNotifyWindow::Global();
		tp->SetTitleTextToDefaultL();
	}

	CreateWindowL();

	iStandByLabel = new (ELeave) CEikLabel;
	iStandByLabel->SetContainerWindowL(*this);
	iStandByLabel->SetTextL(_L("Camera Standby\nClick to resume"));
	iStandByLabel->SetAlignment(TGulAlignment(EHCenterVCenter));
	iStandByLabel->SetExtent(TPoint(0,0), TSize(176,144));
	
	SetRect(aRect);
	ActivateL();
}
void CUploadContainer::ShowImageError(const TDesC& Descr, TInt Code)
{
	CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("ShowImageError"));

	if (!iImgPlaceHolder) return;

	iImgPlaceHolder->MakeVisible(ETrue);

	TBuf<30> msg;
	msg.Append(Descr); msg.Append(_L(": "));
	msg.AppendNum(Code);
	iImgPlaceHolder->SetTextL(msg);
}
示例#4
0
CEikLabel* CTcContainer::CreateLabelL( const TRect& aRect, const TDesC& aText )
{
    // Create new label and add it to the label array
    CEikLabel* label = new( ELeave ) CEikLabel;
    CleanupStack::PushL( label );
    iLabels.AppendL( label );
    CleanupStack::Pop( label );

    // Set label container, area and text
    label->SetContainerWindowL( *this );
    label->SetRect( aRect );
    label->SetTextL( aText );

    return label;
}
void CUploadContainer::MiuoOpenComplete(TInt aError)
{
	CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("MiuoOpenComplete"));

	if (aError!=KErrNone) {
		TBuf<40> msg;
		msg.Format(_L("error opening pic %d"), aError);
		iImgPlaceHolder->SetTextL(msg);
	} else {
		TFrameInfo frameInfo;
		iFileUtil->FrameInfo(0, frameInfo);
		iOrigBitmap=new (ELeave) CFbsBitmap;
		iOrigBitmap->Create(frameInfo.iOverallSizeInPixels, EColor4K);
		iFileUtil->ConvertL(*iOrigBitmap);
	}
}
void CFiletransferContainer::UpdateLabelsL()
{
	//we update labels 2,3,4, 5 and 7
	CEikLabel *l;
	HBufC* txt;
	TInt percent;

	//label 2: KB sent/received + percent
	l = iFileDetailsLabels[2];
	//l->SetContainerWindowL(*this);
	//create the KB array
	CArrayFixFlat<TInt> *transferedKB=new(ELeave)CArrayFixFlat<TInt>(2);
	CleanupStack::PushL(transferedKB);
	transferedKB->AppendL(iFiletransferView->iTotalBytesTransfered/1024);
	percent=(TInt)(iFiletransferView->iTotalBytesTransfered*100.0/iFiletransferView->iTotalBytes2Transfer);
	transferedKB->AppendL(percent);
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_KB_TRANSFERED,*transferedKB);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	CleanupStack::PopAndDestroy(transferedKB);

	//label 3: KB remaining to sent/received
	l = iFileDetailsLabels[3];
	//l->SetContainerWindowL(*this);
	//
	TInt KB2Transfer=(iFiletransferView->iTotalBytes2Transfer-iFiletransferView->iTotalBytesTransfered)/1024;
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_KB_2TRANSFER,KB2Transfer);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);

	//label 4: Elapsed time (m,s):
	l = iFileDetailsLabels[4];
	//l->SetContainerWindowL(*this);
	//create the array
	CArrayFixFlat<TInt> *time=new(ELeave)CArrayFixFlat<TInt>(2);
	CleanupStack::PushL(time);
	time->AppendL(iFiletransferView->iElapsedTime/60); //minutes
	time->AppendL(iFiletransferView->iElapsedTime%60); //seconds
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_ELAPSED_TIME,*time);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	CleanupStack::PopAndDestroy(time);

	//label 5: Estimated time (m, s):
	l = iFileDetailsLabels[5];
	//l->SetContainerWindowL(*this);
	//create the array
	time=new(ELeave)CArrayFixFlat<TInt>(2);
	CleanupStack::PushL(time);
	time->AppendL(iFiletransferView->iEstimatedTime/60); //minutes
	time->AppendL(iFiletransferView->iEstimatedTime%60); //seconds
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_ESTIMATED_TIME,*time);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	CleanupStack::PopAndDestroy(time);

	//label 7: Speed (avrg, kbps):
	l = iFileDetailsLabels[7];
	//l->SetContainerWindowL(*this);
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_SPEED,iFiletransferView->iAverageSpeed);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
}
void CFiletransferContainer::ResetLabelsL()
{
	CEikLabel *l;
	iFileDetailsLabels.ResetAndDestroy();
	HBufC* txt;
	TInt percent;

	//label 0: Sending/Receiving
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	//create the nr of files array
	CArrayFixFlat<TInt> *nrFiles=new(ELeave)CArrayFixFlat<TInt>(2);
	CleanupStack::PushL(nrFiles);
	nrFiles->AppendL(iFiletransferView->iCurrentFileNo);
	nrFiles->AppendL(iFiletransferView->iTotalFilesNo);
	//load label text

	if(iFiletransferView->iDirection==CFiletransferView::EDirectionSending)
		txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_SENDING_FILE,*nrFiles);
	else
		txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_RECEIVING_FILE,*nrFiles);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	CleanupStack::PopAndDestroy(nrFiles);
	iFileDetailsLabels.Append(l);

	//label 1: filename
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	iLabelTextFilename.Copy(iFiletransferView->iLabelTextFilename);
	iLabelTextFilename.Append(_L("     ")); //5 white spaces
	l->SetTextL(iLabelTextFilename);
	iFileDetailsLabels.Append(l);

	//label 2: KB sent/received + percent
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	//create the KB array
	CArrayFixFlat<TInt> *transferedKB=new(ELeave)CArrayFixFlat<TInt>(2);
	CleanupStack::PushL(transferedKB);
	transferedKB->AppendL(iFiletransferView->iTotalBytesTransfered/1024);
	percent=(TInt)(iFiletransferView->iTotalBytesTransfered*100.0/iFiletransferView->iTotalBytes2Transfer);
	transferedKB->AppendL(percent);
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_KB_TRANSFERED,*transferedKB);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	CleanupStack::PopAndDestroy(transferedKB);
	iFileDetailsLabels.Append(l);

	//label 3: KB remaining to sent/received
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	//
	TInt KB2Transfer=(iFiletransferView->iTotalBytes2Transfer-iFiletransferView->iTotalBytesTransfered)/1024;
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_KB_2TRANSFER,KB2Transfer);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	iFileDetailsLabels.Append(l);

	//label 4: Elapsed time (m,s):
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	//create the array
	CArrayFixFlat<TInt> *time=new(ELeave)CArrayFixFlat<TInt>(2);
	CleanupStack::PushL(time);
	time->AppendL(iFiletransferView->iElapsedTime/60); //minutes
	time->AppendL(iFiletransferView->iElapsedTime%60); //seconds
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_ELAPSED_TIME,*time);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	CleanupStack::PopAndDestroy(time);
	iFileDetailsLabels.Append(l);

	//label 5: Estimated time (m, s):
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	//create the array
	time=new(ELeave)CArrayFixFlat<TInt>(2);
	CleanupStack::PushL(time);
	time->AppendL(iFiletransferView->iEstimatedTime/60); //minutes
	time->AppendL(iFiletransferView->iEstimatedTime%60); //seconds
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_ESTIMATED_TIME,*time);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	CleanupStack::PopAndDestroy(time);
	iFileDetailsLabels.Append(l);

	//label 6: Link
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_LINK);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	iFileDetailsLabels.Append(l);

	//label 7: Speed (avrg, kbps):
	l = new (ELeave) CEikLabel;
	l->SetContainerWindowL(*this);
	//load label text
	txt=StringLoader::LoadLC(R_FILETRANSFER_LABEL_SPEED,iFiletransferView->iAverageSpeed);
	//set the label and clean
	l->SetTextL(*txt);
	CleanupStack::PopAndDestroy(txt);
	iFileDetailsLabels.Append(l);
}
示例#8
0
void CMainMenuListContainer::ConstructL(const TRect& aRect,
                                        CMainMenuListView* aView,
                                        const TInt* aMbmImageIds,
                                        const TInt* aMbmMaskIds,
                                        const TInt* aMainMenuCommandIds,
                                        const TInt* aMainMenuFirstLabelIds,
                                        const TInt* aMainMenuSecondLabelIds)
{
    CreateWindowL();

    InitComponentArrayL();

    iBgContext =
        CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,
                aRect, ETrue);

    iView = aView;
    iMainMenuCommandIds = aMainMenuCommandIds;

    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    TRgb fgcolor(0,0,0);
    AknsUtils::GetCachedColor(skin, fgcolor, KAknsIIDQsnTextColors,
                              EAknsCIQsnTextColorsCG6);

    CEikLabel* label = new (ELeave) CEikLabel();

    label->SetContainerWindowL(*this);
    Components().AppendLC(label, ETitleLabel);
    label->OverrideColorL(EColorLabelText, fgcolor);
    label->SetTextL(KDefaultTitle());
    label->SetLabelAlignment(ELayoutAlignCenter);
    HBufC* titleText = CEikonEnv::Static()->AllocReadResourceLC(R_MM_TITLE_TEXT);
    label->SetTextL(*titleText);
    CleanupStack::PopAndDestroy(titleText);
    CleanupStack::Pop(label);

    // Create and populate the listbox
    iListBox = new( ELeave ) CAknDoubleLargeStyleListBox();
    Components().AppendLC(iListBox, EListBox);

    iListBox->SetContainerWindowL(*this);
    iListBox->SetMopParent(this);
    {
        TResourceReader reader;
        iEikonEnv->CreateResourceReaderLC( reader, R_WAYFINDER_MAIN_MENU_LIST_VIEW_LISTBOX );
        iListBox->ConstructFromResourceL( reader );
        CleanupStack::PopAndDestroy(); // reader internal state
    }

    iListBox->SetFocus(ETrue);
    iListBox->SetListBoxObserver(this);

    iListBox->ItemDrawer()->FormattedCellData()->SetMarqueeParams(5, 3, 1000000, 200000);
    iListBox->ItemDrawer()->FormattedCellData()->EnableMarqueeL(ETrue);

    for (TInt i = 0; iMainMenuCommandIds[i] != -1; ++i) {
        AddItemL(aMbmImageIds[i], aMbmMaskIds[i],
                 aMainMenuFirstLabelIds[i],
                 aMainMenuSecondLabelIds[i]);
    }
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
            CEikScrollBarFrame::EOff);
    iListBox->UpdateScrollBarsL();

    iListBox->SetCurrentItemIndex(0);
    iListBox->DrawNow();
    CleanupStack::Pop(iListBox);

    //Activate view
    SetRect(aRect);
    ActivateL();
}
void CUploadContainer::ConstructL(const TRect& aRect)
{
	CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("ConstructL"));

	iControls=new (ELeave) CArrayPtrFlat< CCoeControl >(10);
	CreateWindowL();

	TRect r(TPoint(5, 5), TSize(aRect.Width()-10, 1));

	if (iFileName.Right(3).CompareF(_L("jpg"))==0) {
#ifndef __S60V2__
		iMdaServer=CMdaServer::NewL();
		iFileUtil=CMdaImageFileToBitmapUtility::NewL(*this, iMdaServer);
#else
		iFileUtil=CMdaImageFileToBitmapUtility::NewL(*this, 0);
#endif
		iFileUtil->OpenL(iFileName);
		scaled=false;
		iImgPlaceHolder=new (ELeave) CEikLabel;
		iControls->AppendL(iImgPlaceHolder);
		iImgPlaceHolder->SetContainerWindowL( *this );
		iImgPlaceHolder->SetFont(iEikonEnv->DenseFont());
		iImgPlaceHolder->SetTextL( _L("loading image...") ); 
		r.SetHeight(IMG_HEIGHT);
		iImgPlaceHolder->SetRect(r);
		r.Move(0, r.Height()+4);
	} else {
		r.SetHeight(IMG_HEIGHT);
		r.Move(0, r.Height()+4);
	}

	TInt tagw=0;
	/*
	iTagLabel=new (ELeave) CEikLabel;
	iControls->AppendL(iTagLabel);
	iTagLabel->SetContainerWindowL( *this );
	iTagLabel->SetTextL( _L("Tag:") );
	r.SetHeight(12);
	iTagLabel->SetRect(r);
	tagw=iTagLabel->MinimumSize().iWidth+4;
	r.Move( tagw , 0); r.SetWidth(r.Width()-tagw);
	*/

	TBuf<100> tag;
	Settings().GetSettingL(SETTING_UPLOAD_TAG, tag);
	if (tag.Length() == 0) tag=KTag();

	iTagEdit=new (ELeave) CEikEdwin;
	iControls->AppendL(iTagEdit);
	iTagEdit->SetContainerWindowL( *this );
	iTagEdit->ConstructL();
	iTagEdit->SetTextL(&tag);
	iTagEdit->AddEdwinObserverL(this);
	r.SetHeight(16);
	iTagEdit->SetRect(r);
	iTagEdit->ActivateL();
	r.Move(-tagw, r.Height()+4); r.SetWidth(r.Width()+tagw);


	TBool no_descr;
	if (iTagOnly) 
		no_descr=true;
	else
		no_descr=false;
	
	if (!no_descr) {
		TInt height=56;
		/*
		iDescriptionLabel=new (ELeave) CEikLabel;
		iControls->AppendL(iDescriptionLabel);
		iDescriptionLabel->SetContainerWindowL( *this );
		iDescriptionLabel->SetTextL( _L("Description:") );
		r.SetHeight(12);
		iDescriptionLabel->SetRect(r);
		r.Move(0, r.Height()+4);
		height-=16;
		*/
		r.Move(0, 2);

		iDescriptionEdit=new (ELeave) CEikEdwin;
		iControls->AppendL(iDescriptionEdit);
		iDescriptionEdit->SetContainerWindowL( *this );
		iDescriptionEdit->ConstructL();
		iDescriptionEdit->AddEdwinObserverL(this);
		iDescriptionEdit->SetTextL(&(KDescription()));
		r.SetHeight(height);
		iDescriptionEdit->SetRect(r);
		r.Move(0, r.Height()+4);

		SetEditSelected(iDescriptionEdit, true); SetEditActive(iDescriptionEdit, true);
	} else {
		SetEditSelected(iTagEdit, true); SetEditActive(iTagEdit, true);
	}

	SetRect(aRect);
	ActivateL();	
}