idlehomescreen/widgetmanager/src/wmdetailsdlg.cpp
changeset 5 c743ef5928ba
parent 2 08c6ee43b396
child 34 d05a55b217df
equal deleted inserted replaced
4:4d54b72983ae 5:c743ef5928ba
    26 #include <applayout.cdl.h> //layout
    26 #include <applayout.cdl.h> //layout
    27 #include <layoutmetadata.cdl.h>
    27 #include <layoutmetadata.cdl.h>
    28 #include <aknlayoutscalable_avkon.cdl.h>
    28 #include <aknlayoutscalable_avkon.cdl.h>
    29 #include <aknlayoutscalable_apps.cdl.h>
    29 #include <aknlayoutscalable_apps.cdl.h>
    30 #include <AknsBasicBackgroundControlContext.h>
    30 #include <AknsBasicBackgroundControlContext.h>
    31 
    31 #include <AknMarqueeControl.h>
    32 #include <widgetmanagerview.rsg>
    32 #include <widgetmanagerview.rsg>
    33 #include "widgetmanager.hrh"
    33 #include "widgetmanager.hrh"
    34 #include "wmdetailsdlg.h"
    34 #include "wmdetailsdlg.h"
    35 
    35 
    36 
    36 
    37 // CONSTANTS
    37 // CONSTANTS
    38 
    38 
    39 
    39 
    40 // MEMBER FUNCTIONS
    40 // MEMBER FUNCTIONS
    41 
       
    42 // ---------------------------------------------------------
       
    43 // FullScreenRect
       
    44 // rectangle representing the screen
       
    45 // ---------------------------------------------------------
       
    46 //
       
    47 TRect FullScreenRect()
       
    48     {
       
    49     TRect screen;
       
    50     CCoeEnv* env = CCoeEnv::Static();
       
    51     if ( env )
       
    52         {
       
    53         CWsScreenDevice* screenDevice = env->ScreenDevice();
       
    54         if ( screenDevice )
       
    55             screen.SetRect( TPoint(0,0), screenDevice->SizeInPixels() );
       
    56         }
       
    57     return screen;
       
    58     }
       
    59 
    41 
    60 // ---------------------------------------------------------
    42 // ---------------------------------------------------------
    61 // CWmDetailsDlg::NewL
    43 // CWmDetailsDlg::NewL
    62 // ---------------------------------------------------------
    44 // ---------------------------------------------------------
    63 //
    45 //
    64 CWmDetailsDlg* CWmDetailsDlg::NewL(
    46 CWmDetailsDlg* CWmDetailsDlg::NewL(
    65 			const TDesC& aName,
    47 			const TDesC& aName,
    66 	        const TDesC& aDescription,
    48 	        const TDesC& aDescription,
    67 	        TBool  aCanBeAdded,
    49 	        TBool  aCanBeAdded,
    68             const CFbsBitmap* aLogoBmp,
    50             const CFbsBitmap* aLogoBmp,
    69             const CFbsBitmap* aLogoMask,
    51             const CFbsBitmap* aLogoMask )
    70             CAknsBasicBackgroundControlContext* aBgContext )
       
    71     {
    52     {
    72     CWmDetailsDlg* self = new ( ELeave ) CWmDetailsDlg( aCanBeAdded );
    53     CWmDetailsDlg* self = new ( ELeave ) CWmDetailsDlg( aCanBeAdded );
    73     CleanupStack::PushL( self );
    54     CleanupStack::PushL( self );
    74     self->ConstructL( aName, aDescription, aLogoBmp, aLogoMask, aBgContext );
    55     self->ConstructL( aName, aDescription, aLogoBmp, aLogoMask );
    75     CleanupStack::Pop( self );
    56     CleanupStack::Pop( self );
    76     return self;
    57     return self;
    77     }
    58     }
    78 
    59 
    79 // ---------------------------------------------------------
    60 // ---------------------------------------------------------
    80 // CWmDetailsDlg::CWmDetailsDlg
    61 // CWmDetailsDlg::CWmDetailsDlg
    81 // ---------------------------------------------------------
    62 // ---------------------------------------------------------
    82 //
    63 //
    83 CWmDetailsDlg::CWmDetailsDlg( TBool  aCanBeAdded )
    64 CWmDetailsDlg::CWmDetailsDlg( TBool  aCanBeAdded )
    84     : CAknDialog(),
    65     : CAknDialog(),
    85     iCanBeAdded( aCanBeAdded )
    66     iCanBeAdded( aCanBeAdded ),
    86     {
    67     iNeedToScroll( EFalse )
    87     iBorder = TGulBorder::ERaisedControl;
    68     {
       
    69     iBorder = TGulBorder::ERaisedControl;    
    88     }
    70     }
    89 
    71 
    90 // ---------------------------------------------------------
    72 // ---------------------------------------------------------
    91 // CWmDetailsDlg::~CWmDetailsDlg
    73 // CWmDetailsDlg::~CWmDetailsDlg
    92 // ---------------------------------------------------------
    74 // ---------------------------------------------------------
    93 //
    75 //
    94 CWmDetailsDlg::~CWmDetailsDlg()
    76 CWmDetailsDlg::~CWmDetailsDlg()
    95     {
    77     {
       
    78     StopMarquee();
    96     iEikonEnv->RemoveFromStack( iRtEditor );
    79     iEikonEnv->RemoveFromStack( iRtEditor );
    97     iEikonEnv->RemoveFromStack( this );
    80     iEikonEnv->RemoveFromStack( this );
    98     delete iRtEditor;
    81     delete iRtEditor;
       
    82     delete iMarquee;
    99     delete iName;
    83     delete iName;
   100     delete iDescription;
    84     delete iDescription;
   101     delete iLogoBmp;
    85     delete iLogoBmp;
   102     delete iLogoMask;	
    86     delete iLogoMask;
       
    87     delete iBgContext;
   103     }
    88     }
   104 
    89 
   105 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
   106 // CWmDetailsDlg::ExecuteLD
    91 // CWmDetailsDlg::ExecuteLD
   107 // -----------------------------------------------------------------------------
    92 // -----------------------------------------------------------------------------
   124 //
   109 //
   125 void CWmDetailsDlg::ConstructL(
   110 void CWmDetailsDlg::ConstructL(
   126 			const TDesC& aName,
   111 			const TDesC& aName,
   127 	        const TDesC& aDescription,
   112 	        const TDesC& aDescription,
   128             const CFbsBitmap* aLogoBmp,
   113             const CFbsBitmap* aLogoBmp,
   129             const CFbsBitmap* aLogoMask,
   114             const CFbsBitmap* aLogoMask )
   130             CAknsBasicBackgroundControlContext* aBgContext )
       
   131     {
   115     {
   132     if ( !aLogoBmp )
   116     if ( !aLogoBmp )
   133         {
   117         {
   134         User::Leave( KErrArgument );
   118         User::Leave( KErrArgument );
   135         }
   119         }
   136  
   120  
   137 	CAknDialog::ConstructL( R_AVKON_DIALOG_EMPTY_MENUBAR );
   121 	CAknDialog::ConstructL( R_AVKON_DIALOG_EMPTY_MENUBAR );
   138     
   122     
   139 	iBgContext = aBgContext;
   123 	iBgContext = CAknsBasicBackgroundControlContext::NewL( 
       
   124 	        KAknsIIDQsnFrPopupCenter, TRect(0,0,1,1), EFalse);
       
   125 
   140 	iName = aName.AllocL();
   126 	iName = aName.AllocL();
   141 	iDescription = aDescription.AllocL();
   127 	iDescription = aDescription.AllocL();
   142 	
   128 
   143 	// create bitmap and duplicate handle
   129 	// create bitmap and duplicate handle
   144 	iLogoBmp = new ( ELeave ) CFbsBitmap;
   130 	iLogoBmp = new ( ELeave ) CFbsBitmap;
   145     TSize newSize = TSize( aLogoBmp->SizeInPixels().iWidth ,
   131     TSize newSize = TSize( aLogoBmp->SizeInPixels().iWidth ,
   146                            aLogoBmp->SizeInPixels().iHeight );
   132                            aLogoBmp->SizeInPixels().iHeight );
   147     User::LeaveIfError( iLogoBmp->Create( newSize, aLogoBmp->DisplayMode() ) );    
   133     User::LeaveIfError( iLogoBmp->Create( newSize, aLogoBmp->DisplayMode() ) );    
   153         newSize = TSize( aLogoMask->SizeInPixels().iWidth ,
   139         newSize = TSize( aLogoMask->SizeInPixels().iWidth ,
   154                          aLogoMask->SizeInPixels().iHeight );
   140                          aLogoMask->SizeInPixels().iHeight );
   155         User::LeaveIfError( iLogoMask->Create( newSize, aLogoMask->DisplayMode() ) );    
   141         User::LeaveIfError( iLogoMask->Create( newSize, aLogoMask->DisplayMode() ) );    
   156         User::LeaveIfError( iLogoMask->Duplicate( aLogoMask->Handle() ) );
   142         User::LeaveIfError( iLogoMask->Duplicate( aLogoMask->Handle() ) );
   157         }
   143         }
   158 
   144     
   159     iEikonEnv->AddWindowShadow( static_cast<CCoeControl*>(this) );
   145     iEikonEnv->AddWindowShadow( static_cast<CCoeControl*>(this) );
   160     }
   146     }
   161 
   147 
   162 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   163 // CWmDetailsDlg::OkToExitL
   149 // CWmDetailsDlg::OkToExitL
   193                     EAknEditorFlagEnableScrollBars | 
   179                     EAknEditorFlagEnableScrollBars | 
   194                     EEikEdwinAvkonDisableCursor |
   180                     EEikEdwinAvkonDisableCursor |
   195                     EEikEdwinDisplayOnly |
   181                     EEikEdwinDisplayOnly |
   196                     EEikEdwinReadOnly );
   182                     EEikEdwinReadOnly );
   197 
   183 
   198     iRtEditor->SetSkinBackgroundControlContextL( iBgContext );
       
   199     
       
   200     CEikScrollBarFrame* scrollBarFrame = iRtEditor->CreateScrollBarFrameL();
   184     CEikScrollBarFrame* scrollBarFrame = iRtEditor->CreateScrollBarFrameL();
   201     scrollBarFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
   185     scrollBarFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
   202                                              CEikScrollBarFrame::EOff );
   186                                              CEikScrollBarFrame::EOff ); // set to EAuto 
       
   187                                              // when layout fixed. ~wk04_2010
       
   188                                              // currently scrollbar overlaps cba.
       
   189     
       
   190     iMarquee = CAknMarqueeControl::NewL();
       
   191     TCallBack callback( RedrawCallback, this );
       
   192     iMarquee->SetRedrawCallBack( callback );
       
   193     iMarquee->SetLoops( 1 );
       
   194     iMarquee->SetContainerWindowL( *this );
   203     
   195     
   204     InsertAndFormatContentL();
   196     InsertAndFormatContentL();
   205     iRtEditor->UpdateScrollBarsL();
   197     iRtEditor->UpdateScrollBarsL();
   206     }
   198     }
   207 
   199 
   210 //------------------------------------------------------------------------------
   202 //------------------------------------------------------------------------------
   211 //
   203 //
   212 void CWmDetailsDlg::InsertAndFormatContentL()
   204 void CWmDetailsDlg::InsertAndFormatContentL()
   213     {
   205     {
   214     CRichText* richText = iRtEditor->RichText();
   206     CRichText* richText = iRtEditor->RichText();
   215     const TInt KMinTxtLength = 100;
       
   216     
   207     
   217     richText->Reset();
   208     richText->Reset();
   218     if ( iDescription->Des().Length() <= KMinTxtLength )
       
   219         {     
       
   220         richText->InsertL( richText->DocumentLength(),
       
   221                 CEditableText::ELineBreak );
       
   222         }
       
   223     richText->InsertL( richText->DocumentLength(), *iDescription );
   209     richText->InsertL( richText->DocumentLength(), *iDescription );
   224 
   210 
   225     // change the color of the text according to the skin color
   211     // change the color of the text according to the skin color
   226     TRgb color = KRgbBlack;
   212     TRgb color = KRgbBlack;
   227     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   213     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   261 // CWmDetailsDlg::CountComponentControls
   247 // CWmDetailsDlg::CountComponentControls
   262 //------------------------------------------------------------------------------
   248 //------------------------------------------------------------------------------
   263 //
   249 //
   264 TInt CWmDetailsDlg::CountComponentControls() const
   250 TInt CWmDetailsDlg::CountComponentControls() const
   265     {
   251     {
   266     return iRtEditor ? 1 : 0;
   252     TInt count( 0 );
       
   253     if ( iRtEditor )
       
   254         count++;
       
   255     if ( iMarquee )
       
   256         count++;
       
   257     return count;
   267     }
   258     }
   268 
   259 
   269 //------------------------------------------------------------------------------
   260 //------------------------------------------------------------------------------
   270 // CWmDetailsDlg::ComponentControl
   261 // CWmDetailsDlg::ComponentControl
   271 //------------------------------------------------------------------------------
   262 //------------------------------------------------------------------------------
   274     {
   265     {
   275     switch (aIndex)
   266     switch (aIndex)
   276         {
   267         {
   277         case 0:
   268         case 0:
   278             return iRtEditor;
   269             return iRtEditor;
       
   270         case 1:
       
   271             return iMarquee;
   279         default:
   272         default:
   280             return NULL;
   273             return NULL;
   281         }
   274         }
   282     }
   275     }
   283 
   276 
   292     iEikonEnv->EikAppUi()->AddToStackL( iRtEditor );    
   285     iEikonEnv->EikAppUi()->AddToStackL( iRtEditor );    
   293     iRtEditor->SetFocus( ETrue );
   286     iRtEditor->SetFocus( ETrue );
   294     }
   287     }
   295 
   288 
   296 // -----------------------------------------------------------------------------
   289 // -----------------------------------------------------------------------------
   297 // CWmDetailsDlg::WmDetailsDialogRect
       
   298 // -----------------------------------------------------------------------------
       
   299 //
       
   300 TRect CWmDetailsDlg::WmDetailsDialogRect()
       
   301     {
       
   302     TRect mainPane, dlgRect;    
       
   303     TPoint topLeft;
       
   304     TInt desiredW, desiredH;    
       
   305     AknLayoutUtils::LayoutMetricsRect( 
       
   306             AknLayoutUtils::EApplicationWindow, mainPane );
       
   307 
       
   308     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   309         {
       
   310         desiredW = ( mainPane.Width() - (mainPane.Width()/4) );
       
   311         desiredH = ( mainPane.Height() - (mainPane.Height()/5) );        
       
   312         topLeft.iX = ( ( mainPane.Width() - desiredW ) /2);
       
   313         topLeft.iY = ( ( mainPane.Height() - desiredH ) /2);
       
   314         dlgRect.SetRect( topLeft, TSize( desiredW, desiredH ) );
       
   315         }
       
   316     else
       
   317         {
       
   318         desiredH = ( mainPane.Height() - (mainPane.Height()/4) );
       
   319         desiredW = ( mainPane.Width() - (mainPane.Width()/5) );
       
   320         topLeft.iX = ( ( mainPane.Width() - desiredW ) /2);
       
   321         topLeft.iY = ( ( mainPane.Height() - desiredH ) /2);
       
   322         dlgRect.SetRect( topLeft, TSize( desiredW, desiredH ) );        
       
   323         }
       
   324     return dlgRect;
       
   325     }
       
   326 
       
   327 // -----------------------------------------------------------------------------
       
   328 // CWmDetailsDlg::SetSizeAndPosition
   290 // CWmDetailsDlg::SetSizeAndPosition
   329 // -----------------------------------------------------------------------------
   291 // -----------------------------------------------------------------------------
   330 //
   292 //
   331 void CWmDetailsDlg::SetSizeAndPosition( const TSize& /*aSize*/ )
   293 void CWmDetailsDlg::SetSizeAndPosition( const TSize& /*aSize*/ )
   332     {    
   294     {    
   333     SetRect( WmDetailsDialogRect() );
   295     TRect mainPane;
       
   296     AknLayoutUtils::LayoutMetricsRect(
       
   297             AknLayoutUtils::EApplicationWindow, mainPane );
       
   298     TAknWindowLineLayout dlgWindow = AknLayoutScalable_Apps
       
   299                ::popup_wgtman_window().LayoutLine();
       
   300     AknLayoutUtils::LayoutControl( this, mainPane, dlgWindow );
   334     }
   301     }
   335 
   302 
   336 // -----------------------------------------------------------------------------
   303 // -----------------------------------------------------------------------------
   337 // CWmDetailsDlg::SizeChanged
   304 // CWmDetailsDlg::SizeChanged
   338 // -----------------------------------------------------------------------------
   305 // -----------------------------------------------------------------------------
   339 //
   306 //
   340 void CWmDetailsDlg::SizeChanged()
   307 void CWmDetailsDlg::SizeChanged()
   341     {
   308     {
   342     CAknDialog::SizeChanged();
   309     CAknDialog::SizeChanged();
   343     TRect rect = Rect();
   310     TRect rect = Rect();
   344     if ( iBgContext ) { iBgContext->SetRect( FullScreenRect() ); }
   311     if ( iBgContext ) { iBgContext->SetRect( rect ); }
   345     if ( iRtEditor ) 
   312     if ( iRtEditor ) 
   346         {
   313         {
   347         const TInt offSet = 5;
   314         TAknLayoutRect layoutRect;
   348         TRect cbaRect;
   315         TAknWindowLineLayout contentPane = AknLayoutScalable_Apps
   349         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EControlPane, cbaRect );
   316                    ::wgtman_content_pane().LayoutLine();        
   350         
   317         TAknWindowLineLayout rtePane = AknLayoutScalable_Apps
   351         TInt logoH = iLogoBmp->SizeInPixels().iHeight;
   318                    ::wgtman_list_pane().LayoutLine();
   352         
   319         layoutRect.LayoutRect( rect, contentPane );
   353         TInt height, width;
   320         AknLayoutUtils::LayoutControl( iRtEditor, layoutRect.Rect(), rtePane );
   354         if ( Layout_Meta_Data::IsLandscapeOrientation() )
   321         CEikScrollBarFrame* sbFrame = iRtEditor->ScrollBarFrame();
   355             {        
   322         if ( sbFrame && sbFrame->VScrollBarVisibility() != CEikScrollBarFrame::EOff )
   356             height = ( (rect.Height() - logoH) - (cbaRect.Height() * 2) - offSet );
   323             {
       
   324             CEikScrollBar* scrollBar = sbFrame->VerticalScrollBar();
       
   325             TAknWindowLineLayout scrollPane = AknLayoutScalable_Apps
       
   326                            ::scroll_pane_cp036().LayoutLine();
       
   327             AknLayoutUtils::LayoutControl( scrollBar, layoutRect.Rect(), scrollPane );
   357             }
   328             }
   358         else
       
   359             {
       
   360             height = ( (rect.Height() - logoH) - (cbaRect.Height() * 1.5) - offSet );
       
   361             }
       
   362  
       
   363         width = ( rect.Width() - (CEikScrollBar::DefaultScrollBarBreadth() * 4 ) - offSet );
       
   364         TPoint point = TPoint( rect.iTl.iX + offSet, rect.iTl.iY + logoH + offSet );
       
   365         TSize size = TSize( width, height );
       
   366         iRtEditor->SetRect( TRect( point, size ) );
       
   367         TRAP_IGNORE( 
   329         TRAP_IGNORE( 
   368             iRtEditor->SetSkinBackgroundControlContextL( iBgContext );
   330             iRtEditor->SetSkinBackgroundControlContextL( iBgContext );
   369             InsertAndFormatContentL(); );
   331             InsertAndFormatContentL(); );
       
   332 
       
   333         StartMarquee();
   370         }
   334         }
   371     }
   335     }
   372 
   336 
   373 // ----------------------------------------------------------------------------
   337 // ----------------------------------------------------------------------------
   374 // CWmDetailsDlg::SupplyMopObject
   338 // CWmDetailsDlg::SupplyMopObject
   451         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   415         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   452         gc.DrawRect( innerRect );
   416         gc.DrawRect( innerRect );
   453         gc.SetBrushStyle( CGraphicsContext::ENullBrush );
   417         gc.SetBrushStyle( CGraphicsContext::ENullBrush );
   454         }
   418         }
   455 
   419 
   456     // to fix scrollbar background issue in richtext editor
       
   457     if ( iRtEditor ) 
       
   458         {
       
   459         MAknsControlContext* ccRte = AknsDrawUtils::ControlContext( iRtEditor );
       
   460         AknsDrawUtils::Background( skin, ccRte, iRtEditor, gc, iRtEditor->Rect() );
       
   461         }
       
   462     
       
   463     // draw logo
   420     // draw logo
   464     TRect bmpRect( TPoint(0,0), TSize( iLogoBmp->SizeInPixels() ) );
   421     TAknLayoutRect layoutRect;
   465     TPoint point = TPoint( innerRect.iTl.iX + offSet,
   422     TAknWindowLineLayout headingPane = AknLayoutScalable_Apps
   466                            innerRect.iTl.iY + offSet );
   423                ::wgtman_heading_pane().LayoutLine();        
   467 
   424     layoutRect.LayoutRect( rect, headingPane );
   468     if ( iLogoBmp && iLogoMask )
   425 
   469         {
   426     if( iLogoBmp && iLogoMask )
   470         gc.BitBltMasked( point, iLogoBmp, 
   427         {
   471                          bmpRect, iLogoMask, ETrue );
   428         TAknLayoutRect logoLayout;
   472         }
   429         logoLayout.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Apps
   473     else
   430                 ::wgtman_heading_pane_g1().LayoutLine() );        
   474         {
   431         logoLayout.DrawImage( gc, iLogoBmp, iLogoMask );
   475         gc.BitBlt( point, iLogoBmp, bmpRect );
   432         }
   476         }
       
   477 
       
   478     // draw name
       
   479     point.iX += (bmpRect.Width() + offSet);
       
   480     
   433     
   481     AknsUtils::GetCachedColor( 
   434     AknsUtils::GetCachedColor( 
   482                     skin, color, 
   435                     skin, color, 
   483                     KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
   436                     KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
   484 
   437 
   485     // DRAW TEXT
   438     // DRAW TEXT
   486     const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimaryFont );
   439     TAknTextLineLayout titleTextLayout = 
       
   440               AknLayoutScalable_Apps::wgtman_heading_pane_t1().LayoutLine();
       
   441     TAknLayoutText textLayoutTitle;
       
   442     textLayoutTitle.LayoutText( layoutRect.Rect(), titleTextLayout );
       
   443     
       
   444     const CFont* font = textLayoutTitle.Font();
       
   445     if ( !font ) 
       
   446         {
       
   447         font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimaryFont ); 
       
   448         }
       
   449 
   487     gc.UseFont( font );
   450     gc.UseFont( font );
   488     gc.SetPenColor( color );
   451     gc.SetPenColor( color );
   489     gc.SetPenStyle( CGraphicsContext::ESolidPen );
   452     gc.SetPenStyle( CGraphicsContext::ESolidPen );
   490     point.iY += (bmpRect.Height() - (font->HeightInPixels() /2 ) );
   453     
   491     CGraphicsContext::TDrawTextParam param;
   454     TBool truncate( ETrue );
   492     
   455 
   493     HBufC* buf = iName->Des().Alloc();
   456     // check if name needs scrolling
   494     if ( buf )
   457     if ( textLayoutTitle.Font()->TextWidthInPixels( *iName ) > 
   495         {
   458         textLayoutTitle.TextRect().Width() && IsFocused() )
   496         TPtr bufPtr = buf->Des();
   459         {
   497         TextUtils::ClipToFit( bufPtr, *font, (innerRect.Width() - point.iX ) );
   460         const_cast<CWmDetailsDlg&>(*this).iNeedToScroll = ETrue;
   498         gc.DrawText( bufPtr ,point, param );
   461         const_cast<CWmDetailsDlg&>(*this).StartMarquee();
   499         delete buf;
   462         truncate = iMarquee->DrawText(
   500         }
   463                         gc, textLayoutTitle.TextRect(), *iName,               
   501     else
   464                         (textLayoutTitle.TextRect().Height() - font->FontMaxDescent()),
   502         {
   465                         CGraphicsContext::ELeft, *font );
   503         gc.DrawText( *iName ,point, param );
   466         }
   504         }
   467 
   505     
   468     if ( truncate )
       
   469         {
       
   470         const_cast<CWmDetailsDlg&>(*this).StopMarquee();
       
   471         textLayoutTitle.DrawText( gc, *iName, ETrue, color );
       
   472         }
       
   473 
   506     gc.DiscardFont();
   474     gc.DiscardFont();
   507     
   475 
   508     // draw the rounded rectangle as border
   476     // draw the rounded rectangle as border
   509     const TInt KFrameRoundRadius = 3;
   477     const TInt KFrameRoundRadius = 3;
   510     const TInt KBorderWidth = 2;
   478     const TInt KBorderWidth = 2;
   511     gc.SetPenSize( TSize( KBorderWidth, KBorderWidth ) );    
   479     gc.SetPenSize( TSize( KBorderWidth, KBorderWidth ) );    
   512     gc.DrawRoundRect( innerRect, TSize( KFrameRoundRadius, KFrameRoundRadius ) );
   480     gc.DrawRoundRect( innerRect, TSize( KFrameRoundRadius, KFrameRoundRadius ) );
   526     gc.DrawRect( bottomShadowArea );
   494     gc.DrawRect( bottomShadowArea );
   527     gc.SetBrushStyle( CGraphicsContext::ENullBrush );
   495     gc.SetBrushStyle( CGraphicsContext::ENullBrush );
   528     gc.SetPenStyle( CGraphicsContext::ENullPen );
   496     gc.SetPenStyle( CGraphicsContext::ENullPen );
   529     }
   497     }
   530 
   498 
       
   499 // ---------------------------------------------------------
       
   500 // CWmDetailsDlg::RedrawCallback
       
   501 // ---------------------------------------------------------
       
   502 //
       
   503 TInt CWmDetailsDlg::RedrawCallback( TAny* aPtr )
       
   504     {
       
   505     CWmDetailsDlg* self = 
       
   506         static_cast<CWmDetailsDlg*>( aPtr );
       
   507     if ( !self->iNeedToScroll )
       
   508         {
       
   509         self->StopMarquee();    
       
   510         }
       
   511     self->DrawDeferred();
       
   512     return static_cast<TBool>( ETrue );
       
   513     }
       
   514 
       
   515 // ---------------------------------------------------------
       
   516 // CWmDetailsDlg::StartMarquee
       
   517 // ---------------------------------------------------------
       
   518 //
       
   519 void CWmDetailsDlg::StartMarquee()
       
   520     {
       
   521     if ( iMarquee && iNeedToScroll &&
       
   522         !iMarquee->IsMarqueeOn() )
       
   523         {
       
   524         iMarquee->Reset();
       
   525         iMarquee->EnableMarquee( iNeedToScroll );
       
   526         iMarquee->Start();
       
   527         }
       
   528     }
       
   529 
       
   530 // ---------------------------------------------------------
       
   531 // CWmDetailsDlg::StopMarquee
       
   532 // ---------------------------------------------------------
       
   533 //
       
   534 void CWmDetailsDlg::StopMarquee()
       
   535     {
       
   536     if ( iMarquee && iMarquee->IsMarqueeOn() )
       
   537         {
       
   538         iMarquee->EnableMarquee( EFalse );
       
   539         iMarquee->Stop();        
       
   540         }
       
   541     }
       
   542 
       
   543 // ---------------------------------------------------------
       
   544 // CWmDetailsDlg::FocusChanged
       
   545 // ---------------------------------------------------------
       
   546 //
       
   547 void CWmDetailsDlg::FocusChanged( TDrawNow aDrawNow )
       
   548     {
       
   549     CCoeControl::FocusChanged( aDrawNow );
       
   550     if ( IsFocused() )
       
   551         {
       
   552         StartMarquee();
       
   553         }
       
   554     else
       
   555         {
       
   556         StopMarquee();
       
   557         }
       
   558     }
       
   559 
       
   560 
   531 // End of File
   561 // End of File
   532 
   562