idlehomescreen/inc/xnpropertysubscriber.h
changeset 0 f72a12da539e
child 34 d05a55b217df
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:
       
    15 * Subscribes properties from P&S
       
    16  *
       
    17 */
       
    18 
       
    19 #ifndef XNPROPERTYSUBSCRIBER_H
       
    20 #define XNPROPERTYSUBSCRIBER_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 #include <e32property.h>
       
    25 
       
    26 // Class declaration
       
    27 /**
       
    28  * Observer for property change.
       
    29  */
       
    30 class MXnPropertyChangeObserver
       
    31     {
       
    32 public:
       
    33     /**
       
    34      * Property changed
       
    35      *
       
    36      * @since S60 5.1
       
    37      * @param aKey key value
       
    38      * @param aValue property value
       
    39      */
       
    40     virtual void PropertyChangedL( const TUint32 aKey, const TInt aValue ) = 0;
       
    41     };
       
    42 
       
    43 /**
       
    44  * Subcribes property from P&S and listen property changes
       
    45  *
       
    46  * @ingroup group_xnlayoutengine
       
    47  * @lib xn3layoutengine.lib
       
    48  * @since Series 60 5.0
       
    49  */
       
    50 NONSHARABLE_CLASS( CXnPropertySubscriber ) : public CActive
       
    51     {
       
    52 public:
       
    53     /**
       
    54      * Cancel and destroy
       
    55      */
       
    56     ~CXnPropertySubscriber();
       
    57 
       
    58     /**
       
    59     * Two-phased constructor.
       
    60     *
       
    61     * @param aUid P&S property category
       
    62     * @param aKey P&S property key
       
    63     * @param aObserver Given property change observer
       
    64     */
       
    65     static CXnPropertySubscriber* NewL(
       
    66         const TUid aUid,
       
    67         const TUint32 aKey,
       
    68         MXnPropertyChangeObserver& aObserver );
       
    69 
       
    70     /**
       
    71     * Two-phased constructor.
       
    72     *
       
    73     * @param aUid P&S property category
       
    74     * @param aKey P&S property key
       
    75     * @param aObserver Given property change observer
       
    76     */
       
    77     static CXnPropertySubscriber* NewLC(
       
    78         const TUid aUid,
       
    79         const TUint32 aKey,
       
    80         MXnPropertyChangeObserver& aObserver );
       
    81 
       
    82 private:
       
    83     /**
       
    84      * C++ constructor
       
    85      */
       
    86     CXnPropertySubscriber(
       
    87         MXnPropertyChangeObserver& aObserver,
       
    88         const TUint32 aKey );
       
    89 
       
    90     /**
       
    91      * Second-phase constructor
       
    92      */
       
    93     void ConstructL( const TUid aUid, const TUint32 aKey );
       
    94 
       
    95 private:
       
    96     /**
       
    97      * From CActive.
       
    98      * Handle completion
       
    99      */
       
   100     void RunL();
       
   101 
       
   102     /**
       
   103      * From CActive.
       
   104      * How to cancel me
       
   105      */
       
   106     void DoCancel();
       
   107 
       
   108 private:
       
   109     // Data
       
   110 
       
   111     /**
       
   112      * Observer for property changes.
       
   113      * Not own
       
   114      */
       
   115     MXnPropertyChangeObserver& iPropertyChangeObserver;
       
   116 
       
   117     /**
       
   118      * Property to listen
       
   119      */
       
   120     RProperty iProperty;
       
   121 
       
   122     /**
       
   123      * P&S property key
       
   124      */
       
   125     TUint32 iKey;
       
   126     };
       
   127 
       
   128 #endif