00001 /* 00002 * Copyright © 2008 Nokia Corporation. 00003 */ 00004 00005 // INCLUDE FILES 00006 #include <ImageConversion.h> 00007 #include "ShowInfoDialog.h" 00008 00009 const TInt KMaxInfoDescriptorLength = 100; 00010 00011 CShowInfoDialog::CShowInfoDialog( CFrameInfoStrings* aInfoStrings ) : 00012 iInfoStrings( aInfoStrings ) 00013 { 00014 } 00015 00016 CShowInfoDialog::~CShowInfoDialog() 00017 { 00018 iEikonEnv->ScreenDevice()->ReleaseFont(iFont); 00019 } 00020 00021 void CShowInfoDialog::PreLayoutDynInitL() 00022 { 00023 CAknQueryDialog::PreLayoutDynInitL(); 00024 SetEditableL(ETrue); 00025 00026 // Create font 00027 _LIT( KSeries60SansB, "Series 60 SansB" ); 00028 TFontSpec fontSpec( KSeries60SansB, 75 ); 00029 fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); 00030 User::LeaveIfError(iEikonEnv->ScreenDevice()->GetNearestFontInTwips( iFont, fontSpec )); 00031 } 00032 00033 void CShowInfoDialog::PostLayoutDynInitL() 00034 { 00035 CalculatePositionAndSize(); 00036 } 00037 00038 TBool CShowInfoDialog::OkToExitL(TInt /*aButtonId*/) 00039 { 00040 return ETrue; 00041 } 00042 00043 TInt CShowInfoDialog::CountComponentControls() const 00044 { 00045 return( 0 ); 00046 } 00047 00048 CCoeControl* CShowInfoDialog::ComponentControl(TInt /*aIndex*/) const 00049 { 00050 return NULL; 00051 } 00052 00053 void CShowInfoDialog::CalculatePositionAndSize() 00054 { 00055 TRect cRect; 00056 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,cRect); 00057 00058 cRect.Shrink(25,25); 00059 SetExtent(cRect.iTl,cRect.Size()); 00060 } 00061 00062 void CShowInfoDialog::SetSizeAndPosition(const TSize &aSize) 00063 { 00064 CAknQueryDialog::SetSizeAndPosition( aSize ); 00065 00066 CalculatePositionAndSize(); 00067 } 00068 00069 void CShowInfoDialog::SizeChanged() 00070 { 00071 DrawNow(); 00072 } 00073 00074 void CShowInfoDialog::HandleResourceChange(TInt aType) 00075 { 00076 CAknQueryDialog::HandleResourceChange(aType); 00077 } 00078 00079 void CShowInfoDialog::Draw( const TRect& /*aRect*/ ) const 00080 { 00081 // Get the standard graphics context 00082 CWindowGc& gc = SystemGc(); 00083 gc.SetPenStyle( CGraphicsContext::ENullPen ); 00084 gc.SetBrushColor( KRgbBlack); 00085 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); 00086 00087 // Clear screen 00088 gc.Clear(Rect()); 00089 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); 00090 00091 // Draw round rect 00092 gc.SetPenStyle( CGraphicsContext::ESolidPen ); 00093 gc.SetPenColor(KRgbWhite); 00094 gc.DrawRect(Rect()); 00095 00096 // Draw image info texts 00097 gc.UseFont(iFont); 00098 TBuf<KMaxInfoDescriptorLength> desc; 00099 TPoint point = Rect().iTl; 00100 point.iX += 10; 00101 for( TInt i=0; i<iInfoStrings->Count(); i++ ) 00102 { 00103 point.iY += 20; 00104 desc.Copy( iInfoStrings->String(i) ); 00105 gc.DrawText(desc,point); 00106 } 00107 } 00108 00109 00110 00111
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.