First public contribution.
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * TestPicture.cpp test picture.
20 #include "TestPicture.h"
22 CTestPicture::CTestPicture()
24 iLineBreaksAllowed[0] = ETrue;
25 iLineBreaksAllowed[1] = ETrue;
26 iLineBreaksAllowed[2] = ETrue;
27 iLineBreaksAllowed[3] = ETrue;
28 iSizeInTwips.iWidth = 100;
29 iSizeInTwips.iHeight = 100;
33 void CTestPicture::Draw(CGraphicsContext& aGc, const TPoint& aTopLeft,
34 const TRect& aClipRect, MGraphicsDeviceMap* aMap) const
37 aGc.SetClippingRect(aClipRect);
39 GetSizeInPixels(aMap,size);
42 box.iBr.iX=aTopLeft.iX+size.iWidth;
43 box.iBr.iY=aTopLeft.iY+size.iHeight;
45 aGc.SetBrushColor(red);
46 aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
52 @param aStream No effect.
55 void CTestPicture::ExternalizeL(RWriteStream& /*aStream*/) const
60 Returns size of picture.
62 Returns size of picture.
65 void CTestPicture::GetOriginalSizeInTwips(TSize& aSize) const
71 Returns information supplied by SetLineBreaksAllowed.
74 @param aBeforePicture As CPicture.
75 @param aHaveSpaces As CPicture.
76 @return TBool if line breaks are allowed.
79 TBool CTestPicture::LineBreakPossible(TUint /*aClass*/,
80 TBool aBeforePicture, TBool aHaveSpaces) const
82 TInt index = aBeforePicture? 0 : 2;
83 index += aHaveSpaces? 1 : 0;
84 return iLineBreaksAllowed[index];
88 Set whether LineBreakPossible should return ETrue.
89 @param aBeforeWithoutSpaces
90 Sets the result of LineBreakPossible(*, ETrue, EFalse);
91 @param aBeforeWithSpaces
92 Sets the result of LineBreakPossible(*, ETrue, ETrue);
93 @param aAfterWithoutSpaces
94 Sets the result of LineBreakPossible(*, EFalse, EFalse);
95 @param aAfterWithSpaces
96 Sets the result of LineBreakPossible(*, EFalse, ETrue);
99 void CTestPicture::SetLineBreaksAllowed(
100 TBool aBeforeWithoutSpaces,
101 TBool aBeforeWithSpaces,
102 TBool aAfterWithoutSpaces,
103 TBool aAfterWithSpaces)
105 iLineBreaksAllowed[0] = aBeforeWithoutSpaces;
106 iLineBreaksAllowed[1] = aBeforeWithSpaces;
107 iLineBreaksAllowed[2] = aAfterWithoutSpaces;
108 iLineBreaksAllowed[3] = aAfterWithSpaces;
112 Sets the picture size.
117 void CTestPicture::SetSizeInTwips(TSize aSize)
119 iSizeInTwips = aSize;
123 Sets the picture size so that the graphics device map aMap will convert to
125 @param aSize The size to set.
126 @param aMap The graphics device in which aSize should be the size in pixels.
129 void CTestPicture::SetSizeInPixels(TSize aSize, const MGraphicsDeviceMap& aMap)
131 iSizeInTwips.iWidth = aMap.HorizontalTwipsToPixels(aSize.iWidth);
132 iSizeInTwips.iHeight = aMap.VerticalTwipsToPixels(aSize.iHeight);