void CConeBackgroundTestParentWindowOwning::Draw(const TRect& aRect) const
	{
	CWindowGc& aGc = SystemGc();
	aGc.SetBrushStyle(CGraphicsContext::ERearwardDiagonalHatchBrush);
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	
	TRect tlRect = aRect;
	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
	
	aGc.SetBrushColor(TRgb(0xff0000)); //blue, to be changed or removed
	aGc.DrawRect(tlRect);
	
	TRect brRect = tlRect;
	brRect.Move(tlRect.Width(), tlRect.Height());
	aGc.SetBrushColor(TRgb(0xffffff)); //white , to be changed or removed
	aGc.DrawRect(brRect);
	}
glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const
{
    TOpenFontCharMetrics metrics;
    const TUint8 *glyphBitmapBytes;
    TSize glyphBitmapSize;
    getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize);
    TRect glyphBounds;
    metrics.GetHorizBounds(glyphBounds);
    const glyph_metrics_t result(
        glyphBounds.iTl.iX,
        glyphBounds.iTl.iY,
        glyphBounds.Width(),
        glyphBounds.Height(),
        metrics.HorizAdvance(),
        0
    );
    return result;
}
/**
  Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
  Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
  Sets the brush colour to Red and paints the top left part of the control.\n
  Sets the brush colour and points the bottom right part of the control.\n
*/
void CConeBackgroundTestDrawer1::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
	{
	
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	
	TRect tlRect = aRect;
	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
	
	aGc.SetBrushColor(TRgb(0xff0000));
	aGc.DrawRect(tlRect);
	
	TRect brRect = tlRect;
	brRect.Move(tlRect.Width(), tlRect.Height());
	aGc.SetBrushColor(TRgb(0x00ff00));
	aGc.DrawRect(brRect);
	}
// -----------------------------------------------------------------------------
// CMaskedBitmap::BitBlt
// -----------------------------------------------------------------------------
void CMaskedBitmap::BitBlt( CFbsBitGc& aContext, const TPoint& aPoint, const TRect& aSource ) const
    {
    if (!(aSource.Width()>0 && aSource.Height()>0))
        {
        return;
        }
    if( iBitmap->Handle() )
        {
        if( iMask->Handle() )
            {

            aContext.BitBltMasked( aPoint, iBitmap, aSource, iMask, iInvertMask );
            }
        else
            {
            aContext.BitBlt( aPoint, iBitmap, aSource );
            }
        }
    }
Example #5
0
void PintaIdentificador(CBitmap *BImgDest, TRect &ARect, int **MatrizGrupos)
{
  int x, y;
  int xIni, xFim, yIni, yFim;
  int larg, alt;
  Cor *CorTemp;
  Cor **ImgDest=BImgDest->PMCor;
  larg=ARect.Width();
  alt=ARect.Height();
  for (y=0; y<alt; y++)
    for (x=0; x<larg; x++)
    {
      CorTemp=&(ImgDest[y+ARect.Top][x+ARect.Left]);
      if (MatrizGrupos[y][x]==PIXEL_ACEITO)
        CorTemp->SetCyan();
      else if (MatrizGrupos[y][x]==PIXEL_NAO_ACEITO) 
        CorTemp->SetAzul();
    }
}     
/**
Handles the window close event
@param	aWindow The closing window.
*/
void CTestRenderStage::OnWindowCloseL(MWsWindow* aWindow)
	{
	TPoint origin = aWindow->Origin();
	TRect absRect = aWindow->AbsRect();
	TSize size = aWindow->Size();
	TUint32 handle = aWindow->Handle();

	CLogFile* log = CLogFile::NewL();
	CleanupStack::PushL(log);
	TBuf<255> print(_L(""));
	log->WriteToLogL(print);
	print.Format(_L("Closing Window Handle %d - Origin: %d, %d"), handle, origin.iX, origin.iY);
	log->WriteToLogL(print);
	print.Format(_L("Closing Window Handle %d - AbsRec: Height %d, Width %d"), handle, absRect.Height(), absRect.Width());
	log->WriteToLogL(print);
	print.Format(_L("Closing Window Handle %d - Size: Height %d, Width %d"), handle, size.iHeight, size.iWidth);
	log->WriteToLogL(print);
	CleanupStack::PopAndDestroy(log);
	}
Example #7
0
/**
 * Hides the specified form line, if it does not fit to the specified clipping rectangle.
 * The function never hides focused editable lines. If the form layout is single, the whole
 * captioned control is hidden.
 *
 * @param aControl The form line to be hidden
 * @param aClipRect The clipping rectangle
 *
 * @return How many subcontrols remained visible
 */
