// -----------------------------------------------------------------------------
// 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");
}
    // ---------------------------------------------------------
    // CAknChoiceListPopupList::UpdateTextColors
    // Skin items
    // ---------------------------------------------------------
    //    
    void UpdateTextColors()
    {
        TRgb color( KRgbBlack );  // sane default for nonskinned case
        if ( AknsUtils::AvkonSkinEnabled() )
            {
            AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
                                   color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8 );
            }

        ItemDrawer()->SetTextColor( color );
        ItemDrawer()->SetBackColor( AKN_LAF_COLOR( 0 ) );

        if ( AknsUtils::AvkonSkinEnabled() )
            {
            AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
                                   color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8 );
            }

        ItemDrawer()->SetHighlightedTextColor( color );
        ItemDrawer()->SetHighlightedBackColor( AKN_LAF_COLOR( 0 ) );    
    }
void CAknBatteryIcon::DrawInFlatStatusPane( const TRect& /*aRect*/ ) const
    {
	CWindowGc& gc = SystemGc();
	TRect rect( Rect() );
    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
    gc.SetBrushColor( AKN_LAF_COLOR( KStatusPaneBackgroundColor ) );

    // Draws battery icon
    gc.BitBltMasked( 
        rect.iTl,
        iBatteryIcon,
        TRect( rect.Size() ),
        iBatteryIconMask,
        ETrue );
    }
Example #4
0
// ---------------------------------------------------------------------------
// CAknSignalPane::DrawInFlatStatusPane
// Draws the signal pane in flat status pane layout.
// ---------------------------------------------------------------------------
//
void CAknSignalPane::DrawInFlatStatusPane( const TRect& /*aRect*/ ) const
    {
    CWindowGc& gc = SystemGc();
    TRect rect( Rect() );
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );

    if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
        {
        gc.SetPenStyle( CGraphicsContext::ENullPen );
        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
        gc.SetBrushColor(
            AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
        gc.DrawRect( rect );
        }
    }
// ---------------------------------------------------------
// CMsgHeader::Draw
//
// Draws the header.
// ---------------------------------------------------------
//
void CMsgHeader::Draw( const TRect& /*aRect*/ ) const
    {
    CWindowGc& gc = SystemGc();
    TRect rect( Rect() );

    if ( !AknsDrawUtils::Background( AknsUtils::SkinInstance(), 
                                     AknsDrawUtils::ControlContext( this ), 
                                     this, 
                                     gc, 
                                     rect ) )
        {
	    gc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
		gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
		gc.SetPenStyle( CGraphicsContext::ENullPen );
		gc.DrawRect( rect );
		}
    }
Example #6
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    
    }
Example #7
0
// ---------------------------------------------------------------------------
// CAknSignalPane::DrawInNormalStatusPane
// Draws the signal pane in normal status pane layout.
// ---------------------------------------------------------------------------
//
void CAknSignalPane::DrawInNormalStatusPane( const TRect& /*aRect*/ ) const
    {
    CWindowGc& gc = SystemGc();

    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );

    TRect rect( Rect() );

    // Solid or wipe comes from background
    if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
        {
        // Default drawing if skinning is not available
        gc.Clear( rect );
        // Default solid
        gc.SetPenStyle( CGraphicsContext::ENullPen );
        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
        gc.SetBrushColor(
            AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
        gc.DrawRect( rect );
        }
    }
Example #8
0
void CRhodesAppView::CreateOffScreenBitmapL()   
    {   
    iOffScreenBitmap = new (ELeave) CWsBitmap( iCoeEnv->WsSession() );   
       
    TSize size = Rect().Size();   
   
    TInt createError = iOffScreenBitmap->Create( size, iRhoCamera->DisplayMode());   
    User::LeaveIfError( createError );   
   
    iFbsBitGc = CFbsBitGc::NewL(); //graphic context   
    iBmpDevice = CFbsBitmapDevice::NewL(iOffScreenBitmap);   
    iFbsBitGc->Activate(iBmpDevice);   
    iFbsBitGc->SetBrushColor( AKN_LAF_COLOR( KWhiteColor ) );   
   
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();   
    CFbsBitmap* bitmap = AknsUtils::GetCachedBitmap( skin,    
        KAknsIIDQsnBgAreaMain);   
    if ( bitmap )    
        {   
        iFbsBitGc->BitBlt( TPoint(0,0), bitmap );   
        }   
   
    iOffScreenBitmapCreated = ETrue;   
    } 
Example #9
0
/**
 * Main method. Calculates the index of the appropriate scroller
 * indicator bitmap color and draws it.
 *
 * Alternatively draws a transparent indicator using 8-bit
 * greyscale mask.
 */
