void CWsBackedUpWindow::Scroll(const TRect &aClipRect, const TPoint &aOffset,const TRect &aRect)
	{
	TRect winBorder=TRect(iWsWin->Size());
	TRect clipRect=aClipRect;
	TRect srcRect = aRect;		
	clipRect.Intersection(winBorder);	
	if (!clipRect.IsEmpty())
		{	// If we have to do something (a visible part will change)
		srcRect.Intersection(clipRect);

		STACK_REGION regionToClear;
		regionToClear.AddRect(aRect);
		regionToClear.SubRect(srcRect);
		regionToClear.Offset(aOffset);
		
		ActivateGc();
		iBitGc->SetClippingRect(clipRect);
		iBitGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
		iBitGc->CopyRect(aOffset,srcRect);				
		for (TInt k=0;k<regionToClear.Count();k++)
			{
			iBitGc->Clear(regionToClear[k]);
			}
		iBitGc->SetClippingRect(winBorder);
		iBitGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
		TRegionFix<1> fixRegion(iWsWin->AbsRect());
		UpdateScreen(fixRegion);
		regionToClear.Close();
		}
	}
void CWsBackedUpWindow::Resize(const TSize &aSize, const TSize &aOldSize)
	{
	ActivateGc();
	iBitGc->SetClippingRegion(NULL);
	iBitGc->Clear(TRect(aOldSize.iWidth, 0, aSize.iWidth, aOldSize.iHeight));
	iBitGc->Clear(TRect(0, aOldSize.iHeight,aSize.iWidth, aSize.iHeight));
	
	static_cast<CWsClientWindow *>(iWsWin)->ReactivateGcs();
	
	if(Screen()->ChangeTracking())
		{
		//Keep track of the region we need to refresh when we recieve draw commands
		iCurrentRegion.Reset();
		iCurrentRegion.Copy(iWsWin->WindowArea());
		iCurrentRegion.Offset(-iWsWin->Origin());
		iCurrentRegion.Tidy();
		if(iCurrentRegion.CheckError())
			{
			iCurrentRegion.Reset();
			TRegionFix<1> fallback(iWsWin->AbsRect());
			iCurrentRegion.Copy(fallback); 
			iCurrentRegion.Offset(-iWsWin->Origin());
			}
		
		//If the window has nerver been drawn to screen, we now schedule the initial draw. This can't
		//be done in ConstructL because BackedUpWindows are created with size(0,0). And we can't check
		//iWsWin->IsActive() because the client might activate the window before giving it a size.
		if (!iHasBeenScheduled)
			{
			iHasBeenScheduled = ETrue;
			MarkDirtyAndSchedule(iCurrentRegion);
			}
		}
	}
Exemple #3
0
void CContainer3::InitiateDraw() const
{
	Window().Invalidate();
	ActivateGc();
	Window().BeginRedraw();

	DrawRequiredControls();

	Window().EndRedraw();
	DeactivateGc();
}
void CWsBackedUpWindow::ConstructL()
	{
	iDisplayMode=iWsWin->SetRequiredDisplayModeL(iDisplayMode);
	TSize size=iWsWin->Size();
	iBitmap=new(ELeave) CFbsBitmap();
	User::LeaveIfError(iBitmap->Create(size, iDisplayMode));
	iBitmapDevice=CFbsBitmapDevice::NewL(iBitmap);
	SetSizeInTwips();
//
	ActivateGc();
	iBitGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
	iBitGc->Clear(TRect(size));
	iBitGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
	WS_ASSERT_DEBUG(iWsWin->WinType()==EWinTypeClient,EWsPanicWindowType);
	}
	virtual void StepDone() {
		++iDone;
		CWindowGc& gc = SystemGc();
		ActivateGc();

		TRgb front(216, 214, 214);
		TRect progress( TPoint(progress_left, progress_top), TSize(progress_width, progress_height) );
		progress.SetSize( TSize( progress_width * iDone/iSteps, progress_height ) );
		gc.SetPenStyle(CGraphicsContext::ENullPen);
		gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		gc.SetBrushColor(front);
		progress.SetSize( TSize( progress_width * iDone/iSteps, progress_height ) );
		gc.DrawRect(progress);
		iEikonEnv->Flush();
		DeactivateGc();
	}
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
}
// -----------------------------------------------------------------------------
// CTestTitlePaneControl::DoActivateGc
// -----------------------------------------------------------------------------
//
void CTestTitlePaneControl::DoActivateGc()
    {
    ActivateGc();
    }
// -----------------------------------------------------------------------------
// CTestDOMGridsContainer::DoActivateGc
// -----------------------------------------------------------------------------
//
void CTestDOMGridsContainer::DoActivateGc()
    {
    ActivateGc();
    }
