// -----------------------------------------------------------------------------
// CAafAppFileBrowserView::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CAafAppFileBrowserView::SizeChanged()
{  
	if (iListBox)
	{/*
	 CAafAppUi* appUi = (CAafAppUi*)iCoeEnv->AppUi();
	 TRect clientRect(appUi->ClientRect());

	 iListBox->SetRect(clientRect);
	 iListBox->DrawNow();
	 */
		TRect clientRect = Rect();
		iListBox->SetExtent(TPoint(0, 0), clientRect.Size()); // Set rectangle
		iListBox->DrawNow();
	}
}
CAircraft* CUSSVictory::CreateNewAircraft()
{
	CDauntless* lDauntless = CDauntless::New(false, TIntFloat::Convert(0), true, TPoint(0, 0));//position does matter since we reposition it anyway
	TPoint lCurrentPosition = GetCurrentPositionNormilized();
	//need to adjust it to be on the landing surface to the landing surface
	lCurrentPosition.iY += USS_VICTORY_LANDING_SURFACE_HEIGHT;
	lCurrentPosition.iY += USS_VICTORY_LANDING_SURFACE_HEIGHT_OFF_SET;
	if(iObjectReflected)
		lCurrentPosition.iX -= USS_VICTORY_AIRPLANE_POSITION_X_OFFSET;
	else
		lCurrentPosition.iX += USS_VICTORY_AIRPLANE_POSITION_X_OFFSET;
	lDauntless->SetPosition(lCurrentPosition);
	CFighterPilotThePacificWar::FighterGame->iGameData->GetMap()->GetObjectManager()->AddMoveableGameObject(lDauntless);
	return lDauntless;//all done
}
Пример #3
0
/**
Ensure the text-drawer is propagated from the super-container, 
via the sub-container to the component control	
test case PREQ641.2
*/
TBool CCone7TestAppUi::TestTextDrawer_2L()
	{
	CCtlSuperContainer641* testSuperContainer = new (ELeave)CCtlSuperContainer641;
	CleanupStack::PushL(testSuperContainer);
	testSuperContainer->ConstructL( _L("SuperContainer") );
	testSuperContainer->SetExtent( TPoint(20,20),TSize(600,200) );			
	testSuperContainer->ActivateL();
	testSuperContainer->DrawNow();
	
	const TInt err = testSuperContainer->iSubContainer->iContainee->TestContainerTextDrawer();
	User::After( TTimeIntervalMicroSeconds32(2000000) );
	
	CleanupStack::PopAndDestroy(testSuperContainer);
	return err;
	}
Пример #4
0
/**
 * Tries to hide the specified control. The control will be hidden, if it doesn't
 * fit to the specified clipping rectangle. Checks if the control exists.
 *
 * @return How many subcontrols were hidden
 */
static TInt HideLines_Ctrl(CCoeControl *aControl, TRect aClipRect)
{
    if ( !aControl )
        return 1;   // It doesn't exist and hence not visible
    TRect rect( aControl->Rect() );
    if ( !aClipRect.Contains(rect.iTl) || aClipRect.iBr.iY <= rect.iBr.iY )
        // Never use TRect::Contains() for checking the bottom right corner, see documentation
    {
        // hide it
        aControl->SetPosition( TPoint(-666,-666) );
        return 1;
    }
    else
        return 0;
}
TInt CAnimationTestStep::CountColorsL(const TRect& aRect, TInt aMin, TInt aMax)
	{
	TDisplayMode displayMode = iScreen->DisplayMode();
	TInt width = CFbsBitmap::ScanLineLength(aRect.Width(),displayMode);
	HBufC8* buf=HBufC8::NewMaxLC(width);
	TPtr8 ptr=buf->Des();
	iColors.Reset();
	TInt inc = width/aRect.Width();
	for (TInt row = aRect.iTl.iY; row < aRect.iBr.iY; ++row)
		{
		ptr.SetLength(0);
		iScreen->GetScanLine(ptr,TPoint(aRect.iTl.iX,row),aRect.Width(),displayMode);
		for (TInt col = 0; col < ptr.Length(); col+=inc)
			{
			TUint clr = ptr[col];
			// Pixel buffer represented in block of bytes, if color mode is 8bpp (1byte) we can
			// simply access the buffer sequentially eg clr = ptr[col], however if the color mode
			// is 16bpp or more, access must be adjusted accordingly. 
			// The "inc" variable indicates how many bytes each pixel's colour takes
			// and could be any value from 1 to 4 depending on the color mode.
			for (TInt byteNumber = 1; byteNumber < inc; byteNumber++)
				{
				clr = clr << 8;
				clr += ptr[col + byteNumber];
				}
			if (iColors.Find(clr) == KErrNotFound)
				{
				iColors.Append(clr);
				}
			}
		}
	TInt count = iColors.Count();
	CleanupStack::PopAndDestroy(buf);
	
	if (count < aMin)
		{
		return (count - aMin);	// This is a good place for a break point
		}
	else if (count > aMax)
		{
		return (count - aMax);	// This is a good place for a break point
		}
	else
		{
		return 0;
		}
	
	}