void CAknScrollIndicator::DrawScrollIndicator(const TRect& aRect)
    {
    if( AknLayoutUtils::PenEnabled() && (iTypeOfScrollBar == CAknScrollButton::ENormal) )
        {        
        CWindowGc& gc = SystemGc();
       
        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
        MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
    
        if ( iIsWindowOwningScrollBar )
            {            
            TRect rect( Window().Position() + aRect.iTl, aRect.Size() ); 
            AknsDrawUtils::DrawBackground( skin, cc, NULL, gc, aRect.iTl, rect , KAknsDrawParamNoClearUnderImage );
            }
        else
            {
            AknsDrawUtils::Background( skin, cc, this, gc, aRect, KAknsDrawParamNoClearUnderImage );
            }
        
        if( iIcon )
            {
            gc.BitBltMasked( aRect.iTl, iIcon->Bitmap(), aRect.Size(), iIcon->Mask(), ETrue );            
            }        
        }
    else
        {
        
        if (Size().iWidth)  // only draw bitmaps if the button has some size to it
            {
            CWindowGc& gc=SystemGc();   // graphics context we draw to
            TInt indicator( 0 );            // which indicator color to draw
            TInt grayIndicator( KMinGrayMaskIndex );
            
            // if focus position is at the lower limit the color is the 0th...
            if (iFocusPosition <= 0) {}// do nothing
            // at the upper limit it is the MAXth...
            else if (iFocusPosition >= iScrollSpan-1)
                {
                indicator = KMaxIndicatorIndex;
                grayIndicator = KMaxGrayMaskIndex;
                }
                // ...all other indicator colors are spread evenly between
                // all other focus positions...
            else
                {
                // all indicators minus top & bottom
                TInt variableIndicatorRange( KNoOfIndicatorColors-2 );
                TInt maxVariableIndex( iScrollSpan-1 );
                // Calculate the indicator value...
                indicator=((iFocusPosition*variableIndicatorRange)+
                    (maxVariableIndex-1))/maxVariableIndex;
                
                grayIndicator = KMaxGrayMaskIndex -
                    ( maxVariableIndex - iFocusPosition ) *
                    ( KMaxGrayMaskIndex - KMinGrayMaskIndex ) /
                    maxVariableIndex;
                }
            // Sanity checks...
            __ASSERT_DEBUG(indicator>=0,
                Panic( EEikPanicScrollbarIndicatorOutOfRangeLow));
            __ASSERT_DEBUG(indicator<=KMaxIndicatorIndex,
                Panic(EEikPanicScrollbarIndicatorOutOfRangeHigh));
            __ASSERT_DEBUG(grayIndicator>=0,
                Panic( EEikPanicScrollbarIndicatorOutOfRangeLow));
            __ASSERT_DEBUG(grayIndicator<=KMaxGrayMaskIndex,
                Panic(EEikPanicScrollbarIndicatorOutOfRangeHigh));
            
            // reverse the colors for down buttons
            if ( iType == CAknScrollButton::ENudgeDown )
                {
                indicator = KMaxIndicatorIndex - indicator;
                grayIndicator = KMaxGrayMaskIndex - grayIndicator;
                }
            MAknsSkinInstance* skin = AknsUtils::SkinInstance();
            MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
            
            AknsDrawUtils::Background( skin, cc, this, gc, aRect );
            
            if( indicator )
                {
                CFbsBitmap* mask = NULL;
                if (iType == CAknScrollButton::ENudgeUp)
                    {
                    mask = AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiScrollUpMask );
                    if ( mask )
                        {
                        AknIconUtils::SetSize( mask, aRect.Size() );
                        }
                    }
                else
                    {
                    mask = AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiScrollDownMask );
                    if ( mask )
                        {
                        AknIconUtils::SetSize( mask, aRect.Size() );
                        }
                    }
                
                
                const CFbsBitmap* blitMask = mask;
                if( !blitMask )
                    {
                    blitMask = iBitmap->Mask();
                    }
                
                
                TRgb color( AKN_LAF_COLOR( KIndicatorColors[indicator] ) );
                
                TInt err( AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnScrollColors, KFullColor ) );
                
                const TRect bmpRect( TPoint( 0,0 ), aRect.Size() );
                
                iColorBmpGc->SetPenStyle( CGraphicsContext::ENullPen );
                iColorBmpGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
                
                if ( err == KErrNone )
                    {
                    TRgb gray( 0,0,0 );
                    //mask bitmap with right gray color
                    iMaskBmpGc->SetPenStyle( CGraphicsContext::ENullPen );
                    iMaskBmpGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
                    iMaskBmpGc->SetBrushColor( gray.Gray256( grayIndicator ) );
                    iMaskBmpGc->DrawRect( bmpRect );
                    
                    //bitmap temporarily filled with black
                    iColorBmpGc->SetBrushColor( TRgb( 0, 0, 0 ) );
                    iColorBmpGc->DrawRect( bmpRect );
                    
                    //create the mask with gray colored shape
                    iMaskBmpGc->SetBrushStyle( CGraphicsContext::ENullBrush );
                    iMaskBmpGc->BitBltMasked( aRect.iTl, iColorBitmap,
                        bmpRect, blitMask, EFalse );
                    
                    //set the skin color
                    iColorBmpGc->SetBrushColor( color );
                    iColorBmpGc->DrawRect( bmpRect );
                    
                    //blit to screen with transparent color
                    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
                    gc.BitBltMasked( aRect.iTl, iColorBitmap,
                        bmpRect, iMaskBitmap, ETrue );
                    }
                else
                    {
                    iColorBmpGc->SetBrushColor( color );
                    iColorBmpGc->DrawRect( bmpRect );
                    
                    //draw default color
                    gc.BitBltMasked( aRect.iTl, iColorBitmap, bmpRect,
                        blitMask, ETrue );
                    }
                }
            }
        } //end of else
    }