void CSysApShutdownImage::ShowShutdownImageL(TInt aBitmapId)
    {
    TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL:start" ) ) );
    
    TInt err ( 0 );
    TRect rect(iCoeEnv->ScreenDevice()->SizeInPixels());
    SetRect(rect);
    TRACES( RDebug::Print(_L("CSysApShutdownImage::After:SetRect --Minus one" ) ) );
    ActivateL();

    TRACES( RDebug::Print(_L("CSysApShutdownImage::After:ActivateL --Zero" ) ) );

    if ( aBitmapId )
        {
        _LIT( KDirAndFile, "z:qgn_sysap_screen.svg" );
        TParse* fp = new (ELeave) TParse();
        CleanupStack::PushL(fp);
        fp->Set( KDirAndFile, &KDC_APP_BITMAP_DIR, NULL );
        TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL shutdown image: %S" ), &(fp->FullName())) );
        RFs fs;

        err = fs.Connect();
        if ( err == KErrNone )
            {
            CleanupClosePushL(fs);
            TFindFile findFile( fs );
            err = findFile.FindByPath( fp->FullName(), NULL );

            if ( err != KErrNone )
                {
                TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL: shutdown image not found, err=%d"), err ) );
                }
            else
                {
                delete iBitmap;
                iBitmap = NULL;
                // Ownership of bitmap is transferred to CSysApShutdownImage in CreateIconL
                iBitmap = ReadSVGL(fp->FullName());
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:ReadSVGL --First" ) ) );
                TInt xDelta=0; // for x coordinates
                TInt yDelta=0; // for y coordinates
                TSize bmpSizeInPixels = iBitmap->SizeInPixels();
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:SizeInPixels --Second" ) ) );
                //center image to the center of the screen
                TRect rect = Rect();
                xDelta=( rect.Width() - bmpSizeInPixels.iWidth ) / 2;
                yDelta=( rect.Height() - bmpSizeInPixels.iHeight ) / 2;
                TPoint pos = TPoint( xDelta , yDelta ); // displacement vector
                //pos += rect.iTl; // bitmap top left corner position
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:TPoint --Three" ) ) );
                CWindowGc& gc = SystemGc();
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:SystemGc --Four" ) ) );
                ActivateGc();
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:ActivateGc --Five" ) ) );
                Window().Invalidate( rect );
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:Invalidate --Six" ) ) );
                Window().BeginRedraw( rect );
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:BeginRedraw --Seven" ) ) );
                gc.Clear();
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.Clear --Eight" ) ) );
                gc.BitBlt( pos, iBitmap ); // CWindowGc member function
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.BitBlt --Nine" ) ) );
                Window().EndRedraw();
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.EndRedraw --Ten" ) ) );
                DeactivateGc();
                TRACES( RDebug::Print(_L("CSysApShutdownImage::After:gc.DeactivateGc --Eleven" ) ) );
                ControlEnv()->WsSession().Flush(); // force draw of the context
                TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL:end" ) ) );
                }
            }

        CleanupStack::PopAndDestroy(2); //fp, fs
        }
    else
        {
#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
        DrawDeferred();
#else // RD_STARTUP_ANIMATION_CUSTOMIZATION
        TRACES( RDebug::Print(_L("CSysApShutdownImage::ShowShutdownImageL - Bitmap not defined, blank screen only" ) ) );
        CWindowGc& gc = SystemGc();
        ActivateGc();
        Window().Invalidate();
        Window().BeginRedraw();
        gc.SetBrushColor(KRgbWhite);
        gc.Clear();
        Window().EndRedraw();
        DeactivateGc();
        ControlEnv()->WsSession().Flush(); // force draw of the context
#endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
        }
    }
// -----------------------------------------------------------------------------
// CTestSettingPage::DoActivateGc
// -----------------------------------------------------------------------------
//
void CTestSettingPage::DoActivateGc() const
    {
    ActivateGc();
    }
// -----------------------------------------------------------------------------
// CTestParentControl::DoActivateGc
// -----------------------------------------------------------------------------
//
void CTestParentControl::DoActivateGc()
    {
    ActivateGc();
    }
// -----------------------------------------------------------------------------
// CTestDOMListsEffectsContainer::DoActivateGc
// -----------------------------------------------------------------------------
//
void CTestDOMListsEffectsContainer::DoActivateGc()
    {
    ActivateGc();
    }
// -----------------------------------------------------------------------------
// CTestTextScrollerContainer::DoActivateGc
// -----------------------------------------------------------------------------
//
void CTestTextScrollerContainer::DoActivateGc()
    {
    ActivateGc();
    }
// -----------------------------------------------------------------------------
// CAknPopupFormExt::DoActivateGc
// -----------------------------------------------------------------------------
//
void CAknPopupFormExt::DoActivateGc()
    {
    ActivateGc();
    }