tvout/tvoutengine/inc/glxtv.h
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:    Handles & propogates UI state change notifications.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  * @internal reviewed 24/08/2007 by D Holland
       
    22  */
       
    23 
       
    24 #ifndef __GLXTV_H__
       
    25 #define __GLXTV_H__
       
    26 
       
    27 // External Includes
       
    28 #include <e32def.h>
       
    29 #include <e32base.h>
       
    30 
       
    31 // Internal Includes
       
    32 #include <glxtvconstants.h>
       
    33 
       
    34 // Forward Declarations
       
    35 class MGlxTvObserver;
       
    36 class CGlxWindowVisibilityMonitor;
       
    37 class CGlxTvConnectionMonitor;
       
    38 class CRepository;
       
    39 
       
    40 // For window server visibility notifications 
       
    41 class MGlxWindowVisibilityObserver
       
    42     {
       
    43 public:
       
    44     /**
       
    45      * Handle changes to the application window visiblity
       
    46      * Called when window visible state changes
       
    47      * @param aChangeType The visibility change type
       
    48      */
       
    49     virtual void HandleWindowVisibilityChangedL( TTvChangeType aChangeType ) = 0;
       
    50     };
       
    51         
       
    52         
       
    53         
       
    54 // For Tv connection notification
       
    55 class MGlxTvConnectionObserver
       
    56     {
       
    57 public:
       
    58     /**
       
    59      * Handle TV connection state changes
       
    60      */
       
    61     virtual void HandleTvConnectionStatusChangedL( ) = 0;
       
    62     };
       
    63         
       
    64         
       
    65         
       
    66         
       
    67 /**
       
    68  * Class Description
       
    69  * A class that handles and propagates UI change notifications
       
    70  * @author Loughlin
       
    71  */        
       
    72 NONSHARABLE_CLASS (CGlxTv) : public CBase,
       
    73                              public MGlxWindowVisibilityObserver,
       
    74                              public MGlxTvConnectionObserver
       
    75     {
       
    76 public:
       
    77     /**
       
    78      * Static Symbian 2 stage constructor.
       
    79      * @param a TvObserver
       
    80      */
       
    81     IMPORT_C static CGlxTv* NewL( MGlxTvObserver& aTvObserver );
       
    82     
       
    83     /**
       
    84      * Destructor.
       
    85      */
       
    86     IMPORT_C ~CGlxTv();
       
    87     
       
    88 private:
       
    89 
       
    90     /**
       
    91      * Standard C++ constructor
       
    92      * @param a TvObserver     
       
    93      */
       
    94     CGlxTv(MGlxTvObserver& aTvObserver);
       
    95     
       
    96     /*
       
    97      * Symbian second stage construction
       
    98      */
       
    99     void ConstructL(); 
       
   100    
       
   101 public: // class public method   
       
   102    
       
   103     /**
       
   104      * Get the current screen size
       
   105      * @return the Screen size in pixels
       
   106      */
       
   107     IMPORT_C TSize ScreenSizeL() const;
       
   108    
       
   109     /**
       
   110      * Is the Analog TV Connected
       
   111      * @return ETrue if active, otherwise EFalse
       
   112      */
       
   113     IMPORT_C TBool IsConnected() const; 
       
   114     
       
   115     /**
       
   116      * Is the TV widescreen
       
   117      * @return ETrue if widescreen, otherwise EFalse
       
   118      */
       
   119     IMPORT_C TBool IsWidescreen() const; 
       
   120     
       
   121     /**
       
   122      * Is the HDMI TV Connected
       
   123      * @return ETrue if active, otherwise EFalse
       
   124      */
       
   125     IMPORT_C TBool IsHDMIConnected() const;
       
   126     
       
   127 public: // from MGlxWindowVisibilityObserver
       
   128     /**
       
   129      * @ref MGlxWindowVisibilityObserver::HandleWindowVisibilityChangedL
       
   130      */
       
   131     void HandleWindowVisibilityChangedL( TTvChangeType aChangeType );
       
   132     
       
   133                                 
       
   134 public: // from MGlxTvConnectionObserver
       
   135     /**
       
   136      * @ref MGlxTvConnectionObserver::HandleTvConnectionStatusChangedL
       
   137      */
       
   138     void HandleTvConnectionStatusChangedL( );
       
   139     
       
   140 private: // new private methods
       
   141     /**
       
   142      * Retrive the TV Display Aspect Ratio and TV Setting
       
   143      * Calculate the screen size from aspect ratio and TV type
       
   144      */    
       
   145     void CalcTvScreenSzL();
       
   146 
       
   147     /**
       
   148      * Start monitoring the environment for changes to the TV aspect ratio
       
   149      * and the Gallery window groups visiblity 
       
   150      */        
       
   151     void MonitorEnvironmentL();
       
   152 
       
   153     /**
       
   154      * Stop monitoring the environment for changes to the TV aspect ratio
       
   155      * and the Gallery window groups visiblity 
       
   156      */      
       
   157     void StopMonitoringEnvironment();
       
   158     
       
   159 private: // class member data    
       
   160     // Not Owned: The TV out observer 
       
   161     MGlxTvObserver& iTvObserver;
       
   162 
       
   163     // Owned: The Window visibility monitor
       
   164     CGlxWindowVisibilityMonitor* iWindowVisibilityMonitor;
       
   165 
       
   166     // Owned: The TV connection monitor
       
   167     CGlxTvConnectionMonitor* iTvConnectionMonitor;
       
   168  
       
   169     // Size of the TV Out display size
       
   170     TSize iSzInPixels;
       
   171     
       
   172     // Owned: The central repository where TV display ratio is held.
       
   173     CRepository* iCenRep;
       
   174     
       
   175      // The implementation of the class, hidden from clients
       
   176 	class CGlxTvOutCenRepMonitor;
       
   177 	
       
   178 	// Owned: Monitoring class for Tv Ratio Values
       
   179 	CGlxTvOutCenRepMonitor* iTvDisplayAspectRatioMonitor; 
       
   180 	
       
   181 	// The TV aspect ratio
       
   182 	TInt iAspectRatio;
       
   183     };
       
   184     
       
   185     
       
   186 #endif // __GLXTV_H__