Пример #6
0
/**
This text case will verify that vertical text drawing of XCoeTextDrawer class is correct and 
consistent with horizontal drawing of the same alignment. Clip area will also be set to check that 
drawing will not happen outside this area. The text will consist of a few lines.

defect INC122592  
Visual verification is required.
*/
TBool CCone7TestAppUi::TestTextDrawer_5L()
	{
	CCtlTestTextDrawer* testTextDrawer = new(ELeave) CCtlTestTextDrawer();
	CleanupStack::PushL(testTextDrawer);
	testTextDrawer->ConstructL();
	testTextDrawer->SetExtent(TPoint(20,20),TSize(600,200));
	testTextDrawer->ActivateL();
	testTextDrawer->DrawNow();
	
	const TInt noOfLines = TCoeTextTypeAdaptor(KMultipleLineText1).NumberOfLines();

	TOpenFontFaceAttrib openFontFaceAttrib;
	((CFbsFont&)(testTextDrawer->FontUsed())).GetFaceAttrib(openFontFaceAttrib);
	TBuf<25> buf(openFontFaceAttrib.FullName());
	INFO_PRINTF2(_L("CCtlTestTextDrawer : Typeface being used is %S"), &buf);
	
	//testing with clip area
	TRect clipRect = testTextDrawer->Rect();
	clipRect.Shrink(40, 40);
	TRgb nonClippedText = KRgbRed;
	
	//drawing vertical text, up direction
	for(TInt testIndex = 0; testIndex <= 8; testIndex++)
		{
		testTextDrawer->TestTextDrawer(testIndex, ETrue, NULL, &nonClippedText);
		testTextDrawer->TestTextDrawer(testIndex, ETrue, &clipRect, NULL, EFalse);
		User::After( TTimeIntervalMicroSeconds32(1000000) );

		testTextDrawer->TestTextDrawer(testIndex, EFalse, NULL, &nonClippedText);
		testTextDrawer->TestTextDrawer(testIndex, EFalse, &clipRect, NULL, EFalse);
		User::After( TTimeIntervalMicroSeconds32(1000000) );
		}

	//drawing vertical text, up direction
	for(TInt testIndex = 0; testIndex <= 8; testIndex++)
		{
		testTextDrawer->TestTextDrawer(testIndex, ETrue, NULL, &nonClippedText);
		testTextDrawer->TestTextDrawer(testIndex, ETrue, &clipRect, NULL, EFalse);
		User::After( TTimeIntervalMicroSeconds32(1000000) );

		testTextDrawer->TestTextDrawer(testIndex, EFalse, NULL,     &nonClippedText, ETrue, EFalse);
		testTextDrawer->TestTextDrawer(testIndex, EFalse, &clipRect, NULL,         EFalse, EFalse);
		User::After( TTimeIntervalMicroSeconds32(1000000) );
		}
	
	CleanupStack::PopAndDestroy(testTextDrawer);		
	return ETrue;
	}
