photosgallery/viewframework/tvout/src/glxhdmicontainer.cpp
changeset 0 4e91876724a2
child 15 191387a8b767
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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 <AknFontAccess.h>
       
    19 #include <eikenv.h>
       
    20 #include <glxtracer.h>
       
    21 #include <glxlog.h>
       
    22 #include "glxhdmicontainer.h"
       
    23 const TInt KGroupNameLength = 32;
       
    24 // -----------------------------------------------------------------------------
       
    25 // NewLC
       
    26 // -----------------------------------------------------------------------------
       
    27 CGlxHdmiContainer* CGlxHdmiContainer::NewL(const TRect& aRect)
       
    28     {
       
    29     TRACER("CGlxHdmiContainer* CGlxHdmiContainer::NewL()");
       
    30     CGlxHdmiContainer* self = new (ELeave) CGlxHdmiContainer(aRect);
       
    31     CleanupStack::PushL(self);
       
    32     self->ConstructL();
       
    33     CleanupStack::Pop(self);
       
    34     return self;
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // destructor 
       
    39 // -----------------------------------------------------------------------------
       
    40 CGlxHdmiContainer::~CGlxHdmiContainer()
       
    41     {
       
    42     TRACER("CGlxHdmiContainer::~CGlxHdmiContainer()");
       
    43     iWsWindowGroup.Close();
       
    44     delete iWindowGc;
       
    45     delete iScreenDevice;
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CTor 
       
    50 // -----------------------------------------------------------------------------
       
    51 CGlxHdmiContainer::CGlxHdmiContainer(const TRect& aRect):
       
    52     iRect(aRect)
       
    53     {
       
    54     TRACER("CGlxHdmiContainer::CGlxHdmiContainer()");
       
    55     // Implement nothing here
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // ConstructL 
       
    60 // -----------------------------------------------------------------------------
       
    61 void CGlxHdmiContainer::ConstructL()
       
    62     {
       
    63     TRACER("CGlxHdmiContainer::ConstructL()");
       
    64     CreateHdmiWindowL();
       
    65     ActivateL();
       
    66     }
       
    67 
       
    68 // ----------------------------------------------------------
       
    69 // GetWindow()
       
    70 // ----------------------------------------------------------
       
    71 //
       
    72 RWindow* CGlxHdmiContainer::GetWindow()
       
    73     {
       
    74     TRACER("CGlxHdmiContainer::GetWindow()");
       
    75     return &Window();   
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CreateHdmiWindowL 
       
    80 // -----------------------------------------------------------------------------
       
    81 void CGlxHdmiContainer::CreateHdmiWindowL()
       
    82     {
       
    83     TRACER ("CGlxHdmiContainer::CreateHdmiWindowL()");
       
    84     const TUint32 id = 12345678;
       
    85     
       
    86     // Create screen device and gc
       
    87     iSession = ControlEnv()->WsSession();
       
    88     iScreenDevice = new(ELeave) CWsScreenDevice(iSession);
       
    89     User::LeaveIfError(iScreenDevice->Construct(1));        // use Screen 1
       
    90     User::LeaveIfError(iScreenDevice->CreateContext(iWindowGc));
       
    91     
       
    92     // Create window group
       
    93     iWsWindowGroup = RWindowGroup(iSession);
       
    94     User::LeaveIfError(iWsWindowGroup.Construct(id, iScreenDevice));
       
    95     iWsWindowGroup.SetOrdinalPosition(0);
       
    96     TBuf<KGroupNameLength> winGroupName(_L("PhotosHdmi"));
       
    97     iWsWindowGroup.SetName(winGroupName); 
       
    98     iWsWindowGroupID = iWsWindowGroup.Identifier();
       
    99 
       
   100     // Create window
       
   101     CreateWindowL(iWsWindowGroup);
       
   102     iWsWindow = Window();
       
   103     SetRect(TRect(iScreenDevice->SizeInPixels()));
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // ConstructL 
       
   108 // -----------------------------------------------------------------------------
       
   109 void CGlxHdmiContainer::Draw()
       
   110     {
       
   111     TRACER("CGlxHdmiContainer::Draw()");
       
   112     CWindowGc& gc = SystemGc();
       
   113     gc.DrawRect(iRect);
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // ConstructL 
       
   118 // -----------------------------------------------------------------------------
       
   119 void CGlxHdmiContainer::DoGenCallback()
       
   120     {
       
   121     TRACER("CGlxHdmiContainer::DoGenCallback()");
       
   122     DrawNow(); 
       
   123     }