//////////////////////////////////////////////////////////////////////////
//From CControl
//////////////////////////////////////////////////////////////////////////
void CSelectGroup::Draw(CGraphic& gc)const
{
    TInt index=0;
    for(TInt i=0; i<iMaxLinePerPage; i++)
    {
        index=i+iFirstIndex;
        if(index>=iSelectArray.Count())
            break;

        if(index==iSelectedIndex)
        {
            TRect rect(iStartPoint+TPoint(0,i*iLineHeight),iItemSize);
            gc.SetPenColor(KPopMenuRectColor);
            gc.SetPenStyle(CGraphicsContext::ESolidPen);
            gc.SetBrushColor(KNaviPaneSelectedItemColor);
            gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
            gc.DrawRect(rect);

            gc.SetBrushStyle(CGraphicsContext::ENullBrush);
            gc.SetPenColor(KRgbWhite);
        }
        iSelectArray[index]->DrawItem(gc,TRect(iStartPoint+TPoint(0,i*iLineHeight),iItemSize));
    }
    if(iScrollbar)
        iScrollbar->Draw(gc);
}
示例#2
0
//
/// Resize the CelArray by re-allocating the bitmap(s) to the new size and copying
/// over.
//
bool
TCelArray::Resize(int newCount)
{
  // Can't resize--the bitmap is not ours
  //
  if (!ShouldDelete)
    return false;

  TBitmap* bitmap = new TBitmap(TScreenDC(), CSize.cx*newCount, CSize.cy*NRows);

  // Copy old bitmap if there is one
  //
  if (Bitmap) {
    TMemoryDC srcDC(*Bitmap);
    TMemoryDC dstDC(*bitmap);
    dstDC.BitBlt(TRect(0, 0, CSize.cx*NCels, CSize.cy*NRows), srcDC, TPoint(0));

    // Cleanup old bitmap
    //
    srcDC.RestoreBitmap();
    delete Bitmap;
  }

  // Update bitmap data member
  //
  Bitmap = bitmap;

  // Update total number of Cels
  //
  NCels = newCount;
  return true;
}
示例#3
0
void CButton::Draw()
	{
	iWindow.SetPosition(TPoint(0,iScreenSize.iY-60));
	iWindow.SetSize(TSize(iScreenSize.iX,60));
	iWindow.SetVisible(ETrue);
	TInt i = iScreenSize.iY-60;
	__LOGSTR1("i: %d",i);
	iGc->Activate(iWindow);
	iRectButton = TRect(TPoint(0,0),TSize(iScreenSize.iX,60));
	iWindow.Invalidate();
	iWindow.BeginRedraw();
	iGc->Clear();
	iGc->SetPenColor(iColor);
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	iGc->UseFont(iFont);
	iGc->SetPenColor(KRgbBlue);
	iGc->SetBrushColor(KRgbGray);
	iGc->Clear(iRectButton);
	iGc->DrawText(_L("Демо(Пропустить)"),iRectButton/*TRect(0,0, iRectButton.Width(),iRectButton.Height())*/,60-iFont->FontMaxAscent(), CGraphicsContext::ECenter, 0);
	/*iGc->SetPenColor(KRgbSilver);
	iGc->DrawLine(TPoint(iScreenSize.iX/2,0),TPoint(iScreenSize.iX-1,0));//горизонтальная сверху
	iGc->DrawLine(TPoint(iScreenSize.iX-1,0),TPoint(iScreenSize.iX-1,60));//Вертикальная справа
	iGc->DrawLine(TPoint(iScreenSize.iX/2,59),TPoint(iScreenSize.iX,59));//Горизонтальная снизу
	iGc->DrawLine(TPoint(iScreenSize.iX/2,0),TPoint(iScreenSize.iX/2,60));//Вертикальная справа
*/
	iWindow.EndRedraw();
	iGc->Deactivate();
	iWs.Flush();
	}
