idlehomescreen/xmluirendering/uiengine/inc/xnfocuscontrol.h
changeset 0 f72a12da539e
child 15 ff572dfe6d86
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Focus appearance drawer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _XNFOCUSCONTROL_H
       
    20 #define _XNFOCUSCONTROL_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 
       
    25 // User includes
       
    26 #include "xninactivitymonitor.h"
       
    27 
       
    28 // Forward declarations
       
    29 class CXnAppUiAdapter;
       
    30 class CWindowGc;
       
    31 
       
    32 /**
       
    33  * Focus appearance drawer
       
    34  * 
       
    35  * @ingroup group_xnlayoutengine
       
    36  * @lib xn3layoutengine.lib
       
    37  * @since S60 5.0
       
    38  */
       
    39 NONSHARABLE_CLASS( CXnFocusControl ) : public CBase,
       
    40     public MXnInactivityObserver
       
    41     {
       
    42 public:    
       
    43     // Constructors and destructor
       
    44     
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      */
       
    48     static CXnFocusControl* NewL( CXnAppUiAdapter& aAppUiAdapter );
       
    49 
       
    50     /**
       
    51      * Two-phased constructor. Leaving on stack
       
    52      */
       
    53     static CXnFocusControl* NewLC( CXnAppUiAdapter& aAppUiAdapter );
       
    54 
       
    55     /**
       
    56      * Destructor
       
    57      */
       
    58     ~CXnFocusControl();
       
    59 
       
    60 private:
       
    61     // private constructors
       
    62 
       
    63     /**
       
    64      * Leaving constructor
       
    65      */
       
    66     void ConstructL();
       
    67     
       
    68     /**
       
    69      * C++ default constructor
       
    70      */
       
    71     CXnFocusControl( CXnAppUiAdapter& aAppUiAdapter );
       
    72     
       
    73 private:
       
    74     // from MXnInactivityObserver
       
    75     
       
    76     /**
       
    77      * @see MXnInactivityObserver
       
    78      */
       
    79     void InactivityTimerExpired();
       
    80 
       
    81 public: 
       
    82     // new functions
       
    83     
       
    84     /**
       
    85      * Makes focus viisble
       
    86      * 
       
    87      * @since S60 5.0     
       
    88      * @param aVisible, ETrue visible, EFalse invisible
       
    89      */
       
    90     void MakeVisible( TBool aVisible );
       
    91 
       
    92     /**
       
    93      * Queries whether focus is visible
       
    94      * 
       
    95      * @since S60 5.0     
       
    96      * @return ETrue if focus visible, EFalse otherwise
       
    97      */    
       
    98     TBool IsVisible() const;
       
    99     
       
   100     /**
       
   101      * Draws the 1st state and 2nd state focus appearenace
       
   102      * 
       
   103      * @since S60 5.0
       
   104      * @param aRect Rect where to draw
       
   105      * @param aGc Context
       
   106      */
       
   107     void Draw( const TRect& aRect, CWindowGc& aGc ) const;
       
   108 
       
   109 private:
       
   110     // new functions
       
   111     
       
   112     void DoMakeVisibleL( TBool aVisible );
       
   113     
       
   114 private:
       
   115     // data
       
   116     
       
   117     /** AppUiAdapter, Not owned */
       
   118     CXnAppUiAdapter& iAppUiAdapter;
       
   119     /** Inactivity monitor, Owned */
       
   120     CXnInactivityMonitor* iMonitor;
       
   121     /** Flag to indicate whether it is allowed to show focus */
       
   122     TBool iVisible;
       
   123     /** Flag to indicate refusal */
       
   124     TBool iRefused;
       
   125     };
       
   126 
       
   127 #endif // _XNFOCUSCONTROL_H