|
1 /* |
|
2 * Copyright (c) 2007-2009 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: ESMR UI Container class |
|
15 * |
|
16 */ |
|
17 |
|
18 // CLASS HEADER |
|
19 #include "emailtrace.h" |
|
20 #include "cesmrtrackingfieldlabel.h" |
|
21 |
|
22 // USER INCLUDES |
|
23 #include "mesmrlistobserver.h" |
|
24 #include "cesmrborderlayer.h" |
|
25 |
|
26 // SYSTEM INCLUDES |
|
27 #include <eiklabel.h> |
|
28 #include <avkon.hrh> |
|
29 #include <caluser.h> |
|
30 #include <calentry.h> |
|
31 #include <StringLoader.h> |
|
32 #include <esmrgui.rsg> |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CESMRTrackingFieldLabel::NewL |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CESMRTrackingFieldLabel* CESMRTrackingFieldLabel::NewL( |
|
41 CCalAttendee::TCalRole aRole ) |
|
42 { |
|
43 FUNC_LOG; |
|
44 CESMRTrackingFieldLabel* self = new (ELeave) CESMRTrackingFieldLabel( aRole ); |
|
45 CleanupStack::PushL ( self ); |
|
46 self->ConstructL ( ); |
|
47 CleanupStack::Pop ( self ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CESMRTrackingFieldLabel::ConstructL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CESMRTrackingFieldLabel::ConstructL( ) |
|
56 { |
|
57 FUNC_LOG; |
|
58 SetFieldId ( (iRole == CCalAttendee::EReqParticipant) ? EESMRFieldReqTrack |
|
59 : EESMRFieldOptTrack ); |
|
60 |
|
61 iTitle = new (ELeave) CEikLabel(); |
|
62 iTitle->SetLabelAlignment ( CESMRLayoutManager::IsMirrored ( ) ? ELayoutAlignRight |
|
63 : ELayoutAlignLeft ); |
|
64 |
|
65 |
|
66 HBufC* label = StringLoader::LoadLC (iRole == CCalAttendee::EReqParticipant ? |
|
67 R_QTN_MEET_REQ_LABEL_REQUIRED : R_QTN_MEET_REQ_LABEL_OPT ); |
|
68 |
|
69 iTitle->SetTextL ( *label ); |
|
70 CleanupStack::PopAndDestroy( label ); |
|
71 |
|
72 //this label control cannot ever get keyboard focus |
|
73 SetFocusing(EFalse); |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CESMRTrackingFieldLabel::InitializeL |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CESMRTrackingFieldLabel::InitializeL() |
|
81 { |
|
82 FUNC_LOG; |
|
83 iTitleSize = iLayout->FieldSize ( EESMRFieldAttendeeLabel ); |
|
84 iTitle->SetFont( iLayout->Font (iCoeEnv, EESMRFieldAttendeeLabel ) ); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CESMRTrackingFieldLabel::SizeChanged |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CESMRTrackingFieldLabel::SizeChanged( ) |
|
92 { |
|
93 FUNC_LOG; |
|
94 TRect rect = Rect ( ); |
|
95 if ( CESMRLayoutManager::IsMirrored ( ) ) |
|
96 { |
|
97 TPoint titlePos( rect.iBr.iX - iTitleSize.iWidth, rect.iTl.iY); |
|
98 iTitle->SetExtent ( titlePos, iTitleSize ); |
|
99 } |
|
100 else |
|
101 { |
|
102 // title |
|
103 iTitle->SetExtent ( rect.iTl, iTitleSize ); |
|
104 } |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CESMRTrackingFieldLabel::HandleEdwinSizeEventL |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 TBool CESMRTrackingFieldLabel::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/, |
|
112 TEdwinSizeEvent /*aType*/, TSize /*aSize */) |
|
113 { |
|
114 FUNC_LOG; |
|
115 return ETrue; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // CESMRTrackingFieldLabel::CountComponentControls |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 TInt CESMRTrackingFieldLabel::CountComponentControls( ) const |
|
123 { |
|
124 FUNC_LOG; |
|
125 TInt count = CESMRField::CountComponentControls ( ); |
|
126 if ( iTitle ) |
|
127 { |
|
128 ++count; |
|
129 } |
|
130 |
|
131 return count; |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // CESMRTrackingFieldLabel::ComponentControl |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 CCoeControl* CESMRTrackingFieldLabel::ComponentControl( TInt aInd ) const |
|
139 { |
|
140 FUNC_LOG; |
|
141 if ( aInd == 0 ) |
|
142 { |
|
143 return iTitle; |
|
144 } |
|
145 return CESMRField::ComponentControl ( aInd ); |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CESMRTrackingFieldLabel::~CESMRTrackingFieldLabel |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 CESMRTrackingFieldLabel::~CESMRTrackingFieldLabel( ) |
|
153 { |
|
154 FUNC_LOG; |
|
155 delete iTitle; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CESMRTrackingFieldLabel::CESMRTrackingFieldLabel |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 CESMRTrackingFieldLabel::CESMRTrackingFieldLabel( |
|
163 CCalAttendee::TCalRole aRole ) : |
|
164 iRole( aRole) |
|
165 { |
|
166 FUNC_LOG; |
|
167 //do nothing |
|
168 } |
|
169 |
|
170 // End of File |
|
171 |