author | Simon Howkins <simonh@symbian.org> |
Thu, 25 Nov 2010 12:13:04 +0000 | |
branch | RCL_3 |
changeset 83 | 31a5fbf5db1d |
parent 80 | 726fba06891a |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: compose view container |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#include "emailtrace.h" |
|
21 |
#include <AknIconUtils.h> |
|
22 |
#include <avkon.hrh> |
|
23 |
#include <eiklabel.h> |
|
24 |
#include <eikimage.h> |
|
25 |
#include <eikenv.h> |
|
26 |
#include <AknsDrawUtils.h> |
|
27 |
#include <AknUtils.h> |
|
28 |
#include <StringLoader.h> |
|
29 |
#include <s32mem.h> |
|
30 |
#include <txtrich.h> |
|
31 |
#include <FreestyleEmailUi.rsg> |
|
32 |
#include <freestyleemailui.mbg> |
|
33 |
#include "FreestyleEmailUiLayoutData.h" |
|
34 |
#include "FreestyleEmailUiLayoutHandler.h" |
|
35 |
#include "FreestyleEmailUiAppui.h" |
|
36 |
#include "FreestyleEmailUiTextureManager.h" |
|
37 |
#include "ncssubjectfield.h" |
|
38 |
#include "ncsconstants.h" |
|
39 |
#include "ncsfieldsizeobserver.h" |
|
40 |
#include "ncsutility.h" |
|
41 |
#include "ncsheadercontainer.h" |
|
42 |
||
43 |
// --------------------------------------------------------------------------- |
|
44 |
// CNcsSubjectField::CNcsSubjectField() |
|
45 |
// --------------------------------------------------------------------------- |
|
46 |
// |
|
47 |
CNcsSubjectField::CNcsSubjectField( MNcsFieldSizeObserver* aSizeObserver, |
|
48 |
CNcsHeaderContainer* aParentControl ): |
|
49 |
MNcsControl( aSizeObserver ), |
|
50 |
iParentControl( aParentControl ) |
|
51 |
{ |
|
52 |
FUNC_LOG; |
|
53 |
} |
|
54 |
||
55 |
// ----------------------------------------------------------------------------- |
|
56 |
// CNcsSubjectField::NewL() |
|
57 |
// Two-phased constructor. |
|
58 |
// ----------------------------------------------------------------------------- |
|
59 |
// |
|
60 |
CNcsSubjectField* CNcsSubjectField::NewL( TInt aLabelTextId, |
|
61 |
MNcsFieldSizeObserver* aSizeObserver, CNcsHeaderContainer* aParentControl ) |
|
62 |
{ |
|
63 |
FUNC_LOG; |
|
64 |
CNcsSubjectField* self = |
|
65 |
new ( ELeave ) CNcsSubjectField( aSizeObserver, aParentControl ); |
|
66 |
CleanupStack::PushL( self ); |
|
67 |
self->ConstructL( aLabelTextId ); |
|
68 |
CleanupStack::Pop( self ); |
|
69 |
return self; |
|
70 |
} |
|
71 |
||
72 |
||
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// CNcsSubjectField::ConstructL() |
|
75 |
// Symbian 2nd phase constructor can leave. |
|
76 |
// ----------------------------------------------------------------------------- |
|
77 |
// |
|
78 |
void CNcsSubjectField::ConstructL( TInt aLabelTextId ) |
|
79 |
{ |
|
80 |
FUNC_LOG; |
|
81 |
// Create label |
|
82 |
HBufC* aTextBuf = StringLoader::LoadLC( aLabelTextId ); |
|
83 |
TPtrC captionText = aTextBuf ? aTextBuf->Des() : TPtrC(); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
84 |
iLabel = new ( ELeave ) CNcsLabel( *this, NULL ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
85 |
iLabel->SetTextL( captionText ); |
64 | 86 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
87 |
// S60 Skin support |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
88 |
iLabel->SetBrushStyle(CWindowGc::ENullBrush); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
89 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
90 |
iTextEditor = new ( ELeave ) CNcsEditor( iSizeObserver, ETrue, ENcsEditorSubject, captionText ); |
64 | 91 |
CleanupStack::PopAndDestroy( aTextBuf ); |
92 |
} |
|
93 |
||
94 |
// --------------------------------------------------------------------------- |
|
95 |
// Destructor |
|
96 |
// --------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
CNcsSubjectField::~CNcsSubjectField() |
|
99 |
{ |
|
100 |
FUNC_LOG; |
|
101 |
delete iTextEditor; |
|
102 |
delete iLabel; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
103 |
// Platform layout change |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
104 |
/*if ( iFont ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
105 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
106 |
ControlEnv()->ScreenDevice()->ReleaseFont( iFont ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
107 |
iFont = NULL; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
108 |
}*/ |
64 | 109 |
} |
110 |
||
111 |
// ----------------------------------------------------------------------------- |
|
112 |
// CNcsSubjectField::SetContainerWindowL() const |
|
113 |
// ----------------------------------------------------------------------------- |
|
114 |
// |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
115 |
void CNcsSubjectField::SetContainerWindowL(const CCoeControl& aContainer) |
64 | 116 |
{ |
117 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
118 |
CCoeControl::SetContainerWindowL(aContainer); |
64 | 119 |
|
120 |
// Create the component array |
|
121 |
InitComponentArrayL(); |
|
122 |
CCoeControlArray& controls = Components(); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
123 |
controls.SetControlsOwnedExternally(ETrue); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
124 |
controls.AppendLC(iLabel); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
125 |
CleanupStack::Pop(iLabel); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
126 |
controls.AppendLC(iTextEditor); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
127 |
CleanupStack::Pop(iTextEditor); |
64 | 128 |
|
129 |
// Setup text editor |
|
130 |
iTextEditor->ConstructL( &aContainer, KMaxAddressFieldLines, 0 ); |
|
131 |
iTextEditor->SetBorder( TGulBorder::ENone ); |
|
132 |
iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
133 |
iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
64 | 134 |
iTextEditor->SetEdwinSizeObserver( this ); |
135 |
iTextEditor->SetupEditorL(); |
|
136 |
// Setup label |
|
137 |
UpdateFontSize(); |
|
138 |
UpdateColors(); |
|
139 |
} |
|
140 |
||
141 |
// ----------------------------------------------------------------------------- |
|
142 |
// CNcsSubjectField::Draw() const |
|
143 |
// Draws the display |
|
144 |
// ----------------------------------------------------------------------------- |
|
145 |
// |
|
146 |
void CNcsSubjectField::Draw( const TRect& /*aRect*/ ) const |
|
147 |
{ |
|
148 |
FUNC_LOG; |
|
149 |
CWindowGc& gc = SystemGc(); |
|
150 |
gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
151 |
} |
|
152 |
||
153 |
// ----------------------------------------------------------------------------- |
|
154 |
// CNcsSubjectField::GetMinLabelLength() |
|
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// |
|
157 |
TInt CNcsSubjectField::GetMinLabelLength() const |
|
158 |
{ |
|
159 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
160 |
return iLabel->Font()->TextWidthInPixels( *iLabel->Text() ); |
64 | 161 |
} |
162 |
||
163 |
// ----------------------------------------------------------------------------- |
|
164 |
// CNcsSubjectField::SizeChanged() |
|
165 |
// set size |
|
166 |
// ----------------------------------------------------------------------------- |
|
167 |
// |
|
168 |
void CNcsSubjectField::SizeChanged() |
|
169 |
{ |
|
170 |
FUNC_LOG; |
|
171 |
||
172 |
const TRect rect( Rect() ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
173 |
NcsUtility::LayoutCaptionLabel( iLabel, rect ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
174 |
NcsUtility::LayoutDetailEdwinTouch( iTextEditor, rect, iEditorLineCount, EFalse ); |
64 | 175 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
176 |
if (iTextEditor->ScrollBarFrame()) |
64 | 177 |
{ |
178 |
TRect rc = iTextEditor->Rect(); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
179 |
if (AknLayoutUtils::LayoutMirrored()) |
64 | 180 |
{ |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
181 |
rc.iTl.iX += iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical); |
64 | 182 |
} |
183 |
else |
|
184 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
185 |
rc.iBr.iX -= iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical); |
64 | 186 |
} |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
187 |
iTextEditor->SetRect(rc); |
64 | 188 |
} |
189 |
||
190 |
// Setup text alignment according the mirrored/normal layout. |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
191 |
if ( AknLayoutUtils::LayoutMirrored() ) |
64 | 192 |
{ |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
193 |
iLabel->SetAlignment( EHLeftVCenter ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
194 |
iLabel->SetLabelAlignment( ELayoutAlignLeft ); |
64 | 195 |
} |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
196 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
197 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
198 |
iLabel->SetAlignment( EHRightVCenter ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
199 |
iLabel->SetLabelAlignment( ELayoutAlignRight ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
200 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
201 |
|
64 | 202 |
// this needs to be bidi as in mirrored layout |
203 |
// writing language left to right can be set |
|
204 |
iTextEditor->SetAlignment( EAknEditorAlignBidi ); |
|
205 |
||
206 |
UpdateFontSize(); |
|
207 |
||
208 |
iTextEditor->UpdateCustomDrawer(); |
|
209 |
} |
|
210 |
||
211 |
// ----------------------------------------------------------------------------- |
|
212 |
// CNcsSubjectField::PositionChanged() |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
213 |
// set size |
64 | 214 |
// ----------------------------------------------------------------------------- |
215 |
// |
|
216 |
void CNcsSubjectField::PositionChanged() |
|
217 |
{ |
|
218 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
219 |
//SizeChanged(); |
64 | 220 |
} |
221 |
||
222 |
// ----------------------------------------------------------------------------- |
|
223 |
// CNcsSubjectField::OfferKeyEventL() |
|
224 |
// Handles key events |
|
225 |
// ----------------------------------------------------------------------------- |
|
226 |
// |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
227 |
TKeyResponse CNcsSubjectField::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
64 | 228 |
{ |
229 |
FUNC_LOG; |
|
230 |
TKeyResponse ret( EKeyWasNotConsumed ); |
|
231 |
||
232 |
ret = iTextEditor->OfferKeyEventL( aKeyEvent, aType ); |
|
233 |
return ret; |
|
234 |
} |
|
235 |
||
236 |
// ----------------------------------------------------------------------------- |
|
237 |
// CNcsAddressInputField::HandlePointerEventL() |
|
238 |
// Handles pointer events |
|
239 |
// ----------------------------------------------------------------------------- |
|
240 |
// |
|
241 |
void CNcsSubjectField::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
242 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
243 |
FUNC_LOG; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
244 |
iTextEditor->HandlePointerEventL( aPointerEvent ); |
64 | 245 |
} |
246 |
||
247 |
// ----------------------------------------------------------------------------- |
|
248 |
// CNcsSubjectField::FocusChanged() |
|
249 |
// ----------------------------------------------------------------------------- |
|
250 |
// |
|
251 |
void CNcsSubjectField::FocusChanged( TDrawNow aDrawNow ) |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
252 |
{ |
64 | 253 |
FUNC_LOG; |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
254 |
if ( IsFocused() ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
255 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
256 |
iTextEditor->SetFocus( ETrue ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
257 |
//TRAP_IGNORE( iTextEditor->SetCursorPosL( iTextEditor->TextLength(), EFalse ) ); |
64 | 258 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
259 |
// make sure that control is visible on screen |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
260 |
if ( Rect().iTl.iY < 0 ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
261 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
262 |
TPoint pt = TPoint( 0, 0 ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
263 |
Reposition( pt, Rect().Width() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
264 |
iSizeObserver->UpdateFieldPosition( this ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
265 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
266 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
267 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
268 |
TPoint pos = PositionRelativeToScreen(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
269 |
pos.iY += Size().iHeight; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
270 |
CWsScreenDevice* screenDev = ControlEnv()->ScreenDevice(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
271 |
TPixelsAndRotation pix; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
272 |
screenDev->GetDefaultScreenSizeAndRotation( pix ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
273 |
const TInt h = pix.iPixelSize.iHeight; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
274 |
if ( pos.iY >= h - h / 3 ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
275 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
276 |
TPoint pt = TPoint( 0, h / 3 ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
277 |
Reposition( pt, Rect().Width() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
278 |
iSizeObserver->UpdateFieldPosition( this ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
279 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
280 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
281 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
282 |
if ( iParentControl ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
283 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
284 |
TRAP_IGNORE( iParentControl->SetMskL() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
285 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
286 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
287 |
else |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
288 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
289 |
iTextEditor->SetFocus( EFalse ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
290 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
291 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
292 |
if ( aDrawNow ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
293 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
294 |
DrawNow(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
295 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
296 |
} |
64 | 297 |
|
298 |
// ----------------------------------------------------------------------------- |
|
299 |
// CNcsSubjectField::MinimumHeight() |
|
300 |
// return height of subject control |
|
301 |
// ----------------------------------------------------------------------------- |
|
302 |
// |
|
303 |
TInt CNcsSubjectField::MinimumHeight() |
|
304 |
{ |
|
305 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
306 |
// Platform layout changes |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
307 |
/* |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
308 |
TNcsMeasures m = NcsUtility::Measures(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
309 |
TInt height = m.iAifHeight - m.iAifEditorHeight + iEditorMinimumHeight + m.iSubjectExtraHeightBottom; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
310 |
TInt height2 = m.iAifHeight + m.iSubjectExtraHeightBottom; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
311 |
// if followup icon and priority icon are both visible increase the subject field height |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
312 |
if ( iFollowUp && iPriority != EMsgPriorityNormal ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
313 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
314 |
height2 += KIconHeightFollowUp; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
315 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
316 |
return Max( height, height2 ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
317 |
*/ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
318 |
//return NcsUtility::MinimumHeaderSize( Rect(), iEditorLineCount ).iHeight; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
319 |
// Platform layout changes |
64 | 320 |
return 0; |
321 |
} |
|
322 |
||
323 |
// ----------------------------------------------------------------------------- |
|
324 |
// CNcsSubjectField::SetSubjectL() |
|
325 |
// ----------------------------------------------------------------------------- |
|
326 |
// |
|
327 |
void CNcsSubjectField::SetSubjectL( const TDesC& aSubject ) |
|
328 |
{ |
|
329 |
FUNC_LOG; |
|
330 |
if ( &aSubject && aSubject.Length() > 0 ) |
|
331 |
{ |
|
332 |
// clear subject if necessary |
|
333 |
TInt documentLength = iTextEditor->RichText()->DocumentLength(); |
|
334 |
if ( documentLength > 0 ) |
|
335 |
{ |
|
336 |
iTextEditor->RichText()->DeleteL( 0, documentLength ); |
|
337 |
iTextEditor->HandleTextChangedL(); |
|
338 |
} |
|
339 |
||
340 |
RMemReadStream inputStream( aSubject.Ptr(), aSubject.Size() ); |
|
341 |
CleanupClosePushL( inputStream ); |
|
342 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
343 |
iTextEditor->RichText()->ImportTextL( 0, inputStream, CPlainText::EOrganiseByParagraph ); |
64 | 344 |
|
345 |
// Activating the field will set the control to the end of the text |
|
346 |
iTextEditor->ActivateL(); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
347 |
iTextEditor->SetCursorPosL(0,EFalse); |
64 | 348 |
|
349 |
CleanupStack::PopAndDestroy( &inputStream ); |
|
350 |
} |
|
351 |
} |
|
352 |
||
353 |
// ----------------------------------------------------------------------------- |
|
354 |
// CNcsSubjectField::HandleEdwinSizeEventL() |
|
355 |
// ----------------------------------------------------------------------------- |
|
356 |
// |
|
357 |
TBool CNcsSubjectField::HandleEdwinSizeEventL( CEikEdwin* /*aEdwin*/, |
|
358 |
TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize ) |
|
359 |
{ |
|
360 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
361 |
// Platform layout chage |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
362 |
/* |
64 | 363 |
TInt ret( EFalse ); |
364 |
TInt htLine = iTextEditor->GetLineHeightL(); |
|
365 |
TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
366 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
367 |
if ( numLinesDesired < KMaxAddressFieldLines && |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
368 |
iEditorMinimumHeight != aDesirableEdwinSize.iHeight ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
369 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
370 |
iEditorMinimumHeight = aDesirableEdwinSize.iHeight; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
371 |
iTextEditor->CreateScrollBarFrameL()->SetScjrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
372 |
if ( iSizeObserver ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
373 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
374 |
ret = iSizeObserver->UpdateFieldSizeL(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
375 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
376 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
377 |
else if ( iEditorMinimumHeight != htLine * KMaxAddressFieldLines ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
378 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
379 |
//We may still need to resize the controll. |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
380 |
iEditorMinimumHeight = htLine * KMaxAddressFieldLines; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
381 |
iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
382 |
if ( iSizeObserver ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
383 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
384 |
ret = iSizeObserver->UpdateFieldSizeL(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
385 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
386 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
387 |
*/ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
388 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
389 |
TInt ret( EFalse ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
390 |
TInt htLine = iTextEditor->GetLineHeightL(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
391 |
TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
392 |
// commented because of EGWG-83ECSR, no negative feedback after removing |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
393 |
//CEikScrollBarFrame& scrollBarFrame( *iTextEditor->CreateScrollBarFrameL() ); |
64 | 394 |
iEditorLineCount = numLinesDesired; |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
395 |
//scrollBarFrame.SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
64 | 396 |
if ( iSizeObserver ) |
397 |
{ |
|
398 |
ret = iSizeObserver->UpdateFieldSizeL(); |
|
399 |
} |
|
400 |
return ret; |
|
401 |
} |
|
402 |
||
403 |
// ----------------------------------------------------------------------------- |
|
404 |
// CNcsSubjectField::SelectAllTextL() |
|
405 |
// ----------------------------------------------------------------------------- |
|
406 |
// |
|
407 |
void CNcsSubjectField::SelectAllTextL() |
|
408 |
{ |
|
409 |
FUNC_LOG; |
|
410 |
iTextEditor->SelectAllL(); |
|
411 |
} |
|
412 |
||
413 |
// ----------------------------------------------------------------------------- |
|
414 |
// CNcsSubjectField::Editor |
|
415 |
// ----------------------------------------------------------------------------- |
|
416 |
CNcsEditor* CNcsSubjectField::Editor() const |
|
417 |
{ |
|
418 |
FUNC_LOG; |
|
419 |
return iTextEditor; |
|
420 |
} |
|
421 |
||
422 |
// ----------------------------------------------------------------------------- |
|
423 |
// CNcsSubjectField::LineCount |
|
424 |
// ----------------------------------------------------------------------------- |
|
425 |
TInt CNcsSubjectField::LineCount() const |
|
426 |
{ |
|
427 |
FUNC_LOG; |
|
428 |
return iTextEditor->LineCount(); |
|
429 |
} |
|
430 |
||
431 |
// ----------------------------------------------------------------------------- |
|
432 |
// CNcsSubjectField::CursorLineNumber |
|
433 |
// ----------------------------------------------------------------------------- |
|
434 |
TInt CNcsSubjectField::CursorLineNumber() const |
|
435 |
{ |
|
436 |
FUNC_LOG; |
|
437 |
return iTextEditor->CursorLineNumber(); |
|
438 |
} |
|
439 |
||
440 |
// ----------------------------------------------------------------------------- |
|
441 |
// CNcsSubjectField::CursorPosition |
|
442 |
// ----------------------------------------------------------------------------- |
|
443 |
TInt CNcsSubjectField::CursorPosition() const |
|
444 |
{ |
|
445 |
FUNC_LOG; |
|
446 |
TInt pos = iTextEditor->CursorPosition(); |
|
447 |
//Add the delta between the top of the edit control |
|
448 |
//and the top of the parent control |
|
449 |
pos += iTextEditor->Rect().iTl.iY - Rect().iTl.iY; |
|
450 |
return pos; |
|
451 |
} |
|
452 |
||
453 |
// ----------------------------------------------------------------------------- |
|
454 |
// CNcsSubjectField::ScrollableLines |
|
455 |
// ----------------------------------------------------------------------------- |
|
456 |
TInt CNcsSubjectField::ScrollableLines() const |
|
457 |
{ |
|
458 |
FUNC_LOG; |
|
459 |
return iTextEditor->ScrollableLines(); |
|
460 |
} |
|
461 |
||
462 |
// ----------------------------------------------------------------------------- |
|
463 |
// CNcsSubjectField::GetNumChars |
|
464 |
// ----------------------------------------------------------------------------- |
|
465 |
TInt CNcsSubjectField::GetNumChars() const |
|
466 |
{ |
|
467 |
FUNC_LOG; |
|
468 |
return iTextEditor->GetNumChars(); |
|
469 |
} |
|
470 |
||
471 |
// ----------------------------------------------------------------------------- |
|
472 |
// CNcsSubjectField::GetLabelText |
|
473 |
// ----------------------------------------------------------------------------- |
|
474 |
const TDesC& CNcsSubjectField::GetLabelText() const |
|
475 |
{ |
|
476 |
FUNC_LOG; |
|
477 |
return KNullDesC; |
|
478 |
} |
|
479 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
480 |
// Platform layout change |
64 | 481 |
// --------------------------------------------------------------------------- |
482 |
// CNcsSubjectField::LayoutLineCount |
|
483 |
// --------------------------------------------------------------------------- |
|
484 |
// |
|
485 |
TInt CNcsSubjectField::LayoutLineCount() const |
|
486 |
{ |
|
487 |
FUNC_LOG; |
|
488 |
return ( IsVisible() ? Max( 1, iEditorLineCount ) : 0 ); |
|
489 |
} |
|
490 |
||
491 |
// ----------------------------------------------------------------------------- |
|
492 |
// CNcsSubjectField::Reposition |
|
493 |
// ----------------------------------------------------------------------------- |
|
494 |
void CNcsSubjectField::Reposition(TPoint& aPt, TInt /*aWidth*/) |
|
495 |
{ |
|
496 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
497 |
/* |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
498 |
const TSize size( aWidth, MinimumHeight() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
499 |
SetExtent( aPt, size ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
500 |
aPt.iY += size.iHeight; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
501 |
*/ |
64 | 502 |
SetPosition( aPt ); |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
503 |
// Platform layout changes |
64 | 504 |
} |
505 |
||
506 |
// ----------------------------------------------------------------------------- |
|
507 |
// CNcsSubjectField::GetLineRectL |
|
508 |
// ----------------------------------------------------------------------------- |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
509 |
void CNcsSubjectField::GetLineRectL( TRect& aLineRect ) const |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
510 |
{ |
64 | 511 |
FUNC_LOG; |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
512 |
return iTextEditor->GetLineRectL( aLineRect ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
513 |
} |
64 | 514 |
|
515 |
// ----------------------------------------------------------------------------- |
|
516 |
// CNcsSubjectField::SetMaxLabelLength |
|
517 |
// ----------------------------------------------------------------------------- |
|
518 |
void CNcsSubjectField::SetMaxLabelLength( TInt aMaxLength ) |
|
519 |
{ |
|
520 |
FUNC_LOG; |
|
521 |
iMaximumLabelLength = aMaxLength; |
|
522 |
} |
|
523 |
||
524 |
// ----------------------------------------------------------------------------- |
|
525 |
// CNcsSubjectField::SetTextColorL |
|
526 |
// ----------------------------------------------------------------------------- |
|
527 |
void CNcsSubjectField::SetTextColorL( TLogicalRgb aColor ) |
|
528 |
{ |
|
529 |
FUNC_LOG; |
|
530 |
iTextEditor->SetTextColorL( aColor ); |
|
531 |
} |
|
532 |
||
533 |
// --------------------------------------------------------------------------- |
|
534 |
// CNcsSubjectField::UpdateColors() |
|
535 |
// --------------------------------------------------------------------------- |
|
536 |
// |
|
537 |
void CNcsSubjectField::UpdateColors() |
|
538 |
{ |
|
539 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
540 |
// Platform layout change |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
541 |
TRgb textColor = KRgbBlack; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
542 |
if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
543 |
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ) != KErrNone ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
544 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
545 |
textColor = KRgbBlack; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
546 |
} |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
547 |
TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, textColor ) ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
548 |
// Platform layout change |
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
549 |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
550 |
CFreestyleEmailUiAppUi* appUi = |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
551 |
static_cast<CFreestyleEmailUiAppUi*>( ControlEnv()->AppUi() ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
552 |
iBorderColor = appUi->LayoutHandler()->ComposerFieldBorderColor(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
553 |
iBgColor = appUi->LayoutHandler()->ComposerFieldBackgroundColor(); |
64 | 554 |
} |
555 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
556 |
// Platform layout changes |
64 | 557 |
// --------------------------------------------------------------------------- |
558 |
// CNcsSubjectField::UpdateFontSize() |
|
559 |
// --------------------------------------------------------------------------- |
|
560 |
// |
|
561 |
void CNcsSubjectField::UpdateFontSize() |
|
562 |
{ |
|
563 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
564 |
/*if ( iFont ) |
64 | 565 |
{ |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
566 |
ControlEnv()->ScreenDevice()->ReleaseFont( iFont ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
567 |
iFont = NULL; |
64 | 568 |
} |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
569 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
570 |
TNcsMeasures m = NcsUtility::Measures(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
571 |
if ( !iFont ) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
572 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
573 |
TRAP_IGNORE( iFont = NcsUtility::GetNearestFontL(EAknLogicalFontPrimarySmallFont, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
574 |
m.iLabelFontHeightPx) ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
575 |
}*/ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
576 |
iFont = NcsUtility::GetLayoutFont( iLabel->Rect(), NcsUtility::ENcsHeaderCaptionFont ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
577 |
iLabel->SetFont( iFont ); |
64 | 578 |
iTextEditor->UpdateFontSize(); |
579 |
UpdateColors(); |
|
580 |
} |
|
581 |
||
582 |
// --------------------------------------------------------------------------- |
|
583 |
// CNcsSubjectField::HandleResourceChange() |
|
584 |
// --------------------------------------------------------------------------- |
|
585 |
// |
|
586 |
void CNcsSubjectField::HandleResourceChange( TInt aType ) |
|
587 |
{ |
|
588 |
FUNC_LOG; |
|
589 |
CCoeControl::HandleResourceChange( aType ); |
|
590 |
if ( aType == KAknsMessageSkinChange || |
|
591 |
aType == KEikMessageColorSchemeChange ) |
|
592 |
{ |
|
593 |
UpdateFontSize(); |
|
594 |
UpdateColors(); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
595 |
// Platform layout changes |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
596 |
iTextEditor->HandleResourceChange( aType ) ;//CreateScrollBarFrameL()->DrawScrollBarsNow(); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
597 |
// Platform layout changes |
64 | 598 |
} |
599 |
} |
|
600 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
601 |
void CNcsSubjectField::EnableKineticScrollingL(CAknPhysics* aPhysics) |
64 | 602 |
{ |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
603 |
iTextEditor->EnableKineticScrollingL(aPhysics); |
64 | 604 |
iTextEditor->TextLayout()->RestrictScrollToTopsOfLines( ETrue ); |
605 |
} |
|
606 |
||
607 |
void CNcsSubjectField::SetPhysicsEmulationOngoing( TBool aPhysOngoing ) |
|
608 |
{ |
|
609 |
iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing ); |
|
610 |
} |