Symbian3/SDK/Source/GUID-13D2B45C-3A2A-497A-8D6A-87BE34D1DE69.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-13D2B45C-3A2A-497A-8D6A-87BE34D1DE69" xml:lang="en"><title>Implement
the observer functions</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context><p>An application can register as an observer of a view by implementing
the following observer interfaces. Observers can register with the View Server
as activation observers, deactivation observers or as generic observers.</p><table id="GUID-7159BD7C-6466-4CA8-9211-FD33273C9784">
<tgroup cols="3"><colspec colname="col1"/><colspec colname="col2"/><colspec colname="col3"/>
<thead>
<row>
<entry valign="top"><p>Interface</p></entry>
<entry valign="top"><p>Notification</p></entry>
<entry valign="top"><p>Method to override</p></entry>
</row>
</thead>
<tbody>
<row>
<entry><p><codeph>MCoeViewActivationObserver </codeph></p></entry>
<entry><p>View activation notification for the specified view.</p></entry>
<entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextActivation(TVwsViewId&amp; aViewId,  MCoeViewActivationObserver&amp; aViewActivationObserver)
</codeblock></p></entry>
</row>
<row>
<entry><p><codeph>MCoeViewActivationObserver </codeph></p></entry>
<entry><p>View activation notification for any view registered with view server.</p></entry>
<entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextActivation(MCoeViewActivationObserver&amp; aViewActivationObserver)
</codeblock></p></entry>
</row>
<row>
<entry><p><codeph>MCoeViewDeactivationObserver </codeph></p></entry>
<entry><p>View deactivation notification for the specified view.</p></entry>
<entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextDeactivation (TVwsViewId&amp; aViewId, MCoeViewDeactivationObserver&amp; aViewDeactivationObserver)
</codeblock></p></entry>
</row>
<row>
<entry><p><codeph>MCoeViewDeactivationObserver </codeph></p></entry>
<entry><p>View deactivation notification for any view registered with view
server.</p></entry>
<entry><p><codeblock xml:space="preserve">IMPORT_C void NotifyNextDeactivation (MCoeViewDeactivationObserver&amp; aViewDeactivationObserver)
</codeblock></p></entry>
</row>
</tbody>
</tgroup>
</table><p>The following code snippet shows implementing the <codeph>MCoeViewActivationObserver</codeph> observer
interface class:</p><codeblock xml:space="preserve">/** 
CMCoeViewActivationObserver  - implements the MCoeViewActivationObserver interface for notifications only
*/
CMCoeViewActivationObserver* CMCoeViewActivationObserver::NewL()    
    {
    CMCoeViewActivationObserver* self=new( ELeave ) CMCoeViewActivationObserver();
    return self;
    }
void CMCoeViewActivationObserver::HandleViewActivation( const TVwsViewId&amp; aNewlyActivatedViewId,
                                                        const TVwsViewId&amp; aViewIdToBeDeactivated )    
    {_
    LIT( Kmessage, "Notified MCoeViewActivationObserver::HandleViewActivation: Newly Active View: 0x%x - Deactivate 0x%x" )    
    INFO_PRINTF2( Kmessage, aNewlyActivatedViewId.iViewUid.iUid, aViewIdToBeDeactivated.iViewUid.iUid );
    }</codeblock></context>
</taskbody></task>