|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-13D2B45C-3A2A-497A-8D6A-87BE34D1DE69" xml:lang="en"><title>Implement |
|
13 the observer functions</title><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
14 <context><p>An application can register as an observer of a view by implementing |
|
15 the following observer interfaces. Observers can register with the View Server |
|
16 as activation observers, deactivation observers or as generic observers.</p><table id="GUID-7159BD7C-6466-4CA8-9211-FD33273C9784"> |
|
17 <tgroup cols="3"><colspec colname="col1"/><colspec colname="col2"/><colspec colname="col3"/> |
|
18 <thead> |
|
19 <row> |
|
20 <entry valign="top"><p>Interface</p></entry> |
|
21 <entry valign="top"><p>Notification</p></entry> |
|
22 <entry valign="top"><p>Method to override</p></entry> |
|
23 </row> |
|
24 </thead> |
|
25 <tbody> |
|
26 <row> |
|
27 <entry><p><codeph>MCoeViewActivationObserver </codeph></p></entry> |
|
28 <entry><p>View activation notification for the specified view.</p></entry> |
|
29 <entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextActivation(TVwsViewId& aViewId, MCoeViewActivationObserver& aViewActivationObserver) |
|
30 </codeblock></p></entry> |
|
31 </row> |
|
32 <row> |
|
33 <entry><p><codeph>MCoeViewActivationObserver </codeph></p></entry> |
|
34 <entry><p>View activation notification for any view registered with view server.</p></entry> |
|
35 <entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextActivation(MCoeViewActivationObserver& aViewActivationObserver) |
|
36 </codeblock></p></entry> |
|
37 </row> |
|
38 <row> |
|
39 <entry><p><codeph>MCoeViewDeactivationObserver </codeph></p></entry> |
|
40 <entry><p>View deactivation notification for the specified view.</p></entry> |
|
41 <entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextDeactivation (TVwsViewId& aViewId, MCoeViewDeactivationObserver& aViewDeactivationObserver) |
|
42 </codeblock></p></entry> |
|
43 </row> |
|
44 <row> |
|
45 <entry><p><codeph>MCoeViewDeactivationObserver </codeph></p></entry> |
|
46 <entry><p>View deactivation notification for any view registered with view |
|
47 server.</p></entry> |
|
48 <entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextDeactivation (MCoeViewDeactivationObserver& aViewDeactivationObserver) |
|
49 </codeblock></p></entry> |
|
50 </row> |
|
51 </tbody> |
|
52 </tgroup> |
|
53 </table><p>The following code snippet shows implementing the <codeph>MCoeViewActivationObserver</codeph> observer |
|
54 interface class:</p><codeblock xml:space="preserve">/** |
|
55 CMCoeViewActivationObserver - implements the MCoeViewActivationObserver interface for notifications only |
|
56 */ |
|
57 CMCoeViewActivationObserver* CMCoeViewActivationObserver::NewL() |
|
58 { |
|
59 CMCoeViewActivationObserver* self=new( ELeave ) CMCoeViewActivationObserver(); |
|
60 return self; |
|
61 } |
|
62 void CMCoeViewActivationObserver::HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, |
|
63 const TVwsViewId& aViewIdToBeDeactivated ) |
|
64 {_ |
|
65 LIT( Kmessage, "Notified MCoeViewActivationObserver::HandleViewActivation: Newly Active View: 0x%x - Deactivate 0x%x" ) |
|
66 INFO_PRINTF2( Kmessage, aNewlyActivatedViewId.iViewUid.iUid, aViewIdToBeDeactivated.iViewUid.iUid ); |
|
67 }</codeblock></context> |
|
68 </taskbody></task> |