示例#4
0
void CSliderControl::ConstructFromResourceL(TResourceReader& reader)
	{
	iVal=0;
		CreateWindowL();	
		InitComponentArrayL();
		iLabel = new (ELeave) CEikLabel;
		iLabel->SetContainerWindowL(*this);
		TRgb lbc; 
		MAknsSkinInstance* skin=AknsUtils::SkinInstance();
		AknsUtils::GetCachedColor(skin,lbc,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6 );
		iLabel->OverrideColorL(EColorLabelText,lbc);
		iLabel->SetAlignment(EHCenterVCenter);
		iLabel->SetBrushStyle(CGraphicsContext::ENullBrush);
		iLabel->MakeVisible(ETrue);
		iLabel->SetTextL(reader.ReadTPtrC16());
		Components().AppendLC(iLabel);
		CleanupStack::Pop(iLabel);
		_LIT(KDesCEmpty,"");
		iSlider = new (ELeave) CSliderForDialog(KDesCEmpty,0,255);
		iSlider->ConstructL(this);
		iSlider->SetContainerWindowL(*this);
		iSlider->MakeVisible(ETrue);
		Components().AppendLC(iSlider);
		CleanupStack::Pop(iSlider);
		
		//SetExtentToWholeScreen();
		
		iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,TRect(TPoint(0,0),CEikonEnv::Static()->ScreenDevice()->SizeInPixels()),ETrue);	
		ActivateL();
		_LOGDATA2(_L("Window pos: %d,%d"),Window().Position().iX,Window().Position().iY);
		_LOGDATA2(_L("Window size: %d,%d"),Window().Size().iWidth,Window().Size().iHeight);
		
		
	}
示例#5
0
//
/// Copy specified bitmap to the destination DC
//
bool
OwlCopyBmp(TBitmap& dstBM, const TBitmap& srcBM, const TPoint& pt, const TSize& size, const TPoint offset)
{
  TMemoryDC srcDC(CONST_CAST(TBitmap&, srcBM));
  TMemoryDC dstDC(dstBM);
  return dstDC.BitBlt(TRect(pt, size), srcDC, offset);
}
示例#6
0
void CTap2CloseAppUi::ScreenChanged()
	{
		TInt scrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth;
		//iButton->SetIconSize(KSize);
		iButton->SetRect(TRect ( TPoint(scrX-KSize.iWidth,0),KSize));
		iButton->SetPosition( TPoint(scrX-KSize.iWidth,0));
	}
示例#7
0
int ImageViewer::getDragType(const TPoint &pos, const TRect &loadbox) {
  if (loadbox == TRect()) return eDrawRect;

  int ret = 0, dx = std::min(abs(loadbox.x0 - pos.x), abs(loadbox.x1 - pos.x)),
      dy = std::min(abs(loadbox.y0 - pos.y), abs(loadbox.y1 - pos.y));

  if (dx > 10 && dy > 10)
    return (loadbox.contains(pos)) ? eMoveRect : eDrawRect;

  if (dx <= 10 && pos.y >= loadbox.y0 - 10 && pos.y <= loadbox.y1 + 10) {
    if (dx == abs(loadbox.x0 - pos.x))
      ret = eMoveLeft;
    else if (dx == abs(loadbox.x1 - pos.x))
      ret = eMoveRight;
  } else if (dy <= 10 && pos.x >= loadbox.x0 - 10 && pos.x <= loadbox.x1 + 10) {
    if (dy == abs(loadbox.y0 - pos.y))
      return eMoveDown;
    else
      return eMoveUp;
  } else
    return eDrawRect;

  if (dy > 10) return ret;

  return ret | (dy == (abs(loadbox.y0 - pos.y)) ? eMoveDown : eMoveUp);
}
示例#8
0
void CEdgedWin::DrawBitmap(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin)
	{
	aGc->Reset();
	TPoint origin = iPos + aOrigin;
	aGc->SetOrigin(origin);
	
	TRect clip(origin, iSize);
	clip.Intersection(aClip);
	clip.Move(-origin);	
	
	aGc->SetClippingRect(clip);
	aGc->SetPenStyle(iPenStyle);
	aGc->SetBrushStyle(iBrushStyle);
	//draw outer rectangle
	aGc->SetPenColor(iTransFgColor);
	aGc->SetBrushColor(iTransBgColor);
	aGc->DrawRect(TRect(TPoint(0,0), iSize));
		
	//draw inner rectangle
	aGc->SetPenColor(iFgColor);
	aGc->SetBrushColor(iBgColor);
	aGc->DrawRect(iOpaqueRect);
	
	CCompWin::DrawBitmap(aGc, aClip, aOrigin);
	}	