Example #10
0
EXPORT_C void CSettingsListBoxItemDrawer::DrawItemText( TInt aItemIndex,
                                                        const TRect& aItemTextRect,
                                                        TBool aItemIsCurrent,
                                                        TBool /*aViewIsEmphasized*/,
                                                        TBool /*aItemIsSelected*/) const
    {
    _AKNTRACE_FUNC_ENTER;
    _AKNTRACE("DrawItemText: aItemIndex=%d, aItemTextRect=(%d,%d,%d,%d), aItemIsCurrent=%d",
            aItemIndex, aItemTextRect.iTl.iX, aItemTextRect.iTl.iY, aItemTextRect.iBr.iX,
            aItemTextRect.iBr.iY, aItemIsCurrent);
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
    MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
    if ( transApi )
        {
        transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified );
        }
#endif //RD_UI_TRANSITION_EFFECTS_LIST
    iGc->SetBrushColor( AKN_LAF_COLOR( 0 ) );
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
    if ( transApi )
        {
        transApi->StopDrawing();
        }
#endif //RD_UI_TRANSITION_EFFECTS_LIST

    DrawBackgroundAndSeparatorLines( aItemTextRect );

    if ( aItemIsCurrent )
        {
        FormattedCellData()->SetCurrentItemIndex( aItemIndex );
        }
        
    FormattedCellData()->SetCurrentlyDrawnItemIndex( aItemIndex );

    FormattedCellData()->DrawSettingHighlight( *iGc, aItemTextRect, aItemIsCurrent );

    TBool drawBackground = ETrue;
    TPtrC temp = iModel->ItemText( aItemIndex );
    TPtrC columnText;

    TextUtils::ColumnText( columnText, 3, &temp );
    
    if ( columnText == KNullDesC )
        {
        drawBackground = EFalse;
        }

#ifdef RD_UI_TRANSITION_EFFECTS_LIST 
    if ( transApi )
        {
        transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
        iGc->SetClippingRect( iViewRect );
        }
