idlehomescreen/inc/xnpropertysubscriber.h
branchRCL_3
changeset 83 5456b4e8b3a8
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     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      * Handles an active object's request completion event.
       
    98      * 
       
    99      * @see CActive::RunL
       
   100      */
       
   101     void RunL();
       
   102 
       
   103     /**
       
   104      * Implements cancellation of an outstanding request.
       
   105      * 
       
   106      * @see CActive::DoCancel
       
   107      */
       
   108     void DoCancel();
       
   109 
       
   110     /**
       
   111      * RunError
       
   112      * 
       
   113      * @see CActive::RunError
       
   114      */
       
   115     TInt RunError(TInt aError);
       
   116     
       
   117 private:
       
   118     // Data
       
   119 
       
   120     /**
       
   121      * Observer for property changes.
       
   122      * Not own
       
   123      */
       
   124     MXnPropertyChangeObserver& iPropertyChangeObserver;
       
   125 
       
   126     /**
       
   127      * Property to listen
       
   128      */
       
   129     RProperty iProperty;
       
   130 
       
   131     /**
       
   132      * P&S property key
       
   133      */
       
   134     TUint32 iKey;
       
   135     };
       
   136 
       
   137 #endif