photosgallery/viewframework/tvout/inc/glxtv.h
changeset 0 4e91876724a2
child 4 57d388cc48c1
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:    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 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 public: // from MGlxWindowVisibilityObserver
       
   123     /**
       
   124      * @ref MGlxWindowVisibilityObserver::HandleWindowVisibilityChangedL
       
   125      */
       
   126     void HandleWindowVisibilityChangedL( TTvChangeType aChangeType );
       
   127     
       
   128                                 
       
   129 public: // from MGlxTvConnectionObserver
       
   130     /**
       
   131      * @ref MGlxTvConnectionObserver::HandleTvConnectionStatusChangedL
       
   132      */
       
   133     void HandleTvConnectionStatusChangedL( );
       
   134     
       
   135 private: // new private methods
       
   136     /**
       
   137      * Retrive the TV Display Aspect Ratio and TV Setting
       
   138      * Calculate the screen size from aspect ratio and TV type
       
   139      */    
       
   140     void CalcTvScreenSzL();
       
   141 
       
   142     /**
       
   143      * Start monitoring the environment for changes to the TV aspect ratio
       
   144      * and the Gallery window groups visiblity 
       
   145      */        
       
   146     void MonitorEnvironmentL();
       
   147 
       
   148     /**
       
   149      * Stop monitoring the environment for changes to the TV aspect ratio
       
   150      * and the Gallery window groups visiblity 
       
   151      */      
       
   152     void StopMonitoringEnvironment();
       
   153     
       
   154 private: // class member data    
       
   155     // Not Owned: The TV out observer 
       
   156     MGlxTvObserver& iTvObserver;
       
   157 
       
   158     // Owned: The Window visibility monitor
       
   159     CGlxWindowVisibilityMonitor* iWindowVisibilityMonitor;
       
   160 
       
   161     // Owned: The TV connection monitor
       
   162     CGlxTvConnectionMonitor* iTvConnectionMonitor;
       
   163  
       
   164     // Size of the TV Out display size
       
   165     TSize iSzInPixels;
       
   166     
       
   167     // Owned: The central repository where TV display ratio is held.
       
   168     CRepository* iCenRep;
       
   169     
       
   170      // The implementation of the class, hidden from clients
       
   171 	class CGlxTvOutCenRepMonitor;
       
   172 	
       
   173 	// Owned: Monitoring class for Tv Ratio Values
       
   174 	CGlxTvOutCenRepMonitor* iTvDisplayAspectRatioMonitor; 
       
   175 	
       
   176 	// The TV aspect ratio
       
   177 	TInt iAspectRatio;
       
   178     };
       
   179     
       
   180     
       
   181 #endif // __GLXTV_H__