Пример #7
0
void CPrimaryColoursWin::Draw()
	{
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	iGc->SetPenStyle(CGraphicsContext::ESolidPen);
	iGc->SetPenColor(TRgb(255, 255, 255));
	iGc->SetBrushColor(TRgb(0, 0, 0));
	TSize winSize = Size();
	iGc->DrawRect(TRect(winSize));
	
	CFont* font;
	TFontSpec fontSpec(_L(""), 300);
	TheClient->iScreen->GetNearestFontInTwips(font, fontSpec);
	
	if (font)
		{
		iGc->UseFont(font);
		TRect r(TPoint(0, 0), Size());
		r.Shrink(kMinHeight, kMinHeight);
		iGc->DrawText(iDisplayText, r, font->AscentInPixels(), iGc->ECenter, 0);
		iGc->DiscardFont();
		TheClient->iScreen->ReleaseFont(font);
		}
	
	iNumColours = 0;
	TPoint lhsAbs = Win()->AbsPosition();
	
	for(TInt channelnum = 0, channelmul = 1, xoordinate = kPlotMargin; channelnum < KNumChannels; channelnum++, channelmul <<= 8, xoordinate += kPlotWithMargin)
		{
		TRgb lastPixel(255, 255, 255, 255);
		
		for(TInt colour = 0; colour < KNumColours; colour++)
			{
			if(!iBadPixels[channelnum][colour])
				{
				iGc->SetPenColor(TRgb(colour * channelmul));				
				}
			else
				{
				iGc->SetPenColor(TRgb(255, 255, 255));			
				}

			TPoint point = TPoint(xoordinate + (colour & 0x0f), kPlotMargin + (colour >> 4));
			iGc->Plot(point);
			}
		}
		
	iDrawn=ETrue;
	}
Пример #8
0
void CEdgedWin::SetSize(const TSize & aSize)
	{
	CCompWin::SetSize(aSize);

	iOpaqueRect.iTl.iX = 10;
	iOpaqueRect.iTl.iY = 10;
	iOpaqueRect.iBr.iX = iSize.iWidth - 10;
	iOpaqueRect.iBr.iY = iSize.iHeight - 10;
	if (iTransparent)
		{
		iTransparentRegion.Clear();
		iTransparentRegion.AddRect(TRect(TPoint(0,0), iSize));
		iTransparentRegion.SubRect(iOpaqueRect);
		iRedrawWindow->SetTransparentRegion(iTransparentRegion); //TRANSPARENCY must be defined in wsini.ini
		}
	}
Пример #9
0
//---------------------------------------------------------------------------
void __fastcall TEditorForm::GoToLine()
{
  UnicodeString Str;
  if (InputDialog(LoadStr(EDITOR_GO_TO_LINE), LoadStr(EDITOR_LINE_NUMBER), Str))
  {
    int Line = StrToIntDef(Str, -1);
    if (Line <= 0 || Line > EditorMemo->Lines->Count)
    {
      throw Exception(MainInstructions(LoadStr(EDITOR_INVALID_LINE)));
    }
    else
    {
      EditorMemo->CaretPos = TPoint(0, Line-1);
    }
  }
}
Пример #10
0
void CTKRepeat::ConstructL()
{
    TheClient->iWs.SetFocusScreen(iTest->iScreenNumber);
    iWin=new(ELeave) CRKWindow(this);
    TSize screenSize=Client()->iGroup->Size();
    iWin->SetUpL(TPoint(5,5),TSize(Min(Max(screenSize.iWidth/2,250),screenSize.iWidth-10),screenSize.iHeight-10),Client()->iGroup,*Client()->iGc);
    Client()->iGroup->WinTreeNode()->SetOrdinalPosition(0);
    Client()->iGroup->SetCurrentWindow(iWin);
    Client()->iWs.GetKeyboardRepeatRate(iOldInitialTime, iOldTime);
    iTest->SimulateKeyDownUp(EStdKeyLeftCtrl);
    iTest->SimulateKeyDownUp(EStdKeyRightCtrl);
    TInt mods=Client()->iWs.GetModifierState();
    TheClient->WaitForRedrawsToFinish();		//Let all pending events be processed before test begins
    _LIT(KLog,"Initial Modifiers state 0x%x (ideally should be zero)");
    LOG_MESSAGE2(KLog,mods);
}
QRect S60VideoWidgetDisplay::extentRect() const
{
    QRect rect;
    if (const RWindow *window = windowHandle()) {
        const TSize size = window ? window->Size() : TSize();
        if (m_explicitExtentRect.isValid())
            rect = m_explicitExtentRect;
        else
            rect = QRect(0, 0, size.iWidth, size.iHeight);
#ifndef VIDEOOUTPUT_GRAPHICS_SURFACES
        const TPoint pos = window ? window->AbsPosition() : TPoint();
        rect.moveTopLeft(QPoint(pos.iX, pos.iY));
#endif
    }
    return rect;
}
Пример #12
0
/*
 * shows the pointer sprite by constructing a native handle, and registering
 * it with the window server.
 * Only used when the sprite workaround is in use.
 */
