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: peninput VKB data manager
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <peninputvkbkrwindowconfiginfo_65.rsg>
|
|
19 |
#include <peninputvkbkrwindowkr.rsg>
|
|
20 |
|
|
21 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
22 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
23 |
|
|
24 |
#include <e32keys.h>
|
|
25 |
#include <s32mem.h>
|
|
26 |
#include <AknFepGlobalEnums.h>
|
|
27 |
#include <aknfeppeninputenums.h>
|
|
28 |
#include <AknLayoutDef.h>
|
|
29 |
#include <AknIconUtils.h>
|
|
30 |
#include <AknUtils.h>
|
|
31 |
#include <AknFontAccess.h>
|
|
32 |
|
|
33 |
#include <peninputcommonlayoutglobalenum.h>
|
|
34 |
#include <peninputlayoutmultilineicf.h>
|
|
35 |
#include <peninputlayoutcontext.h>
|
|
36 |
#include <peninputinputcontextfield.h>
|
|
37 |
#include <peninputlayoutbubblectrl.h>
|
|
38 |
#include <peninputrangebar.h>
|
|
39 |
#include <peninputrangebarinfo.h>
|
|
40 |
#include <peninputclientlayoutinfo.h>
|
|
41 |
#include <peninputlayoutchoicelist.h>
|
|
42 |
#include <peninputlayoutinputmodechoice.h>
|
|
43 |
#include <peninputlayoutbubblectrl.h>
|
|
44 |
#include <peninputlabel.h>
|
|
45 |
|
|
46 |
#include <peninputmultimodebutton.h>
|
|
47 |
#include <peninputeventbutton.h>
|
|
48 |
#include <peninputdragbutton.h>
|
|
49 |
#include <peninputrepeatbutton.h>
|
|
50 |
|
|
51 |
#include <peninputdataconverter.h>
|
|
52 |
#include <peninputuistatemgrinterface.h>
|
|
53 |
|
|
54 |
#include "PeninputVkbKrDbg.h"
|
|
55 |
#include "PeninputVkbKr.pan"
|
|
56 |
#include "PeninputVkbKr.hrh"
|
|
57 |
#include "PeninputVkbKrEnum.h"
|
|
58 |
#include "PeninputVkbKrUiStateType.h"
|
|
59 |
#include "PeninputVkbKrWindow.h"
|
|
60 |
#include "peninputgenericvkblafdatamgr.h"
|
|
61 |
|
|
62 |
_LIT( KWindowConfigurationResourceFile,
|
|
63 |
"z:\\resource\\plugins\\PeninputVkbKrWindowConfigInfo_65.rsc" );
|
|
64 |
_LIT( KWindowResourceFile,
|
|
65 |
"z:\\resource\\plugins\\PeninputVkbKrWindowKr.rsc" );
|
|
66 |
const TInt KInvalidImg = -1 ;
|
|
67 |
const TInt KPeninputVkbWndInvalidIndex = -1;
|
|
68 |
//const TUint32 KDefaultTextColor = 0x000000;
|
|
69 |
//const TUint32 KDefaultShadowTextColor = 0x000000;
|
|
70 |
|
|
71 |
struct TDummyRangeInfo // from CPeninputRangeInfo
|
|
72 |
{
|
|
73 |
|
|
74 |
void* vertual1;
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Range id
|
|
78 |
*/
|
|
79 |
TInt iRangeId;
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Response style
|
|
83 |
*/
|
|
84 |
TPeninputRangeResponseStyle iResponseStyle;
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Client layout id
|
|
88 |
*/
|
|
89 |
TInt iClientLayoutId;
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Vkb layout id
|
|
93 |
*/
|
|
94 |
TInt iVkbLayoutId;
|
|
95 |
|
|
96 |
};
|
|
97 |
|
|
98 |
struct TSymbolTableInfo
|
|
99 |
{
|
|
100 |
TInt iVkbLayoutId;
|
|
101 |
TInt iClientLayoutId;
|
|
102 |
};
|
|
103 |
|
|
104 |
const TSymbolTableInfo sSymbolTableInfo[] =
|
|
105 |
{
|
|
106 |
{EPeninputVkbLayoutSymbol1,EPeninputClientLayout11x4},
|
|
107 |
{EPeninputVkbLayoutSymbol2,EPeninputClientLayout11x4},
|
|
108 |
{EPeninputVkbLayoutSymbol3,EPeninputClientLayout11x4},
|
|
109 |
{EPeninputVkbLayoutSymbol4,EPeninputClientLayoutMacroChars},
|
|
110 |
{EPeninputVkbLayoutSymbol5,EPeninputClientLayoutMacroChars},
|
|
111 |
};
|
|
112 |
|
|
113 |
const TInt KMaxSymbolTable = sizeof(sSymbolTableInfo)/sizeof(TSymbolTableInfo);
|
|
114 |
|
|
115 |
namespace SymbolTableUtil
|
|
116 |
{
|
|
117 |
|
|
118 |
LOCAL_C TInt FindIndex(TInt aVkbLayoutId)
|
|
119 |
{
|
|
120 |
TInt ret(KErrNotFound);
|
|
121 |
for (TInt i=0;i<KMaxSymbolTable;i++)
|
|
122 |
{
|
|
123 |
if (aVkbLayoutId==sSymbolTableInfo[i].iVkbLayoutId)
|
|
124 |
{
|
|
125 |
ret=i;
|
|
126 |
break;
|
|
127 |
}
|
|
128 |
}
|
|
129 |
return ret;
|
|
130 |
}
|
|
131 |
|
|
132 |
LOCAL_C TInt GetClientLaytoutFor(TInt aVkbLayoutId)
|
|
133 |
{
|
|
134 |
TInt ret(0);
|
|
135 |
TInt index(FindIndex(aVkbLayoutId));
|
|
136 |
if (index!=KErrNotFound)
|
|
137 |
{
|
|
138 |
ret=sSymbolTableInfo[index].iClientLayoutId;
|
|
139 |
}
|
|
140 |
return ret;
|
|
141 |
}
|
|
142 |
|
|
143 |
LOCAL_C TInt GetNextVkbLayout(TInt aVkbLayoutId)
|
|
144 |
{
|
|
145 |
TInt ret(aVkbLayoutId);
|
|
146 |
TInt index=FindIndex(aVkbLayoutId);
|
|
147 |
if (index!=KErrNotFound)
|
|
148 |
{
|
|
149 |
index=(index+1)%KMaxSymbolTable;
|
|
150 |
ret=sSymbolTableInfo[index].iVkbLayoutId;
|
|
151 |
}
|
|
152 |
return ret;
|
|
153 |
}
|
|
154 |
|
|
155 |
LOCAL_C TInt GetPrevVkbLayout(TInt aVkbLayoutId)
|
|
156 |
{
|
|
157 |
TInt ret(aVkbLayoutId);
|
|
158 |
TInt index=FindIndex(aVkbLayoutId);
|
|
159 |
if (index!=KErrNotFound)
|
|
160 |
{
|
|
161 |
index=(index+KMaxSymbolTable-1)%KMaxSymbolTable;
|
|
162 |
ret=sSymbolTableInfo[index].iVkbLayoutId;
|
|
163 |
}
|
|
164 |
return ret;
|
|
165 |
}
|
|
166 |
}
|
|
167 |
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
// Constructor & Destructor
|
|
170 |
// ---------------------------------------------------------------------------
|
|
171 |
//
|
|
172 |
|
|
173 |
CPeninputVkbKrWindow* CPeninputVkbKrWindow::NewLC(
|
|
174 |
CFepUiLayout* aUiLayout,
|
|
175 |
MPeninputLayoutContext* aLayoutContext,
|
|
176 |
MPeninputUiStateMgr* aUiStateMgr)
|
|
177 |
{
|
|
178 |
CPeninputVkbKrWindow* self =
|
|
179 |
new (ELeave) CPeninputVkbKrWindow(aUiLayout,aLayoutContext,aUiStateMgr);
|
|
180 |
CleanupStack::PushL(self);
|
|
181 |
self->ConstructL();
|
|
182 |
return self;
|
|
183 |
}
|
|
184 |
|
|
185 |
CPeninputVkbKrWindow* CPeninputVkbKrWindow::NewL(
|
|
186 |
CFepUiLayout* aUiLayout,
|
|
187 |
MPeninputLayoutContext* aLayoutContext,
|
|
188 |
MPeninputUiStateMgr* aUiStateMgr)
|
|
189 |
{
|
|
190 |
CPeninputVkbKrWindow* self =
|
|
191 |
CPeninputVkbKrWindow::NewLC(aUiLayout,aLayoutContext,aUiStateMgr);
|
|
192 |
CleanupStack::Pop(); // self;
|
|
193 |
return self;
|
|
194 |
}
|
|
195 |
|
|
196 |
CPeninputVkbKrWindow::CPeninputVkbKrWindow(
|
|
197 |
CFepUiLayout* aUiLayout,
|
|
198 |
MPeninputLayoutContext* aLayoutContext,
|
|
199 |
MPeninputUiStateMgr* aUiStateMgr)
|
|
200 |
: CPeninputLayoutWindowExt(aUiLayout,aLayoutContext),
|
|
201 |
iUiStateMgr(aUiStateMgr),
|
|
202 |
iTableUpButton(NULL),
|
|
203 |
iTableDownButton(NULL),
|
|
204 |
iTablePageLabel(NULL),
|
|
205 |
iFirstConstruct(ETrue),
|
|
206 |
iPopupSet(EFalse),
|
|
207 |
iPopupInited(EFalse)
|
|
208 |
{
|
|
209 |
// No implementation required
|
|
210 |
}
|
|
211 |
|
|
212 |
void CPeninputVkbKrWindow::ConstructL()
|
|
213 |
{
|
|
214 |
CPeninputLayoutWindowExt::ConstructL();
|
|
215 |
iLafMgr = CPeninputGenericVkbLafMgr::NewL();
|
|
216 |
iLafMgr->SetInputModeL(TPluginInputMode(iLayoutContext->LayoutType()));
|
|
217 |
TInt option(iLafMgr->OptionType());
|
|
218 |
option|=EOption3CellRange;
|
|
219 |
iLafMgr->SetLafOption((TPeninputVkbLafOption)option);
|
|
220 |
}
|
|
221 |
|
|
222 |
CPeninputVkbKrWindow::~CPeninputVkbKrWindow()
|
|
223 |
{
|
|
224 |
delete iLafMgr;
|
|
225 |
delete iIdle;
|
|
226 |
}
|
|
227 |
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
// from CPeninputLayoutWindow
|
|
230 |
// ---------------------------------------------------------------------------
|
|
231 |
//
|
|
232 |
|
|
233 |
void CPeninputVkbKrWindow::HandleControlEvent(
|
|
234 |
TInt aEventType,
|
|
235 |
CFepUiBaseCtrl* aCtrl,
|
|
236 |
const TDesC& aEventData )
|
|
237 |
{
|
|
238 |
TInt* data = ( TInt* ) aEventData.Ptr();
|
|
239 |
// Call this function in base class
|
|
240 |
|
|
241 |
if (aEventType==EPeninputLayoutEventRange)
|
|
242 |
{
|
|
243 |
PreProcessRange(*data);
|
|
244 |
}
|
|
245 |
|
|
246 |
CPeninputLayoutWindowExt::HandleControlEvent(
|
|
247 |
aEventType,
|
|
248 |
aCtrl,
|
|
249 |
aEventData );
|
|
250 |
|
|
251 |
switch ( aEventType )
|
|
252 |
{
|
|
253 |
case EPeninputLayoutVkbEventResetShift:
|
|
254 |
{
|
|
255 |
HandleShiftBtnClicked();
|
|
256 |
}
|
|
257 |
break;
|
|
258 |
case EPenInputLayoutEventClosePopup:
|
|
259 |
{
|
|
260 |
if ( iPopupWnd && !iPopupWnd->Hiden() )
|
|
261 |
{
|
|
262 |
iPopupWnd->CloseWindow();
|
|
263 |
ResetAccentButton();
|
|
264 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
265 |
}
|
|
266 |
}
|
|
267 |
break;
|
|
268 |
case EPeninputLayoutEventOpen:
|
|
269 |
case EPeninputLayoutEventRange:
|
|
270 |
{
|
|
271 |
UpdateArea( Rect(), ETrue );
|
|
272 |
}
|
|
273 |
break;
|
|
274 |
case EEventChoiceSelected:
|
|
275 |
{
|
|
276 |
CFepLayoutChoiceList::SEvent* event =
|
|
277 |
( CFepLayoutChoiceList::SEvent* ) aEventData.Ptr();
|
|
278 |
|
|
279 |
if ( event->iIndex != KPeninputVkbWndInvalidIndex )
|
|
280 |
{
|
|
281 |
if (aCtrl->ControlId() == EPeninutWindowCtrlIdAccentPopupWindow)
|
|
282 |
{
|
|
283 |
TInt currentRange = CPeninputDataConverter::AnyToInt(
|
|
284 |
iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
|
|
285 |
TInt currentAccent = CPeninputDataConverter::AnyToInt(
|
|
286 |
iLayoutContext->RequestData(EPeninputDataTypeCurrentAccent));
|
|
287 |
|
|
288 |
if ((currentRange == ERangeAccent) && (currentAccent == event->iIndex))
|
|
289 |
{
|
|
290 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
291 |
return;
|
|
292 |
}
|
|
293 |
|
|
294 |
iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &(event->iIndex));
|
|
295 |
|
|
296 |
// Active range, update rangebar and vkb layout
|
|
297 |
//ChangeRange( ERangeAccent, EPeninputVkbLayoutAccented1 + 2 * event->iIndex);
|
|
298 |
/*
|
|
299 |
(currentRange == ERangeAccent) ? ChangeRange(ERangeAccent,
|
|
300 |
EPeninputVkbLayoutAccented1 + 2 * event->iIndex, EFalse) :
|
|
301 |
ChangeRange(ERangeAccent,
|
|
302 |
EPeninputVkbLayoutAccented1 + 2 * event->iIndex, ETrue);
|
|
303 |
*/
|
|
304 |
}
|
|
305 |
else if (aCtrl->ControlId() == EPeninutWindowCtrlIdSwitcherPopupWindow)
|
|
306 |
{
|
|
307 |
if (iLayoutContext->LayoutType() != event->iCommand)
|
|
308 |
{
|
|
309 |
TBool switchByMode = ETrue;
|
|
310 |
TInt mode = event->iCommand;
|
|
311 |
|
|
312 |
TBuf<8> buf;
|
|
313 |
buf.Append(reinterpret_cast<TText*>(&switchByMode),
|
|
314 |
sizeof(TBool)/sizeof(TText));
|
|
315 |
buf.Append(reinterpret_cast<TText*>(&mode), sizeof(TInt)/sizeof(TText));
|
|
316 |
UiLayout()->SignalOwner(ESignalLayoutUIChanged,buf);
|
|
317 |
}
|
|
318 |
}
|
|
319 |
}
|
|
320 |
else
|
|
321 |
{
|
|
322 |
ResetAccentButton();
|
|
323 |
}
|
|
324 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
325 |
}
|
|
326 |
break;
|
|
327 |
case EPeninputLayoutEventToHwr:
|
|
328 |
{
|
|
329 |
TRAP_IGNORE(UpdateICFTextL());
|
|
330 |
TRAP_IGNORE(PopupSwitchWindowL());
|
|
331 |
}
|
|
332 |
break;
|
|
333 |
case EPeninputLayoutVkbEventTableUp:
|
|
334 |
if (IsSymbolRange())
|
|
335 |
{
|
|
336 |
TInt curVkbLayout = CPeninputDataConverter::AnyToInt(
|
|
337 |
iLayoutContext->RequestData(EPeninputDataTypeVkbLayout));
|
|
338 |
TInt prevVkbLayout=SymbolTableUtil::GetPrevVkbLayout(curVkbLayout);
|
|
339 |
TRAP_IGNORE( FakeClientLayoutUpdateL(prevVkbLayout));
|
|
340 |
ChangeRange(ERangeSymbol,prevVkbLayout);
|
|
341 |
}
|
|
342 |
break;
|
|
343 |
case EPeninputLayoutVkbEventTableDown:
|
|
344 |
if (IsSymbolRange())
|
|
345 |
{
|
|
346 |
TInt curVkbLayout = CPeninputDataConverter::AnyToInt(
|
|
347 |
iLayoutContext->RequestData(EPeninputDataTypeVkbLayout));
|
|
348 |
TInt nextVkbLayout=SymbolTableUtil::GetNextVkbLayout(curVkbLayout);
|
|
349 |
TRAP_IGNORE( FakeClientLayoutUpdateL(nextVkbLayout));
|
|
350 |
ChangeRange(ERangeSymbol,nextVkbLayout);
|
|
351 |
}
|
|
352 |
break;
|
|
353 |
default:
|
|
354 |
break;
|
|
355 |
}
|
|
356 |
}
|
|
357 |
|
|
358 |
|
|
359 |
TInt CPeninputVkbKrWindow::GetWindowConfigResId()
|
|
360 |
{
|
|
361 |
return R_PENINPUT_LAYOUT_CONFIG_INFO;
|
|
362 |
}
|
|
363 |
|
|
364 |
TInt CPeninputVkbKrWindow::GetWindowResId()
|
|
365 |
{
|
|
366 |
if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
|
|
367 |
{
|
|
368 |
return R_PENINPUT_LAYOUT_FSQ_WINDOW_INFO;
|
|
369 |
}
|
|
370 |
return R_PENINPUT_LAYOUT_VKB_WINDOW_INFO;
|
|
371 |
}
|
|
372 |
|
|
373 |
TInt CPeninputVkbKrWindow::GetNumKeymappingResId()
|
|
374 |
{
|
|
375 |
return R_PENINPUT_LAYOUT_KEY_MAPPING_STRING_LIST;
|
|
376 |
}
|
|
377 |
|
|
378 |
const TDesC& CPeninputVkbKrWindow::GetWindowConfigResFileName( TInt /*aLangID*/ )
|
|
379 |
{
|
|
380 |
return KWindowConfigurationResourceFile();
|
|
381 |
}
|
|
382 |
|
|
383 |
const TDesC& CPeninputVkbKrWindow::GetWindowResFileName()
|
|
384 |
{
|
|
385 |
return KWindowResourceFile();
|
|
386 |
}
|
|
387 |
|
|
388 |
const TRect CPeninputVkbKrWindow::ChangeUnitSize()
|
|
389 |
{
|
|
390 |
return TRect();
|
|
391 |
}
|
|
392 |
|
|
393 |
void CPeninputVkbKrWindow::ChangeClientSize()
|
|
394 |
{
|
|
395 |
LOG("Vkb.Window.ChangeClientSize");
|
|
396 |
if ( !iPopupWnd->Hiden() )
|
|
397 |
{
|
|
398 |
iPopupWnd->CloseWindow();
|
|
399 |
ResetAccentButton();
|
|
400 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
401 |
}
|
|
402 |
|
|
403 |
PopupWindowSizeChange();
|
|
404 |
|
|
405 |
TInt clientLayoutId = CPeninputDataConverter::AnyToInt
|
|
406 |
( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) );
|
|
407 |
CPeninputClientLayoutInfo* clientLayout =
|
|
408 |
ConfigInfo()->FindClientLayoutInfo( clientLayoutId );
|
|
409 |
|
|
410 |
if ( clientLayout )
|
|
411 |
{
|
|
412 |
ReorganizeControls( clientLayout->LayoutID(), EFalse );
|
|
413 |
}
|
|
414 |
|
|
415 |
TRect rect=iVkbCtrl->Rect();
|
|
416 |
LOG2("Vkb.Window.ChangeClientSize %d %d",rect.Width(),rect.Height());
|
|
417 |
UpdateArea( iVkbCtrl->Rect(), EFalse );
|
|
418 |
}
|
|
419 |
|
|
420 |
void CPeninputVkbKrWindow::CreateAllControlsL()
|
|
421 |
{
|
|
422 |
//LOG("Vkb.Window.CreateAllControlsL");
|
|
423 |
CFepLayoutMultiLineIcf* icf =
|
|
424 |
static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF));
|
|
425 |
|
|
426 |
iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine();
|
|
427 |
iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine();
|
|
428 |
|
|
429 |
icf->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
|
|
430 |
icf->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
|
|
431 |
//Change the ID when ID into release
|
|
432 |
icf->MsgBubbleCtrl()->SetBitmapParam(
|
|
433 |
NULL,
|
|
434 |
NULL,
|
|
435 |
KAknsIIDQsnFrInputPreviewSideL,
|
|
436 |
KAknsIIDQsnFrInputPreviewMiddle,
|
|
437 |
KAknsIIDQsnFrInputPreviewSideR);
|
|
438 |
|
|
439 |
/* Teleca change begin, 20.05.2008 ssal */
|
|
440 |
icf->InfoBubbleCtrl()->SetTextFormat(iBubbleTextLayout);
|
|
441 |
icf->InfoBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
|
|
442 |
//Change the ID when ID into release
|
|
443 |
icf->InfoBubbleCtrl()->SetBitmapParam(NULL,
|
|
444 |
NULL,
|
|
445 |
KAknsIIDQsnFrInputPreviewSideL,
|
|
446 |
KAknsIIDQsnFrInputPreviewMiddle,
|
|
447 |
KAknsIIDQsnFrInputPreviewSideR);
|
|
448 |
/* Teleca change end, 20.05.2008 ssal */
|
|
449 |
|
|
450 |
if (iLayoutContext->LayoutType() == EPluginInputModeFSQ)
|
|
451 |
{
|
|
452 |
icf->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
|
|
453 |
/* Teleca change begin, 20.05.2008 ssal */
|
|
454 |
icf->SetInfoBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
|
|
455 |
/* Teleca change end, 20.05.2008 ssal */
|
|
456 |
}
|
|
457 |
|
|
458 |
// Range bar
|
|
459 |
iRangeBar = CAknFepCtrlRangeBar::NewL(
|
|
460 |
UiLayout(),
|
|
461 |
EPeninutWindowCtrlIdRangeBar,
|
|
462 |
//CAknFepCtrlRangeBar::EBtnGroupHorizontal );
|
|
463 |
CAknFepCtrlRangeBar::EBtnGroupVertical );
|
|
464 |
|
|
465 |
// Set event id
|
|
466 |
iRangeBar->SetEventIdForRange( EPeninputLayoutEventRange );
|
|
467 |
iRangeBar->SetEventIdForCase( EPeninputLayoutEventRangeLoop );
|
|
468 |
|
|
469 |
AddControlL( iRangeBar );
|
|
470 |
iRangeBar->AddEventObserver((MEventObserver*)UiLayout());
|
|
471 |
|
|
472 |
// Vkb control
|
|
473 |
iVkbCtrl = CPeninputVkbCtrlExt::NewL(
|
|
474 |
TRect(),
|
|
475 |
UiLayout(),
|
|
476 |
EPeninutWindowCtrlIdVkbCtrl,
|
|
477 |
NULL );
|
|
478 |
iVkbCtrl->SetResourceId(
|
|
479 |
R_PENINPUT_LAYOUT_VKB_KEYBOARD );
|
|
480 |
iVkbCtrl->ConstructFromResourceL();
|
|
481 |
iVkbCtrl->SetKeyTextColorGroup(
|
|
482 |
EAknsCIQsnTextColorsCG68 );
|
|
483 |
iVkbLayout->SetVkbKeyboard( iVkbCtrl );
|
|
484 |
if (iLayoutContext->LayoutType() != EPluginInputModeFSQ)
|
|
485 |
{
|
|
486 |
iVkbCtrl->SetIrregularKeyBoard(ETrue);
|
|
487 |
iVkbLayout->SetIrregularResourceId(R_AKN_FEP_VKB_IRREGULAR_BITMAP);
|
|
488 |
iVkbLayout->ConstructFromIrregularResourceL();
|
|
489 |
}
|
|
490 |
else
|
|
491 |
{
|
|
492 |
iVkbCtrl->SetIrregularKeyBoard(EFalse);
|
|
493 |
|
|
494 |
|
|
495 |
//Add Skin id to Vkb Control for 9 piece picture.
|
|
496 |
iVkbCtrl->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal );
|
|
497 |
iVkbCtrl->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed );
|
|
498 |
iVkbCtrl->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive );
|
|
499 |
|
|
500 |
iVkbLayout->SetNonIrregularResourceId(R_AKN_FEP_VKB_NONIRREGULAR_BITMAP);
|
|
501 |
iVkbLayout->ConstructFromNonIrregularResourceL();
|
|
502 |
}
|
|
503 |
|
|
504 |
// Add bubble support
|
|
505 |
iVkbCtrl->ShowBubble(ETrue);
|
|
506 |
iVkbCtrl->SetGowithPointerDown(ETrue);
|
|
507 |
iVkbCtrl->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); //Change the ID when ID into release
|
|
508 |
|
|
509 |
|
|
510 |
AddControlL( iVkbCtrl );
|
|
511 |
iVkbCtrl->AddEventObserver( UiLayout() );
|
|
512 |
|
|
513 |
AddButtonL( EPeninutWindowCtrlIdEnterBtn,
|
|
514 |
EPeninputLayoutEventEnter,
|
|
515 |
R_PENINPUT_LAYOUT_VKB_ENTER,
|
|
516 |
EKeyEnter );
|
|
517 |
|
|
518 |
// Shift and capslock merged button
|
|
519 |
|
|
520 |
CAknFepCtrlMultiModeButton* button =
|
|
521 |
CAknFepCtrlMultiModeButton::NewLC( UiLayout(),
|
|
522 |
EPeninutWindowCtrlIdShiftBtn );
|
|
523 |
if ( button )
|
|
524 |
{
|
|
525 |
// Read resource
|
|
526 |
TResourceReader reader;
|
|
527 |
|
|
528 |
CCoeEnv::Static()->CreateResourceReaderLC( reader,
|
|
529 |
R_PENINPUT_LAYOUT_VKB_SHIFT_CAPSLOCK );
|
|
530 |
button->SetResourceId( R_PENINPUT_LAYOUT_VKB_SHIFT_CAPSLOCK );
|
|
531 |
button->ConstructFromResourceL();
|
|
532 |
|
|
533 |
// Pop and destroy reader
|
|
534 |
CleanupStack::PopAndDestroy( 1 );
|
|
535 |
|
|
536 |
// Add into the control pool
|
|
537 |
AddControlL( button );
|
|
538 |
|
|
539 |
button->AddEventObserver( UiLayout() );
|
|
540 |
}
|
|
541 |
CleanupStack::Pop( button );
|
|
542 |
// Space button
|
|
543 |
CAknFepCtrlEventButton* spaceButton = static_cast<CAknFepCtrlEventButton*>
|
|
544 |
(Control(EPeninutWindowCtrlIdSpaceBtn));
|
|
545 |
// Create 3-pieces color icon for space button
|
|
546 |
CPenInput3PiecesColorIcons* colorIcons =
|
|
547 |
CPenInput3PiecesColorIcons::NewL( R_AKN_FEP_VKB_SPACE_ICON1,
|
|
548 |
R_AKN_FEP_VKB_SPACE_ICON2,
|
|
549 |
R_AKN_FEP_VKB_SPACE_ICON3 );
|
|
550 |
spaceButton->Set3PiecesColorIcons( colorIcons );
|
|
551 |
|
|
552 |
// Switch to hwr button
|
|
553 |
AddButtonL( EPeninutWindowCtrlIdSwitchToHwrBtn,
|
|
554 |
EPeninputLayoutEventToHwr,
|
|
555 |
R_PENINPUT_LAYOUT_VKB_HWR );
|
|
556 |
|
|
557 |
// Add popup window
|
|
558 |
//AddPopupWindowL();
|
|
559 |
iPopupWnd = CPeninputCommonChoiceList::NewL( UiLayout(),
|
|
560 |
EPeninutWindowCtrlIdAccentPopupWindow,
|
|
561 |
KAknsIIDQsnFrList,
|
|
562 |
KAknsIIDQsnFrPopupSub );
|
|
563 |
|
|
564 |
|
|
565 |
|
|
566 |
iPopupWnd->AddEventObserver( UiLayout() );
|
|
567 |
|
|
568 |
AddControlL( iPopupWnd );
|
|
569 |
iIdle = CIdle::NewL(CActive::EPriorityIdle );
|
|
570 |
iIdle ->Start(TCallBack(BackgroundTaskL,this));
|
|
571 |
}
|
|
572 |
|
|
573 |
void CPeninputVkbKrWindow::SetControlsFont()
|
|
574 |
{
|
|
575 |
//LOG("Vkb.Window.SetControlsFont");
|
|
576 |
}
|
|
577 |
|
|
578 |
void CPeninputVkbKrWindow::PopupChoiceList()
|
|
579 |
{
|
|
580 |
LOG("Vkb.Window.PopupChoiceList");
|
|
581 |
}
|
|
582 |
|
|
583 |
void CPeninputVkbKrWindow::ReorganizeControls(
|
|
584 |
TInt aClientLayoutId,
|
|
585 |
TBool aNeedReset )
|
|
586 |
{
|
|
587 |
LOG("Vkb.Window.ReorganizeControls");
|
|
588 |
CPeninputClientLayoutInfo* clientLayout =
|
|
589 |
ConfigInfo()->FindClientLayoutInfo( aClientLayoutId );
|
|
590 |
RPointerArray<CPeninputControlInfo>& controlList =
|
|
591 |
clientLayout->ControlInfoList();
|
|
592 |
|
|
593 |
const TInt keyColumns = clientLayout->Columns();
|
|
594 |
const TInt keyRows = clientLayout->Rows();
|
|
595 |
|
|
596 |
if( iLastUsedTotalColumns == keyColumns &&
|
|
597 |
iLastUsedTotalRows == keyRows )
|
|
598 |
{
|
|
599 |
return;
|
|
600 |
}
|
|
601 |
|
|
602 |
iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(keyRows,keyColumns));
|
|
603 |
|
|
604 |
iLastUsedTotalColumns = keyColumns;
|
|
605 |
iLastUsedTotalRows = keyRows;
|
|
606 |
|
|
607 |
TRect winRect( Rect().iTl, iLafMgr->EntirePaneRect().Size());
|
|
608 |
|
|
609 |
SetWindowRect(winRect);
|
|
610 |
ReorgnizeTitleBar();
|
|
611 |
ReorgnizeTableUpDown();
|
|
612 |
|
|
613 |
const TInt count = controlList.Count();
|
|
614 |
TInt controlID = 0;
|
|
615 |
CFepUiBaseCtrl* ctrl = NULL;
|
|
616 |
TRect rect;
|
|
617 |
TRect inRect;
|
|
618 |
TRect exRect;
|
|
619 |
|
|
620 |
TPoint winPoint = Rect().iTl;
|
|
621 |
TPoint LafPoint = iLafMgr->EntirePaneRect().iTl;
|
|
622 |
|
|
623 |
TInt x = winPoint.iX - LafPoint.iX;
|
|
624 |
TInt y = winPoint.iY - LafPoint.iY;
|
|
625 |
|
|
626 |
if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
|
|
627 |
{
|
|
628 |
x = 0;
|
|
629 |
y = 0;
|
|
630 |
}
|
|
631 |
|
|
632 |
for ( TInt i = 0; i < count; i++ )
|
|
633 |
{
|
|
634 |
controlID = controlList[i]->ControlID();
|
|
635 |
ctrl = Control( controlID );
|
|
636 |
|
|
637 |
if ( ctrl )
|
|
638 |
{
|
|
639 |
AddNotOwnedControl( ctrl );
|
|
640 |
if ( ( ctrl->ControlType() | ECtrlButton ) == ECtrlButton )
|
|
641 |
{
|
|
642 |
|
|
643 |
iLafMgr->GetButtonRect(TPeninputCommonCtrlID(ctrl->ControlId()),exRect ,inRect);
|
|
644 |
|
|
645 |
exRect.Move(x, y);
|
|
646 |
inRect.Move(x, y);
|
|
647 |
if( controlID == EPeninutWindowCtrlIdShiftBtn)
|
|
648 |
{
|
|
649 |
( static_cast<CAknFepCtrlMultiModeButton*> (ctrl) )->
|
|
650 |
SizeChanged( exRect, inRect, ETrue );
|
|
651 |
}
|
|
652 |
else
|
|
653 |
{
|
|
654 |
if (TPeninputCommonCtrlID(ctrl->ControlId()) == EPeninutWindowCtrlIdSpaceBtn)
|
|
655 |
{
|
|
656 |
// config 3 pieces icon info
|
|
657 |
TRect iconsFrameRect, middleIconRect;
|
|
658 |
iLafMgr->GetSpaceButtonExLayoutInfo( iconsFrameRect, middleIconRect );
|
|
659 |
iconsFrameRect.Move( x, y );
|
|
660 |
middleIconRect.Move( x, y );
|
|
661 |
inRect = iconsFrameRect;
|
|
662 |
|
|
663 |
( static_cast<CAknFepCtrlCommonButton*> (ctrl) )->SetDraw3PieceFrameInfo(
|
|
664 |
TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL,
|
|
665 |
KAknsIIDQgnIndiInputSpaceMiddle,
|
|
666 |
KAknsIIDQgnIndiInputSpaceR,
|
|
667 |
middleIconRect));
|
|
668 |
}
|
|
669 |
( static_cast<CAknFepCtrlCommonButton*> (ctrl) )->SizeChanged( exRect,
|
|
670 |
inRect,
|
|
671 |
ETrue );
|
|
672 |
}
|
|
673 |
}
|
|
674 |
else if ( ctrl->ControlId() == EPeninutWindowCtrlIdVkbCtrl )
|
|
675 |
{
|
|
676 |
iVkbCtrl->SetFont( iLafMgr->KeyTextFont() );
|
|
677 |
iVkbCtrl->SetTextLineLayout( iLafMgr->KeyTextLayout() );
|
|
678 |
iVkbCtrl->SetTextFormat( iLafMgr->KeyTextLayout() ); //Read laf
|
|
679 |
if (aNeedReset)
|
|
680 |
{
|
|
681 |
iVkbCtrl->Reset();
|
|
682 |
}
|
|
683 |
|
|
684 |
rect = iLafMgr->KeypadRect();
|
|
685 |
|
|
686 |
rect.Move(x, y);
|
|
687 |
|
|
688 |
( static_cast<CPeninputVkbCtrlExt*> (ctrl) )->SizeChanged(rect);
|
|
689 |
}
|
|
690 |
|
|
691 |
else if ( ctrl->ControlId() == EPeninutWindowCtrlIdRangeBar )
|
|
692 |
{
|
|
693 |
TRAP_IGNORE(SetRangeBarSizeL(x, y));
|
|
694 |
}
|
|
695 |
}
|
|
696 |
}
|
|
697 |
|
|
698 |
RootControl()->Draw();
|
|
699 |
}
|
|
700 |
|
|
701 |
void CPeninputVkbKrWindow::DoCaseChange( TInt aNewCase )
|
|
702 |
{
|
|
703 |
LOG1("Vkb.Window.DoCaseChange %d",aNewCase);
|
|
704 |
TInt curCase = CPeninputDataConverter::AnyToInt
|
|
705 |
( iLayoutContext->RequestData( EPeninputDataTypeCase ) );
|
|
706 |
|
|
707 |
if ( aNewCase == curCase )
|
|
708 |
{
|
|
709 |
return;
|
|
710 |
}
|
|
711 |
|
|
712 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
713 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
714 |
|
|
715 |
TInt latchFlag = CPeninputDataConverter::AnyToInt
|
|
716 |
(iLayoutContext->RequestData(EAkninputDataTypeLatchedSet));
|
|
717 |
|
|
718 |
if ( latchFlag == 0 && (( curRange == ERangeAccent ) || ( ( curRange == ERangeEnglish )
|
|
719 |
|| ( ( curRange == ERangeNative ) && ( ConfigInfo()->CaseSensitive()) ) ) ) )
|
|
720 |
{
|
|
721 |
// Set shift and caplock button
|
|
722 |
TInt shift;
|
|
723 |
TInt capslock;
|
|
724 |
|
|
725 |
CPeninputDataConverter::ShiftCapslockByCase( aNewCase,
|
|
726 |
shift, capslock );
|
|
727 |
|
|
728 |
iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shift );
|
|
729 |
//ChangeButtonStatus( shfit, EPeninutWindowCtrlIdShiftBtn );
|
|
730 |
iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslock );
|
|
731 |
//ChangeButtonStatus( capslock, EPeninutWindowCtrlIdCapslockBtn );
|
|
732 |
iLayoutContext->SetData( EPeninputDataTypeCase, &aNewCase );
|
|
733 |
ChangeMergedButtonStatus( shift, capslock );
|
|
734 |
|
|
735 |
TRAP_IGNORE( iRangeBar->SetCaseL( curRange, aNewCase ) );
|
|
736 |
|
|
737 |
TInt vkblayout = ConfigInfo()->ShiftCapsSingleVkbLayoutByCase
|
|
738 |
( curRange, aNewCase );
|
|
739 |
|
|
740 |
if ( curRange == ERangeAccent )
|
|
741 |
{
|
|
742 |
TInt curAccentIndex = CPeninputDataConverter::AnyToInt
|
|
743 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) );
|
|
744 |
vkblayout = vkblayout + curAccentIndex * 2;
|
|
745 |
}
|
|
746 |
|
|
747 |
ChangeVkbLayout( vkblayout );
|
|
748 |
}
|
|
749 |
}
|
|
750 |
|
|
751 |
TBool CPeninputVkbKrWindow::CreateCustomControlL( TInt16 aControlId, TInt32 aImageId )
|
|
752 |
{
|
|
753 |
//LOG2("Vkb.Window.CreateCustomControlL %d %d",aControlId,aImageId);
|
|
754 |
TBool create = ETrue;
|
|
755 |
switch ( aControlId )
|
|
756 |
{
|
|
757 |
case EPeninutWindowCtrlIdMoveBtn:
|
|
758 |
{
|
|
759 |
if ( !iMoveButton )
|
|
760 |
{
|
|
761 |
iMoveButton = CAknFepCtrlDragButton::NewL(UiLayout(), EPeninutWindowCtrlIdMoveBtn);
|
|
762 |
AddControlL(iMoveButton);
|
|
763 |
iMoveButton->AddPositionObserver(this);
|
|
764 |
iMoveButton->AddEventObserver( UiLayout() );
|
|
765 |
iMoveButton->SetResourceId( aImageId );
|
|
766 |
iMoveButton->SetImageFrameId(KAknsIIDQsnFrFunctionButtonNormal,
|
|
767 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
768 |
KAknsIIDQsnFrFunctionButtonInactive);
|
|
769 |
UiLayout()->EnableLayoutMoving( static_cast<CDragBar*>( iMoveButton ) );
|
|
770 |
}
|
|
771 |
iMoveButton->ConstructFromResourceL();
|
|
772 |
}
|
|
773 |
break;
|
|
774 |
case EPeninupWindowCtrlIdArrowLeftBtn:
|
|
775 |
{
|
|
776 |
if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ )
|
|
777 |
{
|
|
778 |
break;
|
|
779 |
}
|
|
780 |
|
|
781 |
if (!iArrowLeftButton)
|
|
782 |
{
|
|
783 |
|
|
784 |
iArrowLeftButton = CAknFepCtrlRepeatButton::NewL(
|
|
785 |
UiLayout(), aControlId, EPeninputLayoutEventLeftArrow, EKeyLeftArrow,
|
|
786 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
787 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
788 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
789 |
|
|
790 |
AddControlL(iArrowLeftButton);
|
|
791 |
iArrowLeftButton->AddEventObserver(UiLayout());
|
|
792 |
iArrowLeftButton->SetResourceId( aImageId );
|
|
793 |
}
|
|
794 |
|
|
795 |
iArrowLeftButton->ConstructFromResourceL();
|
|
796 |
}
|
|
797 |
break;
|
|
798 |
case EPeninupWindowCtrlIdArrowRightBtn:
|
|
799 |
{
|
|
800 |
if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ )
|
|
801 |
{
|
|
802 |
break;
|
|
803 |
}
|
|
804 |
|
|
805 |
if (!iArrowRightButton)
|
|
806 |
{
|
|
807 |
iArrowRightButton = CAknFepCtrlRepeatButton::NewL(
|
|
808 |
UiLayout(), aControlId, EPeninputLayoutEventRightArrow, EKeyRightArrow,
|
|
809 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
810 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
811 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
812 |
|
|
813 |
AddControlL(iArrowRightButton);
|
|
814 |
iArrowRightButton->AddEventObserver(UiLayout());
|
|
815 |
iArrowRightButton->SetResourceId( aImageId );
|
|
816 |
|
|
817 |
}
|
|
818 |
iArrowRightButton->ConstructFromResourceL();
|
|
819 |
}
|
|
820 |
break;
|
|
821 |
|
|
822 |
case EPeninutVkbCtrlIdSymbolTableUp:
|
|
823 |
{
|
|
824 |
if (!iTableUpButton)
|
|
825 |
{
|
|
826 |
|
|
827 |
iTableUpButton = CAknFepCtrlRepeatButton::NewL(
|
|
828 |
UiLayout(), aControlId, EPeninputLayoutVkbEventTableUp, EKeyPageUp,
|
|
829 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
830 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
831 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
832 |
|
|
833 |
AddControlL(iTableUpButton);
|
|
834 |
iTableUpButton->AddEventObserver(UiLayout());
|
|
835 |
iTableUpButton->SetResourceId( aImageId );
|
|
836 |
}
|
|
837 |
|
|
838 |
iTableUpButton->ConstructFromResourceL();
|
|
839 |
}
|
|
840 |
break;
|
|
841 |
case EPeninutVkbCtrlIdSymbolTableDown:
|
|
842 |
{
|
|
843 |
if (!iTableDownButton)
|
|
844 |
{
|
|
845 |
iTableDownButton = CAknFepCtrlRepeatButton::NewL(
|
|
846 |
UiLayout(), aControlId, EPeninputLayoutVkbEventTableDown, EKeyPageDown,
|
|
847 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
848 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
849 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
850 |
|
|
851 |
AddControlL(iTableDownButton);
|
|
852 |
iTableDownButton->AddEventObserver(UiLayout());
|
|
853 |
iTableDownButton->SetResourceId( aImageId );
|
|
854 |
|
|
855 |
}
|
|
856 |
iTableDownButton->ConstructFromResourceL();
|
|
857 |
}
|
|
858 |
break;
|
|
859 |
case EPeninutVkbCtrlIdSymbolTablePageLabel:
|
|
860 |
{
|
|
861 |
if (!iTablePageLabel)
|
|
862 |
{
|
|
863 |
/*
|
|
864 |
iTablePageLabel=CAknFepCtrlCommonButton::NewL(
|
|
865 |
UiLayout(),
|
|
866 |
aControlId,
|
|
867 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
868 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
869 |
KAknsIIDQsnFrFunctionButtonInactive);
|
|
870 |
*/
|
|
871 |
iTablePageLabel=CAknFepCtrlEventButton::NewL(
|
|
872 |
UiLayout(),
|
|
873 |
aControlId,
|
|
874 |
0xFFFF,
|
|
875 |
0,
|
|
876 |
KAknsIIDQsnFrFunctionButtonInactive,
|
|
877 |
KAknsIIDQsnFrFunctionButtonInactive,
|
|
878 |
KAknsIIDQsnFrFunctionButtonInactive);
|
|
879 |
AddControlL(iTablePageLabel);
|
|
880 |
iTablePageLabel->AddEventObserver(UiLayout());
|
|
881 |
iTablePageLabel->Hide(EFalse);
|
|
882 |
}
|
|
883 |
}
|
|
884 |
break;
|
|
885 |
default:
|
|
886 |
{
|
|
887 |
create = EFalse;
|
|
888 |
}
|
|
889 |
}
|
|
890 |
return create;
|
|
891 |
}
|
|
892 |
|
|
893 |
void CPeninputVkbKrWindow::AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl)
|
|
894 |
{
|
|
895 |
//LOG("Vkb.Window.AddCustomControlGroupL");
|
|
896 |
AddControlL(aCtrl);
|
|
897 |
}
|
|
898 |
|
|
899 |
void CPeninputVkbKrWindow::SetVkbLayoutSize()
|
|
900 |
{
|
|
901 |
TInt vkbLayoutid = CPeninputDataConverter::AnyToInt
|
|
902 |
( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );
|
|
903 |
CPeninputVkbLayoutInfo* vkbLayout =
|
|
904 |
ConfigInfo()->FindVkbLayoutInfo( vkbLayoutid );
|
|
905 |
|
|
906 |
TRect outrect,innerrect;
|
|
907 |
iLafMgr->GetPreviewWndRect(outrect,innerrect);
|
|
908 |
|
|
909 |
if (SymbolTableUtil::GetClientLaytoutFor(vkbLayoutid)==EPeninputClientLayoutMacroChars)
|
|
910 |
{
|
|
911 |
TInt widthOutrect=outrect.Width();
|
|
912 |
TInt widthInnerrect=innerrect.Width();
|
|
913 |
outrect.SetWidth(widthOutrect*3);
|
|
914 |
innerrect.SetWidth(widthInnerrect*3);
|
|
915 |
}
|
|
916 |
|
|
917 |
iVkbCtrl->SetTextFormat(iLafMgr->PreviewWndText()); //Read laf
|
|
918 |
iVkbCtrl->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf
|
|
919 |
iVkbCtrl->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX,
|
|
920 |
innerrect.iTl.iY - outrect.iTl.iY,
|
|
921 |
outrect.iBr.iX - innerrect.iBr.iX,
|
|
922 |
outrect.iBr.iY - innerrect.iBr.iY);
|
|
923 |
|
|
924 |
// Calculate current vkblayout according current layout
|
|
925 |
if ( vkbLayout )
|
|
926 |
{
|
|
927 |
const TInt columns = vkbLayout->Columns();
|
|
928 |
const TInt rows = vkbLayout->Rows();
|
|
929 |
TRect keyRect;
|
|
930 |
TRect charRect;
|
|
931 |
|
|
932 |
//iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(rows,columns));
|
|
933 |
|
|
934 |
|
|
935 |
for (TInt exter = 0; exter < rows; exter ++)
|
|
936 |
{
|
|
937 |
for (TInt inter = 0; inter < columns; inter ++ )
|
|
938 |
{
|
|
939 |
iLafMgr->GetKeyRect(inter,exter, keyRect, charRect);
|
|
940 |
vkbLayout->SetKeyInfo(exter,inter,keyRect,charRect,iLafMgr->KeyTextFont());
|
|
941 |
}
|
|
942 |
}
|
|
943 |
|
|
944 |
if ( iVkbCtrl->IsIrregularKeyBoard() )
|
|
945 |
{
|
|
946 |
TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size();
|
|
947 |
TSize size = iVkbCtrl->IrregularKeyBitmap(EKeyLeftDown,
|
|
948 |
EKeyStateNormal)->SizeInPixels();
|
|
949 |
if ( curSize != size )
|
|
950 |
{
|
|
951 |
for ( TInt i = 0; i <= EKeyRightUp; i++ )
|
|
952 |
{
|
|
953 |
for ( TInt j = 0; j <= EKeyStateDimmedMask; j++ )
|
|
954 |
{
|
|
955 |
AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap(
|
|
956 |
(TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j),
|
|
957 |
curSize, EAspectRatioNotPreserved );
|
|
958 |
|
|
959 |
AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap(
|
|
960 |
(TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j),
|
|
961 |
curSize, EAspectRatioNotPreserved );
|
|
962 |
}
|
|
963 |
}
|
|
964 |
}
|
|
965 |
}
|
|
966 |
else
|
|
967 |
{
|
|
968 |
TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size();
|
|
969 |
TSize size = iVkbCtrl->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
|
|
970 |
if( curSize != size )
|
|
971 |
{
|
|
972 |
for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
|
|
973 |
{
|
|
974 |
if( iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
|
|
975 |
{
|
|
976 |
AknIconUtils::SetSize(
|
|
977 |
iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i),
|
|
978 |
curSize, EAspectRatioNotPreserved );
|
|
979 |
}
|
|
980 |
}
|
|
981 |
}
|
|
982 |
}
|
|
983 |
}
|
|
984 |
}
|
|
985 |
|
|
986 |
void CPeninputVkbKrWindow::ConstructFromResourceL()
|
|
987 |
{
|
|
988 |
CPeninputLayoutWindowExt::ConstructFromResourceL();
|
|
989 |
if( iVkbLayout && !iFirstConstruct )
|
|
990 |
{
|
|
991 |
if( iVkbCtrl->IsIrregularKeyBoard() )
|
|
992 |
iVkbLayout->ConstructFromIrregularResourceL();
|
|
993 |
else
|
|
994 |
iVkbLayout->ConstructFromNonIrregularResourceL();
|
|
995 |
SetVkbLayoutSize();
|
|
996 |
}
|
|
997 |
iFirstConstruct = EFalse;
|
|
998 |
}
|
|
999 |
|
|
1000 |
// ---------------------------------------------------------------------------
|
|
1001 |
// Internal Functions
|
|
1002 |
// ---------------------------------------------------------------------------
|
|
1003 |
//
|
|
1004 |
|
|
1005 |
void CPeninputVkbKrWindow::SetRangeBarSizeL(TInt x, TInt y)
|
|
1006 |
{
|
|
1007 |
TRect exRect;
|
|
1008 |
exRect = iLafMgr->RangbarRect();
|
|
1009 |
exRect.Move(x, y);
|
|
1010 |
// Get range bar display cell rects
|
|
1011 |
TRect rect, innerRect;
|
|
1012 |
RArray<TRect> displayCellRects, dispalyCellInnerRects;
|
|
1013 |
CleanupClosePushL( displayCellRects );
|
|
1014 |
CleanupClosePushL( dispalyCellInnerRects );
|
|
1015 |
for( TInt i = 0; i < iLafMgr->RangbarCellCount(); i++ )
|
|
1016 |
{
|
|
1017 |
iLafMgr->RangbarCellAt( i, rect, innerRect );
|
|
1018 |
rect.Move(x, y);
|
|
1019 |
displayCellRects.AppendL( rect );
|
|
1020 |
innerRect.Move(x, y);
|
|
1021 |
dispalyCellInnerRects.AppendL( innerRect );
|
|
1022 |
}
|
|
1023 |
iRangeBar->SetDispalyCellRectsL( displayCellRects, dispalyCellInnerRects );
|
|
1024 |
CleanupStack::PopAndDestroy(2);
|
|
1025 |
iRangeBar->SizeChanged( exRect );
|
|
1026 |
}
|
|
1027 |
|
|
1028 |
CAknFepCtrlEventButton* CPeninputVkbKrWindow::AddButtonL(
|
|
1029 |
const TInt aControlId, const TInt aEventId, const TInt aResId,
|
|
1030 |
const TInt aUnicode, const TBool aIsRepeat )
|
|
1031 |
{
|
|
1032 |
CAknFepCtrlEventButton* button = NULL;
|
|
1033 |
|
|
1034 |
if ( aIsRepeat )
|
|
1035 |
{
|
|
1036 |
button = CAknFepCtrlRepeatButton::NewL( UiLayout(), aControlId,
|
|
1037 |
aEventId, aUnicode );
|
|
1038 |
}
|
|
1039 |
else
|
|
1040 |
{
|
|
1041 |
button = CAknFepCtrlEventButton::NewL( UiLayout(), aControlId,
|
|
1042 |
aEventId, aUnicode,
|
|
1043 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
1044 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
1045 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
CleanupStack::PushL( button );
|
|
1049 |
if ( button )
|
|
1050 |
{
|
|
1051 |
// Read resource
|
|
1052 |
TResourceReader reader;
|
|
1053 |
|
|
1054 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
|
|
1055 |
button->SetResourceId( aResId );
|
|
1056 |
button->ConstructFromResourceL();
|
|
1057 |
// Pop and destroy reader
|
|
1058 |
CleanupStack::PopAndDestroy( 1 );
|
|
1059 |
|
|
1060 |
// Add into the control pool
|
|
1061 |
AddControlL( button );
|
|
1062 |
button->AddEventObserver(UiLayout());
|
|
1063 |
|
|
1064 |
}
|
|
1065 |
CleanupStack::Pop( button );
|
|
1066 |
|
|
1067 |
return button;
|
|
1068 |
}
|
|
1069 |
|
|
1070 |
void CPeninputVkbKrWindow::ReorgnizeTitleBar()
|
|
1071 |
{
|
|
1072 |
TRect rect;
|
|
1073 |
|
|
1074 |
TPoint winPoint = Rect().iTl;
|
|
1075 |
TPoint LafPoint = iLafMgr->EntirePaneRect().iTl;
|
|
1076 |
|
|
1077 |
TInt x = winPoint.iX - LafPoint.iX;
|
|
1078 |
TInt y = winPoint.iY - LafPoint.iY;
|
|
1079 |
if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
|
|
1080 |
{
|
|
1081 |
x = 0;
|
|
1082 |
y = 0;
|
|
1083 |
}
|
|
1084 |
|
|
1085 |
TRect inRect;
|
|
1086 |
TRect exRect;
|
|
1087 |
|
|
1088 |
|
|
1089 |
rect = iLafMgr->ICFRect();
|
|
1090 |
rect.Move(x, y);
|
|
1091 |
|
|
1092 |
CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
|
|
1093 |
(Control(EPeninputWindowCtrlIdMultiLineICF));
|
|
1094 |
|
|
1095 |
const CFont* icfFont = iLafMgr->ICFTextFont();
|
|
1096 |
|
|
1097 |
// set icf margin
|
|
1098 |
TPeninputICFConfig icfConfig;
|
|
1099 |
iLafMgr->GetICFConfig( icfConfig );
|
|
1100 |
icf->SetTextMargin( icfConfig.iLeftMargin,
|
|
1101 |
icfConfig.iRightMargin,
|
|
1102 |
icfConfig.iTopMargin,
|
|
1103 |
0 );
|
|
1104 |
icf->SetLineSpace( icfConfig.iLineSpaceMargin );
|
|
1105 |
TRAP_IGNORE(icf->SizeChangedL(
|
|
1106 |
rect,
|
|
1107 |
icfConfig.iTextLineHeight,
|
|
1108 |
icfFont->FontMaxHeight(),
|
|
1109 |
icfFont));
|
|
1110 |
|
|
1111 |
|
|
1112 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdOptionBtn,exRect ,inRect);
|
|
1113 |
exRect.Move(x, y);
|
|
1114 |
inRect.Move(x, y);
|
|
1115 |
static_cast<CAknFepCtrlEventButton*>
|
|
1116 |
( Control( EPeninutWindowCtrlIdOptionBtn ) )->SizeChanged( exRect, inRect, ETrue );
|
|
1117 |
|
|
1118 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdCloseBtn,exRect ,inRect);
|
|
1119 |
exRect.Move(x, y);
|
|
1120 |
inRect.Move(x, y);
|
|
1121 |
static_cast<CAknFepCtrlCommonButton*>
|
|
1122 |
( Control( EPeninutWindowCtrlIdCloseBtn ) )->SizeChanged( exRect, inRect, ETrue );
|
|
1123 |
|
|
1124 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdBackspaceBtn,exRect ,inRect);
|
|
1125 |
exRect.Move(x, y);
|
|
1126 |
inRect.Move(x, y);
|
|
1127 |
|
|
1128 |
// Check size change of bk button, need for mirroring when arabic
|
|
1129 |
CAknFepCtrlCommonButton* bkBtn = static_cast<CAknFepCtrlCommonButton*>
|
|
1130 |
( Control( EPeninutWindowCtrlIdBackspaceBtn ) );
|
|
1131 |
TBool bBKSizeChanged = EFalse;
|
|
1132 |
if( exRect.Size() != bkBtn->Rect().Size() &&
|
|
1133 |
inRect.Size() != bkBtn->ForgroundBmpRect().Size() )
|
|
1134 |
{
|
|
1135 |
bBKSizeChanged = ETrue;
|
|
1136 |
}
|
|
1137 |
bkBtn->SizeChanged( exRect, inRect, bBKSizeChanged );
|
|
1138 |
|
|
1139 |
|
|
1140 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdSpaceBtn,exRect ,inRect);
|
|
1141 |
inRect = exRect;
|
|
1142 |
inRect.Shrink(10, 0);
|
|
1143 |
|
|
1144 |
exRect.Move(x, y);
|
|
1145 |
inRect.Move(x, y);
|
|
1146 |
static_cast<CAknFepCtrlCommonButton*>
|
|
1147 |
( Control( EPeninutWindowCtrlIdSpaceBtn ) )->SizeChanged( exRect, inRect, ETrue );
|
|
1148 |
|
|
1149 |
TRect spaceIconRect = inRect;
|
|
1150 |
spaceIconRect.Shrink(10, 0);
|
|
1151 |
static_cast<CAknFepCtrlCommonButton*>
|
|
1152 |
( Control( EPeninutWindowCtrlIdSpaceBtn ) )->SetDraw3PieceFrameInfo(
|
|
1153 |
TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL,
|
|
1154 |
KAknsIIDQgnIndiInputSpaceMiddle,
|
|
1155 |
KAknsIIDQgnIndiInputSpaceR,
|
|
1156 |
spaceIconRect));
|
|
1157 |
|
|
1158 |
if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
|
|
1159 |
{
|
|
1160 |
iLafMgr->GetButtonRect(EPeninupWindowCtrlIdArrowLeftBtn,exRect ,inRect);
|
|
1161 |
exRect.Move(x, y);
|
|
1162 |
inRect.Move(x, y);
|
|
1163 |
iArrowLeftButton->SizeChanged( exRect, inRect, ETrue );
|
|
1164 |
|
|
1165 |
iLafMgr->GetButtonRect(EPeninupWindowCtrlIdArrowRightBtn,exRect ,inRect);
|
|
1166 |
exRect.Move(x, y);
|
|
1167 |
inRect.Move(x, y);
|
|
1168 |
iArrowRightButton->SizeChanged( exRect, inRect, ETrue );
|
|
1169 |
}
|
|
1170 |
else
|
|
1171 |
{
|
|
1172 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdMoveBtn,exRect ,inRect);
|
|
1173 |
exRect.Move(x, y);
|
|
1174 |
inRect.Move(x, y);
|
|
1175 |
static_cast<CAknFepCtrlDragButton*>
|
|
1176 |
( Control( EPeninutWindowCtrlIdMoveBtn ) )->SizeChanged( exRect, inRect, ETrue );
|
|
1177 |
}
|
|
1178 |
|
|
1179 |
}
|
|
1180 |
|
|
1181 |
void CPeninputVkbKrWindow::ReorgnizeTableUpDown()
|
|
1182 |
{
|
|
1183 |
TPoint winPoint = Rect().iTl;
|
|
1184 |
TPoint LafPoint = iLafMgr->EntirePaneRect().iTl;
|
|
1185 |
|
|
1186 |
TRect inRect;
|
|
1187 |
TRect exRect;
|
|
1188 |
|
|
1189 |
TInt x = winPoint.iX - LafPoint.iX;
|
|
1190 |
TInt y = winPoint.iY - LafPoint.iY;
|
|
1191 |
|
|
1192 |
iLafMgr->GetButtonRect(
|
|
1193 |
(TPeninputCommonCtrlID)EPeninutVkbCtrlIdSymbolTableUp,
|
|
1194 |
exRect ,
|
|
1195 |
inRect);
|
|
1196 |
exRect.Move(x, y);
|
|
1197 |
inRect.Move(x, y);
|
|
1198 |
if (exRect.IsEmpty())
|
|
1199 |
{
|
|
1200 |
iTableUpButton->Hide(ETrue);
|
|
1201 |
}
|
|
1202 |
else
|
|
1203 |
{
|
|
1204 |
iTableUpButton->Hide(EFalse);
|
|
1205 |
iTableUpButton->SizeChanged( exRect, inRect, ETrue );
|
|
1206 |
}
|
|
1207 |
|
|
1208 |
iLafMgr->GetButtonRect(
|
|
1209 |
(TPeninputCommonCtrlID)EPeninutVkbCtrlIdSymbolTablePageLabel,
|
|
1210 |
exRect ,
|
|
1211 |
inRect);
|
|
1212 |
exRect.Move(x, y);
|
|
1213 |
inRect.Move(x, y);
|
|
1214 |
|
|
1215 |
/* for CButtonBase
|
|
1216 |
TRgb color( KRgbBlack ); // sane default for nonskinned case
|
|
1217 |
AknsUtils::GetCachedColor(
|
|
1218 |
UiLayout()->SkinInstance(),
|
|
1219 |
color,
|
|
1220 |
KAknsIIDQsnTextColors,
|
|
1221 |
EAknsCIQsnTextColorsCG59);
|
|
1222 |
iTablePageLabel->SetCaptionColor(color);
|
|
1223 |
TFontStyle style;
|
|
1224 |
CFbsFont* font=AknFontAccess::GetClosestFont(
|
|
1225 |
*BitmapDevice(),
|
|
1226 |
style,
|
|
1227 |
BitmapDevice()->VerticalPixelsToTwips(exRect.Height()/3),
|
|
1228 |
AknFontAccess::EAknFontFamilyNotSpecified);
|
|
1229 |
iTablePageLabel->SetFont(font);
|
|
1230 |
*/
|
|
1231 |
/* for Common
|
|
1232 |
TAknTextLineLayout layout=iLafMgr->KeyTextLayout();
|
|
1233 |
layout.iFont=ELatinPlain12;
|
|
1234 |
iTablePageLabel->SetTextFormat(layout);
|
|
1235 |
iTablePageLabel->SetTextColorIndex(EAknsCIQsnTextColorsCG59);
|
|
1236 |
*/
|
|
1237 |
/*
|
|
1238 |
TAknTextLineLayout langSwitch;
|
|
1239 |
TAknTextLineLayout langSwitchShadow;
|
|
1240 |
langSwitch =
|
|
1241 |
AknLayoutScalable_Avkon::cell_vkb_side_pane_t1().LayoutLine();
|
|
1242 |
langSwitchShadow =
|
|
1243 |
AknLayoutScalable_Avkon::cell_vkb_side_pane_t1_copy1().LayoutLine();
|
|
1244 |
iTablePageLabel->SetFont(AknLayoutUtils::FontFromId(langSwitch.iFont, NULL));
|
|
1245 |
iTablePageLabel->SetShadowFont(AknLayoutUtils::FontFromId(langSwitchShadow.iFont, NULL));
|
|
1246 |
*/
|
|
1247 |
TAknTextLineLayout langSwitch;
|
|
1248 |
TAknTextLineLayout langSwitchShadow;
|
|
1249 |
langSwitch =
|
|
1250 |
AknLayoutScalable_Avkon::cell_vkb_side_pane_t1().LayoutLine();
|
|
1251 |
TAknTextLineLayout layout=iLafMgr->KeyTextLayout();
|
|
1252 |
|
|
1253 |
if (iLayoutContext->LayoutType()==EPluginInputModeVkb)
|
|
1254 |
{
|
|
1255 |
layout.iFont=langSwitch.iFont;
|
|
1256 |
}
|
|
1257 |
iTablePageLabel->SetTextFormat(layout);
|
|
1258 |
iTablePageLabel->SetTextColorIndex(EAknsCIQsnTextColorsCG59);
|
|
1259 |
|
|
1260 |
if (exRect.IsEmpty())
|
|
1261 |
{
|
|
1262 |
iTablePageLabel->Hide(ETrue);
|
|
1263 |
}
|
|
1264 |
else
|
|
1265 |
{
|
|
1266 |
iTablePageLabel->Hide(EFalse);
|
|
1267 |
iTablePageLabel->SizeChanged( exRect, inRect, ETrue );
|
|
1268 |
}
|
|
1269 |
|
|
1270 |
iLafMgr->GetButtonRect(
|
|
1271 |
(TPeninputCommonCtrlID)EPeninutVkbCtrlIdSymbolTableDown,
|
|
1272 |
exRect ,
|
|
1273 |
inRect);
|
|
1274 |
exRect.Move(x, y);
|
|
1275 |
inRect.Move(x, y);
|
|
1276 |
if (exRect.IsEmpty())
|
|
1277 |
{
|
|
1278 |
iTableDownButton->Hide(ETrue);
|
|
1279 |
}
|
|
1280 |
else
|
|
1281 |
{
|
|
1282 |
iTableDownButton->Hide(EFalse);
|
|
1283 |
iTableDownButton->SizeChanged( exRect, inRect, ETrue );
|
|
1284 |
}
|
|
1285 |
|
|
1286 |
TRect updateArea;
|
|
1287 |
updateArea.iTl=iTableUpButton->Rect().iTl;
|
|
1288 |
updateArea.iBr=iTableDownButton->Rect().iBr;
|
|
1289 |
UpdateArea( updateArea, ETrue );
|
|
1290 |
}
|
|
1291 |
|
|
1292 |
void CPeninputVkbKrWindow::ResetAccentButton()
|
|
1293 |
{
|
|
1294 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
1295 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
1296 |
|
|
1297 |
if ( iRangeBar )
|
|
1298 |
{
|
|
1299 |
iRangeBar->ActiveRange( curRange );
|
|
1300 |
}
|
|
1301 |
}
|
|
1302 |
|
|
1303 |
void CPeninputVkbKrWindow::UpdateICFTextL()
|
|
1304 |
{
|
|
1305 |
CFepLayoutMultiLineIcf* icf =
|
|
1306 |
static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF));
|
|
1307 |
if( icf )
|
|
1308 |
{
|
|
1309 |
icf->UpdateSecretTextL();
|
|
1310 |
}
|
|
1311 |
}
|
|
1312 |
|
|
1313 |
|
|
1314 |
TInt CPeninputVkbKrWindow::BackgroundTaskL(TAny* aPtr)
|
|
1315 |
{
|
|
1316 |
CPeninputVkbKrWindow* self = static_cast<CPeninputVkbKrWindow*>(aPtr);
|
|
1317 |
self->DoIdleConstructL();
|
|
1318 |
return EFalse; // only run once
|
|
1319 |
}
|
|
1320 |
|
|
1321 |
void CPeninputVkbKrWindow::PopupWindowSizeChange()
|
|
1322 |
{
|
|
1323 |
TAknTextLineLayout choiceTextLayout;
|
|
1324 |
if (CPeninputDataConverter::AnyToInt(
|
|
1325 |
iLayoutContext->RequestData(EAkninputDataTypeSizeChanging)) || (!iPopupSet))
|
|
1326 |
{
|
|
1327 |
// if size changing, or popup window's property has not been set yet
|
|
1328 |
TAknWindowLineLayout appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine();
|
|
1329 |
iAppWndRect = appWnd.Rect();
|
|
1330 |
|
|
1331 |
TAknWindowLineLayout mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine();
|
|
1332 |
TAknLayoutRect mainPaneRect;
|
|
1333 |
mainPaneRect.LayoutRect(iAppWndRect, mainPane);
|
|
1334 |
|
|
1335 |
TAknWindowLineLayout choiceWnd =
|
|
1336 |
AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine();
|
|
1337 |
TAknLayoutRect choiceRect;
|
|
1338 |
choiceRect.LayoutRect(mainPaneRect.Rect(), choiceWnd);
|
|
1339 |
|
|
1340 |
iPopupItemRect = TRect(0, 0, choiceRect.Rect().Width(),
|
|
1341 |
AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH);
|
|
1342 |
|
|
1343 |
choiceTextLayout =
|
|
1344 |
AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine();
|
|
1345 |
}
|
|
1346 |
|
|
1347 |
const CFont* font = AknLayoutUtils::FontFromId(choiceTextLayout.iFont, NULL);
|
|
1348 |
iPopupWnd->SetFont(font);
|
|
1349 |
iPopupWnd->SetItemRect(iPopupItemRect, iPopupItemRect);
|
|
1350 |
|
|
1351 |
TInt leftMargin = choiceTextLayout.il;
|
|
1352 |
|
|
1353 |
iPopupWnd->SetMarginAndBaseline(leftMargin, font->HeightInPixels());
|
|
1354 |
|
|
1355 |
iPopupWnd->SetFontColor(AKN_LAF_COLOR_STATIC(choiceTextLayout.iC));
|
|
1356 |
|
|
1357 |
AknIconUtils::SetSize(iPopupWndBgImg, TSize(iPopupItemRect.Width(),
|
|
1358 |
iPopupItemRect.Height()*3), EAspectRatioNotPreserved);
|
|
1359 |
AknIconUtils::SetSize(iPopupWndFocusImg, TSize(iPopupItemRect.Width(),
|
|
1360 |
iPopupItemRect.Height()* 3), EAspectRatioNotPreserved);
|
|
1361 |
|
|
1362 |
iPopupSet = ETrue;
|
|
1363 |
}
|
|
1364 |
|
|
1365 |
void CPeninputVkbKrWindow::DoIdleConstructL()
|
|
1366 |
{
|
|
1367 |
if(iPopupInited)
|
|
1368 |
return;
|
|
1369 |
|
|
1370 |
// Read resource
|
|
1371 |
TResourceReader reader;
|
|
1372 |
|
|
1373 |
CCoeEnv::Static()->CreateResourceReaderLC( reader,
|
|
1374 |
R_PENINPUT_LAYOUT_VKB_POPUP_WINDOW );
|
|
1375 |
|
|
1376 |
GetPopupWndInfoFromResL(reader, iPopupItemRect);
|
|
1377 |
|
|
1378 |
// Pop and destroy reader
|
|
1379 |
CleanupStack::PopAndDestroy( 1 );
|
|
1380 |
|
|
1381 |
}
|
|
1382 |
|
|
1383 |
void CPeninputVkbKrWindow::GetPopupWndInfoFromResL(
|
|
1384 |
TResourceReader aRes,
|
|
1385 |
const TRect& aRect )
|
|
1386 |
{
|
|
1387 |
TPtrC bmpFileName = aRes.ReadTPtrC();
|
|
1388 |
TInt32 imgMajorSkinId = aRes.ReadInt32();
|
|
1389 |
|
|
1390 |
TAknsItemID id;
|
|
1391 |
|
|
1392 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
1393 |
|
|
1394 |
TInt popWinBmpId = aRes.ReadInt16();
|
|
1395 |
TInt popWinBmpMaskId = aRes.ReadInt16();
|
|
1396 |
TInt popWinBmpSkinId = aRes.ReadInt16();
|
|
1397 |
|
|
1398 |
id.Set( TInt( imgMajorSkinId ), popWinBmpSkinId );
|
|
1399 |
|
|
1400 |
if ( popWinBmpId != KInvalidImg )
|
|
1401 |
{
|
|
1402 |
AknsUtils::CreateIconL( skininstance,
|
|
1403 |
id,
|
|
1404 |
iPopupWndBgImg,
|
|
1405 |
bmpFileName,
|
|
1406 |
popWinBmpId );
|
|
1407 |
|
|
1408 |
AknIconUtils::SetSize( iPopupWndBgImg, TSize( aRect.Width(),
|
|
1409 |
aRect.Height() * 3 ), EAspectRatioNotPreserved );
|
|
1410 |
iPopupWnd->SetBackgroundBitmapL( iPopupWndBgImg );
|
|
1411 |
}
|
|
1412 |
|
|
1413 |
TInt focusBmpId = aRes.ReadInt16();
|
|
1414 |
TInt focusBmpMaskId = aRes.ReadInt16();
|
|
1415 |
TInt focusBmpSkinId = aRes.ReadInt16();
|
|
1416 |
|
|
1417 |
id.Set( TInt( imgMajorSkinId ), focusBmpSkinId );
|
|
1418 |
|
|
1419 |
if ( focusBmpId != KInvalidImg )
|
|
1420 |
{
|
|
1421 |
AknsUtils::CreateIconL( skininstance,
|
|
1422 |
id,
|
|
1423 |
iPopupWndFocusImg,
|
|
1424 |
bmpFileName,
|
|
1425 |
focusBmpId );
|
|
1426 |
|
|
1427 |
AknIconUtils::SetSize( iPopupWndFocusImg, TSize( aRect.Width(),
|
|
1428 |
aRect.Height() * 3 ), EAspectRatioNotPreserved );
|
|
1429 |
iPopupWnd->SetFocusBmp( iPopupWndFocusImg );
|
|
1430 |
}
|
|
1431 |
}
|
|
1432 |
|
|
1433 |
void CPeninputVkbKrWindow::PopupSwitchWindowL()
|
|
1434 |
{
|
|
1435 |
CFepUiBaseCtrl* switchBtn = Control(EPeninutWindowCtrlIdSwitchToHwrBtn);
|
|
1436 |
|
|
1437 |
if ( switchBtn )
|
|
1438 |
{
|
|
1439 |
/*
|
|
1440 |
if (!iPopupInited)
|
|
1441 |
{
|
|
1442 |
DoIdleConstructL();
|
|
1443 |
}
|
|
1444 |
TRect rect = switchBtn->Rect();
|
|
1445 |
*/
|
|
1446 |
static_cast<CPeninputLayoutInputmodelChoice*>
|
|
1447 |
(Control(EPeninutWindowCtrlIdSwitcherPopupWindow))->PopUpSwitchListL( switchBtn->Rect() );
|
|
1448 |
}
|
|
1449 |
}
|
|
1450 |
|
|
1451 |
TBool CPeninputVkbKrWindow::IsSymbolRange()
|
|
1452 |
{
|
|
1453 |
TInt currentRange = CPeninputDataConverter::AnyToInt(
|
|
1454 |
iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
|
|
1455 |
return currentRange==ERangeSymbol;
|
|
1456 |
}
|
|
1457 |
|
|
1458 |
void CPeninputVkbKrWindow::FakeClientLayoutUpdateL(const TInt& aVkbLayoutId)
|
|
1459 |
{
|
|
1460 |
TInt vkbLayoutToUpdate=aVkbLayoutId;
|
|
1461 |
CPeninputRangeBarInfo* rangeBarInfo = iConfigInfo->RangeBarInfo();
|
|
1462 |
CPeninputRangeInfo* rangeInfo = rangeBarInfo->FindRange(ERangeSymbol);
|
|
1463 |
if (vkbLayoutToUpdate==0)
|
|
1464 |
{
|
|
1465 |
vkbLayoutToUpdate = rangeInfo->VkbLayoutId();
|
|
1466 |
}
|
|
1467 |
|
|
1468 |
// TODO: find better way to handle changing client layout.
|
|
1469 |
TDummyRangeInfo* dummyRangeInfo=(TDummyRangeInfo*)rangeInfo;
|
|
1470 |
dummyRangeInfo->iClientLayoutId=
|
|
1471 |
SymbolTableUtil::GetClientLaytoutFor(vkbLayoutToUpdate);
|
|
1472 |
|
|
1473 |
if (iTablePageLabel)
|
|
1474 |
{
|
|
1475 |
TBuf<50> buf;
|
|
1476 |
buf.Format(_L("%d/%d"),SymbolTableUtil::FindIndex(vkbLayoutToUpdate)+1,KMaxSymbolTable);
|
|
1477 |
//iTablePageLabel->SetCaptionL(buf);
|
|
1478 |
iTablePageLabel->SetTextL(buf);
|
|
1479 |
RootControl()->Draw();
|
|
1480 |
}
|
|
1481 |
}
|
|
1482 |
|
|
1483 |
// ---------------------------------------------------------------------------
|
|
1484 |
// External Functions
|
|
1485 |
// ---------------------------------------------------------------------------
|
|
1486 |
//
|
|
1487 |
|
|
1488 |
void CPeninputVkbKrWindow::SetPromptTextL(TUint8* aData)
|
|
1489 |
{
|
|
1490 |
RDesReadStream readStream;
|
|
1491 |
|
|
1492 |
TPtr8 countPtr(aData, 2*sizeof(TInt), 2*sizeof(TInt));
|
|
1493 |
readStream.Open(countPtr);
|
|
1494 |
CleanupClosePushL(readStream);
|
|
1495 |
const TInt dataCount = readStream.ReadInt32L();
|
|
1496 |
const TInt textCount = readStream.ReadInt32L();
|
|
1497 |
CleanupStack::PopAndDestroy(&readStream);
|
|
1498 |
|
|
1499 |
TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount );
|
|
1500 |
readStream.Open(ptr);
|
|
1501 |
CleanupClosePushL(readStream);
|
|
1502 |
|
|
1503 |
HBufC8* dataBuf = HBufC8::NewLC(dataCount);
|
|
1504 |
TPtr8 dataBufPtr = dataBuf->Des();
|
|
1505 |
readStream.ReadL(dataBufPtr, dataCount);
|
|
1506 |
|
|
1507 |
TFepPromptText* pIcfData =
|
|
1508 |
reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr()));
|
|
1509 |
|
|
1510 |
HBufC* textBuf;
|
|
1511 |
if (textCount > 0)
|
|
1512 |
{
|
|
1513 |
textBuf = HBufC::NewLC(textCount/2);
|
|
1514 |
TPtr textBufPtr = textBuf->Des();
|
|
1515 |
readStream.ReadL(textBufPtr, textCount/2);
|
|
1516 |
static_cast<CFepLayoutMultiLineIcf*>
|
|
1517 |
(Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL(textBuf->Des());
|
|
1518 |
CleanupStack::PopAndDestroy(textBuf);
|
|
1519 |
}
|
|
1520 |
else
|
|
1521 |
{
|
|
1522 |
static_cast<CFepLayoutMultiLineIcf*>
|
|
1523 |
(Control(EPeninputWindowCtrlIdMultiLineICF))->SetPromptTextL(KNullDesC);
|
|
1524 |
}
|
|
1525 |
|
|
1526 |
CleanupStack::PopAndDestroy(dataBuf);
|
|
1527 |
CleanupStack::PopAndDestroy(&readStream);
|
|
1528 |
}
|
|
1529 |
|
|
1530 |
void CPeninputVkbKrWindow::SetSwitchlistSecretFlag(TBool aSecret)
|
|
1531 |
{
|
|
1532 |
static_cast<CPeninputLayoutInputmodelChoice*>
|
|
1533 |
(Control(EPeninutWindowCtrlIdSwitcherPopupWindow))->SetSecretEditor(aSecret);
|
|
1534 |
//disable or enable arrow keys of FSQ in secret editor.
|
|
1535 |
}
|
|
1536 |
|
|
1537 |
void CPeninputVkbKrWindow::DimArrowKeys( TBool aDimArrow )
|
|
1538 |
{
|
|
1539 |
if(iLayoutContext->LayoutType() == EPluginInputModeFSQ
|
|
1540 |
&& iArrowLeftButton && iArrowRightButton)
|
|
1541 |
{
|
|
1542 |
iArrowLeftButton->SetDimmed( aDimArrow );
|
|
1543 |
iArrowRightButton->SetDimmed( aDimArrow );
|
|
1544 |
}
|
|
1545 |
}
|
|
1546 |
|
|
1547 |
void CPeninputVkbKrWindow::DimEnterKey( TBool aDimmed )
|
|
1548 |
{
|
|
1549 |
CAknFepCtrlEventButton* enterBtn = static_cast<CAknFepCtrlEventButton*>
|
|
1550 |
( Control(EPeninutWindowCtrlIdEnterBtn) );
|
|
1551 |
if( iLayoutContext->LayoutType() == EPluginInputModeFSQ
|
|
1552 |
&& enterBtn )
|
|
1553 |
{
|
|
1554 |
enterBtn->SetDimmed( aDimmed );
|
|
1555 |
}
|
|
1556 |
}
|
|
1557 |
|
|
1558 |
void CPeninputVkbKrWindow::ShowBubble(TInt aShow)
|
|
1559 |
{
|
|
1560 |
if (aShow > 0)
|
|
1561 |
{
|
|
1562 |
iVkbCtrl->ShowBubble(ETrue);
|
|
1563 |
}
|
|
1564 |
else
|
|
1565 |
{
|
|
1566 |
iVkbCtrl->ShowBubble(EFalse);
|
|
1567 |
}
|
|
1568 |
}
|
|
1569 |
|
|
1570 |
void CPeninputVkbKrWindow::PreProcessRange(const TInt& aRange)
|
|
1571 |
{
|
|
1572 |
CAknFepCtrlMultiModeButton* ctrlShift=
|
|
1573 |
(CAknFepCtrlMultiModeButton*)ControlById(EPeninutWindowCtrlIdShiftBtn);
|
|
1574 |
if (aRange==ERangeSymbol)
|
|
1575 |
{
|
|
1576 |
TRAP_IGNORE( FakeClientLayoutUpdateL());
|
|
1577 |
ctrlShift->SetDimmed(ETrue);
|
|
1578 |
}
|
|
1579 |
else
|
|
1580 |
{
|
|
1581 |
ctrlShift->SetDimmed(EFalse);
|
|
1582 |
}
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
void CPeninputVkbKrWindow::UpdateLafData()
|
|
1586 |
{
|
|
1587 |
TRAP_IGNORE( iLafMgr->UpdateLafDataL() );
|
|
1588 |
}
|