Symbian3/SDK/Source/GUID-1B58FBA8-4E2C-5A99-A4B7-D7475E1B8F96.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     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 concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept xml:lang="en" id="GUID-1B58FBA8-4E2C-5A99-A4B7-D7475E1B8F96"><title>How to use wrapping</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>After any operation which resizes the <keyword>text
       
    13         area</keyword>, the wrapping width may need to be changed. The code in this section resets the view rectangle, and then resets the wrapping width accordingly.</p> <ul><li id="GUID-0027B472-465C-537F-8F40-641997F362A1"><p>Resize the view rectangle (an instance of class <xref href="GUID-101762DC-E498-3325-88AB-B0FF17DC62B6.dita"><apiname>TRect</apiname></xref>) by shrinking it by forty pixels in both directions.</p> </li> <li id="GUID-49E7E1FD-C954-5097-B11F-AE0FF9ED9384"><p>Reset the view rectangle using <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-3D04D758-B829-34C6-9B22-C51F58D0316C"><apiname>CTextView::SetViewRect()</apiname></xref>.</p> </li> </ul> <codeblock id="GUID-1F0FBF4A-BF54-5926-A7B6-564E8136646B" xml:space="preserve">iViewRect.Shrink(40,40);
       
    14 iTextView-&gt;SetViewRect(iViewRect);
       
    15 iTextView-&gt;HandleGlobalChangeL(); 
       
    16     // update formatting and draw the completely revamped view</codeblock> <p>The following code sets the wrapping width to be the width of the new view rectangle minus the total margin width, so that text wraps at the right hand edge of the view rectangle.</p> <ul><li id="GUID-BF3388F7-13D4-5C72-959E-751CDA7D9C10"><p>To ensure that text wrapping is set, use <xref href="GUID-FEE7C848-2E93-3848-A3DA-7EAA533615AF.dita#GUID-FEE7C848-2E93-3848-A3DA-7EAA533615AF/GUID-B8C93ECC-1BEA-321F-AF2A-AF534212900F"><apiname>CTextLayout::DisableWrapOverride(EFalse)</apiname></xref>. By default, wrapping is set.</p> </li> <li id="GUID-B27EE3E1-0716-563B-9063-5A3463412636"><p>As the wrapping width is a global document characteristic, changes to it may be handled using <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-903D1087-42CB-32EB-8379-7B019936AD16"><apiname>CTextView::HandleGlobalChangeL()</apiname></xref>.</p> </li> </ul> <codeblock id="GUID-C92925E0-AE52-507E-93AA-7653BE7107B9" xml:space="preserve">// Wrap text to new view rectangle
       
    17 TInt labelsWidth,lineCursorWidth;
       
    18 // Get both margin widths
       
    19 iTextView-&gt;MarginWidths(labelsWidth,lineCursorWidth);
       
    20 // New wrap width = new view rect width minus total margin width
       
    21 iLayout-&gt;SetWrapWidth(iViewRect.Width()-(labelsWidth+lineCursorWidth));
       
    22 iLayout-&gt;DisableWrapOverride(EFalse); // Ensure wrapping on
       
    23 iTextView-&gt;HandleGlobalChangeL();</codeblock> </conbody></concept>