void qt_symbian_show_pointer_sprite()
{
    if (cursorSprite.d) {
        if (cursorSprite.d->scurs.WsHandle())
            cursorSprite.d->scurs.Close();
    } else {
        cursorSprite = QCursor(Qt::ArrowCursor);
    }

    cursorSprite.d->scurs = RWsSprite(S60->wsSession());
    QPoint pos = QCursor::pos();
    cursorSprite.d->scurs.Construct(S60->windowGroup(), TPoint(pos.x(), pos.y()), ESpriteNoChildClip | ESpriteNoShadows);

    cursorSprite.d->constructCursorSprite(cursorSprite.d->scurs);
    cursorSprite.d->scurs.Activate();
}
	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();
	}
Пример #14
0
//
/// Constructs a TCelArray from a device independent bitmap (DIB) by slicing the DIB
/// into a horizontal array of evenly sized cels. If numRows is 0, the number of
/// rows is calculated using the bitmap height and the celSize y parameter.
//
TCelArray::TCelArray(const TDib& dib, int numCels, int numRows)
{
  NGrowBy = 1;
  NCels = NCelsUsed = std::max(1, numCels);
  NRows  = std::max(1, numRows);
  CSize = TSize(dib.Width() / NCels, dib.Height() / NRows);
  NCurRow = 0;
  Offs = TPoint(0, 0);
  ShouldDelete = true;

  TPalette palette((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
  Bitmap = new TBitmap(dib, &palette);

  TRACEX(OwlGadget, OWL_CDLEVEL, "TCelArray constructed @" << (void*)this <<
    " from slicing the dib @" << (void*)&dib);
}
void CEglTest_TestStep_StressLoad::LoadGpuProcessorL()
    {
    CSurface  *surface = CSurface::SurfaceFactoryL(ESurfTypeEglWindow);
    CleanupStack::PushL(surface);
    surface->CreateL(EStandard128sqSurface, TPoint(128, 128));
    TRgb bg = TRgb(0x55, 0x88, 0xff);   // Cyan/turqoise-ish.  
    TRgb fg = TRgb(0xff, 0x11, 0x22);   // Red (sort of)
    while(!__e32_atomic_load_acq32(&iStopThreadFlag[EThreadLoadGpuProcessor])) 
        {
            surface->DrawContentL(bg);
            surface->DrawComplexL(fg);
            surface->SubmitContent(ETrue);
        }
    CleanupStack::PopAndDestroy(surface);
    eglReleaseThread();
    }
	virtual void Draw(const TRect& aRect) const {
		TRgb back(127, 120, 120);
		TRgb front(216, 214, 214);
		CWindowGc& gc = SystemGc();
		gc.DrawBitmap(Rect(), iBitmap);

		gc.SetPenStyle(CGraphicsContext::ENullPen);
		gc.SetBrushColor(back);
		gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		TRect progress( TPoint(progress_left, progress_top), TSize(progress_width, progress_height) );
		gc.DrawRect(progress);

		progress.SetSize( TSize( progress_width * iDone/iSteps, progress_height ) );
		gc.SetBrushColor(front);
		gc.DrawRect(progress);
	}
Пример #17
0
void CTap2MenuAppUi::CopyBitmapL(CFbsBitmap *aSource, CFbsBitmap *aTarget)
	{
	if(aSource != NULL && aTarget != NULL)
		{
		if(aSource->SizeInPixels() != aTarget->SizeInPixels() || aSource->DisplayMode() != aTarget->DisplayMode())
			{User::Leave(KErrArgument);}
		CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(aTarget);
		CleanupStack::PushL(device);
		CFbsBitGc* gc = NULL;
		User::LeaveIfError(device->CreateContext(gc));
		CleanupStack::PushL(gc);
		gc->BitBlt(TPoint(0, 0), aSource);
		CleanupStack::PopAndDestroy(gc);
		CleanupStack::PopAndDestroy(device);
		}
	}
Пример #18
0
/**
 * @brief Completes the second phase of Symbian object construction. 
 * Put initialization code that could leave here. 
 */ 
void CTap2MenuAppUi::ConstructL()
	{
	// [[[ begin generated region: do not modify [Generated Contents]
	ReadSettings();
	ReadExceptions();
	BaseConstructL( EAknEnableSkin  | 
					 EAknEnableMSK ); 
	InitializeContainersL();
	// ]]] end generated region [Generated Contents]
	
	iWinGroup=new (ELeave) RWindowGroup(CEikonEnv::Static()->WsSession());
	iWinGroup->Construct((TUint32)&iWinGroup, EFalse);
	iWinGroup->EnableReceiptOfFocus(EFalse); // Don't capture any key events.
	iWinGroup->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
	
	CApaWindowGroupName* wn=CApaWindowGroupName::NewL(CEikonEnv::Static()->WsSession());
	wn->SetHidden(ETrue);
	wn->SetSystem(ETrue);
	wn->SetWindowGroupName(*iWinGroup);
	delete wn;
	iButton=CContainerButton::NewL(iWinGroup);
	iButton->SetSize(TSize(iSettings[4],iSettings[4]));
	iButton->SetPosition(TPoint(iSettings[0],iSettings[1]));
	iButton->MakeVisible(ETrue);
	CGulIcon* icon;
	const TUid KMenuUid=TUid::Uid(0x101f4cd2);
	TRAPD(erreasy,icon=LoadAppIconEasy(KMenuUid));
	if (erreasy==KErrNotFound)
		{
		CFbsBitmap*	AppIcon(NULL);
		CFbsBitmap*	AppIconMsk(NULL);
		AknIconUtils::CreateIconL(AppIcon,AppIconMsk,_L("\\resource\\apps\\Tap2Menu_aif.mif"), EMbmTap2menu_aifQgn_menu_tap2menu, EMbmTap2menu_aifQgn_menu_tap2menu_mask);
		AknIconUtils::SetSize(AppIcon,TSize(iSettings[4],iSettings[4]));
		AknIconUtils::SetSize(AppIconMsk,TSize(iSettings[4],iSettings[4]));
		icon=CGulIcon::NewL(AppIcon,AppIconMsk);
		}
	else if (erreasy!=KErrNone){TRAPD(errhard,icon=LoadAppIconHard(KMenuUid));}
	iButton->SetIcon(icon);
	iButton->MakeVisible(ETrue);
	iButton->DrawNow();
	iWsSession=new (ELeave) RWsSession();
	iWsSession->Connect();
	UpdateSettings();
	iObserver=CFgrObserver::NewL(*iWsSession,*this);
	CEikonEnv::Static()->RootWin().SetOrdinalPosition(-4);
	HideApplicationFromFSW(ETrue);
	}
Пример #19
0
void CButton::Message(TDes& aText,TInt aInterval)
	{
	const TInt KBetween=10;
	const TInt KFontSize = 120;
	_LIT(KFontName, "Nokia Hindi S60");
	
	CFont* font;
	TTypefaceSupport iTypefaceSupport;
	TBuf<KMaxTypefaceNameLength> fontName;
	fontName.FillZ(KMaxTypefaceNameLength);
	CEikonEnv::Static()->ScreenDevice()->TypefaceSupport(iTypefaceSupport, 0);
	fontName = iTypefaceSupport.iTypeface.iName;
		
	TFontSpec fontSpec(fontName, KFontSize);
	CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(font, fontSpec);
	TInt maxW;
	TInt scrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth;
	TInt scrY=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iHeight;
	
	iLabel->SetFont(font);
	
	TInt w=iLabel->Font()->TextWidthInPixels(aText);
	TInt h=iLabel->Font()->HeightInPixels();
	TInt posX=iButton->Position().iX+(iButton->Size().iWidth/2)-(w/2);
	TInt posY=0;
	if (iButton->Position().iY>scrY/2)
		{posY=iButton->Position().iY-h-KBetween;} //bottom
	else {posY=iButton->Position().iY+iButton->Size().iHeight+KBetween;} //top 
	if (iButton->Position().iX<scrX/2)
			{maxW=2*(iButton->Position().iX+(iButton->Size().iWidth/2));} //left
		else {maxW=2*((scrX-(iButton->Position().iX+iButton->Size().iWidth))-(iButton->Size().iWidth/2));} //right
	TRgb themecolor;
	MAknsSkinInstance* skin=AknsUtils::SkinInstance();
	AknsUtils::GetCachedColor(skin,themecolor,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6 );
	iLabel->SetBrushStyle(CGraphicsContext::ESolidBrush);
	TRgb col=KRgbBlack;
	themecolor=KRgbWhite;
	iLabel->OverrideColorL(EColorControlBackground,col);
	iLabel->OverrideColorL(EColorLabelText,themecolor);
	iLabel->SetPosition(TPoint(posX,posY));
	iLabel->SetSize(TSize(w,h));
	iLabel->SetFont(font);
	iLabel->MakeVisible(ETrue);
	iLabel->SetTextL(aText);
	iLabel->DrawNow();
	iMsgTimer->Start(aInterval*1000,aInterval*1000,TCallBack(MsgTick,this));
	}
/**
Copy a source bitmap into a new bitmap with the specified display mode
*/
CFbsBitmap* CTe_graphicsperformanceSuiteStepBase::CopyIntoNewBitmapL(CFbsBitmap* aSrc, TDisplayMode aDisplayMode)
	{
	CFbsBitmap* dstBmp = new(ELeave) CFbsBitmap;
	CleanupStack::PushL(dstBmp);
	TInt ret=dstBmp->Create(aSrc->SizeInPixels(), aDisplayMode);
	User::LeaveIfError(ret);
	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(dstBmp);
	CleanupStack::PushL(bitmapDevice);
	CFbsBitGc* gc;
	ret = bitmapDevice->CreateContext(gc);
	User::LeaveIfError(ret);
	CleanupStack::PushL(gc);
	gc->BitBlt(TPoint(0,0), aSrc);
	CleanupStack::PopAndDestroy(2, bitmapDevice); // gc, bitmapDevice
	CleanupStack::Pop(dstBmp);
	return dstBmp;
	}
void CZXingBarcodeReaderAppView::Draw(const TRect& /*aRect*/) const
		{
	CWindowGc& gc = SystemGc ();

	// Draw backbuffer that has camera picture
	gc.BitBlt(TPoint(0, 0), iBackBuffer);

	// Draw texts
	DrawTexts(gc);

	// Focus rect
	if (iCameraWrapper && iCameraWrapper->State() == CCameraEngine::EEngineFocusing)
		{
	gc.SetPenColor(KRgbWhite);
	gc.DrawRect(iFocusRect);
		}
		}
Пример #22
0
void CRhodesAppView::ReDrawOffScreenBitmap()   
    {   
    iOffScreenBitmapCreated = ETrue;   
   
    iFbsBitGc->SetBrushColor( AKN_LAF_COLOR( KWhiteColor ) );   
    iFbsBitGc->Clear();   
   
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();   
    CFbsBitmap* bitmap = AknsUtils::GetCachedBitmap( skin,    
        KAknsIIDQsnBgAreaMain );   
    if ( bitmap )    
        {   
        iFbsBitGc->BitBlt( TPoint(0,0), bitmap );   
        }   
   
    DrawNow();  // clear screen    
    }
Пример #23
0
void CBgAnimHost::CreateWindowL()
    {
    iScreenDevice = new (ELeave) CWsScreenDevice(iWsSession);
    User::LeaveIfError(iScreenDevice->Construct(0));
    
    TPixelsAndRotation rot;
    TInt screenmode = iScreenDevice->CurrentScreenMode(); 
    iScreenDevice->GetScreenModeSizeAndRotation(screenmode, rot);
    if (rot.iRotation == CFbsBitGc::EGraphicsOrientationNormal)
        {
        iDisplaySize = rot.iPixelSize;
        }
    else
        {
        iDisplaySize.iWidth = rot.iPixelSize.iHeight;
        iDisplaySize.iHeight = rot.iPixelSize.iWidth;
        }
    
    iRealDisplaySize = iDisplaySize;
    iDisplaySize.iWidth/=2;
    iDisplaySize.iHeight/=2;
    
    iWindowGroup=RWindowGroup(iWsSession);
    User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup));
	iWindowGroup.SetOrdinalPosition(-1,-1000);
	
	iWindow=RWindow(iWsSession);
	User::LeaveIfError(iWindow.Construct(iWindowGroup, (TUint32)&iWindow));
	User::LeaveIfError(iWindow.SetExtentErr(TPoint(0,0),iDisplaySize));
    iWindow.SetVisible(ETrue);
	iWindow.Activate();

    iWindGroupName = CApaWindowGroupName::NewL(iWsSession, iWindowGroup.Identifier());

    TUid wgUid;
    wgUid.iUid = 0x200286D3;
    
    iWindGroupName->SetAppUid(wgUid);
    iWindGroupName->SetCaptionL(KExeCaption);
    iWindGroupName->SetHidden(ETrue);
    iWindGroupName->SetAppReady(ETrue);
    iWindGroupName->SetSystem(ETrue);
    iWindGroupName->SetWindowGroupName(iWindowGroup);

	iWsSession.Flush();
    }
