Symbian3/SDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,63 @@
+<?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="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeControlClass.html#%3a%3aCCoeControl%3a%3aHandleResourceChange%28TInt%29" format="application/java-archive"><parmname>CCoeControl::HandleResourceChange()</parmname></xref> to detect the <parmname>KEikDynamicLayoutVariantSwitch</parmname> message.</p>
+</li>
+<li><p>UI controllers can override the <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeControlClass.html#%3a%3aCCoeControl%3a%3aHandleResourceChange%28TInt%29" format="application/java-archive"><parmname>CCoeControl::HandleResourceChange()</parmname></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>
+<p>For a reference design of a layout-aware application using a custom
+UI, refer to the <i>S60 Platform: Scalable Screen-Drawing Example</i> available
+for download from <xref href="http://www.forum.nokia.com/info/sw.nokia.com/id/c5b4228b-992c-4636-8f48-753040760391/S60_Platform_Scalable_Screen_Drawing_Example_v1_3_en.zip.html" scope="external">Forum Nokia</xref>.</p>
+</conbody></concept>
\ No newline at end of file