示例#9
0
void CEdgedWin::Redraw(const TRect& aRect)
	{
	iWsGc.Activate(*iWindow);
	iWsGc.Reset();
	iWsGc.SetPenStyle(iPenStyle);
	iWsGc.SetBrushStyle(iBrushStyle);
	TBool redraw = EFalse;
	//redraw outer rectangle if in rect
	if (aRect.iTl.iX < iOpaqueRect.iTl.iX ||
	    aRect.iTl.iY < iOpaqueRect.iTl.iY ||
	    aRect.iBr.iX > iOpaqueRect.iBr.iX ||
	    aRect.iBr.iY > iOpaqueRect.iBr.iY)
	    {
	    redraw = ETrue;
	    iRedrawWindow->BeginRedraw();
		iWsGc.SetPenColor(iTransFgColor);
		iWsGc.SetBrushColor(iTransBgColor);
		iWsGc.DrawRect(TRect(TPoint(0,0), iSize));
	//	iRedrawWindow->EndRedraw() will be taken care of below
	    }
	//redraw inner rectangle
	if (redraw || aRect.Intersects(iOpaqueRect))
		{
		if (!redraw)
			{
			iRedrawWindow->BeginRedraw(iOpaqueRect);//iOpaqueRect);
			}
		iWsGc.SetPenColor(iFgColor);
		iWsGc.SetBrushColor(iBgColor);
		iWsGc.DrawRect(iOpaqueRect);
		iRedrawWindow->EndRedraw();
		}
	iWsGc.Deactivate();
	}
示例#10
0
//---------------------------------------------------------------------------
TRect TIPrintDialog::GetDrawingArea()
{
  //Calculate margins in inches;
  double LeftMargin   = FLeftMargin /100.0;
  double TopMargin    = FTopMargin / 100.0;

  HDC hPrnDC = Printer()->Handle;
  //Get x-resolution and y-resolution
  double PrnLogPixelsX = GetDeviceCaps(hPrnDC, LOGPIXELSX) / InchToMillimeter;
  double PrnLogPixelsY = GetDeviceCaps(hPrnDC, LOGPIXELSY) / InchToMillimeter;

  //LOGPIXELSX doesn't work. Always returns 96 for screen
  HDC ScreenDC = GetDC(NULL);
  double ScreenLogPixelsX = (double)GetDeviceCaps(ScreenDC, HORZRES) / GetDeviceCaps(ScreenDC, HORZSIZE);
  double ScreenLogPixelsY = (double)GetDeviceCaps(ScreenDC, VERTRES) / GetDeviceCaps(ScreenDC, VERTSIZE);
  ReleaseDC(NULL, ScreenDC);

  double xScale = PrnLogPixelsX / ScreenLogPixelsX;
  double yScale = PrnLogPixelsY / ScreenLogPixelsY;

  // Locate the upper left corner of the printable area
  TPoint pt(0,0);
  pt.x = GetDeviceCaps(hPrnDC, PHYSICALOFFSETX);
  pt.y = GetDeviceCaps(hPrnDC, PHYSICALOFFSETY);

  double Left = PrnLogPixelsX * LeftMargin - pt.x;
  double Top = PrnLogPixelsY * TopMargin - pt.y;
  double Right = Left + xScale * FImageWidth * Scale / 100.0;
  double Bottom = Top + yScale * FImageHeight * Scale / 100.0;

  //Return drawing area
  //(0,0) is the top left corner of the printable area
  return TRect(Left, Top, Right, Bottom);
}
示例#11
0
EXPORT_C void CEikScrollBarFrame::Tile(TEikScrollBarModel* aVModel, TRect& aVScrollBarRect)
    {
	Tile(aVModel);
	TRect tempRect(aVScrollBarRect);
    if(aVScrollBarRect.Height() < 0 )
        {
        aVScrollBarRect.iTl.iY = aVScrollBarRect.iBr.iY;
        aVScrollBarRect.iBr.iY = tempRect.iTl.iY;
        }
    if(aVScrollBarRect.Width() < 0 )
        {
        aVScrollBarRect.iTl.iX = aVScrollBarRect.iBr.iX;
        aVScrollBarRect.iBr.iX = tempRect.iTl.iX;
        }
    if (iV.iBar && TypeOfVScrollBar() == EDoubleSpan && iV.iExternalScrollBarAttached==EFalse )
        {
        CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*> (iV.iBar);
        // check if fixed layout has been set
        if (scrollbar->FixedLayoutRect().Size() == TSize(0,0))
            {
            if (aVScrollBarRect != TRect(iV.iBar->Position(), iV.iBar->Size()))
                {
                iV.iBar->SetRect(aVScrollBarRect);
                }
            }
        }
    }
