// ----------------------------------------------------------------------------- // CFiletransferContainer::Draw() // Draws the display. // ----------------------------------------------------------------------------- // void CFiletransferContainer::Draw( const TRect& /*aRect*/ ) const { // Get the standard graphics context CWindowGc& gc = SystemGc(); // Clears the screen gc.Clear( Rect() ); //LOG("CFiletransferContainer::Draw: start"); gc.SetPenColor(AKN_LAF_COLOR(185));//green //gc.SetPenColor(AKN_LAF_COLOR(35));//red gc.UseBrushPattern(&iFill); gc.SetBrushStyle(CGraphicsContext::EPatternedBrush); gc.SetBrushColor(AKN_LAF_COLOR(215)); gc.SetPenStyle(CGraphicsContext::ENullPen); TInt i; for(i=0;i<iRects.Count();i++) { if(i==iFiletransferView->iCurrentFileNo-1 || iDistanceBetweenRectangles<0) { gc.SetBrushStyle(CGraphicsContext::ENullBrush); gc.SetPenStyle(CGraphicsContext::ESolidPen); }; gc.DrawRoundRect(*iRects[i],TSize(iRound,iRound)); }; //fill the rect up to now TRect fRect; TReal hrzCurrent; if(iDistanceBetweenRectangles>=0) { //we have one rectangle for each file fRect=*iRects[iFiletransferView->iCurrentFileNo-1]; hrzCurrent=fRect.Width(); hrzCurrent=iFiletransferView->iBytesTransfered*(hrzCurrent-iDistanceBetweenRectangles)/iFiletransferView->iCurrentFileSize; } else { //we have one rectangle overall fRect=*iRects[0]; hrzCurrent=fRect.Width(); hrzCurrent=iFiletransferView->iTotalBytesTransfered*hrzCurrent/iFiletransferView->iTotalBytes2Transfer; }; gc.UseBrushPattern(&iFill); gc.SetBrushStyle(CGraphicsContext::EPatternedBrush); gc.SetBrushColor(AKN_LAF_COLOR(215)); gc.SetPenStyle(CGraphicsContext::ENullPen); TInt delta=iRound-(TInt)hrzCurrent; if(delta<0)delta=0; fRect.SetWidth((TInt)hrzCurrent); fRect.Grow(0,-delta); gc.DrawRoundRect(fRect,TSize(iRound-delta,iRound-delta)); //LOG("CFiletransferContainer::Draw: end"); }
void CHuiShadowBorderBrush::ExpandVisualRect(TRect& aRect) const { // We need access to visual to convert metric units into pixels, // currently a pointer to visual is provided through separate // method since we want to avoid breaking binary compatibility // of this class. TReal32 widthInPixels = WidthInPixels(BrushGuide()); aRect.Grow(HUI_ROUND_FLOAT_TO_INT(widthInPixels), HUI_ROUND_FLOAT_TO_INT(widthInPixels)); }
void CHuiShadowBorderBrush::Draw(CHuiGc& aGc, const MHuiBrushGuide& aGuide) const { TRect content = aGuide.BrushRect().Round(); TReal32 opacity = aGuide.BrushOpacity() * iOpacity.Now(); if(opacity <= 0) { return; } aGc.SetPenAlpha(TInt(opacity * 255)); aGc.SetPenColor(TRgb(0, 0, 30)); const CHuiTexture* shadowTexture = NULL; TInt err = aGuide.BrushSkin().GetTexture(EHuiSkinShadowTexture, shadowTexture); if (err!=KErrNone) { ASSERT(EFalse); // failed to get the shadow texture - unable to proceed! return; } ASSERT(shadowTexture); THuiImage shadowImage(*shadowTexture); aGc.Disable(CHuiGc::EFeatureDepthWrite); TReal32 widthInPixels = WidthInPixels(BrushGuide()); content.Grow(HUI_ROUND_FLOAT_TO_INT(widthInPixels), HUI_ROUND_FLOAT_TO_INT(widthInPixels)); // ID: EHJK-7G5AHB - shadow border leaves artifacts in the display while visual is moved. TReal32 offset = 0.0f; // NOTE: It was 1.f. // Note: DrawBorders does not (yet) support different widths for every border. aGc.DrawBorders(content, widthInPixels-offset, widthInPixels+offset, widthInPixels-offset, widthInPixels+offset, CHuiGc::EBorderImage, &shadowImage); aGc.Enable(CHuiGc::EFeatureDepthWrite); }
TMyApp::TMyApp(int argc, char **argv): TProgram(argc, argv, EGA_CYAN) { int i, _MaxX, _MaxY; TRect r ( Bounds ); r.Grow( 10, 10 ); doc = new QDocument(); mainWindow = new TWindow( r, "One-Shot: Simulador de circuitos digitales" ); // mainWindow->State |= stNoMoveable; // mainWindow->Align |= vaFixedSize; insert( mainWindow ); mainWindow->GotFocus(); mainWindow->getClientArea( r ); _MaxX = r.deltax(); _MaxY = r.deltay(); r.b.y = r.a.y + Ht*2; mainMenu = new TMenuBar (r, new TSubMenu("Archivo", new TMenuItem("Nuevo", cmNuevo, new TMenuItem("Abrir", cmAbrir, new TMenuItem("Guardar", cmGuardar, new TMenuItem(mnuSeparatorLine, 0, new TMenuItem("Salir", cmSalir, NULL))))), new TSubMenu("Editar", new TMenuItem("Propiedades", cmPropiedades, new TMenuItem(mnuSeparatorLine, 0, new TMenuItem("Borrar", cmBorrar, NULL))), new TSubMenu("Simular", new TMenuItem("Arrancar", cmSimOn, new TMenuItem("Detener", cmSimOff, NULL)), new TSubMenu("Ayuda", new TMenuItem("Acerca de...", cmAcerca_de, NULL), NULL)))) ); mainWindow->insert( led = new QLed( QPoint( _MaxX-32, r.b.y+1 ) ) ); led->Align = vaFixedSize+vaRight; r = TRect (2, mainMenu->Bounds.b.y, 3*_MaxX/4, _MaxY-12); mainWindow->insert (canvas = new TScrollCanvas (r, 1200, 1200)); canvas->Align = vaClient+vaPropW+vaPropH; canvas->shpbg = EGA_BLACK; canvas->insert( visualBinding = new QVisualBinding() ); r = TRect (r.b.x+2, r.a.y+24, _MaxX-2, r.b.y); mainWindow->insert (complist = new TListBox (r)); complist->Align = vaPreservW+vaRight+vaTop+vaBottom+vaPropW+vaPropH; complist->height_item = 32; extern char *compList[]; for (i=0; compList[i]; i++) complist->additem( compList[i] ); complist->onSelect = onSelectComp; mainWindow->setMenuWindow( mainMenu ); }