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