示例#12
0
/** Converts a bitmap size to twips before any scaling is applied.

@param aSize The size of the bitmap rectangle in pixels.
@pre None.
@post The bitmap rectangle size is expressed in twips. */
void CHlpPicture::GetOriginalSizeInTwips(TSize& aSize) const
	{
	__ASSERT_ALWAYS(iHlpModel, Panic(EHlpNoHelpModelPointer));
	aSize = iImage->SizeInPixels();

	if	(iImageCountForPicture != KHlpModelMaximumNumberOfImagesForV6Point2Files)
		{
		// ER6 and 6.1 scale-based code
		TRect rect(aSize);
		rect = CCoeEnv::Static()->ScreenDevice()->PixelsToTwips(rect);
		aSize = rect.Size();
		}
	else
		{
		// Fetch the zoom 
		const TReal zoomValue = static_cast<TReal>(iHlpModel->CurrentZoomFactor());
		const TReal scaleFactor = static_cast<TReal>(KHlpModelDefaultZoomFactorAsRealNumber / zoomValue);

		// Scale up or down (in pixels) accordingly
		aSize.iWidth = static_cast<TInt>(aSize.iWidth * scaleFactor);
		aSize.iHeight = static_cast<TInt>(aSize.iHeight * scaleFactor);

		// Now scale into twips
		aSize = CCoeEnv::Static()->ScreenDevice()->PixelsToTwips(TRect(TPoint(0,0), aSize)).Size();
		}
	}
示例#13
0
//---------------------------------------------------------------------------
// DragOver イベントのコールバック関数
//---------------------------------------------------------------------------
void __fastcall TForm1::FilesDragOver(POINTL ptl)
{

int px, py, pr, pb;
TRect rcResult;
TRect rcMouse = TRect(ptl.x-1, ptl.y-1, ptl.x+1, ptl.y+1);   //マウス位置
TRect rcTarget;

DragAndDropTarget->fMultipleFilesOk = false;
DragAndDropTarget->DropImageType = DROPIMAGE_COPY;

//パスワード入力ボックス
px = txtInputPassword->Left;
py = txtInputPassword->Top;
pr = txtInputPassword->BoundsRect.Right;
pb = txtInputPassword->BoundsRect.Bottom;
rcTarget = Rect(ClientToScreen(TPoint(px, py)), ClientToScreen(TPoint(pr, pb)));

if (IntersectRect(rcResult, rcMouse, rcTarget) == true ) {
	txtInputPassword->Color = TColor(0xDBEBF7);  //オレンジ色
}
else{
	txtInputPassword->Color = clWindow;
}


}
示例#14
0
//
/// Create a bitmap & get its handle, given an other bitmap
/// Used by ctors here and in derived classes. Assumes Handle can be
/// written over, & adds handle to reference container.
//
void
TBitmap::Create(const TBitmap& src)
{
  TMemoryDC memDC1;
  TMemoryDC memDC2;

  BITMAP  bm;
  src.GetObject(bm);
  if (bm.bmPlanes != 1 || bm.bmBitsPixel != 1) {
    // create a color bitmap (Assume screen compatible)
    TScreenDC dc;
    Handle = ::CreateCompatibleBitmap(dc, bm.bmWidth, bm.bmHeight);
  }
  else
    // create a mono bitmap
    Handle = ::CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, 0);

  CheckValid();
  RefAdd(Handle, Bitmap);

  memDC1.SelectObject(src);
  memDC2.SelectObject(*this);
  memDC2.BitBlt(TRect(TPoint(0, 0), TSize(bm.bmWidth, bm.bmHeight)),
                memDC1, TPoint(0, 0), SRCCOPY);
}
示例#15
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CShowString::Draw(const TRect& aRect) const
{
	CWindowGc& gc = SystemGc();
	gc.Clear(aRect);
	gc.DrawRect(aRect);

	if(iString && iMyFont)
	{
		TInt fontHeight = iMyFont->HeightInPixels();
		
		gc.UseFont(iMyFont);			
		
		TInt TextToDraw = iString->Des().Length() - iCurrentCut;
			
		if(TextToDraw < 1)
		{
			TextToDraw = 1;
		}
		if(TextToDraw > iString->Des().Length())
		{
			TextToDraw = iString->Des().Length();
		}
		
		gc.DrawText(iString->Des().Right(TextToDraw),TRect(5,(fontHeight / 2),aRect.Width() - 5,((fontHeight / 2) + fontHeight)),iMyFont->AscentInPixels(), CGraphicsContext::ELeft, 0);
	}
}
示例#16
0
void CRhodesAppView::DrawImage(CWindowGc& aGc,   
    const TRect& aRect) const   
    {   
    TSize bmpSizeInPixels( iBitmap->SizeInPixels() );   
    TInt xDelta = (aRect.Width() - bmpSizeInPixels.iWidth) / 2;   
    TInt yDelta = (aRect.Height() - bmpSizeInPixels.iHeight) / 2;   
    TPoint pos( xDelta, yDelta ); // displacement vector   
    pos += aRect.iTl; // bitmap top left corner position   
   
    // Drawing viewfinder image to bitmap   
    iFbsBitGc->BitBlt( pos, iBitmap, TRect( TPoint( 0, 0 ), bmpSizeInPixels ));   
   
    // Draws bitmap with indicators on the screen   
    TSize size( iOffScreenBitmap->SizeInPixels() );   
    aGc.BitBlt( TPoint(0,0), iOffScreenBitmap, TRect( TPoint(0,0), size ) );   
    }