static TInt HideLines(CEikCaptionedControl *aControl, TRect aClipRect)
{
    TInt visibleCtrls = 3; // Visible subcontrols after hiding
    CEikCaptionedControl *currentdLine = aControl->DialogPage()->CurrentLine();
    if( ( aControl == currentdLine ) && aControl->iIsEditable )
    {
        return visibleCtrls;
    }

    TBool isEdwin = aControl->ControlIsAnEdwin(aControl->iControlType);
    CEikEdwin* edwin( NULL );
    if( isEdwin )
        edwin = (CEikEdwin*)aControl->iControl;
    TRect ctrlRect( aControl->iControl->Rect() );

    if( isEdwin )
    {
        // Adjust rectangle only to the first line (with edwin's top margin)
        TRect textFirstLine;
        edwin->TextLayout()->GetLineRect(ctrlRect.iTl.iY, textFirstLine);
        ctrlRect.iBr.iY = ctrlRect.iTl.iY + edwin->Margins().iTop + textFirstLine.Height();
    }

    // Find the minimal clipping rectangle
    if( aControl->iBitmap )
        GetVertMinRect( aClipRect, aControl->iBitmap->Rect() );
    if( aControl->iCaption )
        GetVertMinRect( aClipRect, aControl->iCaption->Rect() );
    GetVertMinRect( aClipRect, ctrlRect );



    // Try to hide all controls on the current line
    aControl->SetPartiallyVisible( ETrue );
    visibleCtrls -= HideLines_Ctrl( aControl->iBitmap, aClipRect );
    visibleCtrls -= HideLines_Ctrl( aControl->iCaption, aClipRect );
    if( isEdwin )
        visibleCtrls -= HideLines_Edwin( edwin, aClipRect );
    else
        visibleCtrls -= HideLines_Ctrl( aControl->iControl, aClipRect );
    return visibleCtrls;
}
Example #8
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMySplashScreen::DrawImages(CWindowGc& aGc,const TRect& aRect,CGulIcon* aIcon) const
{
	if(aIcon)
	{
		if(aIcon->Bitmap() && aIcon->Mask())
		{
			if(aIcon->Bitmap()->Handle() && aIcon->Mask()->Handle())
			{
				TSize ImgSiz(aIcon->Bitmap()->SizeInPixels());
				
				TInt LFtMargin = aRect.iTl.iX + ((aRect.Width() - ImgSiz.iWidth) / 2);
				TInt RghMargin = aRect.iTl.iY + ((aRect.Height() - ImgSiz.iHeight) / 2);
				
				TRect DrwRect(LFtMargin,RghMargin,(ImgSiz.iWidth + LFtMargin),(ImgSiz.iHeight + RghMargin));
				
				aGc.DrawBitmapMasked(DrwRect,aIcon->Bitmap(),TRect(0,0,ImgSiz.iWidth,ImgSiz.iHeight),aIcon->Mask(),EFalse);
			}
		}
	}
}
// -----------------------------------------------------------------------------
// CMaskedBitmap::DrawBitmap
// -----------------------------------------------------------------------------
void CMaskedBitmap::DrawBitmap( CFbsBitGc& aContext, const TRect& aTarget ) const
    {
    TSize s(iBitmap->SizeInPixels());
    if (!(aTarget.Width()>0 && aTarget.Height()>0 && s.iWidth>0 && s.iHeight>0))
        {
        return;
        }
    if( iBitmap->Handle() )
        {
        // ### FIXME DrawBitmapMasked is too buggy to use 2.8/week52, so no transparency with scaling
        if( iMask->Handle() )
            {
            aContext.DrawBitmapMasked( aTarget, iBitmap, s, iMask, iInvertMask );
            }
        else
            {
            aContext.DrawBitmap( aTarget, iBitmap );
            }
        }
    }
Example #10
0
///////////////////////////////////////////////////////////////
// TLevelProgressDialog
// --------------------
//
void TLevelProgressDialog::EvPaint ()
{
	if ( Minimized )
	{
		TPaintDC dc(*this);
		TRect ClientRect;
		// Get size of iconic window
		GetClientRect(ClientRect);
		int Width = ClientRect.Width();
		int Height = ClientRect.Height();

		DrawIconicGauge (dc, 0,
						 Width, Height / 3, pNodesGauge->GetValue());
		DrawIconicGauge (dc, Height / 3,
						 Width, Height / 3, pRejectGauge->GetValue());
		DrawIconicGauge (dc, 2 * Height / 3,
						 Width, Height / 3, pBlockmapGauge->GetValue());
	}
	else
		TDialog::EvPaint();
}
Example #11
0
void COokjorContainer::Draw(const TRect& arect) const
    {
		CSkinnedContainer::Draw(arect);

		if(iBitmap)
		 {
			TRect aRect = Rect();
			CWindowGc& gc = SystemGc();
				aRect.Width();
				TPoint p;
				TSize picsz = iBitmap->SizeInPixels();

				p.iX = aRect.Width() - picsz.iWidth;
				p.iX/=2;

				p.iY = aRect.Height() - picsz.iHeight;
				p.iY/=2;

		 	gc.BitBlt(p,iBitmap);
		 }
    }
