author | Simon Howkins <simonh@symbian.org> |
Mon, 15 Nov 2010 14:00:51 +0000 | |
branch | RCL_3 |
changeset 59 | 7febbd162ded |
parent 56 | 8152b1f1763a |
permissions | -rw-r--r-- |
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: peninput VKB data manager |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// System includes |
|
20 |
#include <peninputdataconverter.h> |
|
21 |
#include <peninputcommonlayoutglobalenum.h> |
|
22 |
#include <AknUtils.h> |
|
23 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
24 |
#include <peninputpluginutils.h> |
|
25 |
#include <aknlayoutscalable_apps.cdl.h> |
|
26 |
#include <layoutmetadata.cdl.h> |
|
27 |
||
28 |
// User includes |
|
29 |
#include "peninputsplitqwertylafdatamgr.h" |
|
30 |
||
31 |
// --------------------------------------------------------------------------- |
|
32 |
// C++ destructor |
|
33 |
// --------------------------------------------------------------------------- |
|
34 |
// |
|
35 |
CPeninputQwtLayoutDataInfo::~CPeninputQwtLayoutDataInfo() |
|
36 |
{ |
|
37 |
iKeypad.iRects.Close(); |
|
38 |
iKeypad.iCharRects.Close(); |
|
39 |
} |
|
40 |
||
41 |
// --------------------------------------------------------------------------- |
|
42 |
// C++ destructor |
|
43 |
// --------------------------------------------------------------------------- |
|
44 |
// |
|
45 |
MPeninputLafDataCommon::~MPeninputLafDataCommon() |
|
46 |
{ |
|
47 |
} |
|
48 |
||
49 |
// --------------------------------------------------------------------------- |
|
50 |
// Release laf data |
|
51 |
// --------------------------------------------------------------------------- |
|
52 |
// |
|
53 |
void MPeninputLafDataCommon::DestoryDataCommon() |
|
54 |
{ |
|
55 |
iLayoutDataInfo.ResetAndDestroy(); |
|
56 |
iLayoutDataInfo.Close(); |
|
57 |
} |
|
58 |
||
59 |
// --------------------------------------------------------------------------- |
|
60 |
// Symbian constructor |
|
61 |
// --------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
void MPeninputLafDataCommon::ConstructL() |
|
64 |
{ |
|
65 |
ReadLafInfoL(); |
|
66 |
} |
|
67 |
||
68 |
// --------------------------------------------------------------------------- |
|
69 |
// Retrieve laf data of button specified by aButtonID |
|
70 |
// --------------------------------------------------------------------------- |
|
71 |
// |
|
72 |
const TPeninputButtonLayoutData& MPeninputLafDataCommon::ButtonLayoutData( |
|
73 |
TInt aButtonID ) const |
|
74 |
{ |
|
75 |
ASSERT( IsValid() ); |
|
76 |
const TPeninputButtonLayoutData* pData = NULL; |
|
77 |
||
78 |
switch ( aButtonID ) |
|
79 |
{ |
|
80 |
case EPeninutWindowCtrlIdMoveBtn: |
|
81 |
{ |
|
82 |
pData = &(iLayoutDataInfo[iLayoutType]->iMoveButton); |
|
83 |
} |
|
84 |
break; |
|
85 |
case EPeninutWindowCtrlIdCloseBtn: |
|
86 |
{ |
|
87 |
pData = &(iLayoutDataInfo[iLayoutType]->iCloseButton); |
|
88 |
} |
|
89 |
break; |
|
90 |
case EPeninutWindowCtrlIdOptionBtn: |
|
91 |
{ |
|
92 |
pData = &(iLayoutDataInfo[iLayoutType]->iOptionButton); |
|
93 |
} |
|
94 |
break; |
|
95 |
case EPeninutWindowCtrlIdBackspaceBtn: |
|
96 |
{ |
|
97 |
pData = &(iLayoutDataInfo[iLayoutType]->iClearButton); |
|
98 |
} |
|
99 |
break; |
|
100 |
case EPeninutWindowCtrlIdEnterBtn: |
|
101 |
{ |
|
102 |
pData = &(iLayoutDataInfo[iLayoutType]->iEnterButton); |
|
103 |
} |
|
104 |
break; |
|
105 |
case EPeninutWindowCtrlIdSpaceBtn: |
|
106 |
{ |
|
107 |
pData = &(iLayoutDataInfo[iLayoutType]->iSpaceButton); |
|
108 |
} |
|
109 |
break; |
|
110 |
case EPeninutWindowCtrlIdShiftBtn: |
|
111 |
{ |
|
112 |
pData = &(iLayoutDataInfo[iLayoutType]->iShiftButton); |
|
113 |
} |
|
114 |
break; |
|
115 |
case EPeninupWindowCtrlIdArrowLeftBtn: |
|
116 |
{ |
|
117 |
pData = &(iLayoutDataInfo[iLayoutType]->iLeftButton); |
|
118 |
} |
|
119 |
break; |
|
120 |
case EPeninupWindowCtrlIdArrowRightBtn: |
|
121 |
{ |
|
122 |
pData = &(iLayoutDataInfo[iLayoutType]->iRightButton); |
|
123 |
} |
|
124 |
break; |
|
125 |
||
126 |
case EPeninutWindowCtrlIdRangeBtn: |
|
127 |
{ |
|
128 |
pData = &(iLayoutDataInfo[iLayoutType]->iRangeButton); |
|
129 |
} |
|
130 |
break; |
|
131 |
default: |
|
132 |
ASSERT( EFalse ); |
|
133 |
break; |
|
134 |
} |
|
135 |
ASSERT( pData ); |
|
136 |
return *pData; |
|
137 |
} |
|
138 |
||
139 |
// --------------------------------------------------------------------------- |
|
140 |
// Retrieve laf data of keypad |
|
141 |
// --------------------------------------------------------------------------- |
|
142 |
// |
|
143 |
const TPeninputKeyLayoutData& MPeninputLafDataCommon::KeypadLayoutData() const |
|
144 |
{ |
|
145 |
ASSERT( IsValid() ); |
|
146 |
return iLayoutDataInfo[iLayoutType]->iKeypad; |
|
147 |
} |
|
148 |
||
149 |
// --------------------------------------------------------------------------- |
|
150 |
// Retrieve laf data of qwerty layout |
|
151 |
// --------------------------------------------------------------------------- |
|
152 |
// |
|
153 |
const CPeninputQwtLayoutDataInfo& MPeninputLafDataCommon::QwtLayoutData() const |
|
154 |
{ |
|
155 |
ASSERT( IsValid() ); |
|
156 |
return *iLayoutDataInfo[iLayoutType]; |
|
157 |
} |
|
158 |
||
159 |
// --------------------------------------------------------------------------- |
|
160 |
// Set layout type |
|
161 |
// --------------------------------------------------------------------------- |
|
162 |
// |
|
163 |
void MPeninputLafDataCommon::SetLayoutType( TInt aLayoutType ) |
|
164 |
{ |
|
165 |
iLayoutType = aLayoutType; |
|
166 |
} |
|
167 |
||
168 |
// --------------------------------------------------------------------------- |
|
169 |
// Get current layout type |
|
170 |
// --------------------------------------------------------------------------- |
|
171 |
// |
|
172 |
TInt MPeninputLafDataCommon::LayoutType() const |
|
173 |
{ |
|
174 |
return iLayoutType; |
|
175 |
} |
|
176 |
||
177 |
// --------------------------------------------------------------------------- |
|
178 |
// Set laf option) |
|
179 |
// --------------------------------------------------------------------------- |
|
180 |
// |
|
181 |
void MPeninputLafDataCommon::SetLafOption( TPeninputVkbLafOption aLafOption ) |
|
182 |
{ |
|
183 |
iLafOption = aLafOption; |
|
184 |
} |
|
185 |
||
186 |
// --------------------------------------------------------------------------- |
|
187 |
// Get current laf option |
|
188 |
// --------------------------------------------------------------------------- |
|
189 |
// |
|
190 |
TPeninputVkbLafOption MPeninputLafDataCommon::LafOption() const |
|
191 |
{ |
|
192 |
return iLafOption; |
|
193 |
} |
|
194 |
||
195 |
// --------------------------------------------------------------------------- |
|
196 |
// Check whether laf data is valid or not |
|
197 |
// --------------------------------------------------------------------------- |
|
198 |
// |
|
199 |
TBool MPeninputLafDataCommon::IsValid() const |
|
200 |
{ |
|
201 |
return ( iLayoutDataInfo.Count() && iLayoutType != ELayoutNone ) ? ETrue : EFalse; |
|
202 |
} |
|
203 |
||
204 |
// --------------------------------------------------------------------------- |
|
205 |
// Symbian constructor |
|
206 |
// --------------------------------------------------------------------------- |
|
207 |
// |
|
208 |
CPeninputLafDataFSQ* CPeninputLafDataFSQ::NewL( TInt aLayoutType ) |
|
209 |
{ |
|
210 |
CPeninputLafDataFSQ* self = NewLC( aLayoutType ); |
|
211 |
CleanupStack::Pop(); |
|
212 |
return self; |
|
213 |
} |
|
214 |
// --------------------------------------------------------------------------- |
|
215 |
// Symbian constructor |
|
216 |
// --------------------------------------------------------------------------- |
|
217 |
// |
|
218 |
CPeninputLafDataFSQ* CPeninputLafDataFSQ::NewLC( TInt aLayoutType ) |
|
219 |
{ |
|
220 |
CPeninputLafDataFSQ* self = new( ELeave ) CPeninputLafDataFSQ( aLayoutType ); |
|
221 |
CleanupStack::PushL( self ); |
|
222 |
self->ConstructL(); |
|
223 |
||
224 |
return self; |
|
225 |
} |
|
226 |
||
227 |
// --------------------------------------------------------------------------- |
|
228 |
// C++ destructor |
|
229 |
// --------------------------------------------------------------------------- |
|
230 |
// |
|
231 |
CPeninputLafDataFSQ::~CPeninputLafDataFSQ() |
|
232 |
{ |
|
233 |
DestoryDataCommon(); |
|
234 |
} |
|
235 |
||
236 |
// --------------------------------------------------------------------------- |
|
237 |
// Read all laf data |
|
238 |
// --------------------------------------------------------------------------- |
|
239 |
// |
|
240 |
void CPeninputLafDataFSQ::ReadLafInfoL() |
|
241 |
{ |
|
242 |
// clean up all the data |
|
243 |
iLayoutDataInfo.ResetAndDestroy(); |
|
244 |
||
245 |
CPeninputQwtLayoutDataInfo* info = NULL; |
|
246 |
||
247 |
//ELayout10x3 |
|
248 |
info = ReadLC( ELayout10x3, 3, 10 ); |
|
249 |
iLayoutDataInfo.AppendL( info ); |
|
250 |
CleanupStack::Pop( info ); |
|
251 |
||
252 |
//ELayout11x3 |
|
253 |
info = ReadLC( ELayout11x3, 3, 11 ); |
|
254 |
iLayoutDataInfo.AppendL( info ); |
|
255 |
CleanupStack::Pop( info ); |
|
256 |
||
257 |
//ELayout11x4 |
|
258 |
info = ReadLC( ELayout11x4, 4, 11 ); |
|
259 |
iLayoutDataInfo.AppendL( info ); |
|
260 |
CleanupStack::Pop( info ); |
|
261 |
} |
|
262 |
||
263 |
// --------------------------------------------------------------------------- |
|
264 |
// C++ constructor |
|
265 |
// --------------------------------------------------------------------------- |
|
266 |
// |
|
267 |
CPeninputLafDataFSQ::CPeninputLafDataFSQ( TInt aLayoutType ) |
|
268 |
{ |
|
269 |
SetLayoutType( aLayoutType ); |
|
270 |
} |
|
271 |
||
272 |
// --------------------------------------------------------------------------- |
|
273 |
// Read laf data |
|
274 |
// --------------------------------------------------------------------------- |
|
275 |
// |
|
276 |
CPeninputQwtLayoutDataInfo* CPeninputLafDataFSQ::ReadLC( const TInt aLayoutType, |
|
277 |
const TInt aRows, |
|
278 |
const TInt aCols ) |
|
279 |
{ |
|
280 |
//variety v1, value 0/1 = 10cols/11cols, applay to: |
|
281 |
// grid_vkbss_keypad_pane |
|
282 |
// aid_vkbss_key_offset |
|
283 |
TInt v1 = ( aCols == 10 ) ? 0 : 1; |
|
284 |
||
285 |
//variety v2, value 0/1/2/3 = 10x3/10x4/11x3/11x4, applay to: |
|
286 |
// cell_vkbss_key_pane |
|
287 |
// bg_cell_vkbss_key_g1 |
|
288 |
// cell_vkbss_key_t1 |
|
289 |
// cell_vkbss_key_g1 |
|
290 |
// cell_vkbss_key_3p_pane |
|
291 |
TInt v2 = 0; |
|
292 |
switch ( aLayoutType ) |
|
293 |
{ |
|
294 |
case ELayout10x3: v2 = 0; break; |
|
295 |
case ELayout11x3: v2 = 2; break; |
|
296 |
case ELayout11x4: v2 = 3; break; |
|
297 |
default: v2 = 0; |
|
298 |
} |
|
299 |
||
300 |
CPeninputQwtLayoutDataInfo* data = new( ELeave ) CPeninputQwtLayoutDataInfo; |
|
301 |
CleanupStack::PushL( data ); |
|
302 |
||
303 |
TAknWindowLineLayout linelayout, linelayoutInner; |
|
304 |
TAknLayoutRect layoutrect, layoutInnerect; |
|
305 |
||
306 |
TAknLayoutRect keypadRect, keypaneRect, keycellRect, keylabelRect; |
|
307 |
TAknLayoutRect pic3paneRect; |
|
308 |
||
309 |
TAknTextLineLayout keyText; |
|
310 |
||
311 |
TRect rectAppWin, rectMainWin; |
|
312 |
TPoint base; |
|
313 |
TInt pic3pLeftWidth, pic3pRightWidth; |
|
314 |
||
315 |
linelayout = AknLayoutScalable_Avkon::application_window(0).LayoutLine(); |
|
316 |
rectAppWin = linelayout.Rect(); |
|
317 |
||
318 |
linelayout = AknLayoutScalable_Avkon::popup_fep_vkbss_window(0).LayoutLine(); |
|
319 |
layoutrect.LayoutRect( rectAppWin, linelayout ); |
|
320 |
rectMainWin = layoutrect.Rect(); |
|
321 |
||
322 |
linelayout = AknLayoutScalable_Avkon::grid_vkbss_keypad_pane(v1).LayoutLine(); |
|
323 |
keypadRect.LayoutRect( rectMainWin, linelayout ); |
|
324 |
||
325 |
linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_pane(v2).LayoutLine(); |
|
326 |
keypaneRect.LayoutRect( keypadRect.Rect(), linelayout ); |
|
327 |
||
328 |
linelayout = AknLayoutScalable_Avkon::bg_cell_vkbss_key_g1(v2).LayoutLine(); |
|
329 |
keycellRect.LayoutRect( keypaneRect.Rect(), linelayout ); |
|
330 |
||
331 |
keyText = AknLayoutScalable_Avkon::cell_vkbss_key_t1(v2).LayoutLine(); |
|
332 |
keyText.iB += 3; |
|
333 |
||
334 |
linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_g1(v2).LayoutLine(); |
|
335 |
keylabelRect.LayoutRect( keypaneRect.Rect(), linelayout ); |
|
336 |
||
337 |
linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_3p_pane(v2).LayoutLine(); |
|
338 |
pic3paneRect.LayoutRect( keypaneRect.Rect(), linelayout ); |
|
339 |
||
340 |
linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_3p_pane_g1(0).LayoutLine(); |
|
341 |
layoutrect.LayoutRect( pic3paneRect.Rect(), linelayout ); |
|
342 |
pic3pLeftWidth = layoutrect.Rect().Width(); |
|
343 |
||
344 |
linelayout = AknLayoutScalable_Avkon::cell_vkbss_key_3p_pane_g3(0).LayoutLine(); |
|
345 |
layoutrect.LayoutRect( pic3paneRect.Rect(), linelayout ); |
|
346 |
pic3pRightWidth = layoutrect.Rect().Width(); |
|
347 |
||
348 |
base = rectMainWin.iTl; |
|
349 |
||
350 |
data->iClientRect = RelativeRect( rectMainWin, base ); |
|
351 |
data->iQwtRect = rectMainWin; //screen coord-sys ? |
|
352 |
||
353 |
TRect rectOfKeypad = RelativeRect( keypadRect.Rect(), base ); |
|
354 |
TRect rectOfButtons = rectOfKeypad; |
|
46
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
355 |
|
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
356 |
TInt rowNumberOfKeyboard; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
357 |
TInt gapValue; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
358 |
switch ( aLayoutType ) |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
359 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
360 |
case ELayout10x3: |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
361 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
362 |
rowNumberOfKeyboard = 3; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
363 |
break; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
364 |
} |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
365 |
case ELayout11x3: |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
366 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
367 |
rowNumberOfKeyboard = 3; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
368 |
break; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
369 |
} |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
370 |
case ELayout11x4: |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
371 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
372 |
rowNumberOfKeyboard = 4; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
373 |
break; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
374 |
} |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
375 |
default: |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
376 |
{ |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
377 |
rowNumberOfKeyboard = 3; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
378 |
break; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
379 |
} |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
380 |
} |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
381 |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
382 |
// Compute the gap between first row key's top line and keyboard's top line |
46
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
383 |
gapValue = keypaneRect.Rect().iTl.iY - keypadRect.Rect().iTl.iY; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
384 |
// Compute function button's top left Y coordinate |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
385 |
rectOfButtons.iTl.iY = rectOfButtons.iTl.iY + |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
386 |
keypaneRect.Rect().Height() * rowNumberOfKeyboard + gapValue; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
387 |
|
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
388 |
// Compute keyboard position |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
389 |
rectOfKeypad.iBr.iY = rectOfKeypad.iTl.iY + |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
390 |
keypaneRect.Rect().Height() * rowNumberOfKeyboard + gapValue; |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
391 |
rectOfKeypad.iTl.iY += gapValue; |
44 | 392 |
|
393 |
//keypad |
|
394 |
data->iKeypad.iKaypadRect = rectOfKeypad; |
|
395 |
data->iKeypad.iTextLayout = keyText; |
|
396 |
data->iKeypad.iFont = AknLayoutUtils::FontFromId( keyText.iFont, NULL ); |
|
397 |
||
398 |
//all template rects are relative to TL of keypad |
|
399 |
TRect rectXPane = RelativeRect( keypaneRect.Rect(), base ); |
|
400 |
TRect rectXBorder = RelativeRect( keycellRect.Rect(), base ); |
|
401 |
TRect rectXInner = RelativeRect( keylabelRect.Rect(), base ); |
|
402 |
||
403 |
rectXPane.Move( - rectOfKeypad.iTl ); //translate to keypad coord-sys |
|
404 |
rectXBorder.Move( - rectOfKeypad.iTl ); |
|
405 |
rectXInner.Move( - rectOfKeypad.iTl ); |
|
406 |
||
407 |
for ( TInt i = 0; i < aRows; i++ ) |
|
408 |
{ |
|
409 |
for ( TInt j = 0; j < aCols; j++ ) |
|
410 |
{ |
|
411 |
TRect bound = rectXPane; |
|
412 |
bound.Move( j * rectXPane.Width(), i * rectXPane.Height() ); |
|
413 |
||
414 |
data->iKeypad.iRects.AppendL( bound ); |
|
415 |
||
416 |
TRect inner = rectXPane; |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
417 |
inner.Move( j * rectXPane.Width(), i * rectXPane.Height() ); |
44 | 418 |
|
419 |
TAknLayoutText keyTextLayout; |
|
420 |
keyTextLayout.LayoutText( inner, keyText ); |
|
421 |
data->iKeypad.iCharRects.AppendL( keyTextLayout.TextRect() ); |
|
422 |
} |
|
423 |
} |
|
424 |
||
425 |
//buttons |
|
426 |
||
427 |
//all template rects are relative to TL of buttons row |
|
428 |
rectXPane = keypaneRect.Rect(); |
|
46
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
429 |
// The key rect without gap |
bd83ceabce89
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
430 |
rectXBorder = RelativeRect( keypaneRect.Rect(), rectXPane.iTl ); |
44 | 431 |
rectXInner = RelativeRect( keylabelRect.Rect(), rectXPane.iTl ); |
432 |
TRect rect3PicPane = RelativeRect( pic3paneRect.Rect(), rectXPane.iTl ); |
|
433 |
rectXPane.Move( - rectXPane.iTl ); |
|
434 |
||
435 |
TInt spaceBtnWidth = rectOfButtons.Width() - rectXPane.Width() * 8; |
|
436 |
TInt dx = rectOfButtons.iTl.iX; |
|
437 |
TInt dy = rectOfButtons.iTl.iY; |
|
438 |
||
439 |
data->iCloseButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
440 |
data->iCloseButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
441 |
dx += rectXPane.Width(); |
|
442 |
||
443 |
data->iShiftButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
444 |
data->iShiftButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
445 |
dx += rectXPane.Width(); |
|
446 |
||
447 |
data->iRangeButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
448 |
data->iRangeButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
449 |
dx += rectXPane.Width(); |
|
450 |
||
451 |
data->iLeftButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
452 |
data->iLeftButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
453 |
dx += rectXPane.Width(); |
|
454 |
||
455 |
TInt expand = spaceBtnWidth - rectXPane.Width(); |
|
456 |
data->iSpaceButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
457 |
data->iSpaceButton.iRect.Resize( expand, 0 ); |
|
458 |
data->iSpaceButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
459 |
data->iSpaceButton.iInnerRect.Resize( expand, 0 ); |
|
460 |
data->iSpaceButtonEx.iIconsFrameRect = OffsetRect( rect3PicPane, dx, dy ); |
|
461 |
data->iSpaceButtonEx.iIconsFrameRect.Resize( expand, 0 ); |
|
462 |
data->iSpaceButtonEx.iMiddleIconRect = data->iSpaceButtonEx.iIconsFrameRect; |
|
463 |
data->iSpaceButtonEx.iMiddleIconRect.iTl.iX += pic3pLeftWidth; |
|
464 |
data->iSpaceButtonEx.iMiddleIconRect.iBr.iX -= pic3pRightWidth; |
|
465 |
dx += spaceBtnWidth; |
|
466 |
||
467 |
data->iRightButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
468 |
data->iRightButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
469 |
dx += rectXPane.Width(); |
|
470 |
||
471 |
data->iOptionButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
472 |
data->iOptionButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
473 |
dx += rectXPane.Width(); |
|
474 |
||
475 |
data->iEnterButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
476 |
data->iEnterButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
477 |
dx += rectXPane.Width(); |
|
478 |
||
479 |
data->iClearButton.iRect = OffsetRect( rectXBorder, dx, dy ); |
|
480 |
data->iClearButton.iInnerRect = OffsetRect( rectXInner, dx, dy ); |
|
481 |
dx += rectXPane.Width(); |
|
482 |
||
483 |
// preview popup window |
|
484 |
keyText = AknLayoutScalable_Avkon::popup_fep_char_preview_window_t1( v2 ).LayoutLine(); |
|
485 |
linelayout = AknLayoutScalable_Avkon::popup_fep_char_preview_window( v2 ).LayoutLine(); |
|
486 |
linelayoutInner = AknLayoutScalable_Avkon::bg_popup_fep_char_preview_window_g9().LayoutLine(); |
|
487 |
||
488 |
layoutrect.LayoutRect( pic3paneRect.Rect(), linelayout ); |
|
489 |
layoutInnerect.LayoutRect( layoutrect.Rect(), linelayoutInner ); |
|
490 |
||
491 |
data->iPreviewWndText = keyText; |
|
492 |
data->iPreviewWndRect = layoutrect.Rect(); |
|
493 |
data->iPreviewWndInnerRect = layoutInnerect.Rect(); |
|
494 |
||
495 |
return data; |
|
496 |
} |
|
497 |
||
498 |
// --------------------------------------------------------------------------- |
|
499 |
// calculate relative rect base on given point |
|
500 |
// --------------------------------------------------------------------------- |
|
501 |
// |
|
502 |
TRect CPeninputLafDataFSQ::RelativeRect( const TRect& aRect, const TPoint& aPoint ) |
|
503 |
{ |
|
504 |
TRect rect = aRect; |
|
505 |
rect.Move( - aPoint.iX, - aPoint.iY ); |
|
506 |
return rect; |
|
507 |
} |
|
508 |
||
509 |
// --------------------------------------------------------------------------- |
|
510 |
// Offset rect |
|
511 |
// --------------------------------------------------------------------------- |
|
512 |
// |
|
513 |
TRect CPeninputLafDataFSQ::OffsetRect( const TRect& aRect, TInt aDx, TInt aDy ) |
|
514 |
{ |
|
515 |
TRect rect = aRect; |
|
516 |
rect.Move( aDx, aDy ); |
|
517 |
return rect; |
|
518 |
} |
|
519 |
||
520 |
||
521 |
// --------------------------------------------------------------------------- |
|
522 |
// Symbian constructor |
|
523 |
// --------------------------------------------------------------------------- |
|
524 |
// |
|
525 |
CPeninputSplitQwertyLafMgr* CPeninputSplitQwertyLafMgr::NewL() |
|
526 |
{ |
|
527 |
CPeninputSplitQwertyLafMgr* self = NewLC(); |
|
528 |
CleanupStack::Pop(self); |
|
529 |
||
530 |
return self; |
|
531 |
} |
|
532 |
||
533 |
// --------------------------------------------------------------------------- |
|
534 |
// Symbian constructor |
|
535 |
// --------------------------------------------------------------------------- |
|
536 |
// |
|
537 |
CPeninputSplitQwertyLafMgr* CPeninputSplitQwertyLafMgr::NewLC() |
|
538 |
{ |
|
539 |
CPeninputSplitQwertyLafMgr* self = new ( ELeave ) CPeninputSplitQwertyLafMgr(); |
|
540 |
CleanupStack::PushL( self ); |
|
541 |
self->ConstructL(); |
|
542 |
||
543 |
return self; |
|
544 |
} |
|
545 |
||
546 |
// --------------------------------------------------------------------------- |
|
547 |
// C++ destructor |
|
548 |
// --------------------------------------------------------------------------- |
|
549 |
// |
|
550 |
CPeninputSplitQwertyLafMgr::~CPeninputSplitQwertyLafMgr() |
|
551 |
{ |
|
552 |
delete iLafData; |
|
553 |
iLafData = NULL; |
|
554 |
} |
|
555 |
||
556 |
// --------------------------------------------------------------------------- |
|
557 |
// Set input mode and reload laf |
|
558 |
// --------------------------------------------------------------------------- |
|
559 |
// |
|
560 |
void CPeninputSplitQwertyLafMgr::SetInputModeL( TPluginInputMode aInputMode ) |
|
561 |
{ |
|
562 |
if ( iInputMode == aInputMode ) |
|
563 |
{ |
|
564 |
return; |
|
565 |
} |
|
566 |
||
567 |
if ( iLafData ) |
|
568 |
{ |
|
569 |
delete iLafData; |
|
570 |
iLafData = NULL; |
|
571 |
} |
|
572 |
||
573 |
if ( aInputMode == EPluginInputModeFSQ ) |
|
574 |
{ |
|
575 |
iLafData = CPeninputLafDataFSQ::NewL( ELayoutNone ); |
|
576 |
} |
|
577 |
else |
|
578 |
{ |
|
579 |
User::Leave( KErrNotSupported ); |
|
580 |
} |
|
581 |
} |
|
582 |
||
583 |
// --------------------------------------------------------------------------- |
|
584 |
// Get current input mode |
|
585 |
// --------------------------------------------------------------------------- |
|
586 |
// |
|
587 |
TPluginInputMode CPeninputSplitQwertyLafMgr::InputMode() const |
|
588 |
{ |
|
589 |
return iInputMode; |
|
590 |
} |
|
591 |
||
592 |
// --------------------------------------------------------------------------- |
|
593 |
// Set layout type |
|
594 |
// --------------------------------------------------------------------------- |
|
595 |
// |
|
596 |
void CPeninputSplitQwertyLafMgr::SetLayoutType( TPeninputQwtLayoutType aLayoutType ) |
|
597 |
{ |
|
598 |
ASSERT( iLafData ); |
|
599 |
if ( iLafData ) |
|
600 |
{ |
|
601 |
iLafData->SetLayoutType( aLayoutType ); |
|
602 |
} |
|
603 |
} |
|
604 |
||
605 |
// --------------------------------------------------------------------------- |
|
606 |
// Get layout type by row and column count |
|
607 |
// --------------------------------------------------------------------------- |
|
608 |
// |
|
609 |
TPeninputQwtLayoutType CPeninputSplitQwertyLafMgr::LayoutTypeFromRowsColumns( |
|
610 |
const TInt aRows, |
|
611 |
const TInt aColumns ) |
|
612 |
{ |
|
613 |
TPeninputQwtLayoutType ret = ELayoutNone; |
|
614 |
||
615 |
if ( aRows == 3 && aColumns == 10 ) |
|
616 |
{ |
|
617 |
ret = ELayout10x3; |
|
618 |
} |
|
619 |
else if ( aRows == 3 && aColumns == 11 ) |
|
620 |
{ |
|
621 |
ret = ELayout11x3; |
|
622 |
} |
|
623 |
else if ( aRows == 4 && aColumns == 11 ) |
|
624 |
{ |
|
625 |
ret = ELayout11x4; |
|
626 |
} |
|
627 |
else |
|
628 |
{ |
|
629 |
ret = ELayoutNone; |
|
630 |
} |
|
631 |
||
632 |
return ret; |
|
633 |
} |
|
634 |
||
635 |
// --------------------------------------------------------------------------- |
|
636 |
// Set option ( and reload laf ) |
|
637 |
// --------------------------------------------------------------------------- |
|
638 |
// |
|
639 |
void CPeninputSplitQwertyLafMgr::SetLafOption( TPeninputVkbLafOption aOption ) |
|
640 |
{ |
|
641 |
if ( iLafData->LafOption() == aOption ) |
|
642 |
{ |
|
643 |
return; |
|
644 |
} |
|
645 |
||
646 |
iLafData->SetLafOption( aOption ); |
|
647 |
TRAP_IGNORE( iLafData->ConstructL() ); |
|
648 |
} |
|
649 |
||
650 |
// --------------------------------------------------------------------------- |
|
651 |
// Get current option |
|
652 |
// --------------------------------------------------------------------------- |
|
653 |
// |
|
654 |
TPeninputVkbLafOption CPeninputSplitQwertyLafMgr::OptionType() const |
|
655 |
{ |
|
656 |
return iLafData->LafOption(); |
|
657 |
} |
|
658 |
||
659 |
// --------------------------------------------------------------------------- |
|
660 |
// Check whether laf data is valid or not |
|
661 |
// --------------------------------------------------------------------------- |
|
662 |
// |
|
663 |
TBool CPeninputSplitQwertyLafMgr::IsValid() |
|
664 |
{ |
|
665 |
if ( !iLafData ) |
|
666 |
{ |
|
667 |
return EFalse; |
|
668 |
} |
|
669 |
||
670 |
return iLafData->IsValid(); |
|
671 |
} |
|
672 |
||
673 |
// --------------------------------------------------------------------------- |
|
674 |
// Reload laf data |
|
675 |
// --------------------------------------------------------------------------- |
|
676 |
// |
|
677 |
void CPeninputSplitQwertyLafMgr::UpdateLafDataL() |
|
678 |
{ |
|
679 |
iLafData->ConstructL(); |
|
680 |
} |
|
681 |
||
682 |
// --------------------------------------------------------------------------- |
|
683 |
// Get rect of entire ui, screen coord-sys |
|
684 |
// --------------------------------------------------------------------------- |
|
685 |
// |
|
686 |
const TRect& CPeninputSplitQwertyLafMgr::EntirePaneRect() const |
|
687 |
{ |
|
688 |
ASSERT( iLafData ); |
|
689 |
return iLafData->QwtLayoutData().iQwtRect; |
|
690 |
} |
|
691 |
||
692 |
// --------------------------------------------------------------------------- |
|
693 |
// Get rect of entire ui, client coord-sys |
|
694 |
// --------------------------------------------------------------------------- |
|
695 |
// |
|
696 |
const TRect& CPeninputSplitQwertyLafMgr::ClientRect() const |
|
697 |
{ |
|
698 |
ASSERT( iLafData ); |
|
699 |
return iLafData->QwtLayoutData().iClientRect; |
|
700 |
} |
|
701 |
||
702 |
// --------------------------------------------------------------------------- |
|
703 |
// Get rect of button ctrl |
|
704 |
// --------------------------------------------------------------------------- |
|
705 |
// |
|
706 |
void CPeninputSplitQwertyLafMgr::GetButtonRect( TPeninputCommonCtrlID aButtonID, |
|
707 |
TRect& aOutterRect, |
|
708 |
TRect& aInnerRect ) |
|
709 |
{ |
|
710 |
ASSERT( iLafData ); |
|
711 |
const TPeninputButtonLayoutData& data = iLafData->ButtonLayoutData( aButtonID ); |
|
712 |
aOutterRect = data.iRect; |
|
713 |
aInnerRect = data.iInnerRect; |
|
714 |
} |
|
715 |
||
716 |
||
717 |
// --------------------------------------------------------------------------- |
|
718 |
// Get rect of virtual keypad ctrl |
|
719 |
// --------------------------------------------------------------------------- |
|
720 |
// |
|
721 |
const TRect& CPeninputSplitQwertyLafMgr::KeypadRect() const |
|
722 |
{ |
|
723 |
ASSERT( iLafData ); |
|
724 |
const TPeninputKeyLayoutData& data = iLafData->KeypadLayoutData(); |
|
725 |
return data.iKaypadRect; |
|
726 |
} |
|
727 |
||
728 |
// --------------------------------------------------------------------------- |
|
729 |
// Get rect of virtual key ctrl |
|
730 |
// --------------------------------------------------------------------------- |
|
731 |
// |
|
732 |
void CPeninputSplitQwertyLafMgr::GetKeyRect( TInt aCol, TInt aRow, |
|
733 |
TRect& aKeyRect, |
|
734 |
TRect& aCharRect ) const |
|
735 |
{ |
|
736 |
ASSERT(iLafData); |
|
737 |
TInt colNum = 0; |
|
738 |
TInt index = 0; |
|
739 |
switch( iLafData->LayoutType() ) |
|
740 |
{ |
|
741 |
case ELayout10x3: |
|
742 |
{ |
|
743 |
colNum = 10; |
|
744 |
} |
|
745 |
break; |
|
746 |
case ELayout11x3: |
|
747 |
{ |
|
748 |
colNum = 11; |
|
749 |
} |
|
750 |
break; |
|
751 |
case ELayout11x4: |
|
752 |
{ |
|
753 |
colNum = 11; |
|
754 |
} |
|
755 |
break; |
|
756 |
} |
|
757 |
index = aRow * colNum + aCol; |
|
758 |
aKeyRect = iLafData->KeypadLayoutData().iRects[index]; |
|
759 |
aCharRect = iLafData->KeypadLayoutData().iCharRects[index]; |
|
760 |
} |
|
761 |
||
762 |
// --------------------------------------------------------------------------- |
|
763 |
// Get text font of virtual keypad ctrl |
|
764 |
// --------------------------------------------------------------------------- |
|
765 |
// |
|
766 |
const CFont* CPeninputSplitQwertyLafMgr::KeyTextFont() const |
|
767 |
{ |
|
768 |
ASSERT( iLafData ); |
|
769 |
return iLafData->KeypadLayoutData().iFont; |
|
770 |
} |
|
771 |
||
772 |
// --------------------------------------------------------------------------- |
|
773 |
// Get text layout of virtual keypad ctrl |
|
774 |
// --------------------------------------------------------------------------- |
|
775 |
// |
|
776 |
TAknTextLineLayout CPeninputSplitQwertyLafMgr::KeyTextLayout() const |
|
777 |
{ |
|
778 |
ASSERT( iLafData ); |
|
779 |
return iLafData->KeypadLayoutData().iTextLayout; |
|
780 |
} |
|
781 |
||
782 |
// --------------------------------------------------------------------------- |
|
783 |
// Get rect of preview bubble ctrl |
|
784 |
// --------------------------------------------------------------------------- |
|
785 |
// |
|
786 |
void CPeninputSplitQwertyLafMgr::GetPreviewWndRect( TRect& aOutRect, |
|
787 |
TRect& aInnerRect ) const |
|
788 |
{ |
|
789 |
aOutRect = iLafData->QwtLayoutData().iPreviewWndRect; |
|
790 |
aInnerRect = iLafData->QwtLayoutData().iPreviewWndInnerRect; |
|
791 |
} |
|
792 |
||
793 |
// --------------------------------------------------------------------------- |
|
794 |
// Get text layout of preview bubble |
|
795 |
// --------------------------------------------------------------------------- |
|
796 |
// |
|
797 |
TAknTextLineLayout CPeninputSplitQwertyLafMgr::PreviewWndText() const |
|
798 |
{ |
|
799 |
return iLafData->QwtLayoutData().iPreviewWndText; |
|
800 |
} |
|
801 |
||
802 |
// --------------------------------------------------------------------------- |
|
803 |
// Get 3-pieces info of space button |
|
804 |
// --------------------------------------------------------------------------- |
|
805 |
// |
|
806 |
void CPeninputSplitQwertyLafMgr::GetSpaceButtonExLayoutInfo( TRect& aIconsFrameRect, |
|
807 |
TRect& aMiddleIconRect ) const |
|
808 |
{ |
|
809 |
ASSERT( iLafData ); |
|
810 |
aIconsFrameRect = iLafData->QwtLayoutData().iSpaceButtonEx.iIconsFrameRect; |
|
811 |
aMiddleIconRect = iLafData->QwtLayoutData().iSpaceButtonEx.iMiddleIconRect; |
|
812 |
} |
|
813 |
||
814 |
// --------------------------------------------------------------------------- |
|
815 |
// C++ constructor |
|
816 |
// --------------------------------------------------------------------------- |
|
817 |
// |
|
818 |
CPeninputSplitQwertyLafMgr::CPeninputSplitQwertyLafMgr() |
|
819 |
: iInputMode(EPluginInputModeNone) |
|
820 |
{ |
|
821 |
} |
|
822 |
||
823 |
// --------------------------------------------------------------------------- |
|
824 |
// CPeninputSplitQwertyLafMgr::ConstructL |
|
825 |
// (other items were commented in a header) |
|
826 |
// --------------------------------------------------------------------------- |
|
827 |
// |
|
828 |
void CPeninputSplitQwertyLafMgr::ConstructL() |
|
829 |
{ |
|
830 |
} |
|
831 |
// End Of File |