void CTextListScrollAppUi::ConstructL()
    {
    BaseConstructL(ENoAppResourceFile);
    CWsScreenDevice* aScreenDevice = CCoeEnv::Static()->ScreenDevice();
    iTextList = CTextList::NewL(TRect(TPoint(), TSize(aScreenDevice->SizeInPixels())));
    AddToStackL(iTextList);
    }
示例#18
0
void TCadGroup::Clear()
{
  TCadObjectBasePtrVector::iterator i,e;
  for(i=objects.begin(), e=objects.end(); i!=e; i++) delete (*i);
  objects.erase(objects.begin(), objects.end());
  ExtentCache=TRect(0,0,0,0);
}
示例#19
0
void CContainerButton::Draw(const TRect& aRect) const
	{
	CWindowGc& gc=SystemGc();
	gc.Clear();
	if (iIcon)
		{gc.BitBltMasked(TPoint(0,0),iIcon->Bitmap(),TRect(TPoint(0,0),iIcon->Bitmap()->SizeInPixels()),iIcon->Mask(),EFalse);}
	}
示例#20
0
//
// TCadLine
//
TCadLine::TCadLine(const TPoint& _p1, const TPoint& _p2)
 : p1(_p1), p2(_p2)
{
  size=TRect(_p1, _p2).Normalized().Size();
  if (size.cx==0) size.cx=1;
  if (size.cy==0) size.cy=1;
}
示例#21
0
TProgram::TProgram() :
    TProgInit( &TProgram::initStatusLine,
                  &TProgram::initMenuBar,
                  &TProgram::initDeskTop
                ),
    TGroup( TRect( 0,0,TScreen::screenWidth,TScreen::screenHeight ) )
{
    application = this;
    initScreen();
    state = sfVisible | sfSelected | sfFocused | sfModal | sfExposed;
    options = 0;
    buffer = TScreen::screenBuffer;

    if( createDeskTop != 0 &&
        (deskTop = createDeskTop( getExtent() )) != 0
      )
        insert(deskTop);

    if( createStatusLine != 0 &&
        (statusLine = createStatusLine( getExtent() )) != 0
      )
        insert(statusLine);

    if( createMenuBar != 0 &&
        (menuBar = createMenuBar( getExtent() )) != 0
      )
        insert(menuBar);

}
示例#22
0
/** Copies screen to bitmap
*/
TInt COomCopyScreen::Fail()
	{
	TInt ret=iScrDev->CopyScreenToBitmap(iBitmap);
	if (ret==KErrNone)
		ret=iScrDev->CopyScreenToBitmap(iBitmap,TRect(10,10,50,50));
	return(ret);
	}
// -----------------------------------------------------------------------------
// CMceComDisplaySink::DisplayRect
// -----------------------------------------------------------------------------
//
TRect CMceComDisplaySink::DisplayRect()
    {
    return TRect( iDisplayRectTlX,
                  iDisplayRectTlY,
                  iDisplayRectBrX,
                  iDisplayRectBrY );
    }
