|
1 /* |
|
2 * Copyright (c) 2009 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: Implementation of char range selector. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE |
|
19 #include <peninputfingerhwrcn.rsg> |
|
20 |
|
21 #include <coemain.h> |
|
22 #include <S32MEM.h> |
|
23 |
|
24 #include <aknlayoutscalable_apps.cdl.h> |
|
25 #include <aknLayoutscalable_avkon.cdl.h> |
|
26 #include <AknLayoutDef.h> |
|
27 #include <AknUtils.h> |
|
28 #include <AknsUtils.h> |
|
29 #include <akniconutils.h> |
|
30 #include <aknfeppeninputenums.h> |
|
31 #include <AknFepGlobalEnums.h> |
|
32 |
|
33 #include <peninputlayout.h> |
|
34 #include <peninputrepeatbutton.h> |
|
35 #include <peninputmultiimagebutton.h> |
|
36 |
|
37 #include "peninputfingerhwrevent.h" |
|
38 #include "peninputfingerhwrcontrolid.h" |
|
39 #include "peninputfingerhwrstoreconstants.h" |
|
40 |
|
41 #include "peninputfingerhwrrangeselector.h" |
|
42 |
|
43 |
|
44 //CONST DEFINATION |
|
45 const TInt KButtonInnerPadding = 6; |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // Symbian Constructor |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CPeninputFingerHwrRangeSelector* CPeninputFingerHwrRangeSelector::NewL( |
|
52 CFepUiLayout* aUiLayout, TInt aId ) |
|
53 { |
|
54 CPeninputFingerHwrRangeSelector* self = CPeninputFingerHwrRangeSelector::NewLC( |
|
55 aUiLayout, aId ); |
|
56 |
|
57 CleanupStack::Pop( self ); // self; |
|
58 return self; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Symbian Constructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CPeninputFingerHwrRangeSelector* CPeninputFingerHwrRangeSelector::NewLC( |
|
66 CFepUiLayout* aUiLayout, TInt aId ) |
|
67 { |
|
68 CPeninputFingerHwrRangeSelector* self = new (ELeave) CPeninputFingerHwrRangeSelector( |
|
69 aUiLayout, aId ); |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL(); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // c++ destructor |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CPeninputFingerHwrRangeSelector::~CPeninputFingerHwrRangeSelector() |
|
80 { |
|
81 iRangeChBtn = NULL; |
|
82 iRangeEnBtn = NULL; |
|
83 iRangeNumBtn = NULL; |
|
84 |
|
85 iRangeChMiBtn = NULL; |
|
86 iRangeEnMiBtn = NULL; |
|
87 iRangeNumMiBtn = NULL; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // popup the list. |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CPeninputFingerHwrRangeSelector::Popup( TInt aDirect ) |
|
95 { |
|
96 CapturePointer( ETrue ); |
|
97 iPopupVisible = ETrue; |
|
98 LayoutRangeButtons( iPermittedRanges, iCurRange, |
|
99 iCurRangeActive, ETrue, aDirect ); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // cancel the popup. |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 void CPeninputFingerHwrRangeSelector::CancelPopup() |
|
107 { |
|
108 TRect extendRect = Rect(); |
|
109 LayoutRangeButtons( iPermittedRanges, iCurRange, |
|
110 iCurRangeActive, EFalse, EPopDirAuto ); |
|
111 CapturePointer( EFalse ); |
|
112 iPopupVisible = EFalse; |
|
113 |
|
114 //todo: fix ESXU-7UCC9S, 2 lines |
|
115 RootControl()->Draw(); |
|
116 UpdateArea( extendRect, EFalse ); |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // get visibility of popup. |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 TBool CPeninputFingerHwrRangeSelector::IsPopup() |
|
124 { |
|
125 return iPopupVisible; |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // set permitted char range. |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 void CPeninputFingerHwrRangeSelector::SetPermittedRanges( const TInt aPermittedRanges ) |
|
133 { |
|
134 iPermittedRanges = aPermittedRanges; |
|
135 |
|
136 if ( IsPopup() ) |
|
137 { |
|
138 CancelPopup(); |
|
139 } |
|
140 |
|
141 LayoutRangeButtons( iPermittedRanges, iCurRange, iCurRangeActive, |
|
142 EFalse, EPopDirAuto ); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // set current char range. |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 void CPeninputFingerHwrRangeSelector::SetCurRange( const TInt aCurRange, |
|
150 const TBool aActive ) |
|
151 { |
|
152 iCurRange = aCurRange; |
|
153 iCurRangeActive = aActive; |
|
154 |
|
155 if ( IsPopup() ) |
|
156 { |
|
157 CancelPopup(); |
|
158 } |
|
159 |
|
160 LayoutRangeButtons( iPermittedRanges, iCurRange, iCurRangeActive, |
|
161 EFalse, EPopDirAuto ); |
|
162 |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // set base rect of popup. |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 void CPeninputFingerHwrRangeSelector::SetBaseRect( const TRect& aRect ) |
|
170 { |
|
171 iPopupBaseRect = aRect; |
|
172 |
|
173 LayoutRangeButtons( iPermittedRanges, iCurRange, |
|
174 iCurRangeActive, iPopupVisible, EPopDirAuto ); |
|
175 |
|
176 UpdateArea( Rect(), EFalse ); |
|
177 } |
|
178 |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // Handle pointer down event. |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 CFepUiBaseCtrl* CPeninputFingerHwrRangeSelector::HandlePointerDownEventL( |
|
185 const TPoint& aPoint ) |
|
186 { |
|
187 CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerDownEventL( aPoint ); |
|
188 |
|
189 if ( !ctrl ) |
|
190 { |
|
191 if ( IsPopup() ) |
|
192 { |
|
193 CancelPopup(); |
|
194 } |
|
195 } |
|
196 |
|
197 return ctrl; |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // Handle pointer up event. |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 CFepUiBaseCtrl* CPeninputFingerHwrRangeSelector::HandlePointerUpEventL( |
|
205 const TPoint& aPoint ) |
|
206 { |
|
207 CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerUpEventL( aPoint ); |
|
208 |
|
209 iRangeChBtn->CancelPointerDownL(); |
|
210 iRangeEnBtn->CancelPointerDownL(); |
|
211 iRangeNumBtn->CancelPointerDownL(); |
|
212 |
|
213 return ctrl; |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // Handle pointer move event. |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 CFepUiBaseCtrl* CPeninputFingerHwrRangeSelector::HandlePointerMoveEventL( |
|
221 const TPoint& /*aPoint*/ ) |
|
222 { |
|
223 //bypass |
|
224 return NULL; |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // C++ constructor. |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 CPeninputFingerHwrRangeSelector::CPeninputFingerHwrRangeSelector( |
|
232 CFepUiLayout* aFepUiLayout, TInt aControlId ) |
|
233 : CControlGroup( aFepUiLayout, aControlId ) |
|
234 { |
|
235 |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------------------------- |
|
239 // Symbian second-phase constructor. |
|
240 // --------------------------------------------------------------------------- |
|
241 // |
|
242 void CPeninputFingerHwrRangeSelector::ConstructL() |
|
243 { |
|
244 BaseConstructL(); |
|
245 |
|
246 //disable border |
|
247 SetBorderSize( TSize(0,0) ); |
|
248 |
|
249 //create buttons |
|
250 iRangeChBtn = CreateEventBtnL( EHwrCtrlIdChineseButton, R_AKN_FEP_HWR_RANGE_CHINESE ); |
|
251 iRangeEnBtn = CreateEventBtnL( EHwrCtrlIdEnglishButton, R_AKN_FEP_HWR_RANGE_ENGLISH ); |
|
252 iRangeNumBtn = CreateEventBtnL( EHwrCtrlIdNumberButton, R_AKN_FEP_HWR_RANGE_NUMERIC ); |
|
253 |
|
254 iRangeChMiBtn = CreateMultiBtnL( EHwrCtrlIdChineseMiButton, R_AKN_FEP_HWR_RANGE_CH_MI ); |
|
255 iRangeEnMiBtn = CreateMultiBtnL( EHwrCtrlIdEnglishMiButton, R_AKN_FEP_HWR_RANGE_EN_MI ); |
|
256 iRangeNumMiBtn = CreateMultiBtnL( EHwrCtrlIdNumberMiButton, R_AKN_FEP_HWR_RANGE_NUM_MI ); |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // EventButton creation helper. |
|
261 // --------------------------------------------------------------------------- |
|
262 // |
|
263 CAknFepCtrlEventButton* CPeninputFingerHwrRangeSelector::CreateEventBtnL( |
|
264 TInt aCtrlId, TInt32 aResId, TInt aEvent/*= 0xFFFF*/,TInt aUnicode/*=0*/ ) |
|
265 { |
|
266 CAknFepCtrlEventButton* button = CAknFepCtrlEventButton::NewL( |
|
267 UiLayout(), aCtrlId, aEvent, aUnicode, |
|
268 KAknsIIDQsnFrFunctionButtonNormal, |
|
269 KAknsIIDQsnFrFunctionButtonPressed, |
|
270 KAknsIIDQsnFrFunctionButtonInactive ); |
|
271 |
|
272 button->SetResourceId( aResId ); |
|
273 button->ConstructFromResourceL(); |
|
274 button->AddEventObserver( UiLayout() ); |
|
275 AddControlL( button ); |
|
276 return button; |
|
277 } |
|
278 |
|
279 // --------------------------------------------------------------------------- |
|
280 // MultiImageButton creation helper. |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 CAknFepCtrlMultiImageButton* CPeninputFingerHwrRangeSelector::CreateMultiBtnL( |
|
284 TInt aCtrlId, TInt32 aResId ) |
|
285 { |
|
286 CAknFepCtrlMultiImageButton* button = CAknFepCtrlMultiImageButton::NewL( |
|
287 UiLayout(), aCtrlId, |
|
288 KAknsIIDQsnFrFunctionButtonNormal, |
|
289 KAknsIIDQsnFrFunctionButtonPressed, |
|
290 KAknsIIDQsnFrFunctionButtonInactive ); |
|
291 |
|
292 button->SetResourceId( aResId ); |
|
293 button->ConstructFromResourceL(); |
|
294 button->AddEventObserver( UiLayout() ); |
|
295 AddControlL( button ); |
|
296 return button; |
|
297 } |
|
298 |
|
299 // --------------------------------------------------------------------------- |
|
300 // EventButton layout helper. Move button to specified rect. |
|
301 // --------------------------------------------------------------------------- |
|
302 // |
|
303 void CPeninputFingerHwrRangeSelector::MoveIconButton( CAknFepCtrlEventButton* aButton, |
|
304 const TRect& aRect, TInt aXPadding, TInt aYPadding, TBool aReloadImages ) |
|
305 { |
|
306 if ( !aButton ) |
|
307 { |
|
308 return; |
|
309 } |
|
310 |
|
311 aButton->SetRect( aRect ); |
|
312 TRect rcInner = aRect; |
|
313 if ( rcInner.Width() > rcInner.Height() ) |
|
314 { |
|
315 TInt dx = ( rcInner.Width() - rcInner.Height() ) / 2; |
|
316 rcInner.Move( dx, 0); |
|
317 rcInner.SetWidth( rcInner.Height() ); |
|
318 } |
|
319 else |
|
320 { |
|
321 TInt dy = ( rcInner.Height() - rcInner.Width() ) / 2; |
|
322 rcInner.Move( 0, dy ); |
|
323 rcInner.SetHeight( rcInner.Width() ); |
|
324 } |
|
325 |
|
326 rcInner.Shrink( aXPadding, aYPadding ); |
|
327 aButton->SizeChanged( aRect, rcInner, aReloadImages ); |
|
328 } |
|
329 |
|
330 // --------------------------------------------------------------------------- |
|
331 // MultiIconButton layout helper. Move button to specified rect. |
|
332 // --------------------------------------------------------------------------- |
|
333 // |
|
334 void CPeninputFingerHwrRangeSelector::MoveMultiIconButton( |
|
335 CAknFepCtrlMultiImageButton* aButton, const TRect& aRect, |
|
336 TInt aXPadding, TInt aYPadding, TBool aReloadImages ) |
|
337 { |
|
338 if ( !aButton ) |
|
339 { |
|
340 return; |
|
341 } |
|
342 |
|
343 aButton->SetRect( aRect ); |
|
344 TRect rcInner=aRect; |
|
345 if ( rcInner.Width() > rcInner.Height() ) |
|
346 { |
|
347 TInt dx = ( rcInner.Width() - rcInner.Height() ) / 2; |
|
348 rcInner.Move( dx, 0); |
|
349 rcInner.SetWidth( rcInner.Height() ); |
|
350 } |
|
351 else |
|
352 { |
|
353 TInt dy = ( rcInner.Height() - rcInner.Width() ) / 2; |
|
354 rcInner.Move( 0, dy ); |
|
355 rcInner.SetHeight( rcInner.Width() ); |
|
356 } |
|
357 |
|
358 rcInner.Shrink( aXPadding, aYPadding ); |
|
359 aButton->SizeChanged( aRect, rcInner, aReloadImages ); |
|
360 } |
|
361 |
|
362 // --------------------------------------------------------------------------- |
|
363 // layout buttons. |
|
364 // --------------------------------------------------------------------------- |
|
365 // |
|
366 void CPeninputFingerHwrRangeSelector::LayoutRangeButtons( TInt aPermittedRanges, |
|
367 TInt aCurRange, TBool aActive, TBool aShowDropList, TInt aDropDirect ) |
|
368 { |
|
369 |
|
370 TRect rcBound = UiLayout()->Rect(); |
|
371 TRect rcBase = iPopupBaseRect; |
|
372 TRect rcTarget = rcBase; |
|
373 TInt pdx = KButtonInnerPadding; |
|
374 TInt pdy = KButtonInnerPadding; |
|
375 |
|
376 |
|
377 TInt count = 0; |
|
378 |
|
379 count += aPermittedRanges & ERangeNative ? 1 : 0; |
|
380 count += aPermittedRanges & ERangeEnglish ? 1 : 0; |
|
381 count += aPermittedRanges & ERangeNumber ? 1 : 0; |
|
382 |
|
383 if ( count == 1 || aShowDropList ) |
|
384 { |
|
385 iRangeChMiBtn->Hide( ETrue ); |
|
386 iRangeEnMiBtn->Hide( ETrue ); |
|
387 iRangeNumMiBtn->Hide( ETrue ); |
|
388 } |
|
389 |
|
390 if ( count < 1 ) |
|
391 { |
|
392 return; |
|
393 } |
|
394 |
|
395 if ( count == 1 ) |
|
396 { |
|
397 |
|
398 switch( aCurRange ) |
|
399 { |
|
400 case EFingerHwrNativeRange: |
|
401 { |
|
402 MoveIconButton( iRangeChBtn, rcBase, pdx, pdy, ETrue ); |
|
403 } |
|
404 break; |
|
405 case EFingerHwrEnglishRange: |
|
406 { |
|
407 MoveIconButton( iRangeEnBtn, rcBase, pdx, pdy, ETrue ); |
|
408 } |
|
409 break; |
|
410 case EFingerHwrNumberRange: |
|
411 { |
|
412 MoveIconButton( iRangeNumBtn, rcBase, pdx, pdy, ETrue ); |
|
413 } |
|
414 break; |
|
415 default: |
|
416 break; |
|
417 } |
|
418 iRangeChBtn->Hide( aCurRange != EFingerHwrNativeRange ); |
|
419 iRangeEnBtn->Hide( aCurRange != EFingerHwrEnglishRange ); |
|
420 iRangeNumBtn->Hide( aCurRange != EFingerHwrNumberRange ); |
|
421 |
|
422 SetRect( rcTarget ); |
|
423 |
|
424 iRangeChBtn->SetHighlight( EFalse ); |
|
425 iRangeEnBtn->SetHighlight( EFalse ); |
|
426 iRangeNumBtn->SetHighlight( EFalse ); |
|
427 |
|
428 return; |
|
429 } |
|
430 |
|
431 if ( aShowDropList ) |
|
432 { |
|
433 TRect rcBtn = rcBase; |
|
434 |
|
435 TPoint direct = CalcDropListDirection( rcBound, rcBtn.iTl, |
|
436 rcBtn.Size(), count, aDropDirect ); |
|
437 |
|
438 TInt dx = direct.iX; |
|
439 TInt dy = direct.iY; |
|
440 |
|
441 CalcDropListRect( rcTarget, dx * count, dy * count ); |
|
442 SetRect( rcTarget ); |
|
443 |
|
444 if ( aPermittedRanges & ERangeNative ) |
|
445 { |
|
446 MoveIconButton( iRangeChBtn, rcBtn, pdx, pdy, ETrue ); |
|
447 rcBtn.Move( dx, dy ); |
|
448 } |
|
449 |
|
450 if ( aPermittedRanges & ERangeEnglish ) |
|
451 { |
|
452 MoveIconButton( iRangeEnBtn, rcBtn, pdx, pdy, ETrue ); |
|
453 rcBtn.Move( dx, dy ); |
|
454 } |
|
455 |
|
456 if ( aPermittedRanges & ERangeNumber ) |
|
457 { |
|
458 MoveIconButton( iRangeNumBtn, rcBtn, pdx, pdy, ETrue ); |
|
459 rcBtn.Move( dx, dy ); |
|
460 } |
|
461 |
|
462 iRangeChBtn->Hide( !(aPermittedRanges & ERangeNative) ); |
|
463 iRangeEnBtn->Hide( !(aPermittedRanges & ERangeEnglish) ); |
|
464 iRangeNumBtn->Hide( !(aPermittedRanges & ERangeNumber) ); |
|
465 |
|
466 iRangeChBtn->SetHighlight( aActive && aCurRange == EFingerHwrNativeRange ); |
|
467 iRangeEnBtn->SetHighlight( aActive && aCurRange == EFingerHwrEnglishRange ); |
|
468 iRangeNumBtn->SetHighlight( aActive && aCurRange == EFingerHwrNumberRange ); |
|
469 } |
|
470 else |
|
471 { |
|
472 SetRect( rcTarget ); |
|
473 |
|
474 switch( aCurRange ) |
|
475 { |
|
476 case EFingerHwrNativeRange: |
|
477 { |
|
478 MoveMultiIconButton( iRangeChMiBtn, rcBase, pdx, pdy, ETrue ); |
|
479 } |
|
480 break; |
|
481 case EFingerHwrEnglishRange: |
|
482 { |
|
483 MoveMultiIconButton( iRangeEnMiBtn, rcBase, pdx, pdy, ETrue ); |
|
484 } |
|
485 break; |
|
486 case EFingerHwrNumberRange: |
|
487 { |
|
488 MoveMultiIconButton( iRangeNumMiBtn, rcBase, pdx, pdy, ETrue ); |
|
489 } |
|
490 break; |
|
491 default: |
|
492 break; |
|
493 } |
|
494 iRangeChMiBtn->Hide( aCurRange != EFingerHwrNativeRange ); |
|
495 iRangeEnMiBtn->Hide( aCurRange != EFingerHwrEnglishRange ); |
|
496 iRangeNumMiBtn->Hide( aCurRange != EFingerHwrNumberRange ); |
|
497 |
|
498 iRangeChBtn->Hide( ETrue ); |
|
499 iRangeEnBtn->Hide( ETrue ); |
|
500 iRangeNumBtn->Hide( ETrue ); |
|
501 } |
|
502 } |
|
503 |
|
504 |
|
505 // --------------------------------------------------------------------------- |
|
506 // calculates popup direction. |
|
507 // --------------------------------------------------------------------------- |
|
508 // |
|
509 TPoint CPeninputFingerHwrRangeSelector::CalcDropListDirection( const TRect& aBound, |
|
510 const TPoint& aTarget, const TSize& aItemSize, |
|
511 TInt aItemCount, TInt aDirect ) |
|
512 { |
|
513 TInt dirx = 0; |
|
514 TInt diry = 0; |
|
515 |
|
516 TInt direct = aDirect; |
|
517 if( aDirect == EPopDirAuto ) |
|
518 { |
|
519 //determine pop diretion, in this order: down, up, right, left |
|
520 const TInt minx = aBound.iTl.iX; |
|
521 TInt miny = aBound.iTl.iY; |
|
522 TInt maxy = aBound.iBr.iY; |
|
523 |
|
524 if( aTarget.iY + aItemSize.iHeight * aItemCount <= maxy ) |
|
525 { |
|
526 direct = EPopDirDown; |
|
527 } |
|
528 else if( aTarget.iY - aItemSize.iHeight * ( aItemCount - 1 ) >= miny ) |
|
529 { |
|
530 direct = EPopDirTop; |
|
531 } |
|
532 else if( aTarget.iX + aItemSize.iWidth * aItemCount <= maxy ) |
|
533 { |
|
534 direct = EPopDirRight; |
|
535 } |
|
536 else if( aTarget.iX - aItemSize.iWidth * ( aItemCount - 1 ) >= minx ) |
|
537 { |
|
538 direct = EPopDirLeft; |
|
539 } |
|
540 else |
|
541 { |
|
542 direct = EPopDirDown; |
|
543 } |
|
544 } |
|
545 |
|
546 switch( direct ) |
|
547 { |
|
548 case EPopDirDown: |
|
549 { |
|
550 diry = 1; |
|
551 } |
|
552 break; |
|
553 case EPopDirTop: |
|
554 { |
|
555 diry = -1; |
|
556 } |
|
557 break; |
|
558 case EPopDirRight: |
|
559 { |
|
560 dirx = 1; |
|
561 } |
|
562 break; |
|
563 case EPopDirLeft: |
|
564 { |
|
565 dirx = -1; |
|
566 } |
|
567 break; |
|
568 default: |
|
569 { |
|
570 dirx = 0; |
|
571 diry = 1; |
|
572 } |
|
573 break; |
|
574 } |
|
575 return TPoint( dirx * aItemSize.iWidth, diry * aItemSize.iHeight ); |
|
576 } |
|
577 |
|
578 |
|
579 // --------------------------------------------------------------------------- |
|
580 // calculates popup rect. |
|
581 // --------------------------------------------------------------------------- |
|
582 // |
|
583 void CPeninputFingerHwrRangeSelector::CalcDropListRect( TRect& aRect, |
|
584 const TInt aWidth, const TInt aHeight ) |
|
585 { |
|
586 if ( aWidth > 0 ) |
|
587 { |
|
588 aRect.SetWidth( aWidth ); |
|
589 } |
|
590 else if ( aWidth < 0 ) |
|
591 { |
|
592 aRect.Move( aWidth + aRect.Width(), 0 ); |
|
593 aRect.SetWidth( - aWidth ); |
|
594 } |
|
595 |
|
596 if ( aHeight > 0 ) |
|
597 { |
|
598 aRect.SetHeight( aHeight ); |
|
599 } |
|
600 else if ( aHeight < 0 ) |
|
601 { |
|
602 aRect.Move( 0, aHeight + aRect.Height() ); |
|
603 aRect.SetHeight( - aHeight ); |
|
604 } |
|
605 } |
|
606 // End Of File |