Пример #24
0
void CVideoEntry::ScaleImageL( TInt aDstWidth, TInt aDstHeight )
	{
	iScaledBitmap = new (ELeave) CFbsBitmap;

	TBool scale = (aDstWidth != 0 && aDstHeight != 0);
	if( !scale )
		{
		aDstWidth = iBitmap->SizeInPixels().iWidth;
		aDstHeight = iBitmap->SizeInPixels().iHeight;
		}

	TSize size( aDstWidth, aDstHeight );
	iScaledBitmap->Create( size, EColor64K );
	
	UiItemGfx::BltIconScale( iScaledBitmap, iBitmap, size, TPoint(0,0) );

	}
void CImage::Draw(const TRect& aRect) const
{
   // Draw the parent control
   //CEikBorderedControl::Draw(aRect);
   // Get the standard graphics context 
   CWindowGc& gc = SystemGc();
   // Gets the control's extent - Don't encroach on the border
   TRect rect = Rect();//Border().InnerRect(Rect());
   // set the clipping region
   gc.SetClippingRect(rect);   
   if(iMask == NULL && iBitmap != NULL && rect.Intersects(aRect)){
      gc.BitBlt(rect.iTl, iBitmap);
   } else if(iMask != NULL && iBitmap != NULL && rect.Intersects(aRect)){
      TRect pictRect(TPoint(0,0), iBitmap->SizeInPixels());
      gc.BitBltMasked(rect.iTl, iBitmap, pictRect, iMask, EFalse);
   }
}
Пример #26
0
/*
 * Loads a single cursor shape from resources and appends it to a native sprite.
 * Animated cursors (e.g. the busy cursor) have multiple members.
 */