示例#24
0
/**
 *PrintGraphic
 *  打印图形.
 *Params:
 *  pGraphic[in] - 需要打印的图片.
 *  X0[in] - 相对打印区域左上角(X坐标), 单位: mm
 *  Y0[in] - 相对打印区域左上角(Y坐标), 单位: mm
 *  X1[in] - 相对打印区域右下角(X坐标), 单位: mm, 缺省: 0
 *  Y1[in] - 相对打印区域右下角(Y坐标), 单位: mm, 缺省: 0
 *  bStretch[in] - 是否进行缩放打印
 */
void __fastcall CPrinter::PrintGraphic(TGraphic* pGraphic, Extended X0, Extended Y0, Extended X1, Extended Y1,
                                       bool bStretch)
{
    if ((PPRN == NULL) || (pGraphic == NULL))
    {
        return ;
    }
    if (!PPRN->Printing)
    {
        return;
    }

    int px0 = Ceil(Ceil((X0 + eOffsX) * HPointsPerInch() * 10000 / 25.4) / 10000);
    int py0 = Ceil(Ceil((Y0 + eOffsY) * VPointsPerInch() * 10000 / 25.4) / 10000);
    int px1 = Ceil(Ceil((X1 + eOffsX) * HPointsPerInch() * 10000 / 25.4) / 10000);
    int py1 = Ceil(Ceil((Y1 + eOffsY) * VPointsPerInch() * 10000 / 25.4) / 10000);
    px0 = px0 + 2 * AvgCharWidth();
    py0 = py0 - GetOffSetY();
    px1 = px1 + 2 * AvgCharWidth();
    py1 = py1 - GetOffSetY();
    if (bStretch)
    {
        PPRN->Canvas->StretchDraw(TRect(px0, py0, px1, py1), pGraphic);
    }
    else
    {
        PPRN->Canvas->Draw(px0, py0, pGraphic);
    }
}
示例#25
0
void TTile::addInCache(const TRasterP &raster) {
  if (!raster) {
    m_rasterId = "";
    return;
  }
  TRasterP rin;

  m_rasterId = TImageCache::instance()->getUniqueId();
  if (raster->getParent()) {
    rin = raster->getParent();
    unsigned long offs =
        (raster->getRawData() - raster->getParent()->getRawData()) /
        raster->getPixelSize();
    m_subRect =
        TRect(TPoint(offs % raster->getWrap(), offs / raster->getWrap()),
              raster->getSize());
  } else {
    m_subRect = raster->getBounds();
    rin       = raster;
  }

  if ((TRasterCM32P)rin)
    TImageCache::instance()->add(m_rasterId,
                                 TToonzImageP(rin, rin->getBounds()));
  else if ((TRaster32P)rin || (TRaster64P)rin)
    TImageCache::instance()->add(m_rasterId, TRasterImageP(rin));
  else if ((TRasterGR8P)rin || (TRasterGR16P)rin)
    TImageCache::instance()->add(m_rasterId, TRasterImageP(rin));
  else
    assert(false);
}
void CBubbleCtrl::UnFreeze( TBool aUpdate )
    {
    iFreeze = EFalse;
    if( aUpdate )
        {
        if( !iInvalidRect.IsEmpty() )
            {
            RootControl()->ReDrawRect( iInvalidRect );
            }
        Draw();
        
        if(iInvalidRect.IsEmpty() )
            {
            iInvalidRect = Rect();
            }
        else
            {
            iInvalidRect.BoundingRect( Rect() );
            }      
                  
        UpdateArea(iInvalidRect); 
        }
    
    iInvalidRect = TRect();
    }