void CHuiVg10CanvasGc::DoDrawRects(RArray<THuiRealRect>& aRects)
    {
    if(iPolygonDrawMode == EHuiNoFill)
        {
        CHuiCanvasGc::DoDrawRects(aRects);
        }
    else
        {
        for(TInt i=0; i<aRects.Count(); i++)
            {
            TRect roundedRect = aRects[i].Round();
            if (roundedRect.Height() > 0 && roundedRect.Width() > 0)
                {                   
                CHuiVg10Gc* vg10Gc = (CHuiVg10Gc *)iGc;
                vg10Gc->SetPaintPattern(iPolygonFillTexture, iPolygonFillTextureOrigin);
                iGc->DrawRect(roundedRect);
                vg10Gc->SetPaintPattern(NULL, iPolygonFillTextureOrigin);
                }           
            }            
        }
    }
void CMMADisplay::ResetJavaRectObject(const TRect& aRect)
{
    LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject +");
    //TRect rect = aRect;
    JNIEnv* validJni = iJni;//iEventSource->getValidJniEnv();//iJni;
    /*jmethodID setRectID = validJni->GetMethodID(
                                                 iJavaDisplayClass,
                                                 "setRect",
                                             "()V");
    */
    LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --1");
    // set the value to java,so that we can access those from array

    //jfieldID iRectDimensionField = validJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
    if (iRectDimensionField == NULL)
    {
        // handle error
    }
    /* Write to the instance fields */
    jintArray javaDimensionarr = (jintArray)validJni->GetObjectField(iJavaDisplayObject, iRectDimensionField);
    LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --2");
    jint* nativeRectDimensionArr = validJni->GetIntArrayElements(javaDimensionarr, NULL);
    LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --3");
    if (!nativeRectDimensionArr)
    {    // inputBuffer was already allocated
        validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_ABORT);
        LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject Error in resetting rect dimension to java");
        return;
    }
    nativeRectDimensionArr[0] = aRect.iTl.iX;
    nativeRectDimensionArr[1] = aRect.iTl.iY;;
    nativeRectDimensionArr[2] = aRect.Width();
    nativeRectDimensionArr[3] = aRect.Height();
    // Now the dimension array in java is updated hence reset the java rect

    validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, 0);
    validJni->CallVoidMethod(iJavaDisplayObject,setRectID);

    LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject -");
}
/**
  Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
  Sets the background style for Drawing.\n
  1. if aStyle is zero , the brush style is EVerticalHatchBrush.\n
  2. if aStyle is one , the brush style is EForwardDiagonalHatchBrush.\n
  3. if aStyle is two , the brush style is EHorizontalHatchBrush.\n
  4. if aStyle is three , the brush style is ERearwardDiagonalHatchBrush.\n
  Sets the brush colour to Red and paints the top left part of the control.\n
  Sets the brush colour and points the bottom right part of the control.\n
*/
void CConeBackgroundTestDrawer0::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
	{
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	aGc.SetBrushColor(TRgb(0xffffff));
	aGc.Clear();

	switch (iBgStyle)
		{
		case 0:
			aGc.SetBrushStyle(CGraphicsContext::EVerticalHatchBrush);
			break;
			
		case 1:
			aGc.SetBrushStyle(CGraphicsContext::EForwardDiagonalHatchBrush);
			break;
			
		case 2:
			aGc.SetBrushStyle(CGraphicsContext::EHorizontalHatchBrush);
			break;
			
		case 3:
			aGc.SetBrushStyle(CGraphicsContext::ERearwardDiagonalHatchBrush);
			break;
		}

	aGc.SetPenColor(TRgb(0xff0000));
	aGc.DrawRect(aRect);
	
	TRect tlRect = aRect;
	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
	
	aGc.SetBrushColor(TRgb(0xff00ff));
	aGc.DrawRect(tlRect);
	
	TRect brRect = tlRect;
	brRect.Move(tlRect.Width(), tlRect.Height());
	aGc.SetBrushColor(TRgb(0x00ff00));
	aGc.DrawRect(brRect);
	}
