graphicstest/graphicstestharness/src/apgrfxfacade.cpp
changeset 103 2717213c588a
equal deleted inserted replaced
98:bf7481649c98 103:2717213c588a
       
     1 // Copyright (c) 2010 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 // Provide an alternative to the apgrfx to avoid a dependency on middleware
       
    15 
       
    16 #include "apgrfxfacade.h"
       
    17 
       
    18 TApaTaskFacade::TApaTaskFacade(RWsSession& aSession) :
       
    19     iSession(aSession), iWgId(0)
       
    20     {
       
    21     }
       
    22 
       
    23 TApaTaskFacade::~TApaTaskFacade()
       
    24     {
       
    25     }
       
    26 
       
    27 TApaTaskFacade::TApaTaskFacade(const TApaTaskFacade& aTaskFacade) :
       
    28 	iSession(aTaskFacade.iSession), iWgId(aTaskFacade.iWgId)
       
    29 	{
       
    30 	}
       
    31 
       
    32 void TApaTaskFacade::BringToForeground()
       
    33     {
       
    34     iSession.SetWindowGroupOrdinalPosition(iWgId, 0);
       
    35     }
       
    36 
       
    37 void TApaTaskFacade::SetWgId(TInt aWgId)
       
    38     {
       
    39     iWgId = aWgId;
       
    40     }
       
    41 
       
    42 TApaTaskListFacade::TApaTaskListFacade(RWsSession& aSession) :
       
    43     iSession(aSession)
       
    44     {
       
    45     }
       
    46 
       
    47 TApaTaskListFacade::~TApaTaskListFacade()
       
    48     {
       
    49     }
       
    50 
       
    51 TApaTaskFacade TApaTaskListFacade::FindByPos(TInt aPos)
       
    52 	{
       
    53 	TApaTaskFacade task(iSession);
       
    54 	TRAP_IGNORE(FindByPosL(task, aPos));
       
    55 	return task;
       
    56 	}
       
    57 
       
    58 void TApaTaskListFacade::FindByPosL(TApaTaskFacade& aTask,TInt aPos)
       
    59     {
       
    60     TInt wgId;
       
    61     const TInt windowGroups=iSession.NumWindowGroups(0);
       
    62     if (aPos < 0 || windowGroups < 0 || aPos > windowGroups)
       
    63         {
       
    64         wgId = 0;
       
    65         }
       
    66     else
       
    67         {
       
    68         CArrayFixFlat<TInt>* wgIdArray=new(ELeave) CArrayFixFlat<TInt>(windowGroups);
       
    69         CleanupStack::PushL(wgIdArray);
       
    70         User::LeaveIfError(iSession.WindowGroupList(0, wgIdArray));
       
    71         wgId=(*wgIdArray)[aPos];
       
    72         CleanupStack::PopAndDestroy(1);
       
    73         }
       
    74     aTask.SetWgId(wgId);
       
    75     }