154 iEditor->SetFocus( ETrue ); |
159 iEditor->SetFocus( ETrue ); |
155 iEditor->SetContainerWindowL( *this ); |
160 iEditor->SetContainerWindowL( *this ); |
156 iEditor->SetSize( Rect().Size() ); |
161 iEditor->SetSize( Rect().Size() ); |
157 iEditor->SetSkinBackgroundControlContextL( iBgContext ); |
162 iEditor->SetSkinBackgroundControlContextL( iBgContext ); |
158 iEditor->EnableCcpuSupportL(ETrue); |
163 iEditor->EnableCcpuSupportL(ETrue); |
|
164 CEikScrollBarFrame* scrollBar = iEditor->CreateScrollBarFrameL(); |
|
165 scrollBar->SetScrollBarVisibilityL( |
|
166 CEikScrollBarFrame::EOff, |
|
167 CEikScrollBarFrame::EAuto ); |
|
168 iEditor->TextLayout()->RestrictScrollToTopsOfLines( EFalse ); |
159 } |
169 } |
160 |
170 |
161 // --------------------------------------------------------------------------- |
171 // --------------------------------------------------------------------------- |
162 // CESMRResponseDialogView::HandleResourceChange() |
172 // CESMRResponseDialogView::HandleResourceChange() |
163 // --------------------------------------------------------------------------- |
173 // --------------------------------------------------------------------------- |
164 // |
174 // |
165 void CESMRResponseDialogView::HandleResourceChange( TInt aType ) |
175 void CESMRResponseDialogView::HandleResourceChange( TInt aType ) |
166 { |
176 { |
167 FUNC_LOG; |
177 FUNC_LOG; |
168 CCoeControl::HandleResourceChange( aType ); |
178 CCoeControl::HandleResourceChange( aType ); |
169 |
179 TInt error = KErrNone; |
170 if ( aType == KEikDynamicLayoutVariantSwitch ) |
180 |
|
181 switch ( aType ) |
171 { |
182 { |
172 iEditor->SetRect( Rect() ); |
183 case KAknsMessageSkinChange: |
173 } |
184 case KEikMessageColorSchemeChange: |
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // CESMRResponseDialogView::SizeChanged() |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void CESMRResponseDialogView::SizeChanged() |
|
181 { |
|
182 if(iBgContext) |
|
183 { |
|
184 iBgContext->SetRect(Rect()); |
|
185 if ( &Window() ) |
|
186 { |
185 { |
187 iBgContext->SetParentPos( PositionRelativeToScreen() ); |
186 TAknLayoutText editorLayoutText = NMRLayoutManager::GetLayoutText( |
|
187 Rect(), |
|
188 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ); |
|
189 TRAP( error, SetFontL( editorLayoutText.Font() ) ); |
|
190 if ( error != KErrNone ) |
|
191 { |
|
192 iCoeEnv->HandleError( error ); |
|
193 } |
|
194 break; |
|
195 } |
|
196 case KEikDynamicLayoutVariantSwitch: |
|
197 { |
|
198 iEditor->SetRect( Rect() ); |
188 } |
199 } |
189 } |
200 } |
190 if( iEditor ) |
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // CESMRResponseDialogView::SizeChanged() |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 void CESMRResponseDialogView::SizeChanged() |
|
208 { |
|
209 if(iBgContext) |
|
210 { |
|
211 iBgContext->SetRect(Rect()); |
|
212 if ( &Window() ) |
|
213 { |
|
214 iBgContext->SetParentPos( PositionRelativeToScreen() ); |
|
215 } |
|
216 } |
|
217 if( iEditor ) |
|
218 { |
|
219 TRect r = Rect(); |
|
220 TInt scrollbarWidth = iEditor->ScrollBarFrame()-> |
|
221 ScrollBarBreadth(CEikScrollBar::EVertical); |
|
222 TInt editorWidth = r.Width() - scrollbarWidth; |
|
223 TPoint upperLeftCorner = TPoint(0, 0); |
|
224 iEditor->SetExtent(upperLeftCorner, TSize(editorWidth, r.Height())); |
|
225 |
|
226 TAknLayoutText editorLayoutText = NMRLayoutManager::GetLayoutText( |
|
227 r, |
|
228 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ); |
|
229 |
|
230 TInt error = KErrNone; |
|
231 TRAP( error, SetFontL( editorLayoutText.Font() ) ); |
|
232 if ( error != KErrNone ) |
|
233 { |
|
234 iCoeEnv->HandleError( error ); |
|
235 } |
|
236 } |
|
237 } |
|
238 |
|
239 // --------------------------------------------------------------------------- |
|
240 // CESMRResponseDialogView::MinimumSize() |
|
241 // --------------------------------------------------------------------------- |
|
242 // |
|
243 TSize CESMRResponseDialogView::MinimumSize() |
|
244 { |
|
245 FUNC_LOG; |
|
246 TRect rect; |
|
247 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); |
|
248 return rect.Size(); |
|
249 } |
|
250 |
|
251 // --------------------------------------------------------------------------- |
|
252 // CESMRResponseDialogView::SetFontL() |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 void CESMRResponseDialogView::SetFontL( const CFont* aFont ) |
|
256 { |
|
257 FUNC_LOG; |
|
258 |
|
259 TFontSpec fontSpec = aFont->FontSpecInTwips(); |
|
260 |
|
261 CParaFormat* paraFormat = CParaFormat::NewLC(); |
|
262 TParaFormatMask paraFormatMask; |
|
263 paraFormat->iLineSpacingControl = CParaFormat::ELineSpacingExactlyInPixels; |
|
264 |
|
265 paraFormatMask.SetAttrib( EAttLineSpacing ); |
|
266 paraFormat->iHorizontalAlignment = CParaFormat::ELeftAlign; |
|
267 if ( AknLayoutUtils::LayoutMirrored() ) |
191 { |
268 { |
192 iEditor->SetRect( Rect() ); |
269 paraFormat->iHorizontalAlignment = CParaFormat::ERightAlign; |
193 } |
270 } |
194 } |
271 paraFormatMask.SetAttrib( EAttAlignment ); |
195 |
272 |
|
273 TCharFormat charFormat; |
|
274 TCharFormatMask formatMask; |
|
275 charFormat.iFontSpec = fontSpec; |
|
276 |
|
277 formatMask.SetAttrib( EAttFontTypeface ); |
|
278 formatMask.SetAttrib( EAttFontHeight ); |
|
279 formatMask.SetAttrib( EAttFontPosture ); |
|
280 formatMask.SetAttrib( EAttFontStrokeWeight ); |
|
281 formatMask.SetAttrib( EAttFontHighlightColor ); |
|
282 formatMask.SetAttrib( EAttColor ); |
|
283 |
|
284 charFormat.iFontPresentation.iTextColor = NMRColorManager::Color( |
|
285 NMRColorManager::EMRMainAreaTextColor ); |
|
286 charFormat.iFontPresentation.iHighlightColor = |
|
287 NMRColorManager::Color( NMRColorManager::EMRCutCopyPasteHighlightColor ); |
|
288 |
|
289 CParaFormatLayer* paraFormatLayer = |
|
290 CParaFormatLayer::NewL( paraFormat, paraFormatMask ); |
|
291 CleanupStack::PushL( paraFormatLayer ); |
|
292 CCharFormatLayer* charFormatLayer = |
|
293 CCharFormatLayer::NewL( charFormat, formatMask ); |
|
294 |
|
295 iEditor->SetParaFormatLayer( paraFormatLayer ); |
|
296 CleanupStack::Pop( paraFormatLayer ); |
|
297 CleanupStack::PopAndDestroy( paraFormat ); |
|
298 iEditor->SetCharFormatLayer( charFormatLayer ); |
|
299 } |
196 // end of file |
300 // end of file |