21
|
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: CAknFepCtrlBaseWindowExt
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <coemain.h>
|
|
21 |
#include <bautils.h>
|
|
22 |
#include <AknsItemID.h>
|
|
23 |
#include <AknsSkinInstance.h>
|
|
24 |
#include <AknsUtils.h>
|
|
25 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
26 |
#include <AknUtils.h>
|
|
27 |
|
|
28 |
#include <peninputbutton.h>
|
|
29 |
#include <peninputcommonbutton.h>
|
|
30 |
#include <peninputdragbutton.h>
|
|
31 |
#include <peninputbasewindowext.h>
|
|
32 |
#include <peninputcommonlayoutglobalenum.h>
|
|
33 |
|
|
34 |
#include <peninputlayoutinputmodechoice.h>
|
|
35 |
#include <peninputlayoutmultilineicf.h>
|
|
36 |
|
|
37 |
const TInt32 KInvalidResId = -1;
|
|
38 |
const TInt KNotSupportSkin = -1;
|
|
39 |
const TInt KInvalidImg = -1 ;
|
|
40 |
const TUint32 KDefaultTextColor = 0x000000;
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
// ---------------------------------------------------------
|
|
45 |
// Constructor
|
|
46 |
// ---------------------------------------------------------
|
|
47 |
//
|
|
48 |
EXPORT_C CAknFepCtrlBaseWindowExt::CAknFepCtrlBaseWindowExt(CFepUiLayout* aFepUiLayout,
|
|
49 |
TInt aControlId)
|
|
50 |
:CControlGroup(aFepUiLayout,aControlId),
|
|
51 |
iCloseButton(NULL),
|
|
52 |
iFirstTimeConstruct(ETrue),
|
|
53 |
iCoeEnv(CCoeEnv::Static())
|
|
54 |
{
|
|
55 |
}
|
|
56 |
|
|
57 |
// ---------------------------------------------------------
|
|
58 |
// Constructor
|
|
59 |
// ---------------------------------------------------------
|
|
60 |
//
|
|
61 |
EXPORT_C void CAknFepCtrlBaseWindowExt::BaseConstructL()
|
|
62 |
{
|
|
63 |
CControlGroup::ConstructL();
|
|
64 |
}
|
|
65 |
|
|
66 |
// ---------------------------------------------------------
|
|
67 |
// Destructor
|
|
68 |
// ---------------------------------------------------------
|
|
69 |
//
|
|
70 |
EXPORT_C CAknFepCtrlBaseWindowExt::~CAknFepCtrlBaseWindowExt()
|
|
71 |
{
|
|
72 |
}
|
|
73 |
|
|
74 |
// ---------------------------------------------------------
|
|
75 |
// Draw window frame and sub controls
|
|
76 |
// ---------------------------------------------------------
|
|
77 |
//
|
|
78 |
EXPORT_C void CAknFepCtrlBaseWindowExt::Draw()
|
|
79 |
{
|
|
80 |
if(Hiden() || !Ready())
|
|
81 |
{
|
|
82 |
return;
|
|
83 |
}
|
|
84 |
|
|
85 |
//Clear();
|
|
86 |
|
|
87 |
DrawOpaqueMaskBackground( Rect() );
|
|
88 |
CFbsBitGc* gc= static_cast<CFbsBitGc*> ( BitGc());
|
|
89 |
/*
|
|
90 |
gc->Activate( MaskBitmapDevice() );
|
|
91 |
gc->SetBrushStyle( CGraphicsContext::ENullBrush );
|
|
92 |
gc->SetBrushColor( MaskBkCol() );
|
|
93 |
gc->SetPenSize( PenSize());
|
|
94 |
gc->SetPenColor( PenColor() );
|
|
95 |
gc->DrawRect( Rect());
|
|
96 |
*/
|
|
97 |
// ----- draw bitmaps -----
|
|
98 |
|
|
99 |
gc->Activate( BitmapDevice() );
|
|
100 |
gc->SetBrushColor( TRgb(KOpaqueColor) );
|
|
101 |
gc->SetPenColor( TRgb(KOpaqueColor) );
|
|
102 |
gc->DrawRect( Rect());
|
|
103 |
if( BackgroundBmp() && BackgroundBmp()->SizeInPixels() != Rect().Size() )
|
|
104 |
AknIconUtils::SetSize(BackgroundBmp(), Rect().Size(), EAspectRatioNotPreserved);
|
|
105 |
|
|
106 |
DrawBackground();
|
|
107 |
CControlGroup::Draw();
|
|
108 |
/*
|
|
109 |
for(TInt i=0; i< NumOfControls(); i++)
|
|
110 |
{
|
|
111 |
CFepUiBaseCtrl* ctrl = At(i);
|
|
112 |
if(!ctrl->Hiden())
|
|
113 |
{
|
|
114 |
ctrl->Draw();
|
|
115 |
}
|
|
116 |
}*/
|
|
117 |
}
|
|
118 |
|
|
119 |
// ---------------------------------------------------------
|
|
120 |
// Close window
|
|
121 |
// ---------------------------------------------------------
|
|
122 |
//
|
|
123 |
EXPORT_C void CAknFepCtrlBaseWindowExt::Close()
|
|
124 |
{
|
|
125 |
if (DoClose())
|
|
126 |
{
|
|
127 |
Hide(ETrue);
|
|
128 |
}
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------
|
|
132 |
// Enable or disable drag window
|
|
133 |
// ---------------------------------------------------------
|
|
134 |
//
|
|
135 |
EXPORT_C void CAknFepCtrlBaseWindowExt::SetDragEnable(TBool /*aEnable*/)
|
|
136 |
{
|
|
137 |
/*if (iMoveButton)
|
|
138 |
{
|
|
139 |
iMoveButton->EnableDragging(aEnable);
|
|
140 |
}*/
|
|
141 |
}
|
|
142 |
|
|
143 |
// ---------------------------------------------------------
|
|
144 |
// Handle close event
|
|
145 |
// ---------------------------------------------------------
|
|
146 |
//
|
|
147 |
EXPORT_C void CAknFepCtrlBaseWindowExt::HandleControlEvent(TInt aEventType,
|
|
148 |
CFepUiBaseCtrl* aCtrl,
|
|
149 |
const TDesC& /*aEventData*/)
|
|
150 |
{
|
|
151 |
if (aEventType == EEventButtonUp)
|
|
152 |
{
|
|
153 |
if (aCtrl->ControlId() == EPeninutWindowCtrlIdCloseBtn)
|
|
154 |
{
|
|
155 |
Close();
|
|
156 |
}
|
|
157 |
}
|
|
158 |
}
|
|
159 |
|
|
160 |
EXPORT_C TBool CAknFepCtrlBaseWindowExt::DoClose()
|
|
161 |
{
|
|
162 |
return ETrue;
|
|
163 |
}
|
|
164 |
|
|
165 |
EXPORT_C CFepUiBaseCtrl* CAknFepCtrlBaseWindowExt::Control(TInt aCtrlId)
|
|
166 |
{
|
|
167 |
CFepUiBaseCtrl* ctrl = NULL;
|
|
168 |
RPointerArray<CFepUiBaseCtrl> todo;
|
|
169 |
TInt current = 0;
|
|
170 |
TBool notFound = ETrue;
|
|
171 |
|
|
172 |
todo.Append(this);
|
|
173 |
|
|
174 |
while (current < todo.Count() && notFound)
|
|
175 |
{
|
|
176 |
ctrl = todo[current];
|
|
177 |
if(ctrl->ControlId() == aCtrlId)
|
|
178 |
{
|
|
179 |
notFound = EFalse;
|
|
180 |
}
|
|
181 |
else
|
|
182 |
{
|
|
183 |
if(ctrl->IsKindOfControl(ECtrlControlGroup))
|
|
184 |
{
|
|
185 |
CControlGroup* temp = static_cast<CControlGroup*>(ctrl);
|
|
186 |
for (int i = 0; i < temp->NumOfControls(); i++)
|
|
187 |
{
|
|
188 |
todo.Append(temp->At(i));
|
|
189 |
}
|
|
190 |
}
|
|
191 |
current++;
|
|
192 |
}
|
|
193 |
}
|
|
194 |
|
|
195 |
todo.Close();
|
|
196 |
|
|
197 |
return notFound ? NULL : ctrl;
|
|
198 |
}
|
|
199 |
|
|
200 |
EXPORT_C void CAknFepCtrlBaseWindowExt::ConstructFromResourceL()
|
|
201 |
{
|
|
202 |
if (iResourceId == KInvalidResId)
|
|
203 |
{
|
|
204 |
User::Leave(KErrArgument);
|
|
205 |
}
|
|
206 |
|
|
207 |
TResourceReader reader;
|
|
208 |
iCoeEnv->CreateResourceReaderLC(reader, iResourceId);
|
|
209 |
|
|
210 |
TInt supportskin = reader.ReadInt16();
|
|
211 |
|
|
212 |
if (iFirstTimeConstruct&& (supportskin != KNotSupportSkin))
|
|
213 |
{
|
|
214 |
UiLayout()->AddControlL(this);
|
|
215 |
}
|
|
216 |
|
|
217 |
// Read information of shadow
|
|
218 |
const TInt32 shadowResId = reader.ReadInt32();
|
|
219 |
ReadShadowInfoL( shadowResId );
|
|
220 |
|
|
221 |
// Read information of background
|
|
222 |
const TInt32 backgroundResId = reader.ReadInt32();
|
|
223 |
ReadBackgroundInfoL( backgroundResId );
|
|
224 |
|
|
225 |
// Read resource information to create base window controls
|
|
226 |
const TInt count = reader.ReadInt16();
|
|
227 |
|
|
228 |
if( iFirstTimeConstruct )
|
|
229 |
{
|
|
230 |
for( TInt i = 0; i < count && iFirstTimeConstruct; i++ )
|
|
231 |
{
|
|
232 |
const TInt16 id = reader.ReadInt16();
|
|
233 |
const TInt32 image = reader.ReadInt32();
|
|
234 |
CreateBaseWindowControlsL( id, image );
|
|
235 |
}
|
|
236 |
}
|
|
237 |
else
|
|
238 |
{
|
|
239 |
CControlGroup::ConstructFromResourceL();
|
|
240 |
// ReConstruct ICF when resource changed
|
|
241 |
CFepLayoutMultiLineIcf* multiIcf =
|
|
242 |
static_cast<CFepLayoutMultiLineIcf*>( Control(EPeninputWindowCtrlIdMultiLineICF));
|
|
243 |
if( multiIcf )
|
|
244 |
{
|
|
245 |
TResourceReader reader;
|
|
246 |
iCoeEnv->CreateResourceReaderLC( reader, multiIcf->ResourceId() );
|
|
247 |
ReadMultiLineIcfInforL( reader, multiIcf );
|
|
248 |
CleanupStack::PopAndDestroy( 1 );
|
|
249 |
}
|
|
250 |
}
|
|
251 |
CleanupStack::PopAndDestroy(); // reader
|
|
252 |
|
|
253 |
iFirstTimeConstruct = EFalse;
|
|
254 |
}
|
|
255 |
|
|
256 |
TBool CAknFepCtrlBaseWindowExt::CreateCustomControlL( TInt16 /*aControlId*/, TInt32 /*aImageId*/ )
|
|
257 |
{
|
|
258 |
return EFalse;
|
|
259 |
}
|
|
260 |
|
|
261 |
void CAknFepCtrlBaseWindowExt::AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl)
|
|
262 |
{
|
|
263 |
AddControlL(aCtrl);
|
|
264 |
}
|
|
265 |
|
|
266 |
EXPORT_C void CAknFepCtrlBaseWindowExt::CreateBaseWindowControlsL( TInt16 aControlId,
|
|
267 |
TInt32 aImageId )
|
|
268 |
{
|
|
269 |
if (CreateCustomControlL(aControlId, aImageId))
|
|
270 |
{
|
|
271 |
return;
|
|
272 |
}
|
|
273 |
|
|
274 |
switch ( aControlId )
|
|
275 |
{
|
|
276 |
case EPeninutWindowCtrlIdCloseBtn:
|
|
277 |
{
|
|
278 |
CAknFepCtrlCommonButton* closeButton =
|
|
279 |
CAknFepCtrlCommonButton::NewL(UiLayout(), aControlId,
|
|
280 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
281 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
282 |
KAknsIIDQsnFrFunctionButtonInactive);
|
|
283 |
|
|
284 |
AddCustomControlGroupL( closeButton );
|
|
285 |
|
|
286 |
closeButton->AddEventObserver(this);
|
|
287 |
closeButton->SetResourceId( aImageId );
|
|
288 |
closeButton->ConstructFromResourceL();
|
|
289 |
SetCloseButton(closeButton);
|
|
290 |
}
|
|
291 |
break;
|
|
292 |
case EPeninutWindowCtrlIdInputContextField:
|
|
293 |
{
|
|
294 |
CFepInputContextField* icf= CFepInputContextField::NewL( TRect(),
|
|
295 |
UiLayout(), aControlId );
|
|
296 |
|
|
297 |
AddCustomControlGroupL( icf );
|
|
298 |
|
|
299 |
icf->SetFocus(ETrue);
|
|
300 |
icf->AddEventObserver( UiLayout() );
|
|
301 |
|
|
302 |
TResourceReader reader;
|
|
303 |
iCoeEnv->CreateResourceReaderLC( reader, aImageId );
|
|
304 |
ReadIcfInfoL( reader, icf);
|
|
305 |
CleanupStack::PopAndDestroy( 1 );
|
|
306 |
}
|
|
307 |
break;
|
|
308 |
case EPeninputWindowCtrlIdMultiLineICF:
|
|
309 |
{
|
|
310 |
const CFont* icfFont = NULL;
|
|
311 |
TAknTextLineLayout textPaneTextLayout;
|
|
312 |
|
|
313 |
textPaneTextLayout =
|
|
314 |
AknLayoutScalable_Avkon::fep_vkb_top_text_pane_t1().LayoutLine();
|
|
315 |
|
|
316 |
icfFont = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, NULL );
|
|
317 |
CFepLayoutMultiLineIcf* multiLineIcf = NULL;
|
|
318 |
|
|
319 |
if ( icfFont )
|
|
320 |
{
|
|
321 |
multiLineIcf = CFepLayoutMultiLineIcf::NewL( TRect(),
|
|
322 |
UiLayout(), aControlId, icfFont->HeightInPixels(),
|
|
323 |
icfFont->FontMaxHeight(),icfFont );
|
|
324 |
|
|
325 |
AddCustomControlGroupL( multiLineIcf );
|
|
326 |
|
|
327 |
// Add layout as event observer
|
|
328 |
multiLineIcf->AddEventObserver( UiLayout() );
|
|
329 |
multiLineIcf->SetResourceId( aImageId );
|
|
330 |
multiLineIcf->SetFocus(ETrue);
|
|
331 |
|
|
332 |
TResourceReader reader;
|
|
333 |
iCoeEnv->CreateResourceReaderLC( reader, aImageId );
|
|
334 |
ReadMultiLineIcfInforL( reader,multiLineIcf );
|
|
335 |
CleanupStack::PopAndDestroy( 1 );
|
|
336 |
}
|
|
337 |
}
|
|
338 |
break;
|
|
339 |
case EPeninutWindowCtrlIdOptionBtn:
|
|
340 |
{
|
|
341 |
CAknFepCtrlEventButton* touchInputOptionButton = CAknFepCtrlEventButton::NewL(
|
|
342 |
UiLayout(),
|
|
343 |
aControlId, EPeninputLayoutEventOption, 0,
|
|
344 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
345 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
346 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
347 |
|
|
348 |
AddCustomControlGroupL( touchInputOptionButton );
|
|
349 |
|
|
350 |
touchInputOptionButton->AddEventObserver( UiLayout() );
|
|
351 |
touchInputOptionButton->SetResourceId( aImageId );
|
|
352 |
touchInputOptionButton->ConstructFromResourceL();
|
|
353 |
}
|
|
354 |
break;
|
|
355 |
case EPeninutWindowCtrlIdBackspaceBtn:
|
|
356 |
{
|
|
357 |
CAknFepCtrlRepeatButton* backspaceButton = CAknFepCtrlRepeatButton::NewL(
|
|
358 |
UiLayout(), aControlId, EPeninputLayoutEventBack, EKeyBackspace,
|
|
359 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
360 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
361 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
362 |
|
|
363 |
AddCustomControlGroupL( backspaceButton );
|
|
364 |
|
|
365 |
backspaceButton->AddEventObserver( UiLayout() );
|
|
366 |
backspaceButton->SetResourceId( aImageId );
|
|
367 |
backspaceButton->ConstructFromResourceL();
|
|
368 |
}
|
|
369 |
break;
|
|
370 |
case EPeninutWindowCtrlIdSpaceBtn:
|
|
371 |
{
|
|
372 |
CAknFepCtrlEventButton* spaceButton = CAknFepCtrlEventButton::NewL(
|
|
373 |
UiLayout(), aControlId, EPeninputLayoutEventSpace, EKeySpace,
|
|
374 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
375 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
376 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
377 |
AddCustomControlGroupL( spaceButton );
|
|
378 |
spaceButton->AddEventObserver( UiLayout() );
|
|
379 |
spaceButton->SetResourceId( aImageId );
|
|
380 |
spaceButton->ConstructFromResourceL();
|
|
381 |
}
|
|
382 |
break;
|
|
383 |
case EPeninutWindowCtrlIdEnterBtn:
|
|
384 |
{
|
|
385 |
CAknFepCtrlEventButton* enterButton = CAknFepCtrlEventButton::NewL(
|
|
386 |
UiLayout(), aControlId, EPeninputLayoutEventEnter, EKeyEnter,
|
|
387 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
388 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
389 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
390 |
|
|
391 |
AddCustomControlGroupL( enterButton );
|
|
392 |
enterButton->AddEventObserver(UiLayout());
|
|
393 |
enterButton->SetResourceId( aImageId );
|
|
394 |
enterButton->ConstructFromResourceL();
|
|
395 |
}
|
|
396 |
break;
|
|
397 |
case EPeninutWindowCtrlIdSwitcherPopupWindow:
|
|
398 |
{
|
|
399 |
CPeninputLayoutInputmodelChoice* modeSwitchChoice =
|
|
400 |
CPeninputLayoutInputmodelChoice::NewL( UiLayout(),
|
|
401 |
EPeninutWindowCtrlIdSwitcherPopupWindow,
|
|
402 |
(TPluginInputMode)(UiLayout()->PenInputType()));
|
|
403 |
modeSwitchChoice->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub );
|
|
404 |
AddCustomControlGroupL( modeSwitchChoice );
|
|
405 |
modeSwitchChoice->AddEventObserver( UiLayout() );
|
|
406 |
}
|
|
407 |
break;
|
|
408 |
default:
|
|
409 |
{
|
|
410 |
}
|
|
411 |
break;
|
|
412 |
}
|
|
413 |
}
|
|
414 |
|
|
415 |
// ---------------------------------------------------------------------------
|
|
416 |
// CAknFepCtrlBaseWindowExt::ReadShadowInfoL
|
|
417 |
// (other items were commented in a header)
|
|
418 |
// ---------------------------------------------------------------------------
|
|
419 |
//
|
|
420 |
void CAknFepCtrlBaseWindowExt::ReadShadowInfoL( TInt aResId )
|
|
421 |
{
|
|
422 |
TResourceReader resReader;
|
|
423 |
iCoeEnv->CreateResourceReaderLC( resReader, aResId );
|
|
424 |
|
|
425 |
TPtrC bmpFileName = resReader.ReadTPtrC();
|
|
426 |
TInt32 imgMajorSkinId = resReader.ReadInt32();
|
|
427 |
|
|
428 |
TAknsItemID id;
|
|
429 |
TInt skinitemid;
|
|
430 |
|
|
431 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
432 |
|
|
433 |
for ( TInt i = 0; i < KShadowBmpBr + 1; i++ )
|
|
434 |
{
|
|
435 |
const TInt16 bmpId = resReader.ReadInt16();
|
|
436 |
const TInt16 bmpMskId = resReader.ReadInt16();
|
|
437 |
skinitemid = resReader.ReadInt16();
|
|
438 |
|
|
439 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
440 |
|
|
441 |
if (bmpId != KInvalidImg)
|
|
442 |
{
|
|
443 |
CFbsBitmap* shadowImg = NULL;
|
|
444 |
CFbsBitmap* shadowMaskImg = NULL;
|
|
445 |
|
|
446 |
if (bmpMskId != KInvalidImg)
|
|
447 |
{
|
|
448 |
AknsUtils::CreateIconL(skininstance,
|
|
449 |
id,
|
|
450 |
shadowImg,
|
|
451 |
shadowMaskImg,
|
|
452 |
bmpFileName,
|
|
453 |
bmpId,
|
|
454 |
bmpMskId);
|
|
455 |
}
|
|
456 |
else
|
|
457 |
{
|
|
458 |
AknsUtils::CreateIconL(skininstance,
|
|
459 |
id,
|
|
460 |
shadowImg,
|
|
461 |
bmpFileName,
|
|
462 |
bmpId);
|
|
463 |
}
|
|
464 |
|
|
465 |
UiLayout()->SetShadowBmp(shadowImg, shadowMaskImg, TShadowBitmapIndex(i));
|
|
466 |
}
|
|
467 |
}
|
|
468 |
CleanupStack::PopAndDestroy( 1 );
|
|
469 |
}
|
|
470 |
|
|
471 |
// ---------------------------------------------------------------------------
|
|
472 |
// CAknFepCtrlBaseWindowExt::ReadBackgroundInfoL
|
|
473 |
// (other items were commented in a header)
|
|
474 |
// ---------------------------------------------------------------------------
|
|
475 |
//
|
|
476 |
void CAknFepCtrlBaseWindowExt::ReadBackgroundInfoL( TInt aResId )
|
|
477 |
{
|
|
478 |
if( aResId == 0 )
|
|
479 |
return;
|
|
480 |
|
|
481 |
if( BackgroundBmp() )
|
|
482 |
{
|
|
483 |
CFbsBitmap* bkBmp = BackgroundBmp();
|
|
484 |
delete bkBmp;
|
|
485 |
SetBackgroundBmp( NULL );
|
|
486 |
}
|
|
487 |
if( BkMaskBmp() )
|
|
488 |
{
|
|
489 |
CFbsBitmap* bkMaskBmp = BkMaskBmp();
|
|
490 |
delete bkMaskBmp;
|
|
491 |
SetBackgroundMaskBmp( NULL );
|
|
492 |
}
|
|
493 |
|
|
494 |
TResourceReader resReader;
|
|
495 |
iCoeEnv->CreateResourceReaderLC( resReader, aResId );
|
|
496 |
|
|
497 |
TPtrC bmpFileName = resReader.ReadTPtrC();
|
|
498 |
TInt32 imgMajorSkinId = resReader.ReadInt32();
|
|
499 |
|
|
500 |
TAknsItemID id;
|
|
501 |
TInt skinitemid;
|
|
502 |
|
|
503 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
504 |
const TInt16 bmpId = resReader.ReadInt16();
|
|
505 |
const TInt16 bmpMskId = resReader.ReadInt16();
|
|
506 |
skinitemid = resReader.ReadInt16();
|
|
507 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
508 |
|
|
509 |
if (bmpId != KInvalidImg)
|
|
510 |
{
|
|
511 |
CFbsBitmap* backgroundImg = NULL;
|
|
512 |
CFbsBitmap* backgroundMaskImg = NULL;
|
|
513 |
if (bmpMskId != KInvalidImg)
|
|
514 |
{
|
|
515 |
AknsUtils::CreateIconL(skininstance,
|
|
516 |
id,
|
|
517 |
backgroundImg,
|
|
518 |
backgroundMaskImg,
|
|
519 |
bmpFileName,
|
|
520 |
bmpId,
|
|
521 |
bmpMskId);
|
|
522 |
}
|
|
523 |
else
|
|
524 |
{
|
|
525 |
AknsUtils::CreateIconL(skininstance,
|
|
526 |
id,
|
|
527 |
backgroundImg,
|
|
528 |
bmpFileName,
|
|
529 |
bmpId);
|
|
530 |
}
|
|
531 |
|
|
532 |
SetBackgroundBmp( backgroundImg );
|
|
533 |
SetBackgroundMaskBmp( backgroundMaskImg );
|
|
534 |
}
|
|
535 |
CleanupStack::PopAndDestroy( 1 );
|
|
536 |
}
|
|
537 |
|
|
538 |
// ---------------------------------------------------------------------------
|
|
539 |
// CAknFepCtrlBaseWindowExt::ReadIcfInfoL
|
|
540 |
// (other items were commented in a header)
|
|
541 |
// ---------------------------------------------------------------------------
|
|
542 |
//
|
|
543 |
void CAknFepCtrlBaseWindowExt::ReadIcfInfoL(TResourceReader aResReader,
|
|
544 |
CFepInputContextField* icf )
|
|
545 |
{
|
|
546 |
TPtrC bmpFileName = aResReader.ReadTPtrC();
|
|
547 |
TInt32 imgMajorSkinId = aResReader.ReadInt32();
|
|
548 |
|
|
549 |
TAknsItemID id;
|
|
550 |
TInt skinitemid;
|
|
551 |
|
|
552 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
553 |
|
|
554 |
const TInt16 icfbgId = aResReader.ReadInt16();
|
|
555 |
const TInt16 icfbgmaskId = aResReader.ReadInt16();
|
|
556 |
skinitemid = aResReader.ReadInt16();
|
|
557 |
|
|
558 |
id.Set( TInt( imgMajorSkinId ), skinitemid );
|
|
559 |
|
|
560 |
if ( icfbgId != KInvalidImg )
|
|
561 |
{
|
|
562 |
CFbsBitmap* icfImg = NULL;
|
|
563 |
|
|
564 |
if (icfbgmaskId != KInvalidImg)
|
|
565 |
{
|
|
566 |
CFbsBitmap* icfmaskImg = NULL;
|
|
567 |
|
|
568 |
AknsUtils::CreateIconL(skininstance,
|
|
569 |
id,
|
|
570 |
icfImg,
|
|
571 |
icfmaskImg,
|
|
572 |
bmpFileName,
|
|
573 |
icfbgId,
|
|
574 |
icfbgmaskId);
|
|
575 |
|
|
576 |
AknIconUtils::SetSize(icfmaskImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
577 |
icf->SetBackgroundMaskBitmapL(icfmaskImg);
|
|
578 |
}
|
|
579 |
else
|
|
580 |
{
|
|
581 |
AknsUtils::CreateIconL(skininstance,
|
|
582 |
id,
|
|
583 |
icfImg,
|
|
584 |
bmpFileName,
|
|
585 |
icfbgId);
|
|
586 |
}
|
|
587 |
|
|
588 |
AknIconUtils::SetSize(icfImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
589 |
icf->SetBackgroundBitmapL(icfImg);
|
|
590 |
}
|
|
591 |
|
|
592 |
// read text color
|
|
593 |
TRgb textcolor;
|
|
594 |
TInt32 colorMajorSkinId = aResReader.ReadInt32();
|
|
595 |
skinitemid = aResReader.ReadInt16();
|
|
596 |
|
|
597 |
id.Set(TInt(colorMajorSkinId), skinitemid);
|
|
598 |
|
|
599 |
const TInt16 textcoloridx = aResReader.ReadInt16();
|
|
600 |
|
|
601 |
TInt error = AknsUtils::GetCachedColor(skininstance,
|
|
602 |
textcolor,
|
|
603 |
id,
|
|
604 |
textcoloridx);
|
|
605 |
|
|
606 |
if (error == KErrNone)
|
|
607 |
{
|
|
608 |
icf->SetTextColor( textcolor );
|
|
609 |
}
|
|
610 |
else
|
|
611 |
{
|
|
612 |
icf->SetTextColor( TRgb( KDefaultTextColor ) );
|
|
613 |
}
|
|
614 |
}
|
|
615 |
|
|
616 |
void CAknFepCtrlBaseWindowExt::ReadMultiLineIcfInforL( TResourceReader aResReader ,
|
|
617 |
CFepLayoutMultiLineIcf* icf)
|
|
618 |
{
|
|
619 |
TPtrC bmpFileName = aResReader.ReadTPtrC();
|
|
620 |
TInt32 imgMajorSkinId = aResReader.ReadInt32();
|
|
621 |
|
|
622 |
TAknsItemID id;
|
|
623 |
TInt skinitemid;
|
|
624 |
|
|
625 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
626 |
|
|
627 |
const TInt16 icfbgId = aResReader.ReadInt16();
|
|
628 |
const TInt16 icfbgmaskId = aResReader.ReadInt16();
|
|
629 |
skinitemid = aResReader.ReadInt16();
|
|
630 |
|
|
631 |
id.Set( TInt( imgMajorSkinId ), skinitemid );
|
|
632 |
|
|
633 |
if ( icfbgId != KInvalidImg )
|
|
634 |
{
|
|
635 |
CFbsBitmap* icfImg = NULL;
|
|
636 |
|
|
637 |
if (icfbgmaskId != KInvalidImg)
|
|
638 |
{
|
|
639 |
CFbsBitmap* icfmaskImg = NULL;
|
|
640 |
|
|
641 |
AknsUtils::CreateIconL(skininstance,
|
|
642 |
id,
|
|
643 |
icfImg,
|
|
644 |
icfmaskImg,
|
|
645 |
bmpFileName,
|
|
646 |
icfbgId,
|
|
647 |
icfbgmaskId);
|
|
648 |
|
|
649 |
AknIconUtils::SetSize(icfmaskImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
650 |
icf->SetBackgroundMaskBitmapL(icfmaskImg);
|
|
651 |
}
|
|
652 |
else
|
|
653 |
{
|
|
654 |
AknsUtils::CreateIconL(skininstance,
|
|
655 |
id,
|
|
656 |
icfImg,
|
|
657 |
bmpFileName,
|
|
658 |
icfbgId);
|
|
659 |
}
|
|
660 |
|
|
661 |
AknIconUtils::SetSize(icfImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
662 |
icf->SetBackgroundBitmapL(icfImg);
|
|
663 |
}
|
|
664 |
|
|
665 |
// read text color
|
|
666 |
TRgb textcolor;
|
|
667 |
TInt32 colorMajorSkinId = aResReader.ReadInt32();
|
|
668 |
skinitemid = aResReader.ReadInt16();
|
|
669 |
|
|
670 |
id.Set(TInt(colorMajorSkinId), skinitemid);
|
|
671 |
|
|
672 |
const TInt16 textcoloridx = aResReader.ReadInt16();
|
|
673 |
|
|
674 |
TInt error = AknsUtils::GetCachedColor(skininstance,
|
|
675 |
textcolor,
|
|
676 |
id,
|
|
677 |
textcoloridx);
|
|
678 |
|
|
679 |
if (error == KErrNone)
|
|
680 |
{
|
|
681 |
icf->SetTextColorL( textcolor );
|
|
682 |
}
|
|
683 |
else
|
|
684 |
{
|
|
685 |
icf->SetTextColorL( TRgb( KDefaultTextColor ) );
|
|
686 |
}
|
|
687 |
}
|
|
688 |
|
|
689 |
|
|
690 |
|
|
691 |
// End Of File
|