Symbian3/SDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita
changeset 7 51a74ef9ed63
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita	Wed Mar 31 11:11:55 2010 +0100
@@ -0,0 +1,62 @@
+<?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-DD15F24B-0786-4531-A6C5-A5E70EBE2732" xml:lang="en"><title>Layout
+change events</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>Layout change events are generated when the screen size or layout is
+changed. The Symbian platform supports multiple screen resolutions (<xref href="GUID-B02C762B-C452-4184-ABEA-4753E6CD47D2.dita">scalable UI</xref>). Thus,
+layout awareness is particularly crucial for those applications that implement
+a customized UI instead of using automatically scalable AVKON UI components.
+Applications can detect the changes in layout with, for example, the following
+methods:</p>
+<ul>
+<li><p>Controls can override the <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-1BC64D91-2796-3F16-AA41-13836BC00701"><apiname>CCoeControl::HandleResourceChange()</apiname></xref> to
+detect the <parmname>KEikDynamicLayoutVariantSwitch</parmname> message.</p>
+</li>
+<li><p>UI controllers can override the <xref href="GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160.dita#GUID-B06F99BD-F032-3B87-AB26-5DD6EBE8C160/GUID-1BC64D91-2796-3F16-AA41-13836BC00701"><apiname>CCoeControl::HandleResourceChange()</apiname></xref> to
+detect the <parmname>KEikDynamicLayoutVariantSwitch</parmname> message. </p>
+</li>
+</ul>
+<p>The following example code demonstrates the implementation of <parmname>HandleResourceChange()</parmname>:</p>
+<codeblock id="GUID-8BF5353E-F09F-457A-826A-3F83ADEDF97E" xml:space="preserve">void CExampleControl::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange(aType);
+    //call base class implementation
+    if( aType==KEikDynamicLayoutVariantSwitch )
+        {
+        TRect rect;
+        // ask where container's rectangle should be
+        // EMainPane equals to area returned by
+        //CEikAppUi::ClientRect()
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,rect );
+        SetRect( rect );
+        }
+    }
+</codeblock>
+<p>The following example code demonstrates the implementation of <parmname>HandleResourceChangeL()</parmname>:</p>
+<codeblock id="GUID-226A9867-C4C5-4286-B324-30EB17A4374D" xml:space="preserve">void CExampleAppUi::HandleResourceChangeL( TInt aType )
+    {
+    CAknAppUi::HandleResourceChangeL( aType );
+    if( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        // do the re-layout of the components
+        }
+    // Controls derived from CCoeControl, handled in a
+    // container class
+    iExampleControlContainer-&gt;HandleResourceChange( aType );
+    //Must not call this if the components are on the control stack
+    //iView-&gt;HandleResourceChangeL( aType );
+    }
+</codeblock>
+<p>If <parmname>iExampleControlContainer</parmname> is added to the control
+stack, it will get its <parmname>HandleResourceChange()</parmname> called
+when a layout is switched and there is no need to call it explicitly. </p>
+</conbody></concept>
\ No newline at end of file