|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================ 00003 * Name : CMyPicture from MyPicture.cpp 00004 * Part of : RichTextEditor 00005 * Created : 05/08/2006 by Forum Nokia 00006 * Version : 2.0 00007 * 00008 * Copyright (c) 2006 - 2007 Nokia Corporation. 00009 * This material, including documentation and any related 00010 * computer programs, is protected by copyright controlled by 00011 * Nokia Corporation. 00012 * ============================================================================ 00013 */ 00014 00015 // INCLUDE FILES 00016 #include "MyPicture.h" 00017 #include <fbs.h> 00018 00019 // --------------------------------------------------------- 00020 // Constructor 00021 // --------------------------------------------------------- 00022 // 00023 CMyPicture::CMyPicture( TSize aSize, CFbsBitmap& aBitmap ) 00024 : iSizeInTwips(aSize), iBitmap(&aBitmap) 00025 { 00026 } 00027 00028 // --------------------------------------------------------- 00029 // LineBreakPossible() 00030 // --------------------------------------------------------- 00031 // 00032 TBool CMyPicture::LineBreakPossible( TUint /*aClass*/, 00033 TBool /*aBeforePicture*/, 00034 TBool /*aHaveSpaces*/ ) const 00035 { 00036 return EFalse; 00037 } 00038 00039 // --------------------------------------------------------- 00040 // Draw() 00041 // --------------------------------------------------------- 00042 // 00043 void CMyPicture::Draw( CGraphicsContext& aGc, 00044 const TPoint& aTopLeft, 00045 const TRect& aClipRect, 00046 MGraphicsDeviceMap* aMap ) const 00047 { 00048 TRect bitmapRect=aMap->TwipsToPixels(TRect(TPoint(),iSizeInTwips)); 00049 bitmapRect.Move(aTopLeft); 00050 aGc.Reset(); 00051 aGc.SetClippingRect(aClipRect); 00052 aGc.DrawBitmap(bitmapRect, iBitmap); 00053 } 00054 00055 // --------------------------------------------------------- 00056 // ExternalizeL() 00057 // --------------------------------------------------------- 00058 // 00059 void CMyPicture::ExternalizeL( RWriteStream& /*aStream*/ ) const 00060 { 00061 // No implementation required 00062 } 00063 00064 // --------------------------------------------------------- 00065 // SetOriginalSizeInTwips() 00066 // --------------------------------------------------------- 00067 // 00068 void CMyPicture::SetOriginalSizeInTwips( TSize aSize ) 00069 { 00070 iSizeInTwips = aSize; 00071 } 00072 00073 // --------------------------------------------------------- 00074 // GetOriginalSizeInTwips() 00075 // --------------------------------------------------------- 00076 // 00077 void CMyPicture::GetOriginalSizeInTwips( TSize& aSize ) const 00078 { 00079 aSize = iSizeInTwips; 00080 } 00081 00082 //EOF
|
© Nokia 2009 |