<?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 concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-68B999C2-0993-4804-9624-42C3D88BE5C7" xml:lang="en"><title>View
architecture</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The following image illustrates the components of the view architecture
approach.</p>
<fig id="GUID-A4D968BE-B048-424C-94B5-FAAA7B14C5D5"><title>View architecture classes</title><image href="GUID-2B50C6B1-E1E8-44E6-840B-7FAA206E6C26_d0e47820_href.png"/></fig>
<p>Symbian platform applications that follow the view architecture require:</p>
<ul>
<li><p>a <xref href="GUID-FD2CDEB8-0784-4BE5-A775-170F57D71BBC.dita">UI
controller</xref> derived from <xref href="GUID-2DBA2DA9-3DA7-381C-842C-9F6FEEDF973E.dita"><apiname>CAknViewAppUi</apiname></xref></p></li>
<li><p>a <xref href="GUID-DAC32BB9-C0EB-42FF-A596-C2F1A90A4BD7.dita">view
controller</xref> derived from <xref href="GUID-11967EBB-7439-3775-B287-7560ECA0AF1F.dita"><apiname>CAknView</apiname></xref></p></li>
<li><p>a <xref href="GUID-DAC32BB9-C0EB-42FF-A596-C2F1A90A4BD7.dita">view</xref> or
views derived from <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref></p></li>
</ul>
<p>The view architecture only allows one view to be active in each application.
If a new view is switched to within an application, the current view is immediately
deactivated, so this architectural approach is <i>not</i> appropriate in the
following cases:</p>
<ul>
<li><p>Applications with any view that cannot cleanly handle unexpected
activation of another view in that application.</p></li>
<li><p>Applications that provide views that can be nested over other
applications, except where embedding is used.</p></li>
<li><p>Applications that provide controls that can be used inside
other applications (for example, using a Web control inside an e-mail viewer
to show an e‑mail with HTML content).</p></li>
</ul>
<p>Typical responsibilities in this architecture are:</p>
<ul>
<li><p><parmname>CAknViewAppUi</parmname>-derived class acts as
a <xref href="GUID-FD2CDEB8-0784-4BE5-A775-170F57D71BBC.dita">UI controller</xref>:</p>
<itemgroup>
<ul>
<li><p>It creates one or more <parmname>CAknView</parmname>-derived
view controllers.</p></li>
<li><p>It handles <xref href="GUID-EF7FF39E-929F-4767-B475-5D582D37BB32.dita">events</xref> that
are not handled by the view controllers.</p></li>
<li><p>To switch between views, it activates and deactivates views.</p>
</li>
<li><p>It handles menu <xref href="GUID-4941C035-C359-4968-9BD5-31F44EE5F810.dita">commands</xref> passed
to it by the view controllers.</p></li>
<li><p>It receives events such as <xref href="GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita">layout</xref> and <xref href="GUID-3B441CDC-AB7A-4D8D-A595-57C21E1D426C.dita">foreground</xref> notifications
from the run-time environment.</p></li>
</ul>
</itemgroup>
</li>
<li><p><xref href="GUID-11967EBB-7439-3775-B287-7560ECA0AF1F.dita"><apiname>CAknView</apiname></xref>-derived class acts as a <xref href="GUID-FD2CDEB8-0784-4BE5-A775-170F57D71BBC.dita">view controller</xref></p>
<itemgroup>
<ul>
<li><p>It creates one of more <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref>-derived
views.</p></li>
<li><p>It handles registering controls for <xref href="GUID-E402616A-7ED8-45AC-B836-99C3A3760B33.dita">key
event handling</xref>.</p></li>
<li><p>It handles menu <xref href="GUID-4941C035-C359-4968-9BD5-31F44EE5F810.dita">commands</xref>.</p>
</li>
</ul>
</itemgroup>
</li>
<li><p><xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita"><apiname>CCoeControl</apiname></xref>-derived view:</p>
<itemgroup>
<ul>
<li><p>Shows application data and state on the screen.</p></li>
</ul>
</itemgroup>
</li>
</ul>
<p>For information on the <xref href="GUID-4F825D83-47A4-36C9-9A25-943A6D799F84.dita"><apiname>CAknApplication</apiname></xref> and <xref href="GUID-935C59EE-AD66-33FE-987B-BD97F5147CC1.dita"><apiname>CAknDocument</apiname></xref>-derived
classes, see <xref href="GUID-BDDDF68F-F7C3-43AF-8B6C-C77C701FD2A9.dita">Framework
requirements for GUI applications</xref>.</p>
</conbody></concept>