uiacceltk/hitchcock/AlfHintPlugin/src/alfhintplugindrawer.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <ecom/implementationproxy.h>
       
    19 #include <s32mem.h> // for RDesReadStream
       
    20 #include "alfhintplugindrawer.h"
       
    21 #include <alfhintapi.h>
       
    22 
       
    23 LOCAL_C const TImplementationProxy KImplementationTable[] = 
       
    24     {
       
    25     // TODO: CHANGE ID
       
    26     IMPLEMENTATION_PROXY_ENTRY(CAlfHintGraphicDrawer::EImplUid, CAlfHintGraphicDrawer::CreateL),
       
    27     };
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // ImplementationGroupProxy
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    34     {
       
    35     aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy));
       
    36     return KImplementationTable;
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // CreateL
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CAlfHintGraphicDrawer* CAlfHintGraphicDrawer::CreateL()
       
    44     {
       
    45     return new(ELeave) CAlfHintGraphicDrawer;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CAlfHintGraphicDrawer
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CAlfHintGraphicDrawer::CAlfHintGraphicDrawer()
       
    53     {
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // ~CAlfHintGraphicDrawer
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CAlfHintGraphicDrawer::~CAlfHintGraphicDrawer()
       
    61     {
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // ConstructL
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 void CAlfHintGraphicDrawer::ConstructL(MWsGraphicDrawerEnvironment& aEnv, const TGraphicDrawerId& aId, 
       
    69                                 MWsClient& aOwner, const TDesC8& aData)
       
    70     {
       
    71     iEnv = &aEnv;
       
    72     BaseConstructL(aEnv, aId, aOwner);
       
    73     iHintApi = static_cast<MAlfHintObserver*>(aEnv.Screen(0)->ResolveObjectInterface( KAlfHintObjectInterface ) );
       
    74     /*RDesReadStream in(aData);
       
    75     TInt windowHandle = in.ReadInt32L();
       
    76 */
       
    77     User::LeaveIfError(ShareGlobally());
       
    78     }
       
    79     
       
    80 // ---------------------------------------------------------------------------
       
    81 // ResolveObjectInterface
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 TAny* CAlfHintGraphicDrawer::ResolveObjectInterface(TUint aTypeId)
       
    85     {
       
    86     switch(aTypeId)
       
    87         {
       
    88         default:
       
    89             return CWsGraphicDrawer::ResolveObjectInterface(aTypeId);
       
    90         }
       
    91     }   
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // DoDraw
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CAlfHintGraphicDrawer::DoDraw(MWsGc& aGc, const TRect& aRect, const TDesC8& aData) const
       
    98     {
       
    99     // read data
       
   100     TInt err = 0;
       
   101     TInt tag = KErrNotFound;
       
   102     TRect boundingRectangle(0,0,360,240);
       
   103     TInt layerId = 0;
       
   104     TInt extraParameters = 0;
       
   105     TRAP( err, 
       
   106     RDesReadStream in(aData);
       
   107     tag = in.ReadInt8L();
       
   108     extraParameters = in.ReadInt8L();
       
   109     in.ReadL((TUint8*)&boundingRectangle,sizeof(TRect));
       
   110     layerId = in.ReadInt32L();
       
   111     );
       
   112     
       
   113     if (iHintApi) 
       
   114         {
       
   115         if (!extraParameters)
       
   116             {
       
   117             iHintApi->InsertTagL( tag );
       
   118             }
       
   119         else
       
   120             {
       
   121             iHintApi->InsertTagL( tag, boundingRectangle, layerId );
       
   122             }
       
   123         }
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // HandleMessage
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CAlfHintGraphicDrawer::HandleMessage(const TDesC8& aData)
       
   131     {
       
   132     }
       
   133