#endif // RD_UI_TRANSITION_EFFECTS_LIST

    // draw setting item's background
    if ( drawBackground )
        {
        TAknLayoutRect outerRect;
        TAknWindowComponentLayout valuePane;
#ifdef RD_LIST_STRETCH                
        if ( Layout_Meta_Data::IsLandscapeOrientation() && 
             Layout_Meta_Data::IsListStretchingEnabled() &&
             FormattedCellData()->StretchingEnabled() )
            {
            valuePane = AknLayoutScalable_Avkon::set_value_pane_cp_vc( 0 );
            }
        else
#endif // RD_LIST_STRETCH
            {
            valuePane = AknLayoutScalable_Avkon::set_value_pane_cp( 0 );
            }
                
        outerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose(
                              valuePane,
                              AknLayoutScalable_Avkon::bg_set_opt_pane( 0 ) ).LayoutLine() );

        TBool frameDrawn = EFalse;
        MAknsControlContext *cc = AknsDrawUtils::ControlContext( FormattedCellData()->Control() );
        
        if ( !cc )
            {
            cc = FormattedCellData()->SkinBackgroundContext();
            }

        if ( cc )
            {
            TAknLayoutRect innerRect;
            innerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose(
                                  valuePane,
                                  AknLayoutScalable_Avkon::bg_set_opt_pane_g1() ).LayoutLine() );

            frameDrawn = AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), 
                                                   *iGc, 
                                                   outerRect.Rect(), 
                                                   innerRect.Rect(),
                                                   KAknsIIDQsnFrSetOptFoc, 
                                                   KAknsIIDQsnFrSetOptFocCenter );
            }
                
        if ( !frameDrawn )
            {
            iGc->SetBrushColor( AKN_LAF_COLOR( 243 ) );
            iGc->Clear( outerRect.Rect() );
            }
        }

    SetupGc( aItemIndex );
        
    CFormattedCellListBoxData::TColors colors;
    
    TBufC<KMaxTotalDataLength> target;

    // Try to allocate buffer dynamically. If out of memory, use the fixed size stack buffer.
    // This size should be sufficient.
    TInt size = temp.Length() * 2;
    HBufC* buffer = NULL;
    
    if ( size > KMaxTotalDataLength )
        {
        buffer = HBufC::New( size );
        }

    TPtr des = ( buffer ? buffer->Des() : target.Des() );
    TDesC* targetptr = &temp;

    if ( columnText == KNullDesC )
        {
#ifdef RD_LIST_STRETCH
        // If list stretching is used and the device is in landscape orientation
        // there is only one text cell available. Therefore, word wrapping 
        // cannot be done. Instead the first text cell must be omitted and the 
        // possible text moved to the second cell. If both text cells contain 
        // data they are combined and the data is moved to the second cell (i.e. 
        // the first cell is never drawn in landscape if list stretching is 
        // turned on).
        if ( Layout_Meta_Data::IsLandscapeOrientation() &&
             Layout_Meta_Data::IsListStretchingEnabled() &&
             FormattedCellData()->StretchingEnabled() )
            {
            TBool swapCells = ETrue;
            TPtrC itemText;
            
            // check if cell swapping should be done at all
            for ( TInt i = 2; i <= 4; ++i )
                {
                if ( TextUtils::ColumnText( itemText, i, targetptr ) == KErrNotFound )
                    {
                    break;
                    }
                
                if ( itemText != KNullDesC )
                    {
                    swapCells = EFalse;
                    break;
                    }
                }
            
            TextUtils::ColumnText( itemText, 1, targetptr );

            if ( swapCells && itemText.Length() > 0 )
                {
                TPtrC secondaryText;
                TextUtils::ColumnText( secondaryText, 5, targetptr );
            
                // remove text from the first text cell
                AknLAFUtils::ReplaceColumn( des, targetptr, (TDesC16*)&KNullDesC, KColumnListSeparator, 1 );

                // ReplaceColumn does not update descriptor's length :(
                des.Set( buffer ? buffer->Des() : target.Des() ); 
                
                TInt secondaryPos = 0;
                TPtrC temp;
                temp.Set( des );

                // add separators if needed
                for ( TInt i = 0; i < 5; ++i )
                    {
                    TInt position = temp.Locate( KColumnListSeparator );
                    
                    if ( position != KErrNotFound )
                        {
                        if ( position < temp.Length() )
                            {
                            ++position;
                            }
                            
                        secondaryPos += position;
                        }
                    else
                        {
                        des.Append( KColumnListSeparator );
                        secondaryPos = des.Length();
                        }

                    temp.Set( des.Mid( secondaryPos ) );
                    }
                
                des.Insert( secondaryPos, itemText );

                if ( secondaryText != KNullDesC )
                    {
                    _LIT( KEmptySpace, " " );
                    des.Insert( secondaryPos + itemText.Length(), KEmptySpace );
                    }
                    
                targetptr = &des;
                }
            }
        else
            {
            WordWrapListItem( des, *targetptr, 1, 5, aItemIndex );
            // Set again because ReplaceColumn in WordWrapListItem does not update the length to 'des' !
            des.Set( buffer ? buffer->Des() : target.Des() );
            targetptr = &des;
            }
#else
        WordWrapListItem( des, temp, 1, 5, aItemIndex );
        // Set again because ReplaceColumn in WordWrapListItem does not update the length to 'des' !
        des.Set( buffer ? buffer->Des() : target.Des() );
        targetptr = &des;
#endif // RD_LIST_STRETCH
        }

#ifdef RD_UI_TRANSITION_EFFECTS_LIST 
    if ( transApi )
        {
        iGc->CancelClippingRect();
        transApi->StopDrawing();
        }
#endif // RD_UI_TRANSITION_EFFECTS_LIST
                
    if (FormattedCellData()->IsMarqueeOn() && 
            FormattedCellData()->CurrentMarqueeItemIndex() != aItemIndex && 
            aItemIsCurrent)
        {
        FormattedCellData()->ResetMarquee();
        FormattedCellData()->SetCurrentMarqueeItemIndex(aItemIndex);
        }

    SettingsData()->Draw( Properties( aItemIndex ), 
                          *iGc,
                          targetptr,
                          aItemTextRect,
                          aItemIsCurrent,
                          colors );

    delete buffer;
    _AKNTRACE_FUNC_EXIT;
    }