|
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: Class draws focus for the fields |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrborderlayer.h" |
|
20 |
|
21 #include <AknUtils.h> |
|
22 #include <AknsConstants.h> |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CESMRBorderLayer::NewL |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 EXPORT_C CESMRBorderLayer* CESMRBorderLayer::NewL( |
|
31 CCoeControl* aExt, TESMRFieldFocusType aFocusType ) |
|
32 { |
|
33 FUNC_LOG; |
|
34 CESMRBorderLayer* self = new (ELeave) CESMRBorderLayer( aExt, aFocusType ); |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL(); |
|
37 CleanupStack::Pop( self ); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CESMRBorderLayer::CESMRBorderLayer |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CESMRBorderLayer::CESMRBorderLayer( |
|
46 CCoeControl* aExtControl, |
|
47 TESMRFieldFocusType aFocusType ) |
|
48 :iExtControl( aExtControl ), |
|
49 iFocus( EFalse ), |
|
50 iFocusType( aFocusType ) |
|
51 { |
|
52 FUNC_LOG; |
|
53 // Do nothing |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CESMRBorderLayer::~CESMRBorderLayer |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C CESMRBorderLayer::~CESMRBorderLayer() |
|
61 { |
|
62 FUNC_LOG; |
|
63 delete iExtControl; |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CESMRBorderLayer::ConstructL |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 EXPORT_C void CESMRBorderLayer::ConstructL() // codescanner::LFunctionCantLeave |
|
71 { |
|
72 FUNC_LOG; |
|
73 SetBackground( this ); |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CESMRBorderLayer::SetContainerWindowL |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 EXPORT_C void CESMRBorderLayer::SetContainerWindowL( |
|
81 const CCoeControl& aContainer) |
|
82 { |
|
83 FUNC_LOG; |
|
84 CCoeControl::SetContainerWindowL( aContainer ); |
|
85 if ( iExtControl ) |
|
86 { |
|
87 iExtControl->SetContainerWindowL( aContainer ); |
|
88 } |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CESMRBorderLayer::SetOutlineFocusL |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C void CESMRBorderLayer::SetOutlineFocusL( // codescanner::LFunctionCantLeave |
|
96 TBool aFocus ) |
|
97 { |
|
98 FUNC_LOG; |
|
99 iFocus = aFocus; |
|
100 if ( iExtControl ) |
|
101 { |
|
102 iExtControl->SetFocus( aFocus ); |
|
103 } |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CESMRBorderLayer::HasFocus |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C TBool CESMRBorderLayer::HasFocus() const |
|
111 { |
|
112 FUNC_LOG; |
|
113 return iFocus; |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // CESMRBorderLayer::Draw |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C void CESMRBorderLayer::Draw( |
|
121 CWindowGc &/*aGc*/, |
|
122 const CCoeControl &/*aControl*/, |
|
123 const TRect& /*aRect*/) const |
|
124 { |
|
125 FUNC_LOG; |
|
126 // Do nothing. Deprecated. |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CESMRBorderLayer::GetTextDrawer |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C void CESMRBorderLayer::GetTextDrawer( |
|
134 CCoeTextDrawerBase*& /*aTextDrawer*/, |
|
135 const CCoeControl* /*aDrawingControl*/) const |
|
136 { |
|
137 FUNC_LOG; |
|
138 // Do nothing |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // CESMRBorderLayer::CountComponentControls |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 EXPORT_C TInt CESMRBorderLayer::CountComponentControls() const |
|
146 { |
|
147 FUNC_LOG; |
|
148 TInt count( 0 ); |
|
149 if ( iExtControl ) |
|
150 { |
|
151 ++count; |
|
152 } |
|
153 return count; |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CESMRBorderLayer::ComponentControl |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C CCoeControl* CESMRBorderLayer::ComponentControl( TInt /*aInd*/ ) const |
|
161 { |
|
162 FUNC_LOG; |
|
163 return iExtControl; |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CESMRBorderLayer::SizeChanged |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 EXPORT_C void CESMRBorderLayer::SizeChanged() |
|
171 { |
|
172 FUNC_LOG; |
|
173 TRect rect = Rect(); |
|
174 if ( iExtControl ) |
|
175 { |
|
176 iExtControl->SetRect( rect ); |
|
177 } |
|
178 } |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // CESMRBorderLayer::OfferKeyEventL |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 EXPORT_C TKeyResponse CESMRBorderLayer::OfferKeyEventL( |
|
185 const TKeyEvent& aEvent, TEventCode aType ) |
|
186 { |
|
187 FUNC_LOG; |
|
188 if ( iExtControl ) |
|
189 { |
|
190 return iExtControl->OfferKeyEventL( aEvent, aType ); |
|
191 } |
|
192 return EKeyWasNotConsumed; |
|
193 } |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // CESMRBorderLayer::SetLayoutManager() |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C void CESMRBorderLayer::SetLayoutManager( |
|
200 CESMRLayoutManager* aLayout ) |
|
201 { |
|
202 FUNC_LOG; |
|
203 iLayout = aLayout; |
|
204 } |
|
205 |
|
206 // EOF |
|
207 |