示例#27
0
// -----------------------------------------------------------------------------
// CSIPExGameView::DrawBoard
// Draws the game board.
// -----------------------------------------------------------------------------
//
void CSIPExGameView::DrawBoard( CWindowGc& aGc, const TRect& aRect ) const 
    {
    CWindowGc& gc =aGc;

    gc.SetPenSize( TSize(1,1) );
    gc.SetPenStyle( CGraphicsContext::ESolidPen );
    gc.SetPenColor( TRgb(0,0,0) );
    gc.SetBrushColor( TRgb(0,0,255) );
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );


	TPoint p1 = aRect.iTl;
	p1.iX = p1.iX  + iXOffset;
	p1.iY = p1.iY + iLabelSize + iYOffset;

	TPoint p2 = aRect.iBr;
	p2.iX = p1.iX + ( ( KBoxCountX * iBoxW ) + ( ( KBoxCountX + 1 ) * iMidW ) );
	p2.iY = p1.iY + ( ( KBoxCountY * iBoxW ) + ( ( KBoxCountY + 1 ) * iMidW ) );
	TRect box2 = TRect(p1, p2);
	gc.DrawRect( box2 );


	gc.SetPenColor( TRgb(0,0,0) );
    gc.SetBrushColor( TRgb(255,255,255) );
    gc.SetPenStyle( CGraphicsContext::ESolidPen );
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );

	for (int i=0 ; i < KBoxCountX; i++) 
        {
	    for (int j=0 ; j < KBoxCountY; j++) 
            {
	        p1 = aRect.iTl;
	        p2 = aRect.iBr;

	        p1.iX = p1.iX + iXOffset + iMidW + (i*iMidW) + (i*iBoxW);
	        p1.iY = p1.iY + iLabelSize  + iYOffset + iMidW + (j*iMidW) + (j*iBoxW);

	        p2.iX = p1.iX + iBoxW;
	        p2.iY = p1.iY + iBoxW;

	        if ( iEngine->BoardValue( i, j ) == -1 )
                {
		        gc.SetBrushColor( TRgb(255,255,255) );
                }
	        else if ( iEngine->BoardValue( i, j ) == 1 )
                {
		        gc.SetBrushColor( TRgb(255,0,0) );
                }
	        else if ( iEngine->BoardValue( i, j ) == 2 )
                {
		        gc.SetBrushColor( TRgb(0,255,0) );
                }
            else { /* Nothing to do */ }

	        TRect rect( p1, p2 ); 
	        gc.DrawEllipse( rect );
	        }
        }
    }
void CSupSplashScreen::ConstructL(void)
{

	CreateWindowL();

	TFindFile AppFile(CCoeEnv::Static()->FsSession());

	if(KErrNone == AppFile.FindByDir(KSupMbm, KNullDesC))
	{			
		iBackgroundPic = new (ELeave) CFbsBitmap();
		TRect clientRect = CEikonEnv::Static()->EikAppUi()->ApplicationRect();

		// Load commerce logo image depends on the current screen width
		switch(clientRect.Width())
		{
		case SCREEN_WIDTH_1:
		case SCREEN_WIDTH_1_2:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_1));
			}
			break;
		case SCREEN_WIDTH_2:
		case SCREEN_WIDTH_2_2:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_2));
			}
			break;
		case SCREEN_WIDTH_3:
		case SCREEN_WIDTH_3_2:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_3));
			}
			break;
		default:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_1));
			}
			break;
		}

		// Place image right in the screen center
		TSize iconSize = iBackgroundPic->SizeInPixels();

		// Set client rect
		TInt cX = clientRect.Width()/2 - iconSize.iWidth/2;
		TInt cY = clientRect.Height()/2 - iconSize.iHeight/2;

		// Set client rect == bitmaps rect
		SetRect(TRect(TPoint(cX, cY), iconSize));
	}
	else
	{

		SetRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
	}

	ActivateL();
	DrawNow();
}
示例#29
0
EXPORT_C void CHuiFxEngine::UnRegisterEffectL(const TDesC &aFileName)
    {
    MHuiFxEffectCacheNode *node = iCache->FindDup(aFileName);
    if (node) 
        iCache->UnUse(node);
#else
EXPORT_C void CHuiFxEngine::UnRegisterEffectL(const TDesC &)
    {
#endif
    }

EXPORT_C void CHuiFxEngine::LoadEffectL(
    const TDesC& aFileName,
    CHuiFxEffect*& aEffect,
    MHuiEffectable* aVisual,
#ifndef HUIFX_EFFECTCACHE_ENABLED
    TRect* extRect,
#else
    TRect*,
#endif		
    MAlfGfxEffectObserver* aEffectEndObserver,
    TInt aHandle, 
    TInt aFlags )
    {
#ifdef HUIFX_TRACE    
    RDebug::Print(_L("CHuiFxEngine::LoadEffectL - %S, 0x%x, 0x%x"),&aFileName, aVisual, aEffect );
#endif
    if (aFileName.Length() == 0)
    	{
    	User::Leave( KErrNotFound);
    	}
    //TODO: reuse parser?
    if( aEffect != NULL ) User::Leave( KErrGeneral );
#ifndef HUIFX_EFFECTCACHE_ENABLED
    iExtRect = TRect(); // clear the extrect
    if ( extRect )
        {
        iExtRect = *extRect;
        }
    CHuiFxEffectParser* parser = CHuiFxEffectParser::NewL( *this, aVisual );
    CleanupStack::PushL( parser );
    parser->SetEffectEndObserver( aEffectEndObserver, aHandle );
    parser->SetEffectFlags( aFlags );
    // Parsing is asychronous, but we are not waiting for it to end.
    // CHuiFxEffectParser will take care of everything, and CHuiVisual
    // will kill the parser when parsing is finished or cancelled.
    aVisual->SetEffectParser( parser ); // ownership transferred
    CleanupStack::Pop( parser );    
    parser->ParseL( aFileName, iExtRect );
#endif
#ifdef HUIFX_EFFECTCACHE_ENABLED
    CHuiFxEffectCacheEffectNode *node = new (ELeave) CHuiFxEffectCacheEffectNode(aFileName, aEffect, aVisual, &iExtRect, this);
    node->SetEffectEndObserver( aEffectEndObserver, aHandle );
    node->SetEffectFlags( aFlags );
    CleanupStack::PushL(node);
    iCache->FindOrCreateL(node); // takes ownership
    CleanupStack::Pop();
#endif
    }
void CAknKeyLockControl::ConstructL()
    {
    FeatureManager::InitializeLibL();
    iFeatureKeypadNoSlider =
        FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider );

    CreateWindowL();
    Window().SetSize(TSize(0,0));

    ActivateL();

    iEikonEnv->EikAppUi()->AddToStackL(this,ECoeStackPriorityEnvironmentFilter+10,ECoeStackFlagRefusesFocus);

    iKeyLockCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, this, R_KEYLOCK_SOFTKEYS_UNLOCK_EMPTY);
    iKeyLockCba->ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(ECoeWinPriorityNeverAtFront);
//    const TSize screenSize=TSize(AKN_LAYOUT_WINDOW_screen.iW,AKN_LAYOUT_WINDOW_screen.iH);  // Ok so far. 'screen' layout used.
    const TSize screenSize( iAvkonAppUi->ApplicationRect().Size() );
    iKeyLockCba->MakeVisible(EFalse);
    iKeyLockCba->SetBoundingRect(TRect(screenSize));

    iEcsNote = new (ELeave) CAknEcsNote( this );
    iEcsNote->ConstructSleepingNoteL(R_AVKON_EMERGENCY_CALL_NOTE);
    iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2);

    iOfferLockNote = new(ELeave)CAknLockedNote(iOfferLockEnabled, this);
    iOfferLockNote->ConstructSleepingNoteL(R_KEYLOCK_OFFER_LOCK_NOTE);
    iOfferLockNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2);

    iKeypadLockedNote = new(ELeave)CAknSleepingNote();
    iKeypadLockedNote->ConstructSleepingNoteL(R_KEYLOCK_NOTE_LOCK_ON);
    iKeypadLockedNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2);

    iKeypadUnlockedNote = new(ELeave)CAknSleepingNote();
    iKeypadUnlockedNote->ConstructSleepingNoteL(R_KEYLOCK_NOTE_LOCK_OFF);
    iKeypadUnlockedNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2);

    iLockedNote = new (ELeave)CAknLockedNote(iLockedNoteDisplayed);
    iLockedNote->ConstructSleepingNoteL(R_KEYLOCK_NOTE_KEYLOCKED);
    iLockedNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2);

    iConfirmationNote = new (ELeave) CAknLockedNote(iUnlockConfirmation);
    iConfirmationNote->ConstructSleepingNoteL(R_KEYLOCK_NOTE_UNLOCK_CONFIRM);
    iConfirmationNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2);

    if ( iFeatureKeypadNoSlider )
        {
        //Show note "Now press *".
        //Note is shown when user has pressed "Unlock" when keypad is in locked state
        iConfirmationNoteAsterisk = new (ELeave) CAknLockedNote(iUnlockConfirmation);
        iConfirmationNoteAsterisk->ConstructSleepingNoteL(R_KEYLOCK_NOTE_UNLOCK_ASTERISK);
        iConfirmationNoteAsterisk->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2);
        }
    // Emergency call support
    iEcsDetector = CAknEcsDetector::NewL();
    iEcsDetector->SetObserver( this );

    iPhoneQueryOnScreen = EFalse;
    iPhoneNumber.Zero();
    }