|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <eikenv.h> |
|
21 |
|
22 #include "aknmfneseparator.h" |
|
23 |
|
24 |
|
25 _LIT( KSafeNullDesC, "" ); |
|
26 |
|
27 |
|
28 CAknMfneSeparator::CAknMfneSeparator() : iVisible( ETrue ) |
|
29 { |
|
30 } |
|
31 |
|
32 CAknMfneSeparator::~CAknMfneSeparator() |
|
33 { |
|
34 delete iText; |
|
35 } |
|
36 |
|
37 CAknMfneSeparator* CAknMfneSeparator::NewL(const TDesC& aText) |
|
38 { |
|
39 CAknMfneSeparator* self = new(ELeave) CAknMfneSeparator(); |
|
40 CleanupStack::PushL(self); |
|
41 self->SetTextL(aText); |
|
42 CleanupStack::Pop(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 void CAknMfneSeparator::SetTextL(const TDesC& aText) |
|
47 { |
|
48 delete iText; |
|
49 iText = NULL; |
|
50 iText = HBufC::NewL(aText.Length()); |
|
51 *iText = aText; |
|
52 } |
|
53 |
|
54 TInt CAknMfneSeparator::MaximumWidthInPixels( |
|
55 const CFont& aFont, |
|
56 TBool /*aShrinkToMinimumSize*/) |
|
57 { |
|
58 return aFont.TextWidthInPixels(*iText); |
|
59 } |
|
60 |
|
61 TCoeInputCapabilities CAknMfneSeparator::InputCapabilities() const |
|
62 { |
|
63 return TCoeInputCapabilities(TCoeInputCapabilities::ENone); |
|
64 } |
|
65 |
|
66 const TDesC& CAknMfneSeparator::Text() const |
|
67 { |
|
68 if ( iVisible ) |
|
69 { |
|
70 return *iText; |
|
71 } |
|
72 else |
|
73 { |
|
74 return KSafeNullDesC(); |
|
75 } |
|
76 } |
|
77 |
|
78 void CAknMfneSeparator::MakeVisible( TBool aVisible ) |
|
79 { |
|
80 iVisible = aVisible; |
|
81 } |