uifw/AvKon/src/aknAnimGc.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Anim Gc
       
    15 *
       
    16 */
       
    17 
       
    18 // AknAnimGc.CPP
       
    19 //
       
    20 // Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
       
    21 //
       
    22 
       
    23 // Animation View Redirection GC
       
    24 
       
    25 
       
    26 #include "aknAnimGc.h"
       
    27 
       
    28 
       
    29 CAknAnimatedGc* CAknAnimatedGc::NewL(CWindowGc& aOldGc, CFbsBitGc& aReGc)
       
    30 	{
       
    31 	CWsScreenDevice* screen = new(ELeave)CWsScreenDevice();
       
    32 	CleanupStack::PushL(screen);
       
    33 	CAknAnimatedGc* self = new(ELeave)CAknAnimatedGc(*screen, aReGc, aOldGc);
       
    34 	self->SetScreenDevice(screen);
       
    35 	CleanupStack::Pop();
       
    36 	return self;
       
    37 	}
       
    38 
       
    39 CAknAnimatedGc::CAknAnimatedGc(CWsScreenDevice& aScreen, CFbsBitGc& aReGc, CWindowGc& aOldGc)
       
    40 :CWindowGc(&aScreen), iReGc(aReGc), iOldGc(aOldGc)
       
    41 	{
       
    42 	}
       
    43 
       
    44 
       
    45 CAknAnimatedGc::~CAknAnimatedGc()
       
    46 	{	
       
    47 	// Delete the CWsScreenDevice used by this object
       
    48 	delete iScreen;
       
    49 	}
       
    50 
       
    51 void CAknAnimatedGc::SetRootWindow(const RWindowTreeNode& aRootWin)
       
    52 	{
       
    53 	iRootWin = &aRootWin;
       
    54 	}
       
    55 
       
    56 EXPORT_C void CAknAnimatedGc::Activate(RDrawableWindow& aWindow)
       
    57 	{
       
    58 	TPoint pos = aWindow.InquireOffset(*iRootWin);
       
    59 	iOrigin = pos;
       
    60 	}
       
    61 
       
    62 EXPORT_C void CAknAnimatedGc::Deactivate()
       
    63 	{
       
    64 	}
       
    65 
       
    66 EXPORT_C void CAknAnimatedGc::Reset()
       
    67 	{
       
    68 	iReGc.Reset();
       
    69 	}
       
    70 
       
    71 EXPORT_C CGraphicsDevice* CAknAnimatedGc::Device() const
       
    72 	{
       
    73 	return iReGc.Device();
       
    74 	}
       
    75 
       
    76 
       
    77 EXPORT_C void CAknAnimatedGc::SetOrigin(const TPoint &aPos)
       
    78 	{
       
    79 	iReGc.SetOrigin(aPos);
       
    80 	}
       
    81 
       
    82 EXPORT_C void CAknAnimatedGc::SetDrawMode(TDrawMode aDrawingMode)
       
    83 	{
       
    84 	iReGc.SetDrawMode(aDrawingMode);
       
    85 	}
       
    86 
       
    87 EXPORT_C void CAknAnimatedGc::SetClippingRect(const TRect& aRect)
       
    88 	{
       
    89 	TRect rect(aRect);
       
    90 	rect.Move(iOrigin);
       
    91 	iReGc.SetClippingRect(rect);
       
    92 	}
       
    93 
       
    94 EXPORT_C void CAknAnimatedGc::CancelClippingRect()
       
    95 	{
       
    96 	iReGc.CancelClippingRect();
       
    97 	}
       
    98 
       
    99 EXPORT_C void CAknAnimatedGc::SetWordJustification(TInt aExcessWidth,TInt aNumGaps)
       
   100 	{
       
   101 	iReGc.SetWordJustification(aExcessWidth, aNumGaps);
       
   102 	}
       
   103 
       
   104 EXPORT_C void CAknAnimatedGc::SetCharJustification(TInt aExcessWidth,TInt aNumChars)
       
   105 	{
       
   106 	iReGc.SetCharJustification(aExcessWidth, aNumChars);
       
   107 	}
       
   108 
       
   109 
       
   110 EXPORT_C void CAknAnimatedGc::DrawText(const TDesC &aString,const TPoint &aPosition)
       
   111 	{
       
   112 	iReGc.DrawText(aString, aPosition+iOrigin);
       
   113 	}
       
   114 
       
   115 EXPORT_C void CAknAnimatedGc::DrawText(const TDesC &aString,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz,TInt aLeftMrg)
       
   116 	{
       
   117 	TRect box(aBox);
       
   118 	box.Move(iOrigin);
       
   119 	iReGc.DrawText(aString, box, aBaselineOffset, aHoriz, aLeftMrg);
       
   120 	}
       
   121 
       
   122 
       
   123 EXPORT_C void CAknAnimatedGc::Clear()
       
   124 	{
       
   125 	iReGc.Clear();
       
   126 	}
       
   127 
       
   128 EXPORT_C void CAknAnimatedGc::Clear(const TRect &aRect)
       
   129 	{
       
   130 	TRect rect(aRect);
       
   131 	rect.Move(iOrigin);
       
   132 	iReGc.Clear(rect);
       
   133 	}
       
   134 
       
   135 EXPORT_C void CAknAnimatedGc::SetBrushColor(const TRgb &aColor)
       
   136 	{
       
   137 	iReGc.SetBrushColor(aColor);
       
   138 	}
       
   139 
       
   140 EXPORT_C void CAknAnimatedGc::SetBrushStyle(TBrushStyle aBrushStyle)
       
   141 	{
       
   142 	iReGc.SetBrushStyle(aBrushStyle);
       
   143 	}
       
   144 
       
   145 
       
   146 EXPORT_C void CAknAnimatedGc::SetBrushOrigin(const TPoint &aOrigin)
       
   147 	{
       
   148 	iReGc.SetBrushOrigin(aOrigin);
       
   149 	}
       
   150 
       
   151 EXPORT_C void CAknAnimatedGc::UseBrushPattern(const CFbsBitmap *aBitmap)
       
   152 	{
       
   153 	iReGc.UseBrushPattern(aBitmap);
       
   154 	}
       
   155 
       
   156 EXPORT_C void CAknAnimatedGc::DiscardBrushPattern()
       
   157 	{
       
   158 	iReGc.DiscardBrushPattern();
       
   159 	}
       
   160 
       
   161 
       
   162 EXPORT_C void CAknAnimatedGc::SetPenColor(const TRgb &aColor)
       
   163 	{
       
   164 	iReGc.SetPenColor(aColor);
       
   165 	}
       
   166 
       
   167 EXPORT_C void CAknAnimatedGc::SetPenStyle(TPenStyle aPenStyle)
       
   168 	{
       
   169 	iReGc.SetPenStyle(aPenStyle);
       
   170 	}
       
   171 
       
   172 EXPORT_C void CAknAnimatedGc::SetPenSize(const TSize& aSize)
       
   173 	{
       
   174 	iReGc.SetPenSize(aSize);
       
   175 	}
       
   176 
       
   177 
       
   178 EXPORT_C void CAknAnimatedGc::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)
       
   179 	{
       
   180 	iReGc.SetStrikethroughStyle(aStrikethroughStyle);
       
   181 	}
       
   182 
       
   183 EXPORT_C void CAknAnimatedGc::SetUnderlineStyle(TFontUnderline aUnderlineStyle)
       
   184 	{
       
   185 	iReGc.SetUnderlineStyle(aUnderlineStyle);
       
   186 	}
       
   187 
       
   188 EXPORT_C void CAknAnimatedGc::UseFont(const CFont *aFont)
       
   189 	{
       
   190 	iReGc.UseFont(aFont);
       
   191 	}
       
   192 
       
   193 EXPORT_C void CAknAnimatedGc::DiscardFont()
       
   194 	{
       
   195 	iReGc.DiscardFont();
       
   196 	}
       
   197 
       
   198 
       
   199 
       
   200 EXPORT_C void CAknAnimatedGc::MoveTo(const TPoint &aPoint)
       
   201 	{
       
   202 	TPoint point = iOrigin + aPoint;
       
   203 	iReGc.MoveTo(point);
       
   204 	}
       
   205 
       
   206 EXPORT_C void CAknAnimatedGc::MoveBy(const TPoint &aVector)
       
   207 	{
       
   208 	iReGc.MoveBy(aVector);
       
   209 	}
       
   210 
       
   211 EXPORT_C void CAknAnimatedGc::Plot(const TPoint &aPoint)
       
   212 	{
       
   213 	TPoint point = iOrigin + aPoint;
       
   214 	iReGc.Plot(point);
       
   215 	}
       
   216 
       
   217 EXPORT_C void CAknAnimatedGc::DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
       
   218 	{
       
   219 	TRect rect = aRect;
       
   220 	rect.Move(iOrigin);
       
   221 	iReGc.DrawArc(rect, aStart+iOrigin, aEnd+iOrigin);
       
   222 	}
       
   223 
       
   224 EXPORT_C void CAknAnimatedGc::DrawLine(const TPoint &aPoint1,const TPoint &aPoint2)
       
   225 	{
       
   226 	iReGc.DrawLine(aPoint1+iOrigin, aPoint2+iOrigin);
       
   227 	}
       
   228 
       
   229 
       
   230 EXPORT_C void CAknAnimatedGc::DrawLineTo(const TPoint &aPoint)
       
   231 	{
       
   232 	iReGc.DrawLineTo(aPoint+iOrigin);
       
   233 	}
       
   234 
       
   235 EXPORT_C void CAknAnimatedGc::DrawLineBy(const TPoint &aVector)
       
   236 	{
       
   237 	iReGc.DrawLineBy(aVector);
       
   238 	}
       
   239 
       
   240 EXPORT_C void CAknAnimatedGc::DrawPolyLine(const CArrayFix<TPoint> *aPointList)
       
   241 	{
       
   242 	iReGc.DrawPolyLine(aPointList);
       
   243 	}
       
   244 
       
   245 EXPORT_C void CAknAnimatedGc::DrawPolyLine(const TPoint* aPointList,TInt aNumPoints)
       
   246 	{
       
   247 	iReGc.DrawPolyLine(aPointList, aNumPoints);
       
   248 	}
       
   249 
       
   250 
       
   251 EXPORT_C void CAknAnimatedGc::DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
       
   252 	{
       
   253 	TRect rect = aRect;
       
   254 	rect.Move(iOrigin);
       
   255 	iReGc.DrawPie(rect, aStart+iOrigin, aEnd+iOrigin);
       
   256 	}
       
   257 
       
   258 EXPORT_C void CAknAnimatedGc::DrawEllipse(const TRect &aRect)
       
   259 	{
       
   260 	TRect rect = aRect;
       
   261 	rect.Move(iOrigin);
       
   262 	iReGc.DrawEllipse(rect);
       
   263 	}
       
   264 
       
   265 EXPORT_C void CAknAnimatedGc::DrawRect(const TRect &aRect)
       
   266 	{
       
   267 	TRect rect(aRect);
       
   268 	rect.Move(iOrigin);
       
   269 	iReGc.DrawRect(rect);
       
   270 	}
       
   271 	
       
   272 EXPORT_C void CAknAnimatedGc::DrawRoundRect(const TRect &aRect,const TSize &aEllipse)
       
   273 	{
       
   274 	TRect rect(aRect);
       
   275 	rect.Move(iOrigin);
       
   276 	iReGc.DrawRoundRect(rect, aEllipse);
       
   277 	}
       
   278 
       
   279 EXPORT_C TInt CAknAnimatedGc::DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule)
       
   280 	{
       
   281 	return iReGc.DrawPolygon(aPointList,aFillRule);
       
   282 	}
       
   283 
       
   284 EXPORT_C TInt CAknAnimatedGc::DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule)
       
   285 	{
       
   286 	return iReGc.DrawPolygon(aPointList, aNumPoints, aFillRule);
       
   287 	}
       
   288 
       
   289 
       
   290 
       
   291 EXPORT_C void CAknAnimatedGc::DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aSource)
       
   292 	{
       
   293 	iReGc.DrawBitmap(iOrigin + aTopLeft, aSource);
       
   294 	}
       
   295 
       
   296 EXPORT_C void CAknAnimatedGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource)
       
   297 	{
       
   298 	TRect rect(aDestRect);
       
   299 	rect.Move(iOrigin);
       
   300 	iReGc.DrawBitmap(rect, aSource);
       
   301 	}
       
   302 
       
   303 EXPORT_C void CAknAnimatedGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource, const TRect &aSourceRect)
       
   304 	{
       
   305 	TRect rect(aDestRect);
       
   306 	rect.Move(iOrigin);
       
   307 	iReGc.DrawBitmap(rect, aSource, aSourceRect);
       
   308 	}
       
   309 
       
   310 
       
   311 
       
   312 EXPORT_C void CAknAnimatedGc::CopyRect(const TPoint &aOffset,const TRect &aRect)
       
   313 	{
       
   314 	TRect rect(aRect);
       
   315 	rect.Move(iOrigin);
       
   316 	iReGc.CopyRect(aOffset + iOrigin, rect);
       
   317 	}
       
   318 
       
   319 EXPORT_C void CAknAnimatedGc::MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards)
       
   320 	{
       
   321 	TRect rect(aRect);
       
   322 	rect.Move(iOrigin);
       
   323 	iReGc.MapColors(rect, aColors, aNumPairs, aMapForwards);
       
   324 	}
       
   325 
       
   326 
       
   327 
       
   328 
       
   329 
       
   330 EXPORT_C void CAknAnimatedGc::BitBlt(const TPoint &aPos, const CFbsBitmap *aDevice)
       
   331 	{
       
   332 	iReGc.BitBlt(aPos+iOrigin, aDevice);
       
   333 	}
       
   334 
       
   335 EXPORT_C void CAknAnimatedGc::BitBlt(const TPoint &aPos, const CFbsBitmap *aDevice, const TRect &aRect)
       
   336 	{
       
   337 	iReGc.BitBlt(aPos+iOrigin, aDevice, aRect);
       
   338 	}
       
   339 
       
   340 EXPORT_C void CAknAnimatedGc::BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)
       
   341 	{
       
   342 	iReGc.BitBltMasked(aPoint+iOrigin, aBitmap, aSourceRect, aMaskBitmap, aInvertMask);
       
   343 	}
       
   344 
       
   345 EXPORT_C void CAknAnimatedGc::BitBlt(const TPoint &aPos, const CWsBitmap *aDevice)
       
   346 	{
       
   347 	iReGc.BitBlt(aPos+iOrigin, aDevice);
       
   348 	}
       
   349 
       
   350 EXPORT_C void CAknAnimatedGc::BitBlt(const TPoint &aPos, const CWsBitmap *aDevice, const TRect &aRect)
       
   351 	{
       
   352 	iReGc.BitBlt(aPos+iOrigin, aDevice, aRect);
       
   353 	}
       
   354 
       
   355 EXPORT_C void CAknAnimatedGc::BitBltMasked(const TPoint& aPoint,const CWsBitmap *aBitmap,const TRect& aSourceRect,const CWsBitmap *aMaskBitmap,TBool aInvertMask)
       
   356 	{
       
   357 	iReGc.BitBltMasked(aPoint+iOrigin, aBitmap, aSourceRect, aMaskBitmap, aInvertMask);
       
   358 	}
       
   359 
       
   360 
       
   361 EXPORT_C void CAknAnimatedGc::DrawTextVertical(const TDesC& aText,const TPoint& aPosition,TBool aUp)
       
   362 	{
       
   363 	iReGc.DrawTextVertical(aText, aPosition + iOrigin, aUp);
       
   364 	}
       
   365 
       
   366 EXPORT_C void CAknAnimatedGc::DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert,TInt aMargin)
       
   367 	{
       
   368 	TRect box(aBox);
       
   369 	box.Move(iOrigin);
       
   370 	iReGc.DrawTextVertical(aText, box, aBaselineOffset, aUp, aVert, aMargin);
       
   371 	}
       
   372 
       
   373 EXPORT_C void CAknAnimatedGc::SetDitherOrigin(const TPoint& aPoint)
       
   374 	{
       
   375 	iReGc.SetDitherOrigin(aPoint + iOrigin);
       
   376 	}
       
   377 
       
   378 EXPORT_C TInt CAknAnimatedGc::SetClippingRegion(const TRegion &aClippingRegion)
       
   379 	{
       
   380 	RRegion region;
       
   381 	region.Copy(aClippingRegion);
       
   382 	region.Offset(iOrigin);
       
   383 	iReGc.SetClippingRegion(&region);
       
   384 	return KErrNone;
       
   385 	}
       
   386 
       
   387 EXPORT_C void CAknAnimatedGc::CancelClippingRegion()
       
   388 	{
       
   389 	iReGc.CancelClippingRegion();
       
   390 	}
       
   391 
       
   392 EXPORT_C void CAknAnimatedGc::SetFaded(TBool /*aFaded*/)
       
   393 	{
       
   394 	}
       
   395 
       
   396 EXPORT_C void CAknAnimatedGc::SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap)
       
   397 	{
       
   398 	iReGc.SetFadingParameters(aBlackMap, aWhiteMap);
       
   399 	}
       
   400 
       
   401 void CAknAnimatedGc::SetScreenDevice(const CWsScreenDevice* aScreen)
       
   402 	{
       
   403 	iScreen = aScreen;
       
   404 	}
       
   405 
       
   406 // End of File