os/graphics/graphicscomposition/surfaceupdate/tsrc/tredrawhandler.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "tredrawhandler.h"
    17 #include "twindows.h"
    18 #include <w32std.h>
    19 
    20 CTRedrawHandler::CTRedrawHandler(RWsSession& aWs) : CActive(EPriorityStandard),
    21 		iWs(aWs)
    22 	{
    23 	}
    24 	
    25 CTRedrawHandler::~CTRedrawHandler()
    26 	{
    27 	Cancel();
    28 	}
    29 
    30 void CTRedrawHandler::Start()
    31 	{
    32 	CActiveScheduler::Add(this);
    33 	iWs.RedrawReady(&iStatus);
    34 	SetActive();
    35 	}
    36 
    37 void CTRedrawHandler::RunL()
    38 	{
    39 	TWsRedrawEvent redraw;
    40 	iWs.GetRedraw(redraw);
    41 	
    42 	if (redraw.Handle())
    43 		{
    44 		if(redraw.Rect().IsEmpty())
    45 			{
    46 			User::Leave(KErrGeneral);
    47 			}
    48 		CTWindowTreeNode* node = reinterpret_cast<CTWindowTreeNode *>(redraw.Handle());
    49 		node->Redraw(redraw);
    50 		}
    51 		
    52 	iWs.RedrawReady(&iStatus);
    53 	SetActive();
    54 	}
    55 
    56 void CTRedrawHandler::DoCancel()
    57 	{
    58 	iWs.RedrawReadyCancel();
    59 	}
    60 
    61 TInt CTRedrawHandler::RunError(TInt aError)
    62 	{
    63 	return(aError);
    64 	}
    65