|
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 the License "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: Header file for CVcxViewMessageUtility.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef VCXVIEWMESSAGEUTILITY_H |
|
21 #define VCXVIEWMESSAGEUTILITY_H |
|
22 |
|
23 #include <coemain.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "mtvobserverutils.inl" |
|
27 |
|
28 /** |
|
29 * Abstract class for observing custom view messages. |
|
30 */ |
|
31 class MVcxViewMessageObserver |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Handles a custom view message. |
|
37 * @param aMessageUid UID for custom message |
|
38 * @param aCustomMessage Message contents |
|
39 */ |
|
40 virtual void HandleCustomViewMessageL( |
|
41 const TUid aMessageUid, const TDesC8 &aCustomMessage ) = 0; |
|
42 }; |
|
43 |
|
44 /** |
|
45 * Message sending component for MPX views. |
|
46 * Creates a singleton object that will be stored by CCoeEnv. |
|
47 */ |
|
48 class CVcxViewMessageUtility : public CCoeStatic |
|
49 { |
|
50 public: |
|
51 |
|
52 /** |
|
53 * First call initializes the singleton object. Subsequent calls return |
|
54 * created instance. |
|
55 * @return singleton object instance. |
|
56 */ |
|
57 IMPORT_C static CVcxViewMessageUtility* InstanceL(); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 IMPORT_C virtual ~CVcxViewMessageUtility(); |
|
63 |
|
64 /** |
|
65 * Add observer. |
|
66 * @param aObserver Observer. |
|
67 */ |
|
68 IMPORT_C void AddObserverL( MVcxViewMessageObserver& aObserver ); |
|
69 |
|
70 /** |
|
71 * Remove observer. |
|
72 * @param aObserver Observer. |
|
73 */ |
|
74 IMPORT_C void RemoveObserver( MVcxViewMessageObserver& aObserver ); |
|
75 |
|
76 /** |
|
77 * Sends message to all registered observers. |
|
78 * @param aMessageUid UID for custom message |
|
79 * @param aCustomMessage Message contents |
|
80 */ |
|
81 IMPORT_C void SendCustomViewMessageL( |
|
82 const TUid aMessageUid, const TDesC8 &aCustomMessage ); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * Default constructor is private because this class is a singleton. |
|
88 */ |
|
89 CVcxViewMessageUtility(); |
|
90 |
|
91 private: // Data |
|
92 |
|
93 /** |
|
94 * Observer array. |
|
95 */ |
|
96 MtvObserverUtils::RObserverData<MVcxViewMessageObserver> iObservers; |
|
97 }; |
|
98 |
|
99 #endif // VCXVIEWMESSAGEUTILITY_H |
|
100 |