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); } }
// ----------------------------------------------------------------------------- // CHelpContainer::SizeChanged() // Called by framework when the view size is changed. // ----------------------------------------------------------------------------- // void CHelpContainer::SizeChanged() { TRect rect = Rect(); #ifdef __SERIES60_3X__ TRect ScrollBarRect = iRtEd->ScrollBarFrame()->VerticalScrollBar()->Rect(); //In 3rd edition CEikRichTextEditor draw the view for the whole rect and //the scrollbar doesn't show. That is a reason why CEikRichTextEditor Width() is //rect.Width()-ScrollBarRect.Width() iRtEd->SetExtent(TPoint(0, 0), TSize(rect.Width() - ScrollBarRect.Width(), rect.Height())); #else iRtEd->SetExtent(TPoint(0,StatusLineHeight), TSize(rect.Width(), rect.Height()-StatusLineHeight)); #endif if (iBgContext) { iBgContext->SetRect(Rect()); if (&Window()) { iBgContext->SetParentPos(PositionRelativeToScreen()); } } }
//Background drawing function void CTestRectGc::Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const { if (iBmpBackground) { TPoint a = PositionRelativeToScreen(); TPoint b = aControl.PositionRelativeToScreen(); //The source rect of the background is the relationship between this control and the control being drawn (child) //plus the subrect (aRect) to be drawn. TRect SourceRect(b-a+aRect.iTl, aRect.Size()); aGc.SetDrawMode(CGraphicsContext::EDrawModePEN); aGc.BitBlt(aRect.iTl, iBmpBackground, SourceRect); aGc.SetDrawMode(CGraphicsContext::EDrawModePEN); } else { TRect rc; aGc.SetClippingRect(aRect); aGc.SetBrushStyle(CGraphicsContext::ESolidBrush); aGc.SetBrushColor(iBrushColor); aGc.SetBrushStyle(iBrushStyle); aGc.DrawRect(rc); aGc.CancelClippingRect(); } }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CMyHelpContainer::SizeChanged() { if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } if(iEditor) { TRect rect(Rect());//CEikonEnv::Static()->EikAppUi()->ClientRect()); TRect ScrollBarRect = iEditor->ScrollBarFrame()->VerticalScrollBar()->Rect(); if(iMirroRed){ rect.iTl.iX = (rect.iTl.iX + ScrollBarRect.Width()); }else{ rect.iBr.iX = (rect.iBr.iX - ScrollBarRect.Width()); } iEditor->SetRect(rect); } }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CMySplashScreen::SizeChanged() { if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } }
void CSliderControl::SizeChanged() { if (iBgContext) { iBgContext->SetRect(Rect()); if ( &Window() ) {iBgContext->SetParentPos( PositionRelativeToScreen() );} } TInt scrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth; TInt scrY=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iHeight; TRect r=TRect(TPoint(0,scrY/3),TSize(scrX,scrY/3)); if (Position().iY!=r.iTl.iY){ShrinkRects(r,EDirectionVertical);} CCoeControl::SizeChanged(); }
void CEdwinTestControl::SizeChanged() { if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } if ( iEditWin ) { iEditWin->SetRect(Rect()); } }
void CBuddycloudListComponent::SizeChanged() { iRect = Rect(); if(iBufferBitmap) delete iBufferBitmap; if(iBufferDevice) delete iBufferDevice; if(iBufferGc) delete iBufferGc; // Fonts ReleaseFonts(); ConfigureFonts(); // Scrollbar if(iScrollBar) { iLayoutMirrored = false; iLeftBarSpacer = 1; iRightBarSpacer = iScrollBar->VerticalScrollBar()->ScrollBarBreadth(); } if(AknLayoutUtils::LayoutMirrored()) { iLayoutMirrored = true; iLeftBarSpacer = (iRightBarSpacer * 2); iRightBarSpacer = 1; } // Skins if(iBgContext) { iBgContext->SetRect(iRect); iBgContext->SetParentPos(PositionRelativeToScreen()); } // Initialize Double Buffer iBufferBitmap = new (ELeave) CFbsBitmap(); PanicIfError(_L("MC-BC"), iBufferBitmap->Create(iRect.Size(), CEikonEnv::Static()->ScreenDevice()->DisplayMode())); User::LeaveIfNull(iBufferDevice = CFbsBitmapDevice::NewL(iBufferBitmap)); PanicIfError(_L("MC-CC"), iBufferDevice->CreateContext(iBufferGc)); CWsScreenDevice * screenDevice = iCoeEnv->ScreenDevice(); TPixelsAndRotation aPixelAndRotation; screenDevice->GetScreenModeSizeAndRotation(screenDevice->CurrentScreenMode(), aPixelAndRotation); iBufferGc->SetOrientation(aPixelAndRotation.iRotation); }
/** * Handle resizing of the container. This implementation will lay out * full-sized controls like list boxes for any screen size, and will layout * labels, editors, etc. to the size they were given in the UI designer. * This code will need to be modified to adjust arbitrary controls to * any screen size. */ void CCalendarManagerContainer::SizeChanged() { CCoeControl::SizeChanged(); LayoutControls(); // [[[ begin generated region: do not modify [Generated Contents] // ]]] end generated region [Generated Contents] if (g_BgContext) { g_BgContext->SetRect(Rect()); if (&Window()) { g_BgContext->SetParentPos(PositionRelativeToScreen()); } } DrawNow(); }
/* ----------------------------------------------------------------------------- Y-Browser will call setsize for client rect when lay-out or size changes, This will be then called by the framework ----------------------------------------------------------------------------- */ void CCrashContainer::SizeChanged() { if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } DisplayListBoxL(); if(iMyHelpContainer) { iMyHelpContainer->SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect()); // Sets rectangle of lstbox. } }
void CTTGPSLoggerViewerContainer::SizeChanged() { //iEdwin->SetExtentToWholeScreen(); TRect rect = Rect(); if (iBgContext) { //iBgContext->SetBitmap(KAknsIIDQsnBgScreen); iBgContext->SetRect(rect); if (&Window()) { iBgContext->SetParentPos(PositionRelativeToScreen()); } } if (iEdwin->ScrollBarFrame()) { rect.SetWidth(rect.Width() - iEdwin->ScrollBarFrame()->VerticalScrollBar()->ScrollBarBreadth()); iEdwin->SetRect(rect); } }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CProfileSettings::SizeChanged() { if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } if(iListBox) { iListBox->SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect()); } else { MakeListboxL(-1); } DrawNow(); }
/* ----------------------------------------------------------------------------- Y-Browser will call setsize for client rect when lay-out or size changes, This will be then called by the framework ----------------------------------------------------------------------------- */ void CTraceContainer::SizeChanged() { if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } if(iProfileSettings) { iProfileSettings->SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect()); } //set rects... TRect ThisRect(Rect()); ThisRect.Shrink(4,4); TInt HeightMe = (ThisRect.Height() / 2); if(iMemControl) { iMemControl->SetRect(TRect(ThisRect.iTl.iX,ThisRect.iTl.iY,ThisRect.iBr.iX,(ThisRect.iTl.iY + (HeightMe - 1)))); } if(iCPUControl) { iCPUControl->SetRect(TRect(ThisRect.iTl.iX,(ThisRect.iTl.iY + (HeightMe + 1)),ThisRect.iBr.iX,ThisRect.iBr.iY)); } if(iMyHelpContainer) { iMyHelpContainer->SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect()); } }
void CEditorContainer::SizeChanged() { TRect rect = Rect(); if (iBgContext) { iBgContext->SetRect(Rect()); if (&Window()) { iBgContext->SetParentPos(PositionRelativeToScreen()); } } if (iEditor) { /*#ifdef __SERIES60_3X__ TRect ScrollBarRect = iEditor->ScrollBarFrame()-> VerticalScrollBar()->Rect(); iEditor->SetExtent(TPoint(0,StatusLineHeight), TSize(rect.Width()-ScrollBarRect.Width(), rect.Height()-StatusLineHeight)); #else*/ iEditor->SetExtent(TPoint(0, 0), TSize(rect.Width(), rect.Height())); // #endif } }
// ----------------------------------------------------------------------------- // CAafAppCameraView::SizeChanged() // Called by framework when the view size is changed. // ----------------------------------------------------------------------------- // void CAafAppCameraView::SizeChanged() { __LOGSTR_TOFILE("CAafAppCameraView::SizeChanged() begins"); #if USE_SKIN_SUPPORT if(iBgContext) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } #endif if ( iContainer ) { CAafAppUi* appUi = (CAafAppUi*)iCoeEnv->AppUi(); iContainer->SetRect( appUi->ClientRect() ); } __LOGSTR_TOFILE("CAafAppCameraView::SizeChanged() ends"); }
/* ----------------------------------------------------------------------- // iRightButton->SetTextAndIconAlignment( CAknButton::EIconBeforeText ); // iRightButton->SetTextHorizontalAlignment( CGraphicsContext::ECenter ); ----------------------------------------------------------------------- */ void CPlayContainer::ConstructL(const TRect& aRect) { CreateWindowL(); /* _LIT(KRecFilename ,"C:\\CallUI_Test.txt"); CCoeEnv::Static()->FsSession().Delete(KRecFilename); iDebugFile.Create(CCoeEnv::Static()->FsSession(),KRecFilename,EFileWrite|EFileShareAny); if(iDebugFile.SubSessionHandle()) { iDebugFile.Write(_L8("started\n\r")); } */ iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMainIdle,TRect(0,0,1,1), ETrue); CheckNormalSettingsL(); iMirroRed = AknLayoutUtils::LayoutMirrored(); SetRect(aRect); #ifdef __S60_50__ TFontSpec spec2 = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont)->FontSpecInTwips(); spec2.iHeight = ((spec2.iHeight * 95) / 100); CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iTextFont, spec2); TFontSpec spec = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont)->FontSpecInTwips(); spec.iHeight = ((spec.iHeight * 90) / 100); CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iButtonFont, spec); TBuf<60> hjelpper; StringLoader::Load(hjelpper,R_SH_STR_ANSWER); iLeftButton = CAknButton::NewL(NULL,NULL,NULL,NULL,hjelpper,_L(""),0,0); iLeftButton->SetContainerWindowL(*this); if(iMirroRed){ iLeftButton->SetRect(iRightBtOut); }else{ iLeftButton->SetRect(iLeftBtOut); } iLeftButton->SetObserver(this); iLeftButton->SetIconScaleMode( EAspectRatioPreserved ); CGulIcon* lefticcon = GetButtonIconL(KAknsIIDQgnIndiButtonAnswer,TSize(50,50)); CAknButtonState* state = iLeftButton->State(iLeftButton->StateIndex()); state->SetIcon(lefticcon); iLeftButton->SetTextFont(iButtonFont); iLeftButton->SetTextAndIconAlignment( CAknButton::EIconOverText ); iLeftButton->SetTextHorizontalAlignment( CGraphicsContext::ECenter ); iLeftButton->MakeVisible(ETrue); iLeftButton->ActivateL(); StringLoader::Load(hjelpper,R_SH_STR_SILENSE); iRightButton = CAknButton::NewL(NULL,NULL,NULL,NULL,hjelpper,_L(""),0,0);//KAknButtonStateHasLatchedFrame iRightButton->SetContainerWindowL(*this); if(iMirroRed){ iRightButton->SetRect(iLeftBtOut); }else{ iRightButton->SetRect(iRightBtOut); } iRightButton->SetObserver(this); CGulIcon* righticcon = GetButtonIconL(KAknsIIDQgnIndiButtonSilence,TSize(50,50)); CAknButtonState* state2 = iRightButton->State(iRightButton->StateIndex()); state2->SetIcon(righticcon); iRightButton->SetIconScaleMode( EAspectRatioPreserved ); iRightButton->SetTextFont(iButtonFont); iRightButton->SetTextAndIconAlignment( CAknButton::EIconOverText ); iRightButton->SetTextHorizontalAlignment( CGraphicsContext::ECenter ); iRightButton->MakeVisible(ETrue); iRightButton->ActivateL(); TFindFile PrivFolder(CCoeEnv::Static()->FsSession()); if(KErrNone == PrivFolder.FindByDir(KMyIconFile, KNullDesC))// finds the drive { iBluePhone = GetPhoneIconL(PrivFolder.File(),0,1,TSize(20,25)); } iGreenPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16384, 16385,TSize(50,50)); iYellowPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16396,16397,TSize(50,50)); #else if(!iTextFont){ TFontSpec spec2 = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont)->FontSpecInTwips(); spec2.iHeight = ((spec2.iHeight * 85) / 100); CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iTextFont, spec2); } if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } iGreenPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16384, 16385,TSize(40,40)); iYellowPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16396,16397,TSize(40,40)); #endif ActivateL(); CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane(); if(sp) { if(sp->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_IDLE)//R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE) { sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_IDLE); } } iGetOperatorName = CGetOperatorName::NewL(*this); //iHWRMLight = CHWRMLight::NewL(); iHWRMVibra = CHWRMVibra::NewL(this); if(iDebugFile.SubSessionHandle()) { iDebugFile.Write(_L8("And running\n\r")); } }