|
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: Subscribes properties from P&S |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MMPROPERTYSUBSCRIBER_H |
|
19 #define MMPROPERTYSUBSCRIBER_H |
|
20 |
|
21 #include <e32base.h> // For CActive, link against: euser.lib |
|
22 #include <e32property.h> |
|
23 // Observer for property change. Currently integer value supported |
|
24 class MMmPropertyChangeObserver |
|
25 { |
|
26 public: |
|
27 virtual void PropertyChangedL(TInt aValue)=0; |
|
28 }; |
|
29 |
|
30 /** |
|
31 * Subcribes property from P&S and listen property changes |
|
32 * |
|
33 * @lib xn3layoutengine.lib |
|
34 * @since Series 60 5.0 |
|
35 */ |
|
36 NONSHARABLE_CLASS( CMmPropertySubscriber ) : public CActive |
|
37 { |
|
38 public: |
|
39 // Cancel and destroy |
|
40 ~CMmPropertySubscriber(); |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @param aUid P&S property category |
|
45 * @param aKey P&S property key |
|
46 * @param aObserver Given property change observer |
|
47 */ |
|
48 static CMmPropertySubscriber* NewL( |
|
49 const TUid aUid, |
|
50 const TUint32 aKey, |
|
51 MMmPropertyChangeObserver& aObserver); |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * @param aUid P&S property category |
|
56 * @param aKey P&S property key |
|
57 * @param aObserver Given property change observer |
|
58 */ |
|
59 static CMmPropertySubscriber* NewLC( |
|
60 const TUid aUid, |
|
61 const TUint32 aKey, |
|
62 MMmPropertyChangeObserver& aObserver); |
|
63 |
|
64 private: |
|
65 // C++ constructor |
|
66 CMmPropertySubscriber(MMmPropertyChangeObserver& aObserver); |
|
67 |
|
68 // Second-phase constructor |
|
69 void ConstructL(const TUid aUid,const TUint32 aKey); |
|
70 |
|
71 private: // From CActive |
|
72 // Handle completion |
|
73 void RunL(); |
|
74 |
|
75 // How to cancel me |
|
76 void DoCancel(); |
|
77 |
|
78 private: |
|
79 //Observer for property changes |
|
80 MMmPropertyChangeObserver& iPropertyChangeObserver; |
|
81 // Property to listen |
|
82 RProperty iProperty; |
|
83 }; |
|
84 |
|
85 #endif // MMPROPERTYSUBSCRIBER_H |