void QCursorData::loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval)
{
    QPixmap pix;
    CFbsBitmap* native;
    QScopedPointer<TSpriteMember> member(new TSpriteMember);
    member->iInterval = interval;
    member->iInvertMask = false;
    member->iMaskBitmap = 0; // all shapes are RGBA
    member->iDrawMode = CGraphicsContext::EDrawModePEN;
    member->iOffset = TPoint(-hx, -hy);
    QString res(QLatin1String(":/trolltech/symbian/cursors/images/%1.png"));
    pix.load(res.arg(resource));
    native = pix.toSymbianCFbsBitmap();
    member->iBitmap = native;
    qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data()));
    target.AppendMember(*(member.take()));
}
void CContentInfoDialog::InitScrollBar()
{
	DELETE(iScrollbar);
	if(iDesArray->Count()>iMaxLine)
	{
		iScrollbar = new (ELeave)CScrollBar;
		iScrollbar->DefaultLayout();
		iScrollbar->SetVerticalSpace(iBackRect.Height());
		iScrollbar->SetScrollWidth(3);
		iScrollbar->SetBeginPostion(iBackRect.iTl+TPoint(iBackRect.Width()-3,0));
		iScrollbar->SetCursorColor(KScrollSpaceColor);
		iScrollbar->SetBackgroundColor(KScrollBackgroundColor);
		iScrollbar->SetMaxLinePerPage(iMaxLine+iAllLine);
		iScrollbar->SetTotalLineNum(iAllLine+iDesArray->Count());
		iScrollbar->Layout();
	}
}
// Handle size changes. Set the contained controls extents. Called by framework
void CMessageListBox::SizeChanged()
{
    innerRect = Border().InnerRect(Rect());

    // Application Title rect. Fills the controls top area
    TSize titleSize(innerRect.Width(), iAppTitle->MinimumSize().iHeight);
    TRect titleRect(innerRect.iTl, titleSize);
    iAppTitle->SetRect(titleRect);

    // List box size and rect. Fills the remaining area
    TSize listBoxSize(innerRect.Width(), innerRect.Height() -
                      iAppTitle->MinimumSize().iHeight);
    TRect listBoxRect(TPoint(titleRect.iTl.iX, titleRect.iBr.iY+1),
                      listBoxSize);

    iListbox->SetRect(listBoxRect);
}
Пример #29
0
void CMainWindow::HandlePointerEvent(TPointerEvent& aPointerEvent)
    {
    switch (aPointerEvent.iType)
        {
        case TPointerEvent::EButton3Down:
            {
            // Cascade windows in top left corner
            // Window at the front should be cascaded last.
            // The window at the front (ordinal position 0) is given by Child(), and 
            // each window behind it is given by NextSibling(). We need to go down
            // the sibling list till we get to the last sibling, and move this to 
            // the top left corner. Then go back up the list and move each previous 
            // sibling on top of the last, displaced by an offset (of TPoint(10,10)).
            TPoint point(0, 0);
            TUint32 nextSib, prevSib;
            CWindow* childWindow;
            TInt numChildren = 0;
            TUint32 child = Window().Child();
            if (child)
                {
                childWindow = (CWindow*) child;
                numChildren++;
                nextSib = childWindow->Window().NextSibling();
                while (nextSib)
                    {
                    numChildren++;
                    childWindow = (CWindow*) nextSib;
                    nextSib = childWindow->Window().NextSibling();
                    }
                for (TInt i = numChildren; i > 0; i--)
                    {
                    childWindow->Window().SetPosition(point);
                    prevSib = childWindow->Window().PrevSibling();
                    if (prevSib)
                        {
                        childWindow = (CWindow*) prevSib;
                        point += TPoint(10, 10);
                        }
                    }
                }
            break;
            }
        default:
            break;
        }
    }
Пример #30
0
//---------------------------------------------------------------------------
//Remove selection rectangle from currently selected box and shows the rectangle
//around box (i,j). SelectedBox is updated
void __fastcall TIColorSelect::SelectBox(int i,int j)
{
  if(i>=ColCount || i<0 || j>=RowCount || j<0)
    return;

  Image->Canvas->Brush->Color = clBtnFace;
  int x = Image->Left + BOX_SPACE/2 + SelectedBox.x * (BOX_WIDTH + BOX_SPACE);
  int y = Image->Top + BOX_SPACE/2 + SelectedBox.y * (BOX_WIDTH + BOX_SPACE);
  Image->Canvas->FrameRect(TRect(x, y, x + BOX_WIDTH + BOX_SPACE, y + BOX_WIDTH + BOX_SPACE));

  Image->Canvas->Brush->Color = clBlack;
  x = Image->Left + BOX_SPACE/2 + i*(BOX_WIDTH+BOX_SPACE);
  y = Image->Top + BOX_SPACE/2 + j*(BOX_WIDTH+BOX_SPACE);
  Image->Canvas->FrameRect(TRect(x, y, x + BOX_WIDTH + BOX_SPACE, y + BOX_WIDTH + BOX_SPACE));

  SelectedBox = TPoint(i, j);
}