Example #15
0
//
/// Paints a maximize box on the tiny caption bar.
//
void
TTinyCaption::PaintMaxBox(TDC& dc, TRect& boxRect, bool pressed)
{
    // Fill the box with light gray & draw bevel if possible
    //
    PaintButton(dc, boxRect, pressed);

    if (pressed)
        boxRect.Offset(1,1);

    // Down triangle
    //
    int bh = boxRect.Height();
    int bw = boxRect.Width();

    if (IsZoomed()) {
        TPoint begPt = boxRect.BottomLeft().OffsetBy((bw+1)/4, -bh*3/8);
        TPoint endPt = begPt.OffsetBy((bw+1)/2, 0);
        while (begPt.x < endPt.x) {
            dc.MoveTo(begPt);
            dc.LineTo(endPt);
            begPt.Offset(1,1);
            endPt.Offset(-1,1);
        }
    }

    // Up triangle
    //
    {
        TPoint begPt = boxRect.TopLeft().OffsetBy((bw+1)/4, IsZoomed() ? bh*3/8 : bh*2/3);
        TPoint endPt = begPt.OffsetBy((bw+1)/2, 0);
        while (begPt.x < endPt.x) {
            dc.MoveTo(begPt);
            dc.LineTo(endPt);
            begPt.Offset(1, -1);
            endPt.Offset(-1, -1);
        }
    }
}
Example #16
0
//
/// Paints a minimize box on the tiny caption bar.
//
void
TTinyCaption::PaintMinBox(TDC& dc, TRect& boxRect, bool pressed)
{
    // Fill the box with light gray & draw bevel if possible
    //
    PaintButton(dc, boxRect, pressed);

    if (pressed)
        boxRect.Offset(1,1);

    int bh = boxRect.Height();
    int bw = boxRect.Width();

    TPoint begPt = boxRect.TopLeft().OffsetBy((bw+1)/4, (bh+2)/3);
    TPoint endPt = begPt.OffsetBy((bw+1)/2,0);
    while (begPt.x < endPt.x) {
        dc.MoveTo(begPt);
        dc.LineTo(endPt);
        begPt.Offset(1,1);
        endPt.Offset(-1,1);
    }
}
void CCalendarManagerContainer::DrawGrid(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Grid_Color1) const
	{
	gc.SetPenColor(p_Default_Grid_Color1);
	gc.SetPenSize(TSize(2, 2));	
	gc.DrawLine(TPoint(0, g_Pos_Y), TPoint(aRect.Width(), g_Pos_Y));
		
	gc.SetPenSize(TSize(1, 1));
	TInt i_Pos_X = g_Space_X;
	for (TInt i = 0; i < 7; i++)
		{
		gc.DrawLine(TPoint(i_Pos_X, g_Pos_Y), TPoint(i_Pos_X, aRect.Height()));
		i_Pos_X += g_Space_X + 1;
		}
	
	g_Pos_Y += 1;
	TInt i_Pos_Y = g_Pos_Y;	
	for (TInt i = 0; i < 6; i++)
		{
		gc.DrawLine(TPoint(g_Space_X, i_Pos_Y), TPoint(aRect.Width(), i_Pos_Y));
		i_Pos_Y += g_Space_Y + 2;
		}
	}
Example #18
0
//
/// Paints a blank button.
//
void
TTinyCaption::PaintButton(TDC& dc, TRect& r, bool pressed)
{
    TBrush winFrameBr(TColor::SysWindowFrame);
//  dc.OWLFastWindowFrame(winFrameBr, r, 1, 1);
    dc.FrameRect(r, winFrameBr);

    r.Inflate(-1,-1);
    dc.TextRect(r, TColor::Sys3dFace);
    if (r.Width() > 4 && r.Height() > 4) {
        if (pressed) {
            dc.TextRect(r.left, r.top, r.right, r.top+1, TColor::Sys3dShadow);
            dc.TextRect(r.left, r.top+1, r.left+1, r.bottom, TColor::Sys3dShadow);
        }
        else {
            dc.TextRect(r.left, r.top, r.right-1, r.top+1, TColor::Sys3dHilight);
            dc.TextRect(r.left, r.top+1, r.left+1, r.bottom-1, TColor::Sys3dHilight);
            dc.TextRect(r.right-1, r.top+1, r.right, r.bottom, TColor::Sys3dShadow);
            dc.TextRect(r.left+1, r.bottom-1, r.right-1, r.bottom, TColor::Sys3dShadow);
        }
    }
}
Example #19
0
void CHuiLayout::DrawStoredBitmap(CHuiGc &aGc) const
    {
    if (!Display()) return;
    
    if (!iHuiLayoutPrivateData->iGc)
        {
        CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer();
		// deleted in destructor or CHuiCanvasVisual::FreeRenderBuffer when not needed anymore
        iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL(); 
        }
    CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc;
    gc.SetGc(aGc);
    gc.SetDefaults();
    gc.PushTransformationMatrix();
    
    //TInt w = displayArea.Width();
    TRect displayArea = Display()->VisibleArea();
    TInt h = displayArea.Height();

    // Pixels are upside down in OpenVG canvas render buffer
    if (CHuiStatic::Env().Renderer() == EHuiRendererVg10)
        {
        TInt height = h;
        //if (relativeOrientation == CHuiGc::EOrientationCW90 || relativeOrientation == CHuiGc::EOrientationCCW90)
        //    {
        //    height = w;    
        //    }            
        gc.Translate(0.0f, height, 0.0f);            
        gc.Scale(1.f, -1.f, 1.f);
        }
    
    THuiRealPoint dest_point = DisplayRect().iTl;
    CHuiCanvasRenderBuffer *stored = StoredRenderBuffer();
    gc.DrawImage(*stored, dest_point); 

    gc.PopTransformationMatrix();

    }
