44
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: CAknFepHwrBxWnd
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <peninputinputcontextfield.h>
|
|
20 |
#include <peninputhwrbxcn.rsg>
|
|
21 |
#include <peninputdropdownlist.h>
|
|
22 |
#include <peninputdragbutton.h>
|
|
23 |
#include <peninputrepeatbutton.h>
|
|
24 |
#include <AknLayoutDef.h>
|
|
25 |
#include <AknUtils.h>
|
|
26 |
#include <AknsUtils.h>
|
|
27 |
#include <AknIconUtils.h>
|
|
28 |
#include <coemain.h>
|
|
29 |
#include <peninputlayoutchoicelist.h>
|
|
30 |
#include <AknFepGlobalEnums.h>
|
|
31 |
#include <peninputlayoutinputmodechoice.h>
|
|
32 |
#include <peninputrepeatbutton.h>
|
|
33 |
|
|
34 |
#include "peninputhwrdebug.h"
|
|
35 |
#include "peninputhwrbxwnd.h"
|
|
36 |
#include "peninputhwrbxlayout.h"
|
|
37 |
#include "peninputhwrevent.h"
|
|
38 |
#include "peninputhwrctrlid.h"
|
|
39 |
#include "peninputhwrbxctrlbar.h"
|
|
40 |
#include "peninputhwrboxgroup.h"
|
|
41 |
#include "peninputhwrbxdatastore.h"
|
|
42 |
#include "aknlayoutscalable_avkon.cdl.h"
|
|
43 |
|
|
44 |
const TInt KBoxCount = 2;
|
|
45 |
const TInt KInvalidImg = -1 ;
|
|
46 |
const TInt KNotSupportSkin = -1;
|
|
47 |
const TUint32 KDefaultTextColor = 0x000000;
|
|
48 |
const TInt32 KInvalidResId = -1;
|
|
49 |
|
|
50 |
const TInt KWrittingFactor = 255; // 0% transparency
|
|
51 |
const TInt KNormalFactor = 229; // 10% transparency
|
|
52 |
|
|
53 |
const TInt KDefaultStrokeEndMarkX = -65536;
|
|
54 |
const TInt KDefaultStrokeEndMarkY = -65536;
|
|
55 |
|
|
56 |
// ---------------------------------------------------------
|
|
57 |
// Constructor
|
|
58 |
// ---------------------------------------------------------
|
|
59 |
//
|
|
60 |
CAknFepHwrBxWnd* CAknFepHwrBxWnd::NewL(CFepUiLayout* aFepUiLayout,
|
|
61 |
TInt aControlId,
|
|
62 |
TBool aLandscapeStyle)
|
|
63 |
{
|
|
64 |
PRINTF((_L("CAknFepHwrBxWnd::NewL(), aCtrlId = %d\n"), aControlId));
|
|
65 |
CAknFepHwrBxWnd* self = NewLC(aFepUiLayout, aControlId, aLandscapeStyle);
|
|
66 |
CleanupStack::Pop(self);
|
|
67 |
|
|
68 |
return self;
|
|
69 |
}
|
|
70 |
|
|
71 |
// ---------------------------------------------------------
|
|
72 |
// Constructor
|
|
73 |
// ---------------------------------------------------------
|
|
74 |
//
|
|
75 |
CAknFepHwrBxWnd* CAknFepHwrBxWnd::NewLC(CFepUiLayout* aFepUiLayout,
|
|
76 |
TInt aControlId,
|
|
77 |
TBool aLandscapeStyle)
|
|
78 |
{
|
|
79 |
PRINTF((_L("CAknFepHwrBxWnd::NewLC(), aCtrlId = %d\n"), aControlId));
|
|
80 |
CAknFepHwrBxWnd* self = new (ELeave) CAknFepHwrBxWnd(aFepUiLayout, aControlId);
|
|
81 |
CleanupStack::PushL(self);
|
|
82 |
self->ConstructL(aLandscapeStyle);
|
|
83 |
|
|
84 |
return self;
|
|
85 |
}
|
|
86 |
|
|
87 |
// ---------------------------------------------------------
|
|
88 |
// Constructor
|
|
89 |
// ---------------------------------------------------------
|
|
90 |
//
|
|
91 |
CAknFepHwrBxWnd::CAknFepHwrBxWnd( CFepUiLayout* aFepUiLayout, TInt aControlId)
|
|
92 |
:CAknFepCtrlBaseWindow(aFepUiLayout,aControlId),
|
|
93 |
iFirstTimeConstruct(ETrue),
|
|
94 |
iUnitShadowSizeSet(EFalse),
|
|
95 |
iControlPosSet(EFalse)
|
|
96 |
{
|
|
97 |
CAknFepHwrBxLayout* layout = static_cast<CAknFepHwrBxLayout*>(aFepUiLayout);
|
|
98 |
iDataStore = layout->DataStore();
|
|
99 |
}
|
|
100 |
|
|
101 |
// ---------------------------------------------------------
|
|
102 |
// Constructor
|
|
103 |
// ---------------------------------------------------------
|
|
104 |
//
|
|
105 |
void CAknFepHwrBxWnd::ConstructL(TBool aLandscapeStyle)
|
|
106 |
{
|
|
107 |
PRINTF((_L("CAknFepHwrBxWnd::ConstructL()\n")));
|
|
108 |
BaseConstructL();
|
|
109 |
|
|
110 |
AddContextFieldL();
|
|
111 |
|
|
112 |
AddBackspaceBtnL();
|
|
113 |
|
|
114 |
AddOptionButtonL();
|
|
115 |
|
|
116 |
AddControlBarL();
|
|
117 |
|
|
118 |
AddBoxGroupL();
|
|
119 |
|
|
120 |
AddDropdownListL(aLandscapeStyle);
|
|
121 |
|
|
122 |
//add layout as window's observer
|
|
123 |
AddEventObserver(UiLayout());
|
|
124 |
MoveButton()->AddEventObserver(UiLayout());
|
|
125 |
|
|
126 |
//add window as the subscriber
|
|
127 |
iDataStore->AddSubscriber(this);
|
|
128 |
|
|
129 |
PRINTF((_L("CAknFepHwrBxWnd::ConstructL()......done!\n")));
|
|
130 |
}
|
|
131 |
|
|
132 |
// ---------------------------------------------------------
|
|
133 |
// Destructor
|
|
134 |
// ---------------------------------------------------------
|
|
135 |
//
|
|
136 |
CAknFepHwrBxWnd::~CAknFepHwrBxWnd()
|
|
137 |
{
|
|
138 |
PRINTF((_L("CAknFepHwrBxWnd::~CAknFepHwrBxWnd()\n")));
|
|
139 |
}
|
|
140 |
|
|
141 |
// ---------------------------------------------------------
|
|
142 |
// ConstructFromResourceL
|
|
143 |
// ---------------------------------------------------------
|
|
144 |
//
|
|
145 |
void CAknFepHwrBxWnd::ConstructFromResourceL(TResourceReader& aReader)
|
|
146 |
{
|
|
147 |
TInt supportskin = aReader.ReadInt16();
|
|
148 |
|
|
149 |
if (iFirstTimeConstruct && (supportskin != KNotSupportSkin))
|
|
150 |
{
|
|
151 |
UiLayout()->AddControlL(this);
|
|
152 |
}
|
|
153 |
|
|
154 |
// read shadow and icf resources
|
|
155 |
TPtrC bmpFileName = aReader.ReadTPtrC();
|
|
156 |
|
|
157 |
TInt32 imgMajorSkinId = aReader.ReadInt32();
|
|
158 |
|
|
159 |
TAknsItemID id;
|
|
160 |
TInt skinitemid;
|
|
161 |
|
|
162 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
163 |
|
|
164 |
for (TInt i = 0; i < KShadowBmpBr + 1; i++)
|
|
165 |
{
|
|
166 |
const TInt16 bmpId = aReader.ReadInt16();
|
|
167 |
const TInt16 bmpMskId = aReader.ReadInt16();
|
|
168 |
skinitemid = aReader.ReadInt16();
|
|
169 |
|
|
170 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
171 |
|
|
172 |
if (bmpId != KInvalidImg)
|
|
173 |
{
|
|
174 |
CFbsBitmap* shadowImg = NULL;
|
|
175 |
CFbsBitmap* shadowMaskImg = NULL;
|
|
176 |
|
|
177 |
if (bmpMskId != KInvalidImg)
|
|
178 |
{
|
|
179 |
AknsUtils::CreateIconL(skininstance,
|
|
180 |
id,
|
|
181 |
shadowImg,
|
|
182 |
shadowMaskImg,
|
|
183 |
bmpFileName,
|
|
184 |
bmpId,
|
|
185 |
bmpMskId);
|
|
186 |
}
|
|
187 |
else
|
|
188 |
{
|
|
189 |
AknsUtils::CreateIconL(skininstance,
|
|
190 |
id,
|
|
191 |
shadowImg,
|
|
192 |
bmpFileName,
|
|
193 |
bmpId);
|
|
194 |
}
|
|
195 |
|
|
196 |
SetShadowBmp(shadowImg, shadowMaskImg, TShadowBitmapIndex(i));
|
|
197 |
}
|
|
198 |
}
|
|
199 |
|
|
200 |
const TInt16 icfbgId = aReader.ReadInt16();
|
|
201 |
const TInt16 icfbgmaskId = aReader.ReadInt16();
|
|
202 |
skinitemid = aReader.ReadInt16();
|
|
203 |
|
|
204 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
205 |
|
|
206 |
if (icfbgId != KInvalidImg)
|
|
207 |
{
|
|
208 |
CFbsBitmap* icfImg = NULL;
|
|
209 |
|
|
210 |
if (icfbgmaskId != KInvalidImg)
|
|
211 |
{
|
|
212 |
CFbsBitmap* icfmaskImg = NULL;
|
|
213 |
|
|
214 |
AknsUtils::CreateIconL(skininstance,
|
|
215 |
id,
|
|
216 |
icfImg,
|
|
217 |
icfmaskImg,
|
|
218 |
bmpFileName,
|
|
219 |
icfbgId,
|
|
220 |
icfbgmaskId);
|
|
221 |
|
|
222 |
AknIconUtils::SetSize(icfmaskImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
223 |
iContextField->SetBackgroundMaskBitmapL(icfmaskImg);
|
|
224 |
}
|
|
225 |
else
|
|
226 |
{
|
|
227 |
AknsUtils::CreateIconL(skininstance,
|
|
228 |
id,
|
|
229 |
icfImg,
|
|
230 |
bmpFileName,
|
|
231 |
icfbgId);
|
|
232 |
}
|
|
233 |
|
|
234 |
AknIconUtils::SetSize(icfImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
235 |
iContextField->SetBackgroundBitmapL(icfImg);
|
|
236 |
}
|
|
237 |
|
|
238 |
// read text color
|
|
239 |
TRgb textcolor;
|
|
240 |
TInt32 colorMajorSkinId = aReader.ReadInt32();
|
|
241 |
skinitemid = aReader.ReadInt16();
|
|
242 |
|
|
243 |
id.Set(TInt(colorMajorSkinId), skinitemid);
|
|
244 |
|
|
245 |
const TInt16 textcoloridx = aReader.ReadInt16();
|
|
246 |
|
|
247 |
TInt error = AknsUtils::GetCachedColor(skininstance,
|
|
248 |
textcolor,
|
|
249 |
id,
|
|
250 |
textcoloridx);
|
|
251 |
|
|
252 |
if (error == KErrNone)
|
|
253 |
{
|
|
254 |
iContextField->SetTextColor(textcolor);
|
|
255 |
}
|
|
256 |
else
|
|
257 |
{
|
|
258 |
iContextField->SetTextColor(TRgb(KDefaultTextColor));
|
|
259 |
}
|
|
260 |
|
|
261 |
if (iFirstTimeConstruct)
|
|
262 |
{
|
|
263 |
const TInt32 moveResId = aReader.ReadInt32();
|
|
264 |
const TInt32 closeResId = aReader.ReadInt32();
|
|
265 |
const TInt32 backResId = aReader.ReadInt32();
|
|
266 |
const TInt32 optionResId = aReader.ReadInt32();
|
|
267 |
const TInt32 ctrlbarResId = aReader.ReadInt32();
|
|
268 |
const TInt32 boxgrpResId = aReader.ReadInt32();
|
|
269 |
const TInt32 bgImageResId = aReader.ReadInt32();
|
|
270 |
|
|
271 |
MoveButton()->SetResourceId(moveResId);
|
|
272 |
MoveButton()->ConstructFromResourceL();
|
|
273 |
|
|
274 |
CloseButton()->SetResourceId(closeResId);
|
|
275 |
CloseButton()->ConstructFromResourceL();
|
|
276 |
|
|
277 |
iBackspace->SetResourceId(backResId);
|
|
278 |
iBackspace->ConstructFromResourceL();
|
|
279 |
|
|
280 |
iOptionButton->SetResourceId(optionResId);
|
|
281 |
iOptionButton->ConstructFromResourceL();
|
|
282 |
|
|
283 |
CCoeEnv* coeEnv = CCoeEnv::Static();
|
|
284 |
TResourceReader ctrlbarreader;
|
|
285 |
|
|
286 |
coeEnv->CreateResourceReaderLC(ctrlbarreader, ctrlbarResId);
|
|
287 |
iControlBar->ConstructFromResourceL(ctrlbarreader);
|
|
288 |
CleanupStack::PopAndDestroy(); // ctrlbarreader
|
|
289 |
|
|
290 |
iBoxGroup->SetResourceId(boxgrpResId);
|
|
291 |
iBoxGroup->ConstructFromResourceL();
|
|
292 |
|
|
293 |
ReadBackgroundInfoL( bgImageResId );
|
|
294 |
}
|
|
295 |
else
|
|
296 |
{
|
|
297 |
CControlGroup::ConstructFromResourceL();
|
|
298 |
}
|
|
299 |
|
|
300 |
iFirstTimeConstruct = EFalse;
|
|
301 |
|
|
302 |
TInt newValue = iDataStore->GetPenTrailColor();
|
|
303 |
iDataStore->SetBoxPenColor(TRgb(newValue));
|
|
304 |
}
|
|
305 |
|
|
306 |
// ---------------------------------------------------------
|
|
307 |
// ConstructFromResourceL
|
|
308 |
// ---------------------------------------------------------
|
|
309 |
//
|
|
310 |
void CAknFepHwrBxWnd::ConstructFromResourceL()
|
|
311 |
{
|
|
312 |
if (iResourceId == KInvalidResId)
|
|
313 |
{
|
|
314 |
User::Leave(KErrArgument);
|
|
315 |
}
|
|
316 |
|
|
317 |
TResourceReader reader;
|
|
318 |
CCoeEnv::Static()->CreateResourceReaderLC(reader, iResourceId);
|
|
319 |
|
|
320 |
TInt supportskin = reader.ReadInt16();
|
|
321 |
|
|
322 |
if (iFirstTimeConstruct && (supportskin != KNotSupportSkin))
|
|
323 |
{
|
|
324 |
UiLayout()->AddControlL(this);
|
|
325 |
}
|
|
326 |
|
|
327 |
// read shadow and icf resources
|
|
328 |
TPtrC bmpFileName = reader.ReadTPtrC();
|
|
329 |
TInt32 imgMajorSkinId = reader.ReadInt32();
|
|
330 |
|
|
331 |
TAknsItemID id;
|
|
332 |
TInt skinitemid;
|
|
333 |
|
|
334 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
335 |
|
|
336 |
for (TInt i = 0; i < KShadowBmpBr + 1; i++)
|
|
337 |
{
|
|
338 |
const TInt16 bmpId = reader.ReadInt16();
|
|
339 |
const TInt16 bmpMskId = reader.ReadInt16();
|
|
340 |
skinitemid = reader.ReadInt16();
|
|
341 |
|
|
342 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
343 |
|
|
344 |
if (bmpId != KInvalidImg)
|
|
345 |
{
|
|
346 |
CFbsBitmap* shadowImg = NULL;
|
|
347 |
CFbsBitmap* shadowMaskImg = NULL;
|
|
348 |
|
|
349 |
if (bmpMskId != KInvalidImg)
|
|
350 |
{
|
|
351 |
AknsUtils::CreateIconL(skininstance,
|
|
352 |
id,
|
|
353 |
shadowImg,
|
|
354 |
shadowMaskImg,
|
|
355 |
bmpFileName,
|
|
356 |
bmpId,
|
|
357 |
bmpMskId);
|
|
358 |
}
|
|
359 |
else
|
|
360 |
{
|
|
361 |
AknsUtils::CreateIconL(skininstance,
|
|
362 |
id,
|
|
363 |
shadowImg,
|
|
364 |
bmpFileName,
|
|
365 |
bmpId);
|
|
366 |
}
|
|
367 |
|
|
368 |
SetShadowBmp(shadowImg, shadowMaskImg, TShadowBitmapIndex(i));
|
|
369 |
}
|
|
370 |
}
|
|
371 |
|
|
372 |
const TInt16 icfbgId = reader.ReadInt16();
|
|
373 |
const TInt16 icfbgmaskId = reader.ReadInt16();
|
|
374 |
skinitemid = reader.ReadInt16();
|
|
375 |
|
|
376 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
377 |
|
|
378 |
if (icfbgId != KInvalidImg)
|
|
379 |
{
|
|
380 |
CFbsBitmap* icfImg = NULL;
|
|
381 |
|
|
382 |
if (icfbgmaskId != KInvalidImg)
|
|
383 |
{
|
|
384 |
CFbsBitmap* icfmaskImg = NULL;
|
|
385 |
|
|
386 |
AknsUtils::CreateIconL(skininstance,
|
|
387 |
id,
|
|
388 |
icfImg,
|
|
389 |
icfmaskImg,
|
|
390 |
bmpFileName,
|
|
391 |
icfbgId,
|
|
392 |
icfbgmaskId);
|
|
393 |
|
|
394 |
AknIconUtils::SetSize(icfmaskImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
395 |
iContextField->SetBackgroundMaskBitmapL(icfmaskImg);
|
|
396 |
}
|
|
397 |
else
|
|
398 |
{
|
|
399 |
AknsUtils::CreateIconL(skininstance,
|
|
400 |
id,
|
|
401 |
icfImg,
|
|
402 |
bmpFileName,
|
|
403 |
icfbgId);
|
|
404 |
}
|
|
405 |
|
|
406 |
AknIconUtils::SetSize(icfImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
407 |
iContextField->SetBackgroundBitmapL(icfImg);
|
|
408 |
}
|
|
409 |
|
|
410 |
// read text color
|
|
411 |
TRgb textcolor;
|
|
412 |
TInt32 colorMajorSkinId = reader.ReadInt32();
|
|
413 |
skinitemid = reader.ReadInt16();
|
|
414 |
|
|
415 |
id.Set(TInt(colorMajorSkinId), skinitemid);
|
|
416 |
|
|
417 |
const TInt16 textcoloridx = reader.ReadInt16();
|
|
418 |
|
|
419 |
TInt error = AknsUtils::GetCachedColor(skininstance,
|
|
420 |
textcolor,
|
|
421 |
id,
|
|
422 |
textcoloridx);
|
|
423 |
|
|
424 |
if (error == KErrNone)
|
|
425 |
{
|
|
426 |
iContextField->SetTextColor(textcolor);
|
|
427 |
}
|
|
428 |
else
|
|
429 |
{
|
|
430 |
iContextField->SetTextColor(TRgb(KDefaultTextColor));
|
|
431 |
}
|
|
432 |
|
|
433 |
if (iFirstTimeConstruct)
|
|
434 |
{
|
|
435 |
const TInt32 moveResId = reader.ReadInt32();
|
|
436 |
const TInt32 closeResId = reader.ReadInt32();
|
|
437 |
const TInt32 backResId = reader.ReadInt32();
|
|
438 |
const TInt32 optionResId = reader.ReadInt32();
|
|
439 |
const TInt32 ctrlbarResId = reader.ReadInt32();
|
|
440 |
const TInt32 boxgrpResId = reader.ReadInt32();
|
|
441 |
const TInt32 bgImageResId = reader.ReadInt32();
|
|
442 |
|
|
443 |
MoveButton()->SetResourceId(moveResId);
|
|
444 |
MoveButton()->ConstructFromResourceL();
|
|
445 |
|
|
446 |
CloseButton()->SetResourceId(closeResId);
|
|
447 |
CloseButton()->ConstructFromResourceL();
|
|
448 |
|
|
449 |
iBackspace->SetResourceId(backResId);
|
|
450 |
iBackspace->ConstructFromResourceL();
|
|
451 |
|
|
452 |
iOptionButton->SetResourceId(optionResId);
|
|
453 |
iOptionButton->ConstructFromResourceL();
|
|
454 |
|
|
455 |
CCoeEnv* coeEnv = CCoeEnv::Static();
|
|
456 |
TResourceReader ctrlbarreader;
|
|
457 |
|
|
458 |
coeEnv->CreateResourceReaderLC(ctrlbarreader, ctrlbarResId);
|
|
459 |
iControlBar->ConstructFromResourceL(ctrlbarreader);
|
|
460 |
CleanupStack::PopAndDestroy(); // ctrlbarreader
|
|
461 |
|
|
462 |
iBoxGroup->SetResourceId(boxgrpResId);
|
|
463 |
iBoxGroup->ConstructFromResourceL();
|
|
464 |
|
|
465 |
ReadBackgroundInfoL( bgImageResId );
|
|
466 |
}
|
|
467 |
else
|
|
468 |
{
|
|
469 |
CControlGroup::ConstructFromResourceL();
|
|
470 |
}
|
|
471 |
|
|
472 |
CleanupStack::PopAndDestroy(); // reader
|
|
473 |
|
|
474 |
iFirstTimeConstruct = EFalse;
|
|
475 |
TInt newValue = iDataStore->GetPenTrailColor();
|
|
476 |
iDataStore->SetBoxPenColor(TRgb(newValue));
|
|
477 |
}
|
|
478 |
|
|
479 |
// ---------------------------------------------------------
|
|
480 |
// CAknFepHwrBxWnd::ReadUnitSize
|
|
481 |
// ---------------------------------------------------------
|
|
482 |
//
|
|
483 |
void CAknFepHwrBxWnd::ReadLafInfo(TBool aLandscapeStyle)
|
|
484 |
{
|
|
485 |
if (iDataStore->SizeChanging() || (!iUnitShadowSizeSet))
|
|
486 |
{
|
|
487 |
// if size is changing, or unit size, shadow size have not been set yet
|
|
488 |
TAknWindowLineLayout appWnd;
|
|
489 |
TAknWindowLineLayout mainPane;
|
|
490 |
TAknWindowLineLayout wndLayout;
|
|
491 |
TAknWindowLineLayout unitLayout;
|
|
492 |
TAknWindowLineLayout shadowPane;
|
|
493 |
TAknWindowLineLayout shadowTl;
|
|
494 |
TAknWindowLineLayout shadowBr;
|
|
495 |
TAknLayoutRect mainPaneRect;
|
|
496 |
TAknLayoutRect wndRect;
|
|
497 |
TAknLayoutRect unitRect;
|
|
498 |
TAknLayoutRect shadowRect;
|
|
499 |
TAknLayoutRect shadowTlRect;
|
|
500 |
TAknLayoutRect shadowBrRect;
|
|
501 |
|
|
502 |
// Get hwr window layout
|
|
503 |
appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine();
|
|
504 |
|
|
505 |
if (aLandscapeStyle)
|
|
506 |
{
|
|
507 |
// landscape
|
|
508 |
mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine();
|
|
509 |
wndLayout = AknLayoutScalable_Avkon::popup_fep_hwr_window(2).LayoutLine();
|
|
510 |
}
|
|
511 |
else
|
|
512 |
{
|
|
513 |
// portrait
|
|
514 |
mainPane = AknLayoutScalable_Avkon::main_pane(1).LayoutLine();
|
|
515 |
wndLayout = AknLayoutScalable_Avkon::popup_fep_hwr_window(0).LayoutLine();
|
|
516 |
}
|
|
517 |
|
|
518 |
mainPaneRect.LayoutRect(appWnd.Rect(), mainPane);
|
|
519 |
wndRect.LayoutRect(mainPaneRect.Rect(), wndLayout);
|
|
520 |
|
|
521 |
unitLayout = AknLayoutScalable_Avkon::fep_hwr_aid_pane(2).LayoutLine();
|
|
522 |
unitRect.LayoutRect(wndRect.Rect(), unitLayout);
|
|
523 |
|
|
524 |
TRect hwrWndRect = TRect(0,
|
|
525 |
0,
|
|
526 |
wndRect.Rect().Width(),
|
|
527 |
wndRect.Rect().Height());
|
|
528 |
|
|
529 |
iUnitWidth = unitRect.Rect().Width();
|
|
530 |
iUnitHeight = unitRect.Rect().Height();
|
|
531 |
|
|
532 |
// iUnitWidth = 34;
|
|
533 |
// iUnitHeight = 34;
|
|
534 |
|
|
535 |
shadowPane = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane(1).LayoutLine();
|
|
536 |
shadowRect.LayoutRect(hwrWndRect, shadowPane);
|
|
537 |
|
|
538 |
shadowTl = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g1().LayoutLine();
|
|
539 |
shadowTlRect.LayoutRect(shadowRect.Rect(), shadowTl);
|
|
540 |
|
|
541 |
shadowBr = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g8().LayoutLine();
|
|
542 |
shadowBrRect.LayoutRect(shadowRect.Rect(), shadowBr);
|
|
543 |
|
|
544 |
iShadowTl = shadowTlRect.Rect().Size();
|
|
545 |
iShadowBr = shadowBrRect.Rect().Size();
|
|
546 |
|
|
547 |
iUnitShadowSizeSet = ETrue;
|
|
548 |
}
|
|
549 |
}
|
|
550 |
|
|
551 |
// ---------------------------------------------------------
|
|
552 |
// Get top left corner shadow size
|
|
553 |
// ---------------------------------------------------------
|
|
554 |
//
|
|
555 |
TSize CAknFepHwrBxWnd::ShadowTlSize()
|
|
556 |
{
|
|
557 |
return iShadowTl;
|
|
558 |
}
|
|
559 |
|
|
560 |
// ---------------------------------------------------------
|
|
561 |
// Get bottom right corner shadow size
|
|
562 |
// ---------------------------------------------------------
|
|
563 |
//
|
|
564 |
TSize CAknFepHwrBxWnd::ShadowBrSize()
|
|
565 |
{
|
|
566 |
return iShadowBr;
|
|
567 |
}
|
|
568 |
|
|
569 |
// ---------------------------------------------------------
|
|
570 |
// Set setting button enable
|
|
571 |
// ---------------------------------------------------------
|
|
572 |
//
|
|
573 |
void CAknFepHwrBxWnd::SetEnableSettingBtn(TBool aEnable)
|
|
574 |
{
|
|
575 |
if ( aEnable )
|
|
576 |
{
|
|
577 |
iOptionButton->SetDimmed(EFalse);
|
|
578 |
}
|
|
579 |
else
|
|
580 |
{
|
|
581 |
iOptionButton->SetDimmed(ETrue);
|
|
582 |
iOptionButton->SetActive(EFalse);
|
|
583 |
}
|
|
584 |
}
|
|
585 |
|
|
586 |
// ---------------------------------------------------------
|
|
587 |
// Resize
|
|
588 |
// ---------------------------------------------------------
|
|
589 |
//
|
|
590 |
void CAknFepHwrBxWnd::SizeChanged(TBool aLandscapeStyle)
|
|
591 |
{
|
|
592 |
ReadLafInfo(aLandscapeStyle);
|
|
593 |
|
|
594 |
if (iDataStore->SizeChanging() || (!iControlPosSet))
|
|
595 |
{
|
|
596 |
// if size changing, or sub controls
|
|
597 |
// size and position have not been set
|
|
598 |
|
|
599 |
TPoint startPos = TPoint(iShadowTl.iWidth, iShadowTl.iHeight);
|
|
600 |
TRect hwrWnd = TRect(startPos,
|
|
601 |
TPoint(startPos.iX + 10*iUnitWidth,
|
|
602 |
startPos.iY + 7*iUnitHeight));
|
|
603 |
SetRect(hwrWnd);
|
|
604 |
|
|
605 |
// title bar
|
|
606 |
startPos = hwrWnd.iTl;
|
|
607 |
TRect titleBar = TRect(startPos,
|
|
608 |
TPoint(startPos.iX + iUnitWidth*10,
|
|
609 |
startPos.iY + iUnitHeight));
|
|
610 |
TitleBar()->SetRect(titleBar);
|
|
611 |
|
|
612 |
// close button
|
|
613 |
startPos = titleBar.iTl;
|
|
614 |
TRect closeRect = TRect(startPos,
|
|
615 |
TPoint(startPos.iX + iUnitWidth,
|
|
616 |
startPos.iY + iUnitHeight));
|
|
617 |
TRect closeInnerRect;
|
|
618 |
AknPenImageUtils::CalculateGraphicRect(closeRect,closeInnerRect);
|
|
619 |
CloseButton()->SizeChanged(closeRect, closeInnerRect, ETrue);
|
|
620 |
|
|
621 |
// header pane
|
|
622 |
startPos = TPoint(closeRect.iBr.iX, closeRect.iTl.iY);
|
|
623 |
TRect headerPane = TRect(startPos,
|
|
624 |
TPoint(startPos.iX + iUnitWidth*8,
|
|
625 |
startPos.iY + iUnitHeight));
|
|
626 |
HeaderPane()->SetRect(headerPane);
|
|
627 |
|
|
628 |
// icf
|
|
629 |
startPos = headerPane.iTl;
|
|
630 |
TRect icfRect = TRect(startPos,
|
|
631 |
TPoint(startPos.iX + iUnitWidth*7,
|
|
632 |
startPos.iY + iUnitHeight));
|
|
633 |
|
|
634 |
TAknTextLineLayout textPaneTextLayout;
|
|
635 |
textPaneTextLayout = AknLayoutScalable_Avkon::fep_hwr_top_text_pane_t1().LayoutLine();
|
|
636 |
iContextField->SetFont(AknLayoutUtils::FontFromId(textPaneTextLayout.iFont, NULL));
|
|
637 |
iContextField->SetRect(icfRect);
|
|
638 |
|
|
639 |
// Backspace button
|
|
640 |
startPos = TPoint(icfRect.iBr.iX, icfRect.iTl.iY);
|
|
641 |
TRect backspaceRect = TRect(startPos,
|
|
642 |
TPoint(startPos.iX + iUnitWidth,
|
|
643 |
startPos.iY + iUnitHeight));
|
|
644 |
TRect backspaceInnerRect;
|
|
645 |
AknPenImageUtils::CalculateGraphicRect(backspaceRect, backspaceInnerRect);
|
|
646 |
iBackspace->SizeChanged(backspaceRect, backspaceInnerRect, ETrue);
|
|
647 |
|
|
648 |
// move button
|
|
649 |
startPos = TPoint(headerPane.iBr.iX, headerPane.iTl.iY);
|
|
650 |
TRect moveRect = TRect(startPos,
|
|
651 |
TPoint(startPos.iX + iUnitWidth,
|
|
652 |
startPos.iY + iUnitHeight));
|
|
653 |
TRect moveInnerRect;
|
|
654 |
AknPenImageUtils::CalculateGraphicRect(moveRect, moveInnerRect);
|
|
655 |
MoveButton()->SizeChanged(moveRect, moveInnerRect,ETrue);
|
|
656 |
|
|
657 |
// client pane
|
|
658 |
startPos = TPoint(titleBar.iTl.iX, titleBar.iBr.iY);
|
|
659 |
TRect clientPane = TRect(startPos,
|
|
660 |
TPoint(startPos.iX + iUnitWidth*10,
|
|
661 |
startPos.iY + iUnitHeight*6));
|
|
662 |
ClientPane()->SetRect(clientPane);
|
|
663 |
|
|
664 |
// option button
|
|
665 |
startPos = clientPane.iTl;
|
|
666 |
TRect optionInnerRect;
|
|
667 |
TRect optionRect = TRect(startPos,
|
|
668 |
TPoint(startPos.iX + iUnitWidth,
|
|
669 |
startPos.iY + iUnitHeight));
|
|
670 |
AknPenImageUtils::CalculateGraphicRect(optionRect, optionInnerRect);
|
|
671 |
iOptionButton->SizeChanged(optionRect, optionInnerRect, ETrue);
|
|
672 |
|
|
673 |
// drop down list
|
|
674 |
startPos = TPoint(optionRect.iBr.iX, optionRect.iTl.iY);
|
|
675 |
TAknTextLineLayout candTextLayout;
|
|
676 |
candTextLayout = AknLayoutScalable_Avkon::cell_hwr_candidate_pane_t1().LayoutLine();
|
|
677 |
iDropdownList->SetFont(AknLayoutUtils::FontFromId(candTextLayout.iFont, NULL));
|
|
678 |
|
|
679 |
iDropdownList->SizeChanged(iUnitWidth,
|
|
680 |
iUnitHeight,
|
|
681 |
iUnitWidth,
|
|
682 |
startPos,
|
|
683 |
8,
|
|
684 |
4);
|
|
685 |
|
|
686 |
// box group
|
|
687 |
startPos = TPoint(clientPane.iTl.iX, clientPane.iTl.iY + iUnitHeight);
|
|
688 |
TRect boxGrp = TRect(startPos,
|
|
689 |
TPoint(startPos.iX + iUnitWidth*9,
|
|
690 |
startPos.iY + iUnitHeight*5));
|
|
691 |
iBoxGroup->SizeChanged(boxGrp);
|
|
692 |
|
|
693 |
// control bar
|
|
694 |
startPos = TPoint( boxGrp.iBr.iX, boxGrp.iTl.iY );
|
|
695 |
TRect ctrlBar = TRect(startPos,
|
|
696 |
TPoint(startPos.iX + iUnitWidth,
|
|
697 |
startPos.iY + iUnitHeight*5));
|
|
698 |
TRect topgridRect = TRect(startPos,
|
|
699 |
TPoint(startPos.iX + iUnitWidth,
|
|
700 |
startPos.iY + iUnitHeight));
|
|
701 |
TRAP_IGNORE(iControlBar->SizeChangedL(ctrlBar, topgridRect));
|
|
702 |
|
|
703 |
// shadow
|
|
704 |
SetShadowRect(TRect(0,
|
|
705 |
0,
|
|
706 |
hwrWnd.iBr.iX + iShadowBr.iWidth,
|
|
707 |
hwrWnd.iBr.iY + iShadowBr.iHeight));
|
|
708 |
}
|
|
709 |
|
|
710 |
iControlPosSet = ETrue;
|
|
711 |
}
|
|
712 |
|
|
713 |
// ---------------------------------------------------------
|
|
714 |
// Just broadcast the close event
|
|
715 |
// ---------------------------------------------------------
|
|
716 |
//
|
|
717 |
TBool CAknFepHwrBxWnd::DoClose()
|
|
718 |
{
|
|
719 |
PRINTF((_L("CAknFepHwrBxWnd::DoClose()\n")));
|
|
720 |
|
|
721 |
ReportEvent(EHwrEventWindowClose);
|
|
722 |
|
|
723 |
return EFalse;
|
|
724 |
}
|
|
725 |
|
|
726 |
// ---------------------------------------------------------
|
|
727 |
// Handle the property change
|
|
728 |
// ---------------------------------------------------------
|
|
729 |
//
|
|
730 |
void CAknFepHwrBxWnd::SetPropertyL(
|
|
731 |
const MAknFepHwrPropertySubscriber::TAknFepHwrProperty aPropertyName,
|
|
732 |
const TDesC& aPropertyValue)
|
|
733 |
{
|
|
734 |
switch (aPropertyName)
|
|
735 |
{
|
|
736 |
case MAknFepHwrPropertySubscriber::EAknFepHwrPropertyCandidates:
|
|
737 |
{
|
|
738 |
const TInt candiCount = iDataStore->CandidateCount();
|
|
739 |
RArray<TInt> secondaryList;
|
|
740 |
|
|
741 |
for (TInt i = 0; i < candiCount; i++)
|
|
742 |
{
|
|
743 |
if (i > candiCount - iDataStore->PermittedRangesCount())
|
|
744 |
{
|
|
745 |
//cell index start from 1
|
|
746 |
secondaryList.Append(i);
|
|
747 |
}
|
|
748 |
}
|
|
749 |
iDropdownList->SetSecondaryList(secondaryList);
|
|
750 |
|
|
751 |
secondaryList.Close();
|
|
752 |
|
|
753 |
RPointerArray<HBufC>* candidates = (RPointerArray<HBufC>*)aPropertyValue.Ptr();
|
|
754 |
iDropdownList->SetCandidatesL(*candidates, CFepCtrlDropdownList::EListNoExpandable);
|
|
755 |
break;
|
|
756 |
}
|
|
757 |
case MAknFepHwrPropertySubscriber::EAknFepHwrPropertyPredictives:
|
|
758 |
{
|
|
759 |
RPointerArray<HBufC>* candidates = (RPointerArray<HBufC>*)aPropertyValue.Ptr();
|
|
760 |
iDropdownList->SetCandidatesL(*candidates, CFepCtrlDropdownList::EListExpandable);
|
|
761 |
break;
|
|
762 |
}
|
|
763 |
case MAknFepHwrPropertySubscriber::EAknFepHwrPropertyAddPredictives:
|
|
764 |
{
|
|
765 |
RPointerArray<HBufC>* candidates = (RPointerArray<HBufC>*)aPropertyValue.Ptr();
|
|
766 |
iDropdownList->AddCandidatesL(*candidates, CFepCtrlDropdownList::EListExpandable);
|
|
767 |
}
|
|
768 |
break;
|
|
769 |
case MAknFepHwrPropertySubscriber::EAknFepHwrPropertySizeChanged:
|
|
770 |
{
|
|
771 |
static_cast<CAknFepHwrBxLayout*>(UiLayout())->SetLayoutPositionL();
|
|
772 |
break;
|
|
773 |
}
|
|
774 |
default:
|
|
775 |
break;
|
|
776 |
}
|
|
777 |
}
|
|
778 |
|
|
779 |
// ---------------------------------------------------------
|
|
780 |
// Stroke end mark
|
|
781 |
// ---------------------------------------------------------
|
|
782 |
//
|
|
783 |
TPoint CAknFepHwrBxWnd::StrokeEndMark()
|
|
784 |
{
|
|
785 |
return TPoint(KDefaultStrokeEndMarkX, KDefaultStrokeEndMarkY);
|
|
786 |
}
|
|
787 |
|
|
788 |
// ---------------------------------------------------------
|
|
789 |
// Send input context field text
|
|
790 |
// ---------------------------------------------------------
|
|
791 |
//
|
|
792 |
void CAknFepHwrBxWnd::SetEditorTextL(const TFepInputContextFieldData& aData)
|
|
793 |
{
|
|
794 |
if(iContextField)
|
|
795 |
{
|
|
796 |
iContextField->SetTextL(aData);
|
|
797 |
}
|
|
798 |
}
|
|
799 |
|
|
800 |
// ---------------------------------------------------------
|
|
801 |
// Highlight a dropdownlist cell
|
|
802 |
// ---------------------------------------------------------
|
|
803 |
//
|
|
804 |
void CAknFepHwrBxWnd::HighlightCell(TInt aIndex)
|
|
805 |
{
|
|
806 |
iDropdownList->SetHighlightCell(aIndex);
|
|
807 |
}
|
|
808 |
|
|
809 |
// ---------------------------------------------------------
|
|
810 |
// Add input context field to window
|
|
811 |
// ---------------------------------------------------------
|
|
812 |
//
|
|
813 |
void CAknFepHwrBxWnd::AddContextFieldL()
|
|
814 |
{
|
|
815 |
CControlGroup* headerPane = NULL;
|
|
816 |
|
|
817 |
//get reference CControlGroup of headerPane
|
|
818 |
headerPane = HeaderPane();
|
|
819 |
User::LeaveIfNull(headerPane);
|
|
820 |
|
|
821 |
//input context field
|
|
822 |
iContextField = CFepInputContextField::NewL(TRect(), UiLayout(), EHwrCtrlIdInputContextField);
|
|
823 |
|
|
824 |
TAknTextLineLayout textPaneTextLayout;
|
|
825 |
|
|
826 |
textPaneTextLayout = AknLayoutScalable_Avkon::fep_hwr_top_text_pane_t1().LayoutLine();
|
|
827 |
|
|
828 |
iContextField->SetFont(AknLayoutUtils::FontFromId(textPaneTextLayout.iFont, NULL));
|
|
829 |
|
|
830 |
//transfer to headerPane
|
|
831 |
headerPane->AddControlL(iContextField);
|
|
832 |
|
|
833 |
//add layout as event observer
|
|
834 |
iContextField->AddEventObserver(UiLayout());
|
|
835 |
|
|
836 |
iContextField->SetFocus();
|
|
837 |
}
|
|
838 |
|
|
839 |
// ---------------------------------------------------------
|
|
840 |
// Add option button to window
|
|
841 |
// ---------------------------------------------------------
|
|
842 |
//
|
|
843 |
void CAknFepHwrBxWnd::AddOptionButtonL()
|
|
844 |
{
|
|
845 |
//option button
|
|
846 |
iOptionButton = CAknFepCtrlCommonButton::NewL(UiLayout(),
|
|
847 |
EHwrCtrlIdTouchInputOption,
|
|
848 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
849 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
850 |
KAknsIIDQsnFrFunctionButtonInactive);
|
|
851 |
|
|
852 |
iInputModeSwitch = CPeninputLayoutInputmodelChoice::NewL(
|
|
853 |
UiLayout(),
|
|
854 |
EHwrCtrlIdHwrModeSwitch,
|
|
855 |
EPluginInputModeHwr );
|
|
856 |
iInputModeSwitch->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub );
|
|
857 |
AddControlL( iInputModeSwitch );
|
|
858 |
iInputModeSwitch->AddEventObserver( UiLayout() );
|
|
859 |
|
|
860 |
ClientPane()->AddControlL(iOptionButton);
|
|
861 |
|
|
862 |
//add layout as event observer
|
|
863 |
iOptionButton->AddEventObserver(UiLayout());
|
|
864 |
}
|
|
865 |
|
|
866 |
// ---------------------------------------------------------
|
|
867 |
// Pup up pen input mode switcher
|
|
868 |
// ---------------------------------------------------------
|
|
869 |
//
|
|
870 |
void CAknFepHwrBxWnd::PopUpPenInputModeSwitcher()
|
|
871 |
{
|
|
872 |
CFepUiBaseCtrl* vkbControl = iControlBar->ControlById(EHwrCtrlIdVkb);
|
|
873 |
TRAP_IGNORE( iInputModeSwitch->PopUpSwitchListL( vkbControl->Rect() ) );
|
|
874 |
}
|
|
875 |
|
|
876 |
// ---------------------------------------------------------
|
|
877 |
// Add controlbar to window
|
|
878 |
// ---------------------------------------------------------
|
|
879 |
//
|
|
880 |
void CAknFepHwrBxWnd::AddControlBarL()
|
|
881 |
{
|
|
882 |
CControlGroup* clientPane = NULL;
|
|
883 |
|
|
884 |
clientPane = ClientPane();
|
|
885 |
User::LeaveIfNull(clientPane);
|
|
886 |
|
|
887 |
//control bar
|
|
888 |
iControlBar = CAknFepHwrBxCtrlBar::NewL(UiLayout(), EHwrCtrlIdControlBar);
|
|
889 |
|
|
890 |
//transfer to clientPane
|
|
891 |
clientPane->AddControlL(iControlBar);
|
|
892 |
|
|
893 |
//add control bar as property subscriber
|
|
894 |
iDataStore->AddSubscriber(iControlBar);
|
|
895 |
|
|
896 |
//no need to add layout as control bar's observer because its sub control
|
|
897 |
//will send event directly to layout
|
|
898 |
}
|
|
899 |
|
|
900 |
// ---------------------------------------------------------
|
|
901 |
// Add box group to window
|
|
902 |
// ---------------------------------------------------------
|
|
903 |
//
|
|
904 |
void CAknFepHwrBxWnd::AddBoxGroupL()
|
|
905 |
{
|
|
906 |
CControlGroup* clientPane = NULL;
|
|
907 |
|
|
908 |
clientPane = ClientPane();
|
|
909 |
User::LeaveIfNull(clientPane);
|
|
910 |
|
|
911 |
iBoxGroup = CAknFepHwrBoxGroup::NewL(UiLayout(), EHwrCtrlIdHwrBoxGroup, KBoxCount);
|
|
912 |
iBoxGroup->SetTransparency(KWrittingFactor, KNormalFactor);
|
|
913 |
|
|
914 |
//transfer to clientPane
|
|
915 |
clientPane->AddControlL(iBoxGroup);
|
|
916 |
|
|
917 |
//add layout as event observer
|
|
918 |
iBoxGroup->AddEventObserver(UiLayout());
|
|
919 |
|
|
920 |
//add BoxGroup as property subscriber
|
|
921 |
iDataStore->AddSubscriber(iBoxGroup);
|
|
922 |
iDataStore->SetStrokeEndMarkControl(iBoxGroup);
|
|
923 |
}
|
|
924 |
|
|
925 |
// ---------------------------------------------------------
|
|
926 |
// Add dropdown list to window
|
|
927 |
// ---------------------------------------------------------
|
|
928 |
//
|
|
929 |
void CAknFepHwrBxWnd::AddDropdownListL(TBool aLandscapeStyle)
|
|
930 |
{
|
|
931 |
TResourceReader reader;
|
|
932 |
CCoeEnv::Static()->CreateResourceReaderLC(reader,R_AKN_FEP_DROP_DOWN_LIST);
|
|
933 |
|
|
934 |
iSecondRangeColor = TRgb(0xFF0000);
|
|
935 |
|
|
936 |
ReadLafInfo(aLandscapeStyle);
|
|
937 |
TAknTextLineLayout candTextLayout =
|
|
938 |
AknLayoutScalable_Avkon::cell_hwr_candidate_pane_t1().LayoutLine();
|
|
939 |
|
|
940 |
TInt textMargin = (iUnitHeight -
|
|
941 |
AknLayoutUtils::FontFromId(candTextLayout.iFont, NULL)->HeightInPixels())/2;
|
|
942 |
|
|
943 |
TDropdownListDrawInfo candiDrawInfo(KAknsIIDQsnFrFunctionButtonInactive,
|
|
944 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
945 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
946 |
KAknsIIDQsnFrItutButtonCandiSideL,
|
|
947 |
KAknsIIDQsnFrItutButtonCandiMiddle,
|
|
948 |
KAknsIIDQsnFrItutButtonCandiSideR,
|
|
949 |
KAknsIIDQsnFrItutButtonCandiPressedSideL,
|
|
950 |
KAknsIIDQsnFrItutButtonCandiPressedMiddle,
|
|
951 |
KAknsIIDQsnFrItutButtonCandiPressedSideR,
|
|
952 |
TRgb(194, 221, 242),
|
|
953 |
ETrue);
|
|
954 |
|
|
955 |
iDropdownList = CFepCtrlDropdownList::NewL(TPoint(Rect().iTl.iX, Rect().iTl.iY + iUnitHeight),
|
|
956 |
UiLayout(),
|
|
957 |
255,
|
|
958 |
reader,
|
|
959 |
iUnitWidth,
|
|
960 |
iUnitHeight,
|
|
961 |
iUnitWidth,
|
|
962 |
9,
|
|
963 |
4,
|
|
964 |
AknLayoutUtils::FontFromId(candTextLayout.iFont,
|
|
965 |
NULL),
|
|
966 |
NULL,
|
|
967 |
CGraphicsContext::ECenter,
|
|
968 |
textMargin,
|
|
969 |
KRgbBlack, // border color
|
|
970 |
TRgb(0xeeeeee), // content bg color
|
|
971 |
KRgbWhite, // navi bg color
|
|
972 |
AKN_LAF_COLOR_STATIC(candTextLayout.iC),
|
|
973 |
KRgbRed);
|
|
974 |
|
|
975 |
ClientPane()->AddControlL(iDropdownList);
|
|
976 |
iDropdownList->SetResourceId(R_AKN_FEP_DROP_DOWN_LIST);
|
|
977 |
iDropdownList->SetEventIdForCandidateSelected(EHwrEventCandidateSelected);
|
|
978 |
iDropdownList->SetEventIdForNextPageCandidate(EHwrEventGetNextCandidatePage);
|
|
979 |
iDropdownList->SetEventIdForPreviousPageCandidate(EHwrEventGetPreviousCandidatePage);
|
|
980 |
iDropdownList->SetEventIdForCandidateExisted(EHwrEventCandidateExisted);
|
|
981 |
iDropdownList->AddEventObserver(UiLayout());
|
|
982 |
iDropdownList->SetDropdownListImgID(candiDrawInfo);
|
|
983 |
CleanupStack::PopAndDestroy(); // reader
|
|
984 |
}
|
|
985 |
|
|
986 |
// ---------------------------------------------------------
|
|
987 |
// Cancel writing
|
|
988 |
// ---------------------------------------------------------
|
|
989 |
//
|
|
990 |
void CAknFepHwrBxWnd::CancelWriting()
|
|
991 |
{
|
|
992 |
if (iBoxGroup)
|
|
993 |
{
|
|
994 |
iBoxGroup->CancelWriting();
|
|
995 |
}
|
|
996 |
}
|
|
997 |
|
|
998 |
// ---------------------------------------------------------
|
|
999 |
// Cancel repeat
|
|
1000 |
// ---------------------------------------------------------
|
|
1001 |
//
|
|
1002 |
void CAknFepHwrBxWnd::CancelRepeat()
|
|
1003 |
{
|
|
1004 |
CAknFepCtrlRepeatButton* btn = static_cast<CAknFepCtrlRepeatButton*>
|
|
1005 |
(Control(EHwrCtrlIdBackspace));
|
|
1006 |
if (btn)
|
|
1007 |
{
|
|
1008 |
btn->CancelRepeat();
|
|
1009 |
}
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
|
|
1013 |
// ---------------------------------------------------------
|
|
1014 |
// Draw window and shadow
|
|
1015 |
// ---------------------------------------------------------
|
|
1016 |
//
|
|
1017 |
void CAknFepHwrBxWnd::Draw()
|
|
1018 |
{
|
|
1019 |
CAknFepCtrlBaseWindow::Draw();
|
|
1020 |
|
|
1021 |
// draw shadow
|
|
1022 |
DrawShadow();
|
|
1023 |
|
|
1024 |
UpdateArea(Rect(), EFalse);
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
// ---------------------------------------------------------
|
|
1028 |
// Draw window and shadow
|
|
1029 |
// ---------------------------------------------------------
|
|
1030 |
//
|
|
1031 |
void CAknFepHwrBxWnd::DimInputContextField(TBool aFlag)
|
|
1032 |
{
|
|
1033 |
if (iContextField)
|
|
1034 |
{
|
|
1035 |
iContextField->SetDimmed(aFlag);
|
|
1036 |
}
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
// ---------------------------------------------------------
|
|
1040 |
// Get drop down list
|
|
1041 |
// ---------------------------------------------------------
|
|
1042 |
//
|
|
1043 |
CFepCtrlDropdownList* CAknFepHwrBxWnd::DropdownList()
|
|
1044 |
{
|
|
1045 |
return iDropdownList;
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
void CAknFepHwrBxWnd::AddBackspaceBtnL()
|
|
1049 |
{
|
|
1050 |
CControlGroup* headerPane = NULL;
|
|
1051 |
|
|
1052 |
//get reference CControlGroup of headerPane
|
|
1053 |
headerPane = HeaderPane();
|
|
1054 |
User::LeaveIfNull(headerPane);
|
|
1055 |
|
|
1056 |
iBackspace = CAknFepCtrlRepeatButton::NewL( UiLayout(), EHwrCtrlIdBackspace,
|
|
1057 |
EHwrEventKeyBack, EKeyBackspace,
|
|
1058 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
1059 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
1060 |
KAknsIIDQsnFrFunctionButtonInactive);
|
|
1061 |
headerPane->AddControlL(iBackspace);
|
|
1062 |
iBackspace->AddEventObserver( UiLayout() );
|
|
1063 |
}
|
|
1064 |
|
|
1065 |
// ---------------------------------------------------------------------------
|
|
1066 |
// CAknFepHwrBxWnd::ReadBackgroundInfoL
|
|
1067 |
// (other items were commented in a header)
|
|
1068 |
// ---------------------------------------------------------------------------
|
|
1069 |
//
|
|
1070 |
void CAknFepHwrBxWnd::ReadBackgroundInfoL( TInt aResId )
|
|
1071 |
{
|
|
1072 |
if( aResId == 0 )
|
|
1073 |
return;
|
|
1074 |
|
|
1075 |
TResourceReader resReader;
|
|
1076 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, aResId );
|
|
1077 |
|
|
1078 |
TPtrC bmpFileName = resReader.ReadTPtrC();
|
|
1079 |
TInt32 imgMajorSkinId = resReader.ReadInt32();
|
|
1080 |
|
|
1081 |
TAknsItemID id;
|
|
1082 |
TInt skinitemid;
|
|
1083 |
|
|
1084 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
1085 |
const TInt16 bmpId = resReader.ReadInt16();
|
|
1086 |
const TInt16 bmpMskId = resReader.ReadInt16();
|
|
1087 |
skinitemid = resReader.ReadInt16();
|
|
1088 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
1089 |
|
|
1090 |
if (bmpId != KInvalidImg)
|
|
1091 |
{
|
|
1092 |
CFbsBitmap* backgroundImg = NULL;
|
|
1093 |
CFbsBitmap* backgroundMaskImg = NULL;
|
|
1094 |
if (bmpMskId != KInvalidImg)
|
|
1095 |
{
|
|
1096 |
AknsUtils::CreateIconL(skininstance,
|
|
1097 |
id,
|
|
1098 |
backgroundImg,
|
|
1099 |
backgroundMaskImg,
|
|
1100 |
bmpFileName,
|
|
1101 |
bmpId,
|
|
1102 |
bmpMskId);
|
|
1103 |
}
|
|
1104 |
else
|
|
1105 |
{
|
|
1106 |
AknsUtils::CreateIconL(skininstance,
|
|
1107 |
id,
|
|
1108 |
backgroundImg,
|
|
1109 |
bmpFileName,
|
|
1110 |
bmpId);
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
SetBackgroundBmp( backgroundImg );
|
|
1114 |
SetBackgroundMaskBmp( backgroundMaskImg );
|
|
1115 |
}
|
|
1116 |
CleanupStack::PopAndDestroy( 1 );
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
void CAknFepHwrBxWnd::SetTextAlignmentL( TInt aAlignment )
|
|
1120 |
{
|
|
1121 |
if ( iContextField )
|
|
1122 |
{
|
|
1123 |
iContextField->SetTextAlignmentL( aAlignment );
|
|
1124 |
}
|
|
1125 |
}
|
|
1126 |
|
|
1127 |
// End Of File
|
|
1128 |
|