The following code constructs a text view, first allocating and constructing all its parameters.
Before constructing the CTextView text view object, first construct a TRect view rectangle, then the CTextLayout layout object to be used by the view.
Call the CCoeControl::Rect() function to construct the view rectangle.
The following must also be provided:
A graphics device map for mapping between the physical co-ordinates of the screen or page being drawn to (measured in twips) and the device specific co-ordinates (measured in pixels). Use the CCoeControl::SystemGc() function to get the graphics context
a window group for the text view. If a window group is not provided, no cursors can be displayed in the document.
The view rectangle is the rectangle in which all text, cursors and labels will be displayed. It resides within the view window and can be smaller than it.
TRect iViewRect; // rectangle in which to view text CTextLayout* iLayout; // text layout CTextView* iTextView; // text view CRichText* iRichText; // rich text document // prerequisites for view - viewing rectangle iViewRect=Rect(); // Construct view rectangle // layout iLayout=CTextLayout::NewL(iRichText,iViewRect.Width()); // construct layout, giving width of view rectangle // context and device CWindowGc& gc=SystemGc(); // get graphics context CBitmapDevice* device=(CBitmapDevice*) (gc.Device()); // device // text view iTextView=CTextView::NewL(iLayout, iViewRect, device, device, &Window(), &iCoeEnv->RootWin(), // window group, needed for cursor &iCoeEnv->WsSession() ); // new view
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.