// ---------------------------------------------------------
// CWebClientContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CWebClientContainer::SizeChanged()
    {
    TInt pointY = 0;
    TRect rect = Rect();
    TInt width = rect.Width();
    TInt height = rect.Height() - 4;    // leave space for thin lines between windows
    TSize labelSize = iLabel->MinimumSize();
    TInt dataWindowHeigth = (( height - labelSize.iHeight - KStatusWindowHeight ) / 2 );
    labelSize.iWidth = width;

    iLabel->SetExtent( TPoint( 0,pointY ), labelSize );
    pointY = pointY + labelSize.iHeight + 1;
    iHeaderWindow->SetExtent( TPoint( 0,pointY ),
        TSize( width - KScrollBarWidth, dataWindowHeigth ));
    pointY = pointY + dataWindowHeigth + 1;
    iSourceWindow->SetExtent( TPoint( 0,pointY ),
        TSize( width - KScrollBarWidth, dataWindowHeigth ));
    pointY = pointY + dataWindowHeigth + 1;
    iStatusWindow->SetExtent( TPoint( 0,pointY ),
        TSize( width - KScrollBarWidth, KStatusWindowHeight ));

    DrawNow();
    }
Example #21
0
/**
 * Sets a clipping rectangle for hiding the whole or a part of edwin's text.
 *
 * The reason for using this function is the multiline edwins. The text inside
 * an edwin can be broken to two or more lines, which must be hidden or shown
 * independently from each other. That is why it is not enough just to move
 * the whole edwin out of the screen.
 *
 * @param aClipRect The clipping rect for edwin's text. An empty rect disables
 *   hiding.
 *
 * @return How many subcontrols were hidden
 */
static TInt HideLines_Edwin(CEikEdwin *aEdwin, TRect aClipRect)
{
    aEdwin->SetTextLinesRect(aClipRect);

    // Create rects of the first and last edwin lines
    TPoint edwinTl( aEdwin->Rect().iTl );
    TPoint edwinBr( aEdwin->Rect().iBr );
    TRect textFirstLine;
    aEdwin->TextLayout()->GetLineRect(edwinTl.iY, textFirstLine);
    textFirstLine.Move( edwinTl.iX, edwinTl.iY + aEdwin->Margins().iTop );
    TRect textLastLine;
    aEdwin->TextLayout()->GetLineRect(edwinBr.iY, textLastLine);
    textLastLine.Move( edwinBr.iX, edwinBr.iY - aEdwin->Margins().iTop - textLastLine.Height() );

    // Check if at least one line fits to the clipping rect
    if( aClipRect.Contains(textFirstLine.iTl) &&
            aClipRect.iBr.iY >= textFirstLine.iBr.iY )   // The first line fits
        return 0;
    if( aClipRect.Contains(textLastLine.iTl) &&
            aClipRect.iBr.iY >= textLastLine.iBr.iY )   // The last line fits
        return 0;
    return 1;
}
EXPORT_C void AknPopupLayouts::SetupPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool heading)
    {
    TRect window_rect = AknPopupLayouts::MenuRect(aDef);
    TAknWindowLineLayout listLayout = AKN_LAYOUT_WINDOW_list_menu_graphic_heading_pane(heading?1:0, num-1);
    // We really don't want parent relative list layout here because findbox will be overwritten.
    // Just calculate list height and use that.
    TRect nullRect(0,0,0,0);
    TRect listItemRect = RectFromLayout(nullRect, AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2(0));
    listLayout.iH = (TInt16)(num * listItemRect.Height());
    listLayout.ib = ELayoutEmpty;

    aDef.iListRect.LayoutRect(window_rect, listLayout);

    TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8;
    TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_and_elements__single_graphic_heading__Line_2;
    // Combine two layouts togeher.
    if (part2.iC != ELayoutEmpty) part1.iC = part2.iC;
    if (part2.il != ELayoutEmpty) part1.il = part2.il;
    if (part2.it != ELayoutEmpty) part1.it = part2.it;
    if (part2.ir != ELayoutEmpty) part1.ir = part2.ir;
    if (part2.ib != ELayoutEmpty) part1.ib = part2.ib;
    if (part2.iW != ELayoutEmpty) part1.iW = part2.iW;
    if (part2.iH != ELayoutEmpty) part1.iH = part2.iH;

    aDef.iHeadingRect.LayoutRect(window_rect, part1);
    
    //MenuPopupWindowGraphics(aDef);

    const TAknWindowLineLayout lines[] =
        {
        AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_and_elements__single_graphic_heading__Line_3(heading?1:0),
        AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_and_elements__single_graphic_heading__Line_3(1)
        };
    TRect inner_rect = window_rect; 
    aDef.iVertLineExt1.LayoutRect( inner_rect, lines[0]);
    aDef.iVertLineExt2.LayoutRect( inner_rect, lines[1]);
    }
Example #23
0
Bool COsmo4AppView::EventProc(GF_Event *evt)
{
	TRect r;

#ifndef GPAC_GUI_ONLY
	switch (evt->type) {
	case GF_EVENT_MESSAGE:
		if (!evt->message.message) return 0;
		if (evt->message.error) {
			char err[1024];
			sprintf(err, "Error: %s", gf_error_to_string(evt->message.error));
			MessageBox(evt->message.message, err);
		} else {
			MessageBox(evt->message.message, "Info");
		}
		break;
	case GF_EVENT_SCENE_SIZE:
		r = Rect();
		gf_term_set_size(m_term, r.Width(), r.Height());
		break;
	}
#endif
	return 0;
}
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
		}
	}
Example #25
0
//
/// Calls TGadget::GetDesiredSize and passes the size of the control gadget. Use
/// GetDesiredSize to find the size the control gadget needs to be in order to
/// accommodate the borders and margins as well as the highest and widest control
/// gadget.
//
void
TControlGadget::GetDesiredSize(TSize& size)
{
  TRACEX(OwlGadget, 1, "TControlGadget::GetDesiredSize() enter @" << (void*)this <<
    " size = " << size);
  TGadget::GetDesiredSize(size);

  // !CQ get from Handle if created?
  if(Control->GetHandle()){
    TRect rect = Control->GetWindowRect();
    if (ShrinkWrapWidth)
      size.cx += rect.Width();
    if (ShrinkWrapHeight)
      size.cy += rect.Height();
  }
  else{
    if (ShrinkWrapWidth)
      size.cx += Control->GetWindowAttr().W;
    if (ShrinkWrapHeight)
      size.cy += Control->GetWindowAttr().H;
  }
  TRACEX(OwlGadget, 1, "TControlGadget::GetDesiredSize() leave @" << (void*)this <<
    " size = " << size);
}
Example #26
0
////////////////////////////////////////////////////////////
// TBitmap256Control
// -----------------
//  Display bitmap in DC
void TBitmap256Control::DisplayBitmap (TDC& dc, TRect &rect)
{
	// Display a cross if no bitmap
	if ( pDIBInfo == 0 )
	{
		dc.SelectObject(TPen(TColor::LtGray));
		dc.MoveTo (0, 0);
		dc.LineTo (MaxWidth, MaxHeight);
		dc.MoveTo (0, MaxHeight);
		dc.LineTo (MaxWidth, 0);
		dc.SetTextAlign(TA_CENTER);
		dc.SetTextColor(TColor::White);
		dc.SetBkColor(TColor::Black);
		char tmp[40];
		if ( BitmapName[0] != '\0' && BitmapName[0] != '-' )
			wsprintf (tmp, "No picture (%s)", BitmapName);
		else
			wsprintf (tmp, "No picture");
		dc.TextOut (MaxWidth / 2, MaxHeight / 2 - 6, tmp);
		return;
	}

	assert (pBitmapPalette != NULL);

	// pBitmapPalette->UnrealizeObject();
	dc.SelectObject (*pBitmapPalette);
	dc.RealizePalette();
	dc.SetStretchBltMode (COLORONCOLOR);

#if 1
	TRect ZoomRect;
	ZoomRect.left   = rect.left;
	ZoomRect.top    = rect.top;
	ZoomRect.right  = rect.right;
	ZoomRect.bottom = rect.bottom;

	// Convert the rect. size to a rect in the sprite
	rect.left   /= ZoomFactor;
	rect.top    /= ZoomFactor;
	rect.right  /= ZoomFactor;
	rect.bottom /= ZoomFactor;

	TRect DIBRect;
	DIBRect.left   = rect.left;
	DIBRect.top    = BitmapYSize - rect.bottom; 	// DIBs are Y inversed
	DIBRect.right  = DIBRect.left + rect.Width();
	DIBRect.bottom = DIBRect.top + rect.Height();

	dc.StretchDIBits (ZoomRect,
					  DIBRect,
					  pDIBits, *pDIBInfo,
					  DIB_PAL_COLORS, SRCCOPY);
#else
	// Create memory DC and display bitmap
	TMemoryDC mdc (dc);
	mdc.SelectObject (*pBitmapPalette);
	mdc.SelectObject (*pBitmap);
	dc.StretchBlt(0, 0, ZoomXSize,   ZoomYSize,
				  mdc,
				  0, 0, BitmapXSize, BitmapYSize,
				  SRCCOPY);

	// Restore GDI objects
	mdc.RestoreBitmap();
	mdc.RestorePalette();
#endif
	dc.RestorePalette();
}
Example #27
0
////////////////////////////////////////////////////////////
// TBitmap256Control
// -----------------
//  Adjust window size occording to zoom factor, bitmap size
//  and bitmap offset
void
TBitmap256Control::AdjustWindowSize ()
{
	// Removed 'static' for the 4 vars. below, because Win95 allow
	// the user to change system metrics when he wants...
	int SBWidth  = 0 ;
	int SBHeight = 0 ;
	int CXBorder = 0;
	int CYBorder = 0;
	int BitmapZoomXSize, BitmapZoomYSize;
	BOOL HasVScroll, HasHScroll;
	int BorderWidth, BorderHeight;
	int wWidth, wHeight;
	int xRange, yRange;

	// Get width of vertical and height of horizontal scroll bars
	if ( SBWidth == 0 )
	{
		SBWidth  = GetSystemMetrics (SM_CXVSCROLL);
		SBHeight = GetSystemMetrics (SM_CYHSCROLL);
		CXBorder = GetSystemMetrics (SM_CXBORDER);
		CYBorder = GetSystemMetrics (SM_CYBORDER);
	}

	// If no bitmap
	if ( pDIBInfo == NULL )
	{
		// Reset Window size to maximum orignal size
		Scroller->SetRange(0, 0);
		SetWindowPos (NULL,
					  0, 0,
					  MaxWidth + 2 * CXBorder, MaxHeight + 2 * CYBorder,
					  SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
		return ;
	}

	// Calc. the maximum bitmap size
	BitmapZoomXSize = BitmapXSize * ZoomFactor;
	BitmapZoomYSize = BitmapYSize * ZoomFactor;

	// The window will have Scroll bars ?
	if ( BitmapZoomXSize > MaxWidth  )      HasHScroll = TRUE;
	else                                    HasHScroll = FALSE;
	if ( BitmapZoomYSize > MaxHeight )      HasVScroll = TRUE;
	else                                    HasVScroll = FALSE;

	// Calc. window width and height
	BorderWidth   = HasVScroll ? SBWidth  + CXBorder : CXBorder * 2;
	BorderHeight  = HasHScroll ? SBHeight + CYBorder : CYBorder * 2;

	// Calc. client area width
	wWidth  = BitmapZoomXSize + BorderWidth > MaxWidth  ?
			  ((MaxWidth - BorderWidth) / ZoomFactor) * ZoomFactor:
			  BitmapZoomXSize;

	xRange = max ((BitmapZoomXSize - wWidth) / ZoomFactor, 0);

	// Calc. client area height
	wHeight = BitmapZoomYSize + BorderHeight > MaxHeight ?
			  ((MaxHeight - BorderHeight) / ZoomFactor) * ZoomFactor:
			  BitmapZoomYSize;

	yRange = max ((BitmapZoomYSize - wHeight) / ZoomFactor, 0);

	// Set window size
	TRect cRect = GetWindowRect();
	if ( cRect.Width() != wWidth  ||  cRect.Height() != wHeight )
	{
		SetWindowPos (NULL,
					  0, 0,
					  wWidth + BorderWidth, wHeight + BorderHeight,
					  SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
	}

	//
	// Adjust scroller position and range
	//

	// Set scroller units
	Scroller->SetUnits (ZoomFactor, ZoomFactor);

	// Calc. scroller position
	Scroller->XPos = min (Scroller->XPos, xRange);
	Scroller->YPos = min (Scroller->YPos, yRange);

	Scroller->SetRange (xRange, yRange);
}
void CRecognizerContainer::ShowCodes(const TRect& aDrawRect, const TSize& aBmpSize) const
{
	CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("ShowCodes"));

	RPointerArray<CCodeInfo>* Codes=0;
	TInt CurrentCode; bool draw_rect=true;
	if (!iVCS || iVCS->GetCodes() == NULL || iVCS->GetCodes()->Count()==0 || iInvalid) {
		if (!iCurrentCodeInfo) return;
		iCurrentCodeArray->Reset();
		User::LeaveIfError(iCurrentCodeArray->Append(iCurrentCodeInfo));
		Codes=iCurrentCodeArray;
		CurrentCode=0;
		if (iVCS || iInvalid) draw_rect=false;
	} else {
		Codes=iVCS->GetCodes();
		CurrentCode=iCurrentCode;
	}

	TInt xd = aDrawRect.iTl.iX;
	TInt yd = aDrawRect.iTl.iY;
	TInt hd = aDrawRect.Height();
	TInt wd = aDrawRect.Width();

	TInt hi = aBmpSize.iHeight;
	TInt wi = aBmpSize.iWidth;

	CWindowGc& gc = SystemGc();
	gc.SetPenStyle(CGraphicsContext::ESolidPen);

	TInt n = Codes->Count();

	// draw frames around the codes

	if (draw_rect) {
		for (TInt i = 0; i < n; i++) {
			CCodeInfo* ci = (*Codes)[i];

			gc.SetPenColor(ci->IsCodeValid() ? KRgbYellow : KRgbRed);
			gc.SetPenSize(i != CurrentCode ? TSize(1,1) : TSize(2,2));

			TPoint rb = ci->GetImageCoordinates(TPoint(10,10));

			gc.DrawLine(TPoint(xd + rb.iX*wd/wi, yd + rb.iY*hd/hi), 
						TPoint(xd + ci->x2*wd/wi, yd + ci->y2*hd/hi));
			gc.DrawLine(TPoint(xd + rb.iX*wd/wi, yd + rb.iY*hd/hi), 
						TPoint(xd + ci->x4*wd/wi, yd + ci->y4*hd/hi));
			gc.DrawLine(TPoint(xd + ci->x1*wd/wi, yd + ci->y1*hd/hi), 
						TPoint(xd + ci->x2*wd/wi, yd + ci->y2*hd/hi));
			gc.DrawLine(TPoint(xd + ci->x4*wd/wi, yd + ci->y4*hd/hi), 
						TPoint(xd + ci->x1*wd/wi, yd + ci->y1*hd/hi));
		}
	}

	gc.SetPenSize(TSize(1,1));

	// display value of current code

	if (CurrentCode >= 0 && CurrentCode < Codes->Count()) {
		CCodeInfo* ci = (*Codes)[CurrentCode];
		TBuf<64> info;

		// code value

		ci->code->AppendToString(info);
		gc.SetPenColor(KRgbYellow);
		gc.SetBrushStyle(CGraphicsContext::ENullBrush);
		const CFont* fontUsed = iEikonEnv->DenseFont();
		gc.UseFont(fontUsed);
		TInt baseline = aDrawRect.Height() - 2 * fontUsed->AscentInPixels();
		info.Copy(*iScreenMsgBuf);
		gc.DrawText(info, aDrawRect, baseline, CGraphicsContext::ECenter);

	}
}
void CFiletransferContainer::UpdateDimensions(const TRect& aRect)
{
	iRect=aRect;
	iWidth=aRect.Width();
	iMargin=iWidth/KMarginRatio;
	iVerticalDistance=aRect.Height()/7;
	if(iVerticalDistance>50)
		iVerticalDistance=50;
	iRound=iVerticalDistance/5; //was 3 before
	iHorizontalDistance=iWidth-iMargin-iMargin;
	iVD4=iVerticalDistance*4;
	iVD5=iVerticalDistance*5;

    iFill.Create(TSize(1,iVerticalDistance),EColor16MU);
    TBitmapUtil bu(&iFill);
    bu.Begin(TPoint(0,0));
    TInt i;
    for(i=0;i<iVerticalDistance;i++)
    {
    	bu.SetPixel(0x00FF00-0x500*i);
    	bu.IncYPos();
    };

    //rectangles
    TInt totHrz=iMargin;
    TReal hrz=0;
    TRect *rect;
    iRects.ResetAndDestroy(); //we will append new elements

    //compute the distance between rectangles
    TInt averageRectangleLength=iHorizontalDistance/iFiletransferView->iTotalFilesNo;

    if(averageRectangleLength<5)
    {
    	//we should have a single rectangle, and not one rectangle for each file
    	//iRects.Count() will be one, but iDistanceBetweenRectangles is negative
    	iDistanceBetweenRectangles=-1;
    	//
    	rect=new(ELeave) TRect(totHrz,iVD4,totHrz+iHorizontalDistance,iVD5);
    	iRects.Append(rect);
    }
    else
    {
    	iDistanceBetweenRectangles=2; //this is what we will use if there are not so many rectangles
    	if(averageRectangleLength<20)iDistanceBetweenRectangles=1;
        if(averageRectangleLength<10)iDistanceBetweenRectangles=0;
        TInt remainingBytes=iFiletransferView->iTotalBytes2Transfer;
        TInt remainingHorizontalDistance=iHorizontalDistance;

        for(i=0;i<iFiletransferView->iTotalFilesNo;i++)
        {
        	totHrz+=(TInt)hrz;//hrz was computed in the last cycle

        	//hrz=iFiletransferView->iFileSizes[i]/(TReal)iFiletransferView->iTotalBytes2Transfer*iHorizontalDistance;
        	hrz=iFiletransferView->iFileSizes[i]/(TReal)remainingBytes*remainingHorizontalDistance;
        	remainingBytes-=iFiletransferView->iFileSizes[i];
        	remainingHorizontalDistance-=(TInt)hrz;

        	rect=new(ELeave) TRect(totHrz,iVD4,totHrz+(TInt)hrz-iDistanceBetweenRectangles,iVD5);
        	iRects.Append(rect);
        };
    }





}
Example #30
0
/*
-----------------------------------------------------------------------
-----------------------------------------------------------------------
*/
void CMailBoxContainer::ConstructL(const TRect& aRect)
{
    CreateWindowL();
    
    iUtils.GetFileUtils().GetCurrentPath(iCurrPath);
    
    iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,TRect(0,0,aRect.Width(),aRect.Height()), ETrue);
	iBgContext->SetParentPos(aRect.iTl);
	
    SetRect(aRect);
    
  	ActivateL();	
	SetMenuL();
	
	CEikStatusPane*		sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
	if(sp)
	{		
		if(sp->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL)//R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE)
		{
			sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
		}
	}
	
	iSession = CMsvSession::OpenSyncL(*this);
	

	iCurrentFolder = 0;
    GetFoldersL();
    MakeNavipanelL();
    
	if(iFolderArray.Count() <= iCurrentFolder)
	{
		iCurrentFolder = 0;
	}
	
	if(iCurrentFolder < iFolderArray.Count())
	{
		if(iFolderArray[iCurrentFolder])
		{
			ReadMailFolderL(iFolderArray[iCurrentFolder]->iMscId);
		}
	}
}