79
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2006 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: MsgExpandableControl implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// ========== INCLUDE FILES ================================
|
|
21 |
|
|
22 |
#include <coeinput.h> // for TCoeInputCapabilities
|
|
23 |
#include <barsread.h> // for TResourceReader
|
|
24 |
#include <eiklabel.h> // for CEikLabel
|
|
25 |
#include <eikenv.h> // for CEikonEnv
|
|
26 |
#include <eikedwin.h> // for TClipboardFunc
|
|
27 |
#include <txtrich.h> // for CRichText
|
|
28 |
#include <AknUtils.h> // for AknUtils
|
|
29 |
#include <aknenv.h> // for CAknEnv
|
|
30 |
#include <AknDef.h>
|
|
31 |
#include <AknsUtils.h> // for Skinned drawing
|
|
32 |
#include <aknbutton.h> // for CAknButton
|
|
33 |
|
|
34 |
#include <applayout.cdl.h> // LAF
|
|
35 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
36 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
37 |
|
|
38 |
#include "MsgEditorCommon.h" //
|
|
39 |
#include "MsgExpandableControl.h" // for CMsgExpandableControl
|
|
40 |
#include "MsgExpandableControlEditor.h" // for CMsgExpandableControlEditor
|
|
41 |
#include "MsgBaseControlObserver.h" // for MMsgBaseControlObserver
|
|
42 |
#include "MsgEditorPanic.h" // for CMsgEditor panics
|
|
43 |
#include "MsgEditorLogging.h"
|
|
44 |
|
|
45 |
// ========== EXTERNAL DATA STRUCTURES =====================
|
|
46 |
|
|
47 |
// ========== EXTERNAL FUNCTION PROTOTYPES =================
|
|
48 |
|
|
49 |
// ========== CONSTANTS ====================================
|
|
50 |
|
|
51 |
// ========== MACROS =======================================
|
|
52 |
|
|
53 |
// ========== LOCAL CONSTANTS AND MACROS ===================
|
|
54 |
|
|
55 |
_LIT(KMsgDefaultCaption, " ");
|
|
56 |
|
|
57 |
// ========== MODULE DATA STRUCTURES =======================
|
|
58 |
|
|
59 |
// ========== LOCAL FUNCTION PROTOTYPES ====================
|
|
60 |
|
|
61 |
// ========== LOCAL FUNCTIONS ==============================
|
|
62 |
|
|
63 |
// ========== MEMBER FUNCTIONS =============================
|
|
64 |
|
|
65 |
// ---------------------------------------------------------
|
|
66 |
// CMsgExpandableControl::CMsgExpandableControl
|
|
67 |
//
|
|
68 |
// Constructor.
|
|
69 |
// ---------------------------------------------------------
|
|
70 |
//
|
|
71 |
EXPORT_C CMsgExpandableControl::CMsgExpandableControl()
|
|
72 |
{
|
|
73 |
}
|
|
74 |
|
|
75 |
// ---------------------------------------------------------
|
|
76 |
// CMsgExpandableControl::CMsgExpandableControl
|
|
77 |
//
|
|
78 |
// Constructor.
|
|
79 |
// ---------------------------------------------------------
|
|
80 |
//
|
|
81 |
EXPORT_C CMsgExpandableControl::CMsgExpandableControl( MMsgBaseControlObserver& aBaseControlObserver ) :
|
|
82 |
CMsgExpandableTextEditorControl( aBaseControlObserver )
|
|
83 |
{
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------
|
|
87 |
// CMsgExpandableControl::ConstructFromResourceL
|
|
88 |
//
|
|
89 |
// Creates this control from resource.
|
|
90 |
// ---------------------------------------------------------
|
|
91 |
//
|
|
92 |
void CMsgExpandableControl::ConstructFromResourceL( TInt aResourceId )
|
|
93 |
{
|
|
94 |
BaseConstructL(); // Sets margins only
|
|
95 |
|
|
96 |
TResourceReader reader;
|
|
97 |
iCoeEnv->CreateResourceReaderLC( reader, aResourceId );
|
|
98 |
|
|
99 |
// Create caption
|
|
100 |
iCaption = CreateCaptionFromResourceL( reader );
|
|
101 |
|
|
102 |
// Read control details from resource
|
|
103 |
ReadControlPropertiesFromResourceL( reader );
|
|
104 |
|
|
105 |
// Create editor
|
|
106 |
iEditor = CreateEditorFromResourceL( reader );
|
|
107 |
|
|
108 |
iEditor->SetControlType(EMsgExpandableControl);
|
|
109 |
iCtrltype = EMsgExpandableControl;
|
|
110 |
iEditor->SetObserver( this );
|
|
111 |
iEditor->SetEdwinSizeObserver( this );
|
|
112 |
iEditor->AddEdwinObserverL( this );
|
|
113 |
iEditor->SetBorder( TGulBorder::ENone );
|
|
114 |
//Set the flag to enable partial screen
|
|
115 |
TInt flags = iEditor->AknEditorFlags();
|
|
116 |
flags |= EAknEditorFlagEnablePartialScreen;
|
|
117 |
iEditor->SetAknEditorFlags( flags );
|
|
118 |
|
|
119 |
SetPlainTextMode( ETrue );
|
|
120 |
|
|
121 |
ResolveLayoutsL();
|
|
122 |
|
|
123 |
CleanupStack::PopAndDestroy(); // reader
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------
|
|
127 |
// CMsgExpandableControl::~CMsgExpandableControl
|
|
128 |
//
|
|
129 |
// Destructor.
|
|
130 |
// ---------------------------------------------------------
|
|
131 |
//
|
|
132 |
EXPORT_C CMsgExpandableControl::~CMsgExpandableControl()
|
|
133 |
{
|
|
134 |
AknsUtils::DeregisterControlPosition( iCaption );
|
|
135 |
delete iCaption;
|
|
136 |
|
|
137 |
#ifdef RD_SCALABLE_UI_V2
|
|
138 |
if ( iButton )
|
|
139 |
{
|
|
140 |
AknsUtils::DeregisterControlPosition( iButton );
|
|
141 |
delete iButton;
|
|
142 |
}
|
|
143 |
#endif // RD_SCALABLE_UI_V2
|
|
144 |
|
|
145 |
AknsUtils::DeregisterControlPosition( iEditor );
|
|
146 |
delete iEditor;
|
|
147 |
|
|
148 |
AknsUtils::DeregisterControlPosition( this );
|
|
149 |
}
|
|
150 |
|
|
151 |
// ---------------------------------------------------------
|
|
152 |
// CMsgExpandableControl::Editor
|
|
153 |
//
|
|
154 |
// Returns a reference to the editor control.
|
|
155 |
// ---------------------------------------------------------
|
|
156 |
//
|
|
157 |
EXPORT_C CEikRichTextEditor& CMsgExpandableControl::Editor() const
|
|
158 |
{
|
|
159 |
return *iEditor;
|
|
160 |
}
|
|
161 |
|
|
162 |
// ---------------------------------------------------------
|
|
163 |
// CMsgExpandableControl::Caption
|
|
164 |
//
|
|
165 |
// Returns a reference to the label control.
|
|
166 |
// ---------------------------------------------------------
|
|
167 |
//
|
|
168 |
EXPORT_C CEikLabel& CMsgExpandableControl::Caption() const
|
|
169 |
{
|
|
170 |
return *iCaption;
|
|
171 |
}
|
|
172 |
|
|
173 |
// ---------------------------------------------------------
|
|
174 |
// CMsgExpandableControl::SetTextContentL
|
|
175 |
//
|
|
176 |
// Sets text content to the control editor.
|
|
177 |
// ---------------------------------------------------------
|
|
178 |
//
|
|
179 |
EXPORT_C void CMsgExpandableControl::SetTextContentL( CRichText& aText )
|
|
180 |
{
|
|
181 |
iEditor->SetTextContentL( aText );
|
|
182 |
|
|
183 |
if ( iControlModeFlags & EMsgControlModeInitialized )
|
|
184 |
{
|
|
185 |
iControlModeFlags |= EMsgControlModeModified;
|
|
186 |
}
|
|
187 |
}
|
|
188 |
|
|
189 |
// ---------------------------------------------------------
|
|
190 |
// CMsgExpandableControl::SetTextContentL
|
|
191 |
//
|
|
192 |
// Sets text content to the control editor.
|
|
193 |
// ---------------------------------------------------------
|
|
194 |
//
|
|
195 |
EXPORT_C void CMsgExpandableControl::SetTextContentL( const TDesC& aText )
|
|
196 |
{
|
|
197 |
iEditor->SetTextL( &aText );
|
|
198 |
|
|
199 |
if ( iControlModeFlags & EMsgControlModeInitialized )
|
|
200 |
{
|
|
201 |
iControlModeFlags |= EMsgControlModeModified;
|
|
202 |
}
|
|
203 |
}
|
|
204 |
|
|
205 |
// ---------------------------------------------------------
|
|
206 |
// CMsgExpandableControl::TextContentStrippedL
|
|
207 |
//
|
|
208 |
// Copies stripped content to aBuf. Control chars, newlines and if
|
|
209 |
// aNoExtraSemicolons is ETrue, also two consecutive semicolons are
|
|
210 |
// replaced with semicolon and space.
|
|
211 |
// ---------------------------------------------------------
|
|
212 |
//
|
|
213 |
EXPORT_C void CMsgExpandableControl::TextContentStrippedL( TDes& aBuf,
|
|
214 |
TInt aMaxLen,
|
|
215 |
TBool aNoExtraSemicolons )
|
|
216 |
{
|
|
217 |
CRichText& text = TextContent();
|
|
218 |
TInt len = text.DocumentLength();
|
|
219 |
HBufC* buf = HBufC::NewLC( len );
|
|
220 |
TPtr ptr = buf->Des();
|
|
221 |
text.ExtractSelectively( ptr, 0, len, CPlainText::EExtractVisible );
|
|
222 |
|
|
223 |
if ( aNoExtraSemicolons )
|
|
224 |
{
|
|
225 |
TText ch0 = 0;
|
|
226 |
len = ptr.Length();
|
|
227 |
for (TInt i = 0; i < len; i++)
|
|
228 |
{
|
|
229 |
TText& ch1 = ptr[i];
|
|
230 |
if ( i > 0 )
|
|
231 |
{
|
|
232 |
ch0 = ptr[i - 1];
|
|
233 |
}
|
|
234 |
if ( ( ch1 == KSemicolon ||
|
|
235 |
ch1 == KArabicSemicolon ) &&
|
|
236 |
( ch0 == KSemicolon ||
|
|
237 |
ch0 == KArabicSemicolon ) )
|
|
238 |
{
|
|
239 |
ch1 = ' ';
|
|
240 |
}
|
|
241 |
}
|
|
242 |
}
|
|
243 |
|
|
244 |
ptr.TrimAll();
|
|
245 |
|
|
246 |
len = ptr.Length();
|
|
247 |
if ( len > aMaxLen )
|
|
248 |
{
|
|
249 |
ptr.Delete( aMaxLen, len - aMaxLen );
|
|
250 |
}
|
|
251 |
|
|
252 |
aBuf.Copy( ptr );
|
|
253 |
|
|
254 |
CleanupStack::PopAndDestroy( buf );
|
|
255 |
}
|
|
256 |
|
|
257 |
// ---------------------------------------------------------
|
|
258 |
// CMsgExpandableControl::NotifyViewEvent
|
|
259 |
//
|
|
260 |
// Notifies editor about the scroll event.
|
|
261 |
// ---------------------------------------------------------
|
|
262 |
//
|
|
263 |
void CMsgExpandableControl::NotifyViewEvent( TMsgViewEvent aEvent, TInt aParam )
|
|
264 |
{
|
|
265 |
TRAP_IGNORE( DoNotifyViewEventL( aEvent, aParam ) );
|
|
266 |
}
|
|
267 |
|
|
268 |
// ---------------------------------------------------------
|
|
269 |
// CMsgExpandableControl::DoNotifyViewEventL
|
|
270 |
// ---------------------------------------------------------
|
|
271 |
//
|
|
272 |
void CMsgExpandableControl::DoNotifyViewEventL( TMsgViewEvent aEvent, TInt aParam )
|
|
273 |
{
|
|
274 |
switch ( aEvent )
|
|
275 |
{
|
|
276 |
case EMsgViewEventPrepareFocusTransitionUp:
|
|
277 |
{
|
|
278 |
if ( IsFocused() )
|
|
279 |
{
|
|
280 |
iEditor->ClearSelectionL();
|
|
281 |
}
|
|
282 |
break;
|
|
283 |
}
|
|
284 |
case EMsgViewEventPrepareFocusTransitionDown:
|
|
285 |
{
|
|
286 |
if ( IsFocused() )
|
|
287 |
{
|
|
288 |
iEditor->ClearSelectionL();
|
|
289 |
}
|
|
290 |
break;
|
|
291 |
}
|
|
292 |
case EMsgViewEventSetCursorFirstPos:
|
|
293 |
{
|
|
294 |
if ( iEditor->TextView() )
|
|
295 |
{
|
|
296 |
if ( IsReadOnly() )
|
|
297 |
{
|
|
298 |
// Do not set document position if autohightlight is
|
|
299 |
// used as it cancels current hightlight if used.
|
|
300 |
if ( !( aParam & EMsgViewEventAutoHighlight ) )
|
|
301 |
{
|
|
302 |
iEditor->SetCursorPosL( 0, EFalse );
|
|
303 |
}
|
|
304 |
}
|
|
305 |
else
|
|
306 |
{
|
|
307 |
if ( !iEditor->CursorInFirstLine() )
|
|
308 |
{
|
|
309 |
iEditor->SetCursorPosL( 0, EFalse );
|
|
310 |
}
|
|
311 |
}
|
|
312 |
}
|
|
313 |
break;
|
|
314 |
}
|
|
315 |
case EMsgViewEventSetCursorLastPos:
|
|
316 |
{
|
|
317 |
if ( iEditor->TextView() )
|
|
318 |
{
|
|
319 |
TInt len = iEditor->TextLength();
|
|
320 |
|
|
321 |
if ( IsReadOnly() )
|
|
322 |
{
|
|
323 |
// Do not set document position if autohightlight is
|
|
324 |
// used as it cancels current hightlight if used.
|
|
325 |
if ( !( aParam & EMsgViewEventAutoHighlight ) )
|
|
326 |
{
|
|
327 |
iEditor->SetCursorPosL( len, EFalse );
|
|
328 |
}
|
|
329 |
}
|
|
330 |
else
|
|
331 |
{
|
|
332 |
if ( !iEditor->CursorInLastLine() )
|
|
333 |
{
|
|
334 |
iEditor->SetCursorPosL( len, EFalse );
|
|
335 |
}
|
|
336 |
}
|
|
337 |
}
|
|
338 |
break;
|
|
339 |
}
|
|
340 |
case EMsgViewEventPrepareForViewing:
|
|
341 |
{
|
|
342 |
/*
|
|
343 |
iEditor->SetSuppressFormatting( EFalse );
|
|
344 |
iEditor->NotifyNewFormatL();
|
|
345 |
*/
|
|
346 |
}
|
|
347 |
default:
|
|
348 |
{
|
|
349 |
break;
|
|
350 |
}
|
|
351 |
}
|
|
352 |
}
|
|
353 |
|
|
354 |
// ---------------------------------------------------------
|
|
355 |
// CMsgExpandableControl::Reset
|
|
356 |
//
|
|
357 |
// Reset contents of the editor.
|
|
358 |
// ---------------------------------------------------------
|
|
359 |
//
|
|
360 |
EXPORT_C void CMsgExpandableControl::Reset()
|
|
361 |
{
|
|
362 |
iEditor->Reset();
|
|
363 |
iControlModeFlags |= EMsgControlModeModified;
|
|
364 |
}
|
|
365 |
|
|
366 |
// ---------------------------------------------------------
|
|
367 |
// CMsgExpandableControl::SetAndGetSizeL
|
|
368 |
//
|
|
369 |
// Sets sizes for the caption and control according to aSize.
|
|
370 |
// ---------------------------------------------------------
|
|
371 |
//
|
|
372 |
EXPORT_C void CMsgExpandableControl::SetAndGetSizeL( TSize& aSize )
|
|
373 |
{
|
|
374 |
#ifdef RD_SCALABLE_UI_V2
|
|
375 |
|
|
376 |
iCaption->SetSize( iCaptionLayout.TextRect().Size() );
|
|
377 |
|
|
378 |
if ( iButton )
|
|
379 |
{
|
|
380 |
iButton->SetSize( iButtonLayout.Rect().Size() );
|
|
381 |
}
|
|
382 |
#else
|
|
383 |
iCaption->SetSize( iCaptionLayout.TextRect().Size() );
|
|
384 |
#endif // RD_SCALABLE_UI_V2
|
|
385 |
|
|
386 |
TSize editorSize( iEditorLayout.TextRect().Width(),
|
|
387 |
iBaseControlObserver->ViewRect().Height() );
|
|
388 |
iEditor->SetAndGetSizeL( editorSize );
|
|
389 |
|
|
390 |
TSize thisSize( aSize.iWidth, 0 );
|
|
391 |
if( iEditor->TextLayout() && iEditor->TextLayout()->IsFormattingBand( ) )
|
|
392 |
{
|
|
393 |
thisSize.iHeight = MsgEditorCommons::MaxBodyHeight( );
|
|
394 |
}
|
|
395 |
else
|
|
396 |
{
|
|
397 |
thisSize.iHeight = iSize.iHeight;
|
|
398 |
}
|
|
399 |
|
|
400 |
// Control height is always atleast one line height
|
|
401 |
thisSize.iHeight = Max( MsgEditorCommons::MsgBaseLineDelta(), thisSize.iHeight );
|
|
402 |
|
|
403 |
SetSizeWithoutNotification( thisSize );
|
|
404 |
aSize = iSize;
|
|
405 |
}
|
|
406 |
|
|
407 |
// ---------------------------------------------------------
|
|
408 |
// CMsgExpandableControl::IsFocusChangePossible
|
|
409 |
//
|
|
410 |
// Checks if focus up or down depending on aDirection is possible and returns
|
|
411 |
// ETrue if it is.
|
|
412 |
// ---------------------------------------------------------
|
|
413 |
//
|
|
414 |
EXPORT_C TBool CMsgExpandableControl::IsFocusChangePossible( TMsgFocusDirection aDirection ) const
|
|
415 |
{
|
|
416 |
switch ( aDirection )
|
|
417 |
{
|
|
418 |
case EMsgFocusUp:
|
|
419 |
{
|
|
420 |
if ( IsReadOnly() )
|
|
421 |
{
|
|
422 |
return iEditor->IsFirstLineVisible();
|
|
423 |
}
|
|
424 |
else
|
|
425 |
{
|
|
426 |
return IsCursorLocation( EMsgTop );
|
|
427 |
}
|
|
428 |
}
|
|
429 |
case EMsgFocusDown:
|
|
430 |
{
|
|
431 |
if ( IsReadOnly() )
|
|
432 |
{
|
|
433 |
return iEditor->IsLastLineVisible();
|
|
434 |
}
|
|
435 |
else
|
|
436 |
{
|
|
437 |
return IsCursorLocation( EMsgBottom );
|
|
438 |
}
|
|
439 |
}
|
|
440 |
default:
|
|
441 |
{
|
|
442 |
break;
|
|
443 |
}
|
|
444 |
}
|
|
445 |
|
|
446 |
return EFalse;
|
|
447 |
}
|
|
448 |
|
|
449 |
// ---------------------------------------------------------
|
|
450 |
// CMsgExpandableControl::SetContainerWindowL
|
|
451 |
//
|
|
452 |
// Sets container window.
|
|
453 |
// ---------------------------------------------------------
|
|
454 |
//
|
|
455 |
EXPORT_C void CMsgExpandableControl::SetContainerWindowL( const CCoeControl& aContainer )
|
|
456 |
{
|
|
457 |
CCoeControl::SetContainerWindowL( aContainer );
|
|
458 |
|
|
459 |
iCaption->SetContainerWindowL( *this );
|
|
460 |
iEditor->SetContainerWindowL( *this );
|
|
461 |
|
|
462 |
#ifdef RD_SCALABLE_UI_V2
|
|
463 |
if ( iButton )
|
|
464 |
{
|
|
465 |
iButton->SetContainerWindowL( *this );
|
|
466 |
}
|
|
467 |
#endif // RD_SCALABLE_UI_V2
|
|
468 |
}
|
|
469 |
|
|
470 |
// ---------------------------------------------------------
|
|
471 |
// CMsgExpandableControl::OfferKeyEventL
|
|
472 |
//
|
|
473 |
// Handles key events.
|
|
474 |
// ---------------------------------------------------------
|
|
475 |
//
|
|
476 |
EXPORT_C TKeyResponse CMsgExpandableControl::OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
477 |
TEventCode aType )
|
|
478 |
{
|
|
479 |
return iEditor->OfferKeyEventL( aKeyEvent, aType );
|
|
480 |
}
|
|
481 |
|
|
482 |
// ---------------------------------------------------------
|
|
483 |
// CMsgExpandableControl::MinimumSize
|
|
484 |
//
|
|
485 |
//
|
|
486 |
// ---------------------------------------------------------
|
|
487 |
//
|
|
488 |
EXPORT_C TSize CMsgExpandableControl::MinimumSize()
|
|
489 |
{
|
|
490 |
return TSize( iSize.iWidth,
|
|
491 |
iEditor->MinimumDefaultHeight() + iMargins.iTop + iMargins.iBottom );
|
|
492 |
}
|
|
493 |
|
|
494 |
// ---------------------------------------------------------
|
|
495 |
// CMsgExpandableControl::InputCapabilities
|
|
496 |
//
|
|
497 |
// Returns input capabilities.
|
|
498 |
// ---------------------------------------------------------
|
|
499 |
//
|
|
500 |
EXPORT_C TCoeInputCapabilities CMsgExpandableControl::InputCapabilities() const
|
|
501 |
{
|
|
502 |
if ( iEditor->IsFocused() )
|
|
503 |
{
|
|
504 |
TCoeInputCapabilities inputCapabilities( TCoeInputCapabilities::ENone,
|
|
505 |
NULL,
|
|
506 |
const_cast<CMsgExpandableControl*>( this ) );
|
|
507 |
inputCapabilities.MergeWith( iEditor->InputCapabilities() );
|
|
508 |
|
|
509 |
return inputCapabilities;
|
|
510 |
}
|
|
511 |
else
|
|
512 |
{
|
|
513 |
return TCoeInputCapabilities::ENone;
|
|
514 |
}
|
|
515 |
}
|
|
516 |
|
|
517 |
// ---------------------------------------------------------
|
|
518 |
// CMsgExpandableControl::HandleResourceChange
|
|
519 |
//
|
|
520 |
// Updates caption text color if skin is changed.
|
|
521 |
// ---------------------------------------------------------
|
|
522 |
//
|
|
523 |
EXPORT_C void CMsgExpandableControl::HandleResourceChange( TInt aType )
|
|
524 |
{
|
|
525 |
if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
526 |
{
|
|
527 |
TRAP_IGNORE( ResolveLayoutsL() );
|
|
528 |
}
|
|
529 |
|
|
530 |
CMsgExpandableTextEditorControl::HandleResourceChange( aType );
|
|
531 |
|
|
532 |
// Control size can be updated only after editor has updated
|
|
533 |
// virtual height accordong to current font
|
|
534 |
if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
535 |
{
|
|
536 |
// Control height can change if new layout uses
|
|
537 |
// font with different height. After HandleResourceChange
|
|
538 |
// controls must know their correct height because
|
|
539 |
// control distances are adjusted related to other controls
|
|
540 |
// before GetAndSetSize is called. This is the reason why
|
|
541 |
// this must be done here.
|
|
542 |
TSize desirableSize( iEditorLayout.TextRect().Width(),
|
|
543 |
iEditor->VirtualHeight() );
|
|
544 |
|
|
545 |
if ( desirableSize.iHeight != Size().iHeight )
|
|
546 |
{
|
|
547 |
TInt maxBodyHeight( iMaxBodyHeight );
|
|
548 |
|
|
549 |
if ( desirableSize.iHeight > maxBodyHeight )
|
|
550 |
{
|
|
551 |
desirableSize.iHeight = maxBodyHeight;
|
|
552 |
}
|
|
553 |
|
|
554 |
SetSizeWithoutNotification( desirableSize );
|
|
555 |
|
|
556 |
TRAP_IGNORE( iEditor->SetAndGetSizeL( desirableSize ) );
|
|
557 |
}
|
|
558 |
}
|
|
559 |
else if ( aType == KAknsMessageSkinChange )
|
|
560 |
{
|
|
561 |
TRAP_IGNORE( UpdateCaptionTextColorL() );
|
|
562 |
}
|
|
563 |
}
|
|
564 |
|
|
565 |
// ---------------------------------------------------------
|
|
566 |
// CMsgExpandableControl::HandleControlEventL
|
|
567 |
//
|
|
568 |
//
|
|
569 |
// ---------------------------------------------------------
|
|
570 |
//
|
|
571 |
#ifdef RD_SCALABLE_UI_V2
|
|
572 |
EXPORT_C void CMsgExpandableControl::HandleControlEventL( CCoeControl* aControl,
|
|
573 |
TCoeEvent aEventType )
|
|
574 |
{
|
|
575 |
CMsgExpandableTextEditorControl::HandleControlEventL( aControl, aEventType );
|
|
576 |
|
|
577 |
if ( aEventType == MCoeControlObserver::EEventStateChanged &&
|
|
578 |
iButton &&
|
|
579 |
aControl == iButton)
|
|
580 |
{
|
|
581 |
iBaseControlObserver->HandleEditObserverEventRequestL( this, EMsgButtonPressed, this );
|
|
582 |
}
|
|
583 |
}
|
|
584 |
#else
|
|
585 |
EXPORT_C void CMsgExpandableControl::HandleControlEventL( CCoeControl* aControl,
|
|
586 |
TCoeEvent aEventType )
|
|
587 |
{
|
|
588 |
CMsgExpandableTextEditorControl::HandleControlEventL( aControl, aEventType );
|
|
589 |
}
|
|
590 |
#endif // RD_SCALABLE_UI_V2
|
|
591 |
|
|
592 |
// ---------------------------------------------------------
|
|
593 |
// CMsgExpandableControl::CreateEditorL
|
|
594 |
//
|
|
595 |
// Creates the editor for the control.
|
|
596 |
// ---------------------------------------------------------
|
|
597 |
//
|
|
598 |
CMsgExpandableControlEditor* CMsgExpandableControl::CreateEditorL()
|
|
599 |
{
|
|
600 |
// Create control editor
|
|
601 |
CMsgExpandableControlEditor* editor =
|
|
602 |
new ( ELeave ) CMsgExpandableControlEditor( this,
|
|
603 |
iControlModeFlags,
|
|
604 |
iBaseControlObserver );
|
|
605 |
|
|
606 |
CleanupStack::PushL( editor );
|
|
607 |
editor->ConstructL();
|
|
608 |
CleanupStack::Pop( editor );
|
|
609 |
|
|
610 |
return editor;
|
|
611 |
}
|
|
612 |
|
|
613 |
// ---------------------------------------------------------
|
|
614 |
// CMsgExpandableControl::ReadControlPropertiesFromResourceL
|
|
615 |
//
|
|
616 |
// Reads control properties from resource.
|
|
617 |
// ---------------------------------------------------------
|
|
618 |
//
|
|
619 |
void CMsgExpandableControl::ReadControlPropertiesFromResourceL( TResourceReader& aReader )
|
|
620 |
{
|
|
621 |
iControlModeFlags = aReader.ReadUint32();
|
|
622 |
iControlId = aReader.ReadInt32();
|
|
623 |
iDistanceFromComponentAbove = aReader.ReadInt32();
|
|
624 |
iMaxNumberOfChars = aReader.ReadInt32();
|
|
625 |
}
|
|
626 |
|
|
627 |
// ---------------------------------------------------------
|
|
628 |
// CMsgExpandableControl::CreateCaptionFromResourceL
|
|
629 |
//
|
|
630 |
// Creates caption for the control from resource.
|
|
631 |
// ---------------------------------------------------------
|
|
632 |
//
|
|
633 |
CEikLabel* CMsgExpandableControl::CreateCaptionFromResourceL( TResourceReader& aReader )
|
|
634 |
{
|
|
635 |
CEikLabel* caption = new ( ELeave ) CEikLabel;
|
|
636 |
CleanupStack::PushL( caption );
|
|
637 |
|
|
638 |
HBufC* captionText = aReader.ReadHBufCL();
|
|
639 |
|
|
640 |
if ( captionText == NULL )
|
|
641 |
{
|
|
642 |
caption->SetTextL( KMsgDefaultCaption );
|
|
643 |
}
|
|
644 |
else
|
|
645 |
{
|
|
646 |
CleanupStack::PushL( captionText );
|
|
647 |
caption->SetTextL( *captionText );
|
|
648 |
CleanupStack::PopAndDestroy( captionText );
|
|
649 |
}
|
|
650 |
|
|
651 |
caption->CropText();
|
|
652 |
|
|
653 |
CleanupStack::Pop( caption );
|
|
654 |
|
|
655 |
return caption;
|
|
656 |
}
|
|
657 |
|
|
658 |
// ---------------------------------------------------------
|
|
659 |
// CMsgExpandableControl::CreateEditorFromResourceL
|
|
660 |
//
|
|
661 |
// This virtual function does nothing but inherited function of this creates
|
|
662 |
// the editor for the control from resource.
|
|
663 |
// ---------------------------------------------------------
|
|
664 |
//
|
|
665 |
CMsgExpandableControlEditor* CMsgExpandableControl::CreateEditorFromResourceL( TResourceReader& aReader )
|
|
666 |
{
|
|
667 |
CMsgExpandableControlEditor* editor =
|
|
668 |
new ( ELeave ) CMsgExpandableControlEditor( this,
|
|
669 |
iControlModeFlags,
|
|
670 |
iBaseControlObserver );
|
|
671 |
|
|
672 |
CleanupStack::PushL( editor );
|
|
673 |
editor->SetMaxNumberOfChars( iMaxNumberOfChars );
|
|
674 |
editor->ConstructFromResourceL( aReader );
|
|
675 |
CleanupStack::Pop( editor );
|
|
676 |
|
|
677 |
return editor;
|
|
678 |
}
|
|
679 |
|
|
680 |
// ---------------------------------------------------------
|
|
681 |
// CMsgExpandableControl::PrepareForReadOnly
|
|
682 |
//
|
|
683 |
// Prepares read only or non read only state.
|
|
684 |
// ---------------------------------------------------------
|
|
685 |
//
|
|
686 |
void CMsgExpandableControl::PrepareForReadOnly( TBool aReadOnly )
|
|
687 |
{
|
|
688 |
TRAP_IGNORE( iEditor->PrepareForReadOnlyL( aReadOnly ) );
|
|
689 |
}
|
|
690 |
|
|
691 |
// ---------------------------------------------------------
|
|
692 |
// CMsgExpandableControl::CountComponentControls
|
|
693 |
//
|
|
694 |
// Returns a number of controls.
|
|
695 |
// ---------------------------------------------------------
|
|
696 |
//
|
|
697 |
EXPORT_C TInt CMsgExpandableControl::CountComponentControls() const
|
|
698 |
{
|
|
699 |
CCoeControl* labelControl = NULL;
|
|
700 |
|
|
701 |
if ( iButton )
|
|
702 |
{
|
|
703 |
labelControl = iButton;
|
|
704 |
}
|
|
705 |
else
|
|
706 |
{
|
|
707 |
labelControl = iCaption;
|
|
708 |
}
|
|
709 |
|
|
710 |
CCoeControl* controls[] = { labelControl, iEditor };
|
|
711 |
|
|
712 |
TInt count = 0;
|
|
713 |
for ( TUint ii = 0; ii < sizeof( controls ) / sizeof( CCoeControl* ); ii++ )
|
|
714 |
{
|
|
715 |
if ( controls[ii] )
|
|
716 |
{
|
|
717 |
count++;
|
|
718 |
}
|
|
719 |
}
|
|
720 |
|
|
721 |
return count;
|
|
722 |
}
|
|
723 |
|
|
724 |
// ---------------------------------------------------------
|
|
725 |
// CMsgExpandableControl::ComponentControl
|
|
726 |
//
|
|
727 |
// Returns a control of index aIndex.
|
|
728 |
// ---------------------------------------------------------
|
|
729 |
//
|
|
730 |
EXPORT_C CCoeControl* CMsgExpandableControl::ComponentControl( TInt aIndex ) const
|
|
731 |
{
|
|
732 |
CCoeControl* labelControl = NULL;
|
|
733 |
|
|
734 |
if ( iButton )
|
|
735 |
{
|
|
736 |
labelControl = iButton;
|
|
737 |
}
|
|
738 |
else
|
|
739 |
{
|
|
740 |
labelControl = iCaption;
|
|
741 |
}
|
|
742 |
|
|
743 |
CCoeControl* controls[] = { labelControl, iEditor };
|
|
744 |
|
|
745 |
for ( TUint ii = 0; ii < sizeof( controls ) / sizeof( CCoeControl* ); ii++ )
|
|
746 |
{
|
|
747 |
if ( controls[ii] && aIndex-- == 0 )
|
|
748 |
{
|
|
749 |
return controls[ii];
|
|
750 |
}
|
|
751 |
}
|
|
752 |
|
|
753 |
return NULL;
|
|
754 |
}
|
|
755 |
|
|
756 |
// ---------------------------------------------------------
|
|
757 |
// CMsgExpandableControl::SizeChanged
|
|
758 |
//
|
|
759 |
// Sets positions for the caption and the editor.
|
|
760 |
// ---------------------------------------------------------
|
|
761 |
//
|
|
762 |
EXPORT_C void CMsgExpandableControl::SizeChanged()
|
|
763 |
{
|
|
764 |
// TODO: No point to do all these calculations every time!
|
|
765 |
|
|
766 |
MEBLOGGER_ENTERFN("CMsgExpandableControl::SizeChanged");
|
|
767 |
|
|
768 |
if ( iControlModeFlags & EMsgControlModeSizeChanging )
|
|
769 |
{
|
|
770 |
MEBLOGGER_WRITE( "EMsgControlModeSizeChanging" );
|
|
771 |
}
|
|
772 |
else
|
|
773 |
{
|
|
774 |
TPoint editorPosition( iEditorLayout.TextRect().iTl.iX,
|
|
775 |
iPosition.iY + iEditorTop );
|
|
776 |
|
|
777 |
#ifdef RD_SCALABLE_UI_V2
|
|
778 |
|
|
779 |
TPoint captionPosition( iCaptionLayout.TextRect().iTl.iX,
|
|
780 |
iPosition.iY + iCaptionTop );
|
|
781 |
|
|
782 |
iCaption->SetPosition( captionPosition );
|
|
783 |
iCaption->MakeVisible( captionPosition.iY >= 0 );
|
|
784 |
|
|
785 |
if ( iButton )
|
|
786 |
{
|
|
787 |
TPoint buttonPosition( iButtonLayout.Rect().iTl.iX,
|
|
788 |
iPosition.iY + iButtonTop );
|
|
789 |
|
|
790 |
iButton->SetPosition( buttonPosition );
|
|
791 |
iButton->MakeVisible( buttonPosition.iY >= 0 );
|
|
792 |
}
|
|
793 |
#else
|
|
794 |
TPoint captionPosition( iCaptionLayout.TextRect().iTl.iX,
|
|
795 |
iPosition.iY + iCaptionTop );
|
|
796 |
|
|
797 |
iCaption->SetPosition( captionPosition );
|
|
798 |
iCaption->MakeVisible( captionPosition.iY >= 0 );
|
|
799 |
#endif // RD_SCALABLE_UI_V2
|
|
800 |
|
|
801 |
TRect editorRect( editorPosition, iEditor->Size() );
|
|
802 |
|
|
803 |
if ( editorRect != iEditor->Rect() )
|
|
804 |
{
|
|
805 |
iEditor->SetRect( editorRect ); // SetPosition cannot be used here
|
|
806 |
}
|
|
807 |
|
|
808 |
AknsUtils::RegisterControlPosition( this );
|
|
809 |
AknsUtils::RegisterControlPosition( iCaption );
|
|
810 |
|
|
811 |
#ifdef RD_SCALABLE_UI_V2
|
|
812 |
if ( iButton )
|
|
813 |
{
|
|
814 |
AknsUtils::RegisterControlPosition( iButton );
|
|
815 |
}
|
|
816 |
#endif // RD_SCALABLE_UI_V2
|
|
817 |
|
|
818 |
AknsUtils::RegisterControlPosition( iEditor );
|
|
819 |
}
|
|
820 |
|
|
821 |
MEBLOGGER_LEAVEFN("CMsgExpandableControl::SizeChanged");
|
|
822 |
}
|
|
823 |
|
|
824 |
// ---------------------------------------------------------
|
|
825 |
// CMsgExpandableControl::FocusChanged
|
|
826 |
//
|
|
827 |
// This is called when the focus of the control is changed.
|
|
828 |
// ---------------------------------------------------------
|
|
829 |
//
|
|
830 |
EXPORT_C void CMsgExpandableControl::FocusChanged( TDrawNow aDrawNow )
|
|
831 |
{
|
|
832 |
iEditor->SetFocus( IsFocused(), aDrawNow );
|
|
833 |
|
|
834 |
if ( aDrawNow == EDrawNow )
|
|
835 |
{
|
|
836 |
DrawDeferred();
|
|
837 |
}
|
|
838 |
}
|
|
839 |
|
|
840 |
// ---------------------------------------------------------
|
|
841 |
// CMsgExpandableControl::Draw
|
|
842 |
//
|
|
843 |
//
|
|
844 |
// ---------------------------------------------------------
|
|
845 |
//
|
|
846 |
EXPORT_C void CMsgExpandableControl::Draw( const TRect& /*aRect*/ ) const
|
|
847 |
{
|
|
848 |
// All drawing is done by iEditor, iCaption and CMsgHeader
|
|
849 |
// class (and CMsgCaptionedHighlight owned by the header)
|
|
850 |
}
|
|
851 |
|
|
852 |
// ---------------------------------------------------------
|
|
853 |
// CMsgExpandableControl::ActivateL
|
|
854 |
//
|
|
855 |
// Sets caption text color from skin. This is the only common
|
|
856 |
// synchronization point before the control is drawn to the screen
|
|
857 |
// for expandable control and all the derived classes.
|
|
858 |
// ---------------------------------------------------------
|
|
859 |
//
|
|
860 |
EXPORT_C void CMsgExpandableControl::ActivateL()
|
|
861 |
{
|
|
862 |
UpdateCaptionTextColorL();
|
|
863 |
|
|
864 |
CMsgExpandableTextEditorControl::ActivateL();
|
|
865 |
}
|
|
866 |
|
|
867 |
// ---------------------------------------------------------
|
|
868 |
// CMsgExpandableControl::ResolveLayoutsL
|
|
869 |
//
|
|
870 |
//
|
|
871 |
// ---------------------------------------------------------
|
|
872 |
//
|
|
873 |
void CMsgExpandableControl::ResolveLayoutsL()
|
|
874 |
{
|
|
875 |
TAknTextLineLayout editorLineLayout;
|
|
876 |
|
|
877 |
TAknLayoutRect msgTextPane;
|
|
878 |
msgTextPane.LayoutRect( MsgEditorCommons::MsgDataPane(),
|
|
879 |
AknLayoutScalable_Apps::msg_text_pane( 0 ).LayoutLine() );
|
|
880 |
|
|
881 |
TAknLayoutRect msgHeaderPane;
|
|
882 |
msgHeaderPane.LayoutRect( msgTextPane.Rect(),
|
|
883 |
AknLayoutScalable_Apps::msg_header_pane().LayoutLine() );
|
|
884 |
|
|
885 |
// iFrameLayout is not really used with "scalable layouts"
|
|
886 |
iFrameLayout.LayoutRect( msgHeaderPane.Rect(),
|
|
887 |
AknLayoutScalable_Apps::input_focus_pane_cp07().LayoutLine() );
|
|
888 |
|
|
889 |
iCaptionLayout.LayoutText( msgHeaderPane.Rect(),
|
|
890 |
AknLayoutScalable_Apps::msg_header_pane_t1( 0 ).LayoutLine() );
|
|
891 |
|
|
892 |
editorLineLayout = AknLayoutScalable_Apps::msg_header_pane_t2( 0 ).LayoutLine();
|
|
893 |
|
|
894 |
iEditorLayout.LayoutText( msgHeaderPane.Rect(),
|
|
895 |
editorLineLayout );
|
|
896 |
//partial input in landscape causes rects to overlay when toolbar is invisible
|
|
897 |
if (iCaptionLayout.TextRect().Intersects(iEditorLayout.TextRect()))
|
|
898 |
{
|
|
899 |
TRect headerPane = msgHeaderPane.Rect();
|
|
900 |
//include toolbar width
|
|
901 |
if (!AknLayoutUtils::LayoutMirrored())
|
|
902 |
{
|
|
903 |
headerPane.iBr.iX -= GetToolBarRect().Width();
|
|
904 |
}
|
|
905 |
else
|
|
906 |
{
|
|
907 |
headerPane.iTl.iX += GetToolBarRect().Width();
|
|
908 |
}
|
|
909 |
|
|
910 |
iCaptionLayout.LayoutText( headerPane,
|
|
911 |
AknLayoutScalable_Apps::msg_header_pane_t1( 0 ).LayoutLine() );
|
|
912 |
}
|
|
913 |
|
|
914 |
iEditorTop = iEditorLayout.TextRect().iTl.iY -
|
|
915 |
msgHeaderPane.Rect().iTl.iY;
|
|
916 |
|
|
917 |
iEditor->SetMaximumHeight( MsgEditorCommons::MaxBodyHeight() - iEditorTop * 2 );
|
|
918 |
|
|
919 |
#ifdef RD_SCALABLE_UI_V2
|
|
920 |
|
|
921 |
iCaptionTop = iCaptionLayout.TextRect().iTl.iY - msgHeaderPane.Rect().iTl.iY;
|
|
922 |
|
|
923 |
iCaption->SetFont( iCaptionLayout.Font() );
|
|
924 |
|
|
925 |
iCaption->SetAlignment( iCaptionLayout.Align() == CGraphicsContext::ELeft ? EHLeftVTop :
|
|
926 |
EHRightVTop );
|
|
927 |
if ( iButton )
|
|
928 |
{
|
|
929 |
iButtonLayout.LayoutRect( msgHeaderPane.Rect(),
|
|
930 |
AknLayoutScalable_Apps::bg_button_pane_cp01().LayoutLine() );
|
|
931 |
|
|
932 |
//partial input in landscape causes rects to overlay when toolbar is invisible
|
|
933 |
if (iButtonLayout.Rect().Intersects(iEditorLayout.TextRect()))
|
|
934 |
{
|
|
935 |
TRect headerPane = msgHeaderPane.Rect();
|
|
936 |
//include toolbar width
|
|
937 |
if (!AknLayoutUtils::LayoutMirrored())
|
|
938 |
{
|
|
939 |
headerPane.iBr.iX -= GetToolBarRect().Width();
|
|
940 |
}
|
|
941 |
else
|
|
942 |
{
|
|
943 |
headerPane.iTl.iX += GetToolBarRect().Width();
|
|
944 |
}
|
|
945 |
|
|
946 |
iButtonLayout.LayoutRect( headerPane,
|
|
947 |
AknLayoutScalable_Apps::bg_button_pane_cp01().LayoutLine() );
|
|
948 |
}
|
|
949 |
|
|
950 |
iButtonTop = iButtonLayout.Rect().iTl.iY - msgHeaderPane.Rect().iTl.iY;
|
|
951 |
|
|
952 |
LayoutButton();
|
|
953 |
}
|
|
954 |
#else
|
|
955 |
|
|
956 |
iCaptionTop = iCaptionLayout.TextRect().iTl.iY -
|
|
957 |
msgHeaderPane.Rect().iTl.iY;
|
|
958 |
|
|
959 |
iCaption->SetFont( iCaptionLayout.Font() );
|
|
960 |
iCaption->SetAlignment( iCaptionLayout.Align() == CGraphicsContext::ELeft ? EHLeftVTop :
|
|
961 |
EHRightVTop );
|
|
962 |
#endif // RD_SCALABLE_UI_V2
|
|
963 |
|
|
964 |
iEditor->SetAlignment( editorLineLayout.iJ );
|
|
965 |
}
|
|
966 |
|
|
967 |
// ---------------------------------------------------------
|
|
968 |
// CMsgExpandableControl::HandleFrameSizeChange
|
|
969 |
// ---------------------------------------------------------
|
|
970 |
//
|
|
971 |
void CMsgExpandableControl::HandleFrameSizeChange()
|
|
972 |
{
|
|
973 |
TRAP_IGNORE( iEditor->HandleFrameSizeChangeL( ) );
|
|
974 |
}
|
|
975 |
|
|
976 |
// ---------------------------------------------------------
|
|
977 |
// CMsgExpandableControl::Button
|
|
978 |
// ---------------------------------------------------------
|
|
979 |
//
|
|
980 |
CAknButton* CMsgExpandableControl::Button() const
|
|
981 |
{
|
|
982 |
return iButton;
|
|
983 |
}
|
|
984 |
|
|
985 |
// ---------------------------------------------------------
|
|
986 |
// CMsgExpandableControl::LayoutButton
|
|
987 |
// ---------------------------------------------------------
|
|
988 |
//
|
|
989 |
void CMsgExpandableControl::LayoutButton()
|
|
990 |
{
|
|
991 |
#ifdef RD_SCALABLE_UI_V2
|
|
992 |
if ( iButton )
|
|
993 |
{
|
|
994 |
iButton->SetTextFont( iCaptionLayout.Font() );
|
|
995 |
iButton->SetTextColorIds( KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG63 );
|
|
996 |
|
|
997 |
iButton->SetTextHorizontalAlignment( iCaptionLayout.Align() );
|
|
998 |
|
|
999 |
if ( iCaptionLayout.Align() == CGraphicsContext::ELeft )
|
|
1000 |
{
|
|
1001 |
iButton->SetIconHorizontalAlignment( CAknButton::ELeft );
|
|
1002 |
}
|
|
1003 |
else
|
|
1004 |
{
|
|
1005 |
iButton->SetIconHorizontalAlignment( CAknButton::ERight );
|
|
1006 |
}
|
|
1007 |
}
|
|
1008 |
#endif // RD_SCALABLE_UI_V2
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
// ---------------------------------------------------------
|
|
1012 |
// CMsgExpandableControl::UpdateCaptionTextColorL
|
|
1013 |
//
|
|
1014 |
// Sets the correct text color for caption from currently
|
|
1015 |
// used theme.
|
|
1016 |
// ---------------------------------------------------------
|
|
1017 |
//
|
|
1018 |
void CMsgExpandableControl::UpdateCaptionTextColorL()
|
|
1019 |
{
|
|
1020 |
TRgb textColor;
|
|
1021 |
if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
|
|
1022 |
textColor,
|
|
1023 |
KAknsIIDQsnTextColors,
|
|
1024 |
EAknsCIQsnTextColorsCG6 ) != KErrNone )
|
|
1025 |
{
|
|
1026 |
/*
|
|
1027 |
From "AknsConstants.h":
|
|
1028 |
// text #6 main area main area texts #215
|
|
1029 |
EAknsCIQsnTextColorsCG6 = 5,
|
|
1030 |
*/
|
|
1031 |
textColor = AKN_LAF_COLOR_STATIC( 215 );
|
|
1032 |
}
|
|
1033 |
|
|
1034 |
iCaption->OverrideColorL( EColorLabelText, textColor );
|
|
1035 |
}
|
|
1036 |
|
|
1037 |
// ---------------------------------------------------------
|
|
1038 |
// CMsgExpandableControl::GetCaptionForFep
|
|
1039 |
// ---------------------------------------------------------
|
|
1040 |
//
|
|
1041 |
void CMsgExpandableControl::GetCaptionForFep( TDes& aCaption ) const
|
|
1042 |
{
|
|
1043 |
const TDesC* captionText = Caption().Text();
|
|
1044 |
|
|
1045 |
const TInt maximumLength = aCaption.MaxLength();
|
|
1046 |
|
|
1047 |
if ( captionText->Length() > maximumLength )
|
|
1048 |
{
|
|
1049 |
aCaption = captionText->Left( maximumLength );
|
|
1050 |
}
|
|
1051 |
else
|
|
1052 |
{
|
|
1053 |
aCaption = *captionText;
|
|
1054 |
}
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
// ---------------------------------------------------------
|
|
1058 |
// CMsgExpandableControl::GetToolBarRect
|
|
1059 |
// ---------------------------------------------------------
|
|
1060 |
//
|
|
1061 |
TRect CMsgExpandableControl::GetToolBarRect()
|
|
1062 |
{
|
|
1063 |
TRect appRect;
|
|
1064 |
AknLayoutUtils::LayoutMetricsRect(
|
|
1065 |
AknLayoutUtils::EApplicationWindow, appRect);
|
|
1066 |
|
|
1067 |
TAknWindowLineLayout lineLayout =
|
|
1068 |
AknLayoutScalable_Avkon::area_side_right_pane(0);
|
|
1069 |
TAknLayoutRect toolBarLayoutRect;
|
|
1070 |
toolBarLayoutRect.LayoutRect(appRect, lineLayout);
|
|
1071 |
|
|
1072 |
return toolBarLayoutRect.Rect();
|
|
1073 |
}
|
|
1074 |
// End of File
|