void CTcContainer::CreateLabelsL( const TRect& /*aRect*/ ) { // Create labels CEikLabel* label; TRect rect( KLabelTlX, KLabelTlY, KLabelBrX, KLabelBrY ); label = CreateLabelL( rect, KTestCase ); rect.Move( 0, KLabelSpacing ); label = CreateLabelL( rect, KNone ); // Use smaller for for this label label->SetFont( CEikonEnv::Static()->AnnotationFont() ); rect.Move( 0, KLabelSpacing ); label = CreateLabelL( rect, KRequest ); rect.Move( 0, KLabelSpacing ); label = CreateLabelL( rect, KNone ); // Use smaller for for this label label->SetFont( CEikonEnv::Static()->AnnotationFont() ); rect.Move( 0, KLabelSpacing ); label = CreateLabelL( rect, KStatus ); rect.Move( 0, KLabelSpacing ); label = CreateLabelL( rect, KNone ); // Use smaller for for this label label->SetFont( CEikonEnv::Static()->AnnotationFont() ); }
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(); }
// ----------------------------------------------------------------------------- // SetTextL // // ----------------------------------------------------------------------------- // void CAknInfoPopupNote::SetTextL( const TDesC& aText ) { if ( aText != iText->Text() ) { iText->SetTextL( aText ); for ( TInt i = 0; i < iText->NumberOfLines(); i++ ) { // Draw the label after the background. CEikLabel* line = iText->Line( i ); line->ActivateL(); // Never leaves if ( !IsVisible() ) { line->MakeVisible( EFalse ); } iText->SetLineModified( i, EFalse ); } SetWindowLayoutL(); if ( IsVisible() ) { Window().Invalidate( Rect() ); } } }
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 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); }
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; }
// ---------------------------------------------------------------------------- // TKeyResponse CGuideContainer::OfferKeyEventL( const TKeyEvent&, // TEventCode ) // Handles the key events. // ---------------------------------------------------------------------------- // TKeyResponse CGuideContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) { CEikLabel* instructionLabel = GetTalkingLabel(); if (aType == EEventKeyDown) { this->SetFocus(ETrue); } // } else if (aType == EEventKeyUp) { // iInstructionLabel->SetFocus(ETrue); // } if ( aType != EEventKey ){ // Is not key event? return EKeyWasNotConsumed; } switch ( aKeyEvent.iScanCode ) { case EStdKeyLeftArrow: case EStdKeyRightArrow: instructionLabel->SetFocus(ETrue); return EKeyWasNotConsumed; break; // Switches tab. case EStdKeyUpArrow: if( !(iAppUI->IsGpsAllowed()) && iAppUI->HasRoute() ){ // update here iView->GoToTurn( ETrue ); instructionLabel->SetFocus(ETrue); return EKeyWasConsumed; } break; case EStdKeyDownArrow: if( !(iAppUI->IsGpsAllowed()) && iAppUI->HasRoute() ){ // update here iView->GoToTurn( EFalse ); instructionLabel->SetFocus(ETrue); return EKeyWasConsumed; } break; case EStdKeyDevice3: iView->HandleCommandL( EWayFinderCmdGuideReroute ); instructionLabel->SetFocus(ETrue); return EKeyWasConsumed; break; case EStdKeyHash: iView->HandleCommandL( EWayFinderCmdMap ) ; instructionLabel->SetFocus(ETrue); return EKeyWasConsumed; break; default: instructionLabel->SetFocus(ETrue); return EKeyWasNotConsumed; break; } // //TODO: Test "return EKeyWasConsumed;" return EKeyWasNotConsumed; }
void CRecognizerContainer::StopDisplay() { CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("StopDisplay")); if (owns_bitmap) delete iBitmap; iBitmap=0; delete iVCS; iVCS=0; delete iCurrentCodeInfo; iCurrentCodeInfo=0; iCurrentCodeArray->Reset(); iStandByLabel->MakeVisible(ETrue); DrawDeferred(); }
void CMainMenuListContainer::SizeChanged() { CCoeControl::SizeChanged(); if(iBgContext) { iBgContext->SetRect(Rect()); if (&Window()) { iBgContext->SetParentPos(PositionRelativeToScreen()); } } CCoeControlArray::TCursor cursor = Components().Find(ETitleLabel); CEikLabel* label = cursor.Control<CEikLabel>(); const TDesC* titleText = label->Text(); TRect rect = Rect(); CFont* titleFont = FindLargestPossibleFontL(*titleText, rect.Width(), EAknLogicalFontPrimaryFont); label->SetFont(titleFont); CEikonEnv::Static()->ScreenDevice()->ReleaseFont(titleFont); // Set the size of the label, need to think of the descent as well. TSize size = label->MinimumSize(); size.iWidth = rect.Width(); TInt descent = label->Font()->DescentInPixels(); size.iHeight += descent; // Set the pos for the listbox, use the height for the label when doing this. // Also add the descent in pixels to get some space between the label and the // listbox. rect.iTl.iY = descent; TPoint pos(0, descent); label->SetExtent(rect.iTl, size); rect.iTl.iY += size.iHeight; // As default display both rows and hide the scrollbars HideSecondRow(EFalse); iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); // Need to set the rect to get the listbox to update its values iListBox->SetRect(rect); TInt listBoxHeight = iListBox->ItemHeight() * iListBox->Model()->NumberOfItems(); if (listBoxHeight > rect.Height()) { // The listbox is to large to fint, hide the row and check again. HideSecondRow(ETrue); iListBox->SetRect(rect); listBoxHeight = iListBox->ItemHeight() * iListBox->Model()->NumberOfItems(); if (listBoxHeight > rect.Height()) { // Show scroll bar only if the height of the listbox is larger then // the rect. iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn); iListBox->UpdateScrollBarsL(); } } else { // Setting the first item gets the list box positioned correctly on the screen iListBox->ScrollToMakeItemVisible(0); } }
void CUploadContainer::MiuoConvertComplete(TInt aError) { // FIXME: error handling if (!iScaledBitmap) { iScaler=CMdaBitmapScaler::NewL(); iScaledBitmap=iOrigBitmap; iScaler->ScaleL(*this, *iScaledBitmap, TSize(100, IMG_HEIGHT)); } else { scaled=true; iImgPlaceHolder->MakeVisible(EFalse); DrawNow(); } }
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 CRecognizerContainer::StartDisplay() { CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("StartDisplay")); iTakingPicture = FALSE; iCurrentCode = -1; iBitmap = NULL; iTranslation.SetXY(0, 0); iTarget.SetXY(320, 240); iTilting.SetXY(0.0, 0.0); iMagnification = 2; iStandByLabel->MakeVisible(EFalse); ViewFinderStartStop(); }
TKeyResponse CRecognizerContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) { CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("OfferKeyEventL")); if (aKeyEvent.iCode==JOY_CLICK && aType==EEventKey) { Reporting().DebugLog(_L("CRecognizerContainer::OfferKeyEventL::joy")); if (iStandByLabel->IsVisible()) { ((CRecognizerViewImpl*)iView)->StartDisplay(); } else { #ifdef __WINS__ iView->HandleCommandL(ERecognizerCaptureCode); #else if (GetCode()) { iView->HandleCommandL(ERecognizerCaptureCode); } #endif } return EKeyWasConsumed; } else { if (iNavi) return EKeyWasConsumed; return EKeyWasNotConsumed; } }
/** * Create a label */ CEikLabel* CAknTextControl::CreateLabelLC(TInt aLen) { CEikLabel* label = new(ELeave) CEikLabel; CleanupStack::PushL(label); label->SetContainerWindowL(*this); label->SetBufferReserveLengthL(aLen); #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS label->SetParent( this ); #endif // we do logical to visual conversion ourselves while wrapping text label->UseLogicalToVisualConversion( EFalse ); if ( iPictoInterface ) { label->EnablePictographsL( *iPictoInterface ); } return label; }
void CGuideContainer::CalculatePortraitLayout() { #ifdef NAV2_CLIENT_SERIES60_V3 ActivateGc(); CWindowGc& gc = SystemGc(); gc.Clear(iCurrStreetLabel->Rect()); SetLabelExtent(iCurrStreetLabel, CURRSTREET_LABEL_POS, ETrue); gc.Clear(iNextStreetLabel->Rect()); SetLabelExtent(iNextStreetLabel, NEXTSTREET_LABEL_POS, ETrue); gc.Clear(iDistanceLabel->Rect()); SetLabelExtent(iDistanceLabel, DISTANCE_LABEL_POS); CEikLabel* instructionLabel = GetTalkingLabel(); // Resets the Edwin control for the screen reader gc.Clear(instructionLabel->Rect()); SetLabelExtent(instructionLabel, TEXT_INSTRUCTION_POS); DeactivateGc(); if (iProgressBar) { iProgressBar->SetSizeAndPosition(TRect( WFLayoutUtils:: CalculatePosUsingMainPane( PROGRESS_BAR_POS ), WFLayoutUtils:: CalculateSizeUsingMainPane( 40, 90 ) ) ); } else { iProgressBar = CGuideProgressBar::NewL(*this, TRect( WFLayoutUtils::CalculatePosUsingMainPane( PROGRESS_BAR_POS ), WFLayoutUtils::CalculateSizeUsingMainPane( 40, 90 ) ), iView->GetMbmName(), EMbmWficonsProgress_triangle_grey, EMbmWficonsProgress_triangle_blue, EMbmWficonsProgress_triangle_grey_mask, EMbmWficonsProgress_bar_grey, EMbmWficonsProgress_bar_blue, EMbmWficonsProgress_bar_grey_mask); } TRect rect = WFLayoutUtils::GetMainPaneRect(); CreatePictureL(iGuidePicture, rect, GUIDE_PICTURE_POS, 100, 100); // CreatePictureL(iNextTurnPicture, rect, NEXT_TURN_PICTURE_POS, 24, 24); // CreatePictureL(iDetourPicture, rect, DETOUR_PICTURE_POS, 24, 24); SetImage(iNextTurnPicture, iGuidePicture->GetRect(), &TopRight, 0.24, 0.24, -WFLayoutUtils::CalculateXValue(IMAGE_PADDING), WFLayoutUtils::CalculateYValueUsingMainPane(IMAGE_PADDING)); SetImage(iDetourPicture, iGuidePicture->GetRect(), &LowerLeft, 0.24, 0.24, WFLayoutUtils::CalculateXValue(IMAGE_PADDING), -WFLayoutUtils::CalculateYValueUsingMainPane(IMAGE_PADDING)); SetImage(iSpeedCamPicture, iGuidePicture->GetRect(), &LowerRight, 0.24, 0.24, -WFLayoutUtils::CalculateXValue(IMAGE_PADDING), -WFLayoutUtils::CalculateYValueUsingMainPane(IMAGE_PADDING)); iDetourPicture->SetShow(EFalse); iSpeedCamPicture->SetShow(EFalse); iDetourPicture->CreateIconL(iView->GetMbmName(), EMbmWficonsDetour_square, EMbmWficonsDetour_square_mask); iSpeedCamPicture->CreateIconL(iView->GetMbmName(), EMbmWficonsSpeedcamera_square, EMbmWficonsSpeedcamera_square); TRect exitRect = Center(iGuidePicture->GetRect(), TRect(TPoint(), WFLayoutUtils:: CalculateSizeUsingSize(iGuidePicture->GetSize(), 0.26, 0.16))); if (iExitPicture) { iExitPicture->SetImageRect(exitRect); } else { iExitPicture = CImageHandler::NewL(exitRect); } iExitPicture->SetShow(EFalse); // XXX Temporary removed until the above lines are tested. // CreatePictureL(iExitPicture, rect, EXIT_PICTURE_POS, 26, 16); #endif }
void CGuideContainer::CalculateLandscapeLayout() { #ifdef NAV2_CLIENT_SERIES60_V3 // Landscape mode! // Clear all labeltexts before setting the new extent, // by doing this we will get rid of the text in the // old positions. ActivateGc(); CWindowGc& gc = SystemGc(); gc.Clear(iCurrStreetLabel->Rect()); SetLabelExtent(iCurrStreetLabel, CURR_STREET_LABEL_X_LS, CURR_STREET_LABEL_Y_LS, ETrue); gc.Clear(iNextStreetLabel->Rect()); SetLabelExtent(iNextStreetLabel, NEXT_STREET_LABEL_X_LS, NEXT_STREET_LABEL_Y_LS, ETrue); gc.Clear(iDistanceLabel->Rect()); SetLabelExtent(iDistanceLabel, DIST_STREET_LABEL_X_LS, DIST_STREET_LABEL_Y_LS); // Resets the Edwin control for the screen reader CEikLabel* instructionLabel = GetTalkingLabel(); gc.Clear(instructionLabel->Rect()); SetLabelExtent(instructionLabel, TEXT_INSTRUCTION_X_LS, TEXT_INSTRUCTION_Y_LS); DeactivateGc(); if (iGuidePicture) { // Recalculate iGuidePicture->SetImageRect(TRect(WFLayoutUtils::CalculatePosUsingMainPaneFloat(0.1, 0.15), WFLayoutUtils::CalculateSizeUsingMainPaneFloat(0.45, 0.70))); } else { iGuidePicture = CImageHandler::NewL(TRect(WFLayoutUtils::CalculatePosUsingMainPaneFloat(0.1, 0.15), WFLayoutUtils::CalculateSizeUsingMainPaneFloat(0.45, 0.70))); } if (iProgressBar) { iProgressBar->SetSizeAndPosition(TRect(WFLayoutUtils::CalculatePosUsingMainPaneFloat(0.7, 0.15), WFLayoutUtils::CalculateSizeUsingMainPaneFloat(0.20, 0.6))); } else { iProgressBar = CGuideProgressBar::NewL(*this, TRect( WFLayoutUtils::CalculatePosUsingMainPaneFloat(0.7, 0.15), WFLayoutUtils::CalculateSizeUsingMainPaneFloat(0.20, 0.6)), iView->GetMbmName(), EMbmWficonsProgress_triangle_grey, EMbmWficonsProgress_triangle_blue, EMbmWficonsProgress_triangle_grey_mask, EMbmWficonsProgress_bar_grey, EMbmWficonsProgress_bar_blue, EMbmWficonsProgress_bar_grey_mask); } SetImage(iNextTurnPicture, iGuidePicture->GetRect(), &TopRight, 0.24, 0.24, -WFLayoutUtils::CalculateXValue(IMAGE_PADDING), WFLayoutUtils::CalculateYValueUsingMainPane(IMAGE_PADDING)); SetImage(iDetourPicture, iGuidePicture->GetRect(), &LowerLeft, 0.24, 0.24, WFLayoutUtils::CalculateXValue(IMAGE_PADDING), -WFLayoutUtils::CalculateYValueUsingMainPane(IMAGE_PADDING)); SetImage(iSpeedCamPicture, iGuidePicture->GetRect(), &LowerRight, 0.24, 0.24, -WFLayoutUtils::CalculateXValue(IMAGE_PADDING), -WFLayoutUtils::CalculateYValueUsingMainPane(IMAGE_PADDING)); iDetourPicture->SetShow(EFalse); iSpeedCamPicture->SetShow(EFalse); iDetourPicture->CreateIconL(iView->GetMbmName(), EMbmWficonsDetour_square, EMbmWficonsDetour_square_mask); iSpeedCamPicture->CreateIconL(iView->GetMbmName(), EMbmWficonsSpeedcamera_square, EMbmWficonsSpeedcamera_square); TRect exitRect = Center(iGuidePicture->GetRect(), TRect(TPoint(), WFLayoutUtils:: CalculateSizeUsingSize(iGuidePicture->GetSize(), 0.26, 0.16))); if (iExitPicture) { iExitPicture->SetImageRect(exitRect); } else { iExitPicture = CImageHandler::NewL(exitRect); } iExitPicture->SetShow(EFalse); #endif }
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(); }
void CPreviewPopUpContent::SetAvailableWidth(TInt aWidth, TInt aPadding, CPreviewPopUpContent::TContentLayout aLayout, TInt aHeight) { iLayout = aLayout; TInt numLabels = iLabelContainer.Count(); if (numLabels == 0) { return; } // The large font header label. CEikLabel* labelLa = iLabelContainer[0].iLabel; // The small font text label. CEikLabel* labelSm = iLabelContainer[1].iLabel; // Font height in pixels TInt fontHeightLa = labelLa->Font()->HeightInPixels(); // Font descent in pixels TInt descentLa = labelLa->Font()->DescentInPixels(); // The height of one label TInt labelHeightLa = fontHeightLa + descentLa; // Font height in pixels TInt fontHeightSm = labelSm->Font()->HeightInPixels(); // Font descent in pixels TInt descentSm = labelSm->Font()->DescentInPixels(); // The height of one label TInt labelHeightSm = fontHeightSm + descentSm; // totLabelsHeight will hold the total height of all labels that // will be drawn (one large font and the rest small fonts). // We additionaly remove a descent on the last line since that // it seems otherwise we're over compensating. TInt totLabelsHeight = labelHeightLa + labelHeightSm * (numLabels - 1); // - descentSm; // Calculate the image size. // This calc will give us the height of two label rows. iIconSize = fontHeightLa + fontHeightSm + descentLa; TInt iconSize = iIconSize; TInt padding = aPadding; if (iBitmap) { AknIconUtils::SetSize(iBitmap, TSize(iconSize, iconSize), EAspectRatioPreservedAndUnusedSpaceRemoved); iconSize = iBitmap->SizeInPixels().iWidth; } else { // We have no bitmap set so dont indent the text around the bitmap. iconSize = 0; padding = 0; } // controlRect will contain the rect for our control to draw in, // including padding. TRect controlRect; if (iLayout == EFourLinesIndentedTextImageTopLeft) { if (aHeight > 0) { controlRect = TRect(TPoint(aPadding, aPadding), TSize(aWidth, aHeight)); } else { controlRect = TRect(TPoint(aPadding, aPadding), TSize(aWidth, totLabelsHeight + aPadding)); } } else if (iLayout == EFourLinesTextImageTopLeftAbove) { if (aHeight > 0) { controlRect = TRect(TPoint(aPadding, aPadding), TSize(aWidth, aHeight)); } else { controlRect = TRect(TPoint(aPadding, aPadding), TSize(aWidth, totLabelsHeight + iconSize + descentLa + aPadding)); } } // iComponentRect will contain the drawing area for our controls // (image and labels). iComponentRect = controlRect; iComponentRect.Shrink(aPadding, aPadding); // Calculate where the text should wrap and // calculate the positions and rects for the labels in the control. TRect labelRectLa; TRect labelRectSm; if (iLayout == EFourLinesIndentedTextImageTopLeft) { // The first line will bew positioned next to the image and // therefore the width will be a bit shorter. iStringLengths->At(0) = (iComponentRect.Width() - (iconSize + padding)); // The width of the last line should not be wrapped but rather set to // cropped later on. iStringLengths->At(1) = (iComponentRect.Width() + 10000); // The rect for the first label in the layout mode. labelRectLa = TRect(TPoint(iComponentRect.iTl.iX + iconSize + padding, iComponentRect.iTl.iY), TSize(iComponentRect.Width() - (iconSize + padding), labelHeightLa)); // The rect for the labels with small font as well. labelRectSm = TRect(TPoint(iComponentRect.iTl.iX + iconSize + padding, iComponentRect.iTl.iY), TSize(iComponentRect.Width() - (iconSize + padding), labelHeightLa)); } else if (iLayout == EFourLinesTextImageTopLeftAbove) { // We can use the full length of the container. iStringLengths->At(0) = iComponentRect.Width(); // The width of the last line should not be wrapped but rather set to // cropped later on. iStringLengths->At(1) = (iComponentRect.Width() + 10000); // The rect for the first label in the layout mode. labelRectLa = TRect(TPoint(iComponentRect.iTl.iX, iComponentRect.iTl.iY + iconSize + descentLa), TSize(iComponentRect.Width(), labelHeightLa)); // The rect for the labels with small font as well. labelRectSm = TRect(TPoint(iComponentRect.iTl.iX, iComponentRect.iTl.iY + iconSize + descentLa), TSize(iComponentRect.Width(), labelHeightLa)); } iLabelContainer[0].SetRect(labelRectLa); labelRectSm.Move(0, labelHeightLa); iLabelContainer[1].SetRect(labelRectSm); // if (iLayout == EFourLinesIndentedTextImageTopLeft) { // // We need to move back the third label in this layout mode. // labelRect.iTl.iX -= (iconSize + padding); // } labelRectSm.Move(0, labelHeightSm); iLabelContainer[2].SetRect(labelRectSm); labelRectSm.Move(0, labelHeightSm); iLabelContainer[3].SetRect(labelRectSm); SetRect(controlRect); }
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); }
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 ContactsReader::Read() { app_state_.Reset(); app_helper_.ReadTitle(&control_tree_, &app_state_); // return; const TVwsViewId view_id = app_helper_.ReadView(&control_tree_, &app_state_); return; app_helper_.ReadCba(&control_tree_, &app_state_); CEikMenuBar* menu = control_tree_.MenuBar(); if (menu && menu->IsFocused()) { CEikMenuPane* pane = menu->MenuPane(); app_helper_.ReadMenu(pane, &app_state_); if (pane) { return; } } // TODO(mikie): move tab reading to AppHelper. CAknTabGroup* tabgroup = control_tree_.TabGroup(); if (tabgroup) { app_state_.SetSelectedTabIndex(tabgroup->ActiveTabIndex()); app_state_.SetTabCount(tabgroup->TabCount()); const TInt id = tabgroup->ActiveTabId(); CAknTabGroupAccess* access = (CAknTabGroupAccess*)tabgroup; CArrayPtr<CAknTabAccess>* tabs = access->iTabArray; for (int i = 0; i < tabs->Count(); ++i) { CAknTabAccess* tab = tabs->At(i); CCoeControl* tab_control = (CCoeControl*)tab; if (tab && tab->iId == id) { // Not all tabs have text. CEikLabel* label = tab->iLabel; if (label) { app_state_.SetSelectedTabText(*label->Text()); } break; } } } if (view_id.iAppUid != ForApplication()) { return; } const TUint view = view_id.iViewUid.iUid; if (view == 1) { // Main contacts view CCoeControl* top = control_tree_.TopFocusedControl(); if (top->CountComponentControls() == 0) return; CCoeControl* container = top->ComponentControl(0); if (container->CountComponentControls() < 2) return; CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0); CAknSearchField* field = (CAknSearchField*)container->ComponentControl(1); ReadList(listbox, &app_state_); HBufC* text = HBufC::NewLC(field->TextLength()); TPtr16 textp = text->Des(); field->GetSearchText(textp); app_state_.SetSearchFieldText(*text); CleanupStack::PopAndDestroy(text); } else if (view == 4) { // Details (read-only) view CCoeControl* top = control_tree_.TopFocusedControl(); if (top->CountComponentControls() == 0) return; CCoeControl* container = top->ComponentControl(0); if (container->CountComponentControls() < 1) return; CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0); ReadList(listbox, &app_state_); } }