25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Container class for compose view
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CNCSADDRESSINPUTFIELD_H
|
|
21 |
#define CNCSADDRESSINPUTFIELD_H
|
|
22 |
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <aknview.h>
|
|
26 |
#include <AknDef.h>
|
|
27 |
//<cmail>
|
|
28 |
#include <eikedwob.h>
|
|
29 |
//</cmail>
|
|
30 |
#include "ncscontrol.h"
|
|
31 |
|
|
32 |
class CAknPhysics;
|
|
33 |
|
|
34 |
//<cmail> Temporary hardcoded layout values
|
|
35 |
//Horizontal values
|
|
36 |
const TInt KButtonXa = 5;
|
|
37 |
const TInt KButtonXb = 80;
|
|
38 |
const TInt KTxtFieldXa = KButtonXb + 7;
|
|
39 |
const TInt KTxtFieldXb = 445;
|
|
40 |
|
|
41 |
//To-field
|
|
42 |
const TInt KToAy = 5;
|
|
43 |
const TInt KToBy = KToAy + 45;
|
|
44 |
const TInt KToFieldAy = 5;
|
|
45 |
const TInt KToFieldBy = KToFieldAy + 45;
|
|
46 |
|
|
47 |
//Cc-field
|
|
48 |
const TInt KCcAy = KToBy + 7;
|
|
49 |
const TInt KCcBy = KCcAy + 45;
|
|
50 |
const TInt KCcFieldAy = KToFieldBy + 7;
|
|
51 |
const TInt KCcFieldBy = KCcFieldAy + 45;
|
|
52 |
|
|
53 |
//Bcc-field
|
|
54 |
const TInt KBccAy = KCcBy + 7;
|
|
55 |
const TInt KBccBy = KBccAy + 45;
|
|
56 |
const TInt KBccFieldAy = KCcFieldBy + 7;
|
|
57 |
const TInt KBccFieldBy = KBccFieldAy + 45;
|
|
58 |
|
|
59 |
//Subject field
|
|
60 |
const TInt KSubjectLblRectAy = KBccBy + 7;
|
|
61 |
const TInt KSubjectLblRectBy = KSubjectLblRectAy + 45;
|
|
62 |
const TInt KSubjectFieldRectAy = KBccFieldBy + 7;
|
|
63 |
const TInt KSubjectFieldRectBy = KSubjectFieldRectAy + 45;
|
|
64 |
|
|
65 |
//A konst for empty return values
|
|
66 |
_LIT( KEmptyReturnValue, "" );
|
|
67 |
//</cmail>
|
|
68 |
|
|
69 |
class CEikImage;
|
|
70 |
class CAknButton;
|
|
71 |
class CNcsAifEditor;
|
|
72 |
class CNcsEmailAddressObject;
|
|
73 |
class CNcsHeaderContainer;
|
|
74 |
|
|
75 |
|
|
76 |
/**
|
|
77 |
* CNcsAddressInputField container control class.
|
|
78 |
*/
|
|
79 |
class MNcsAddressPopupList
|
|
80 |
{
|
|
81 |
public:
|
|
82 |
virtual void UpdatePopupContactListL( const TDesC& aMatchString, TBool iListAll ) = 0;
|
|
83 |
virtual void ClosePopupContactListL() = 0;
|
|
84 |
};
|
|
85 |
|
|
86 |
|
|
87 |
/**
|
|
88 |
* CNcsAddressInputField container control class.
|
|
89 |
*/
|
|
90 |
class CNcsAddressInputField: public CCoeControl, public MEikEdwinSizeObserver,
|
|
91 |
public MNcsControl, public MCoeControlObserver
|
|
92 |
{
|
|
93 |
public: // enum
|
|
94 |
|
|
95 |
enum TNcsInputFieldType
|
|
96 |
{
|
|
97 |
EInputFieldTo,
|
|
98 |
EInputFieldCc,
|
|
99 |
EInputFieldBcc
|
|
100 |
};
|
|
101 |
|
|
102 |
public: // Constructors and destructor
|
|
103 |
|
|
104 |
/**
|
|
105 |
* NewL
|
|
106 |
* Create a CNcsAddressInputField object, which will draw itself to aRect
|
|
107 |
*/
|
|
108 |
static CNcsAddressInputField* NewL(
|
|
109 |
TInt aLabelId,
|
|
110 |
TNcsInputFieldType aFieldType,
|
|
111 |
MNcsFieldSizeObserver* aSizeObserver,
|
|
112 |
MNcsAddressPopupList* aAddressPopupList,
|
|
113 |
CNcsHeaderContainer* aParentControl );
|
|
114 |
|
|
115 |
/**
|
|
116 |
* ~CNcsAddressInputField
|
|
117 |
* Destructor
|
|
118 |
*/
|
|
119 |
virtual ~CNcsAddressInputField();
|
|
120 |
|
|
121 |
public: // new functions
|
|
122 |
|
|
123 |
TInt MinimumHeight() const;
|
|
124 |
|
|
125 |
void SetAddressesL( const RPointerArray<CNcsEmailAddressObject>& aAddress );
|
|
126 |
|
|
127 |
const RPointerArray<CNcsEmailAddressObject>& GetAddressesL( TBool aParseNow=ETrue );
|
|
128 |
|
|
129 |
void GetLineRectL( TRect& aLineRect ) const;
|
|
130 |
|
|
131 |
void SetMaxLabelLength( TInt aMaxLength );
|
|
132 |
|
|
133 |
TInt GetMinLabelLength() const;
|
|
134 |
|
|
135 |
void AddAddressL( const CNcsEmailAddressObject& aAddress );
|
|
136 |
|
|
137 |
void AddAddressL( const TDesC& aDisplayName, const TDesC& aEmail );
|
|
138 |
|
|
139 |
void AddAddressL( const TDesC& aEmail );
|
|
140 |
|
|
141 |
void AppendAddressesL( const RPointerArray<CNcsEmailAddressObject>& aAddress );
|
|
142 |
|
|
143 |
CEikEdwin* TextEditor() const;
|
|
144 |
|
|
145 |
HBufC* GetLookupTextLC() const;
|
|
146 |
|
|
147 |
const CNcsEmailAddressObject* EmailAddressObjectBySelection() const;
|
|
148 |
|
|
149 |
void SelectAllTextL();
|
|
150 |
|
|
151 |
void SetTextColorL( TLogicalRgb aColor );
|
|
152 |
|
|
153 |
CNcsEditor* Editor() const;
|
|
154 |
|
|
155 |
TBool IsEmpty() const;
|
|
156 |
|
|
157 |
void SetLabelTextColorL (TRgb aColor);
|
|
158 |
|
|
159 |
void FixSemicolonAtTheEndL();
|
|
160 |
|
|
161 |
void SetPhysicsEmulationOngoing( TBool aPhysOngoing );
|
|
162 |
|
|
163 |
public: // from CoeControl
|
|
164 |
|
|
165 |
/**
|
|
166 |
* SetContainerWinowL
|
|
167 |
* Set the cotainer window this control should raw in
|
|
168 |
* @since S60 v3.0
|
|
169 |
* @param aContainer The window continer that owns this control
|
|
170 |
*/
|
|
171 |
void SetContainerWindowL(const CCoeControl& aContainer);
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Draw
|
|
175 |
* Draw this CNcsAddressInputField to the screen.
|
|
176 |
* @since S60 v3.0
|
|
177 |
* @param aRect the rectangle of this view that needs updating
|
|
178 |
*/
|
|
179 |
void Draw( const TRect& aRect ) const;
|
|
180 |
|
|
181 |
void SizeChanged();
|
|
182 |
|
|
183 |
void PositionChanged();
|
|
184 |
|
|
185 |
//<cmail>
|
|
186 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
187 |
//</cmail>
|
|
188 |
|
|
189 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
|
|
190 |
|
|
191 |
void FocusChanged(TDrawNow aDrawNow);
|
|
192 |
|
|
193 |
void HandleResourceChange( TInt aType );
|
|
194 |
|
|
195 |
public: // from MEikEdwinSizeObserver
|
|
196 |
|
|
197 |
TBool HandleEdwinSizeEventL( CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize );
|
|
198 |
|
|
199 |
public: // from MNcsControl
|
|
200 |
|
|
201 |
virtual TInt LineCount() const;
|
|
202 |
|
|
203 |
virtual TInt ScrollableLines() const;
|
|
204 |
|
|
205 |
virtual TInt GetNumChars() const;
|
|
206 |
|
|
207 |
virtual TInt CursorLineNumber() const;
|
|
208 |
|
|
209 |
virtual TInt CursorPosition() const;
|
|
210 |
|
|
211 |
virtual void Reposition(TPoint& aPt, TInt aWidth);
|
|
212 |
|
|
213 |
virtual const TDesC& GetLabelText() const;
|
|
214 |
|
|
215 |
// <cmail> Platform layout change
|
|
216 |
TInt LayoutLineCount() const;
|
|
217 |
// </cmail> Platform layout change
|
|
218 |
|
|
219 |
void EnableKineticScrollingL( CAknPhysics* aPhysics );
|
|
220 |
|
|
221 |
//<cmail>
|
|
222 |
private:
|
|
223 |
|
|
224 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
|
|
225 |
//</cmail>
|
|
226 |
private: // methods
|
|
227 |
|
|
228 |
CNcsAddressInputField(
|
|
229 |
TNcsInputFieldType aFieldType,
|
|
230 |
MNcsFieldSizeObserver* aSizeObserver,
|
|
231 |
MNcsAddressPopupList* aAddressPopupList,
|
|
232 |
CNcsHeaderContainer* aParentControl );
|
|
233 |
|
|
234 |
void ConstructL( TInt aLabelTextId );
|
|
235 |
|
|
236 |
void UpdateFontSize();
|
|
237 |
|
|
238 |
//<cmail>
|
|
239 |
void CreateControlsL( const TDesC& aControlText );
|
|
240 |
|
|
241 |
void LayoutTouch();
|
|
242 |
|
|
243 |
void LayoutNonTouch();
|
|
244 |
//</cmail>
|
|
245 |
|
|
246 |
private: // data
|
|
247 |
|
|
248 |
CNcsHeaderContainer* iParentControl; // not owned
|
|
249 |
|
|
250 |
MNcsAddressPopupList* iAddressPopupList;
|
|
251 |
|
|
252 |
/*
|
|
253 |
* text field
|
|
254 |
* Own
|
|
255 |
*/
|
|
256 |
CNcsLabel* iLabel;
|
|
257 |
|
|
258 |
// <cmail> Platform layout changes
|
|
259 |
const CFont* iFont; // not owned, needs to be released in the end
|
|
260 |
|
|
261 |
CAknButton* iButton;
|
|
262 |
// </cmail> Platform layout changes
|
|
263 |
/*
|
|
264 |
* text field
|
|
265 |
* Own
|
|
266 |
*/
|
|
267 |
CNcsAifEditor* iTextEditor;
|
|
268 |
|
|
269 |
TNcsInputFieldType iFieldType;
|
|
270 |
|
|
271 |
TBool iFocusChanged;
|
|
272 |
|
|
273 |
TInt iEditorMinimumHeight;
|
|
274 |
|
|
275 |
// <cmail> Platform layout changes
|
|
276 |
TInt iEditorLineCount;
|
|
277 |
// </cmail> Platform layout changes
|
|
278 |
|
|
279 |
TInt iMaximumLabelLength;
|
|
280 |
|
|
281 |
RTimer iPopupTimer;
|
|
282 |
|
|
283 |
TRgb iBorderColor;
|
|
284 |
|
|
285 |
TRgb iBgColor;
|
|
286 |
|
|
287 |
// for keeping buttons in view while scrolling
|
|
288 |
TPoint iOriginalFieldPos;
|
|
289 |
TPoint iOriginalButtonPos;
|
|
290 |
|
|
291 |
// panning related
|
|
292 |
CAknPhysics* iPhysics;
|
|
293 |
TBool iIsDraggingStarted;
|
|
294 |
TPoint iStartPosition;
|
|
295 |
};
|
|
296 |
|
|
297 |
#endif // CNCSADDRESSINPUTFIELD_H
|