1 /* |
|
2 * Copyright (c) 2002-2004 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: |
|
15 * Provides the CAknFepUICtrlCandidatePane methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
31 #include <uikon/eikdefmacros.h> |
|
32 #endif |
|
33 #include <eiklabel.h> |
|
34 #include <AknsDrawUtils.h> |
|
35 #include <AknBidiTextUtils.h> |
|
36 #include <AknsUtils.h> |
|
37 #include <AknIconUtils.h> |
|
38 |
|
39 #include <aknfepuictrls.mbg> |
|
40 #include "AknFepUiInterfacePanic.h" |
|
41 #include "AknFepUIAvkonCtrlCandidatePane.h" |
|
42 #include "AknFepUIAvkonCtrlCandidateSelected.h" |
|
43 #include "aknfepchineseuidataconv.h" |
|
44 #include "aknfepuilayoutdatamgr.h" |
|
45 |
|
46 |
|
47 #include "data_caging_path_literals.hrh" |
|
48 |
|
49 const TInt CandidateCountLeft = 10; |
|
50 |
|
51 _LIT(KFepUiControlsBitmapFile, "aknfepuictrls.mbm"); |
|
52 |
|
53 CAknFepUICtrlCandidatePane* CAknFepUICtrlCandidatePane::NewL(RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr) |
|
54 { |
|
55 CAknFepUICtrlCandidatePane* self = new(ELeave) CAknFepUICtrlCandidatePane( aLafDataMgr ); |
|
56 CleanupStack::PushL(self); |
|
57 self->ConstructL(aParent); |
|
58 CleanupStack::Pop(); |
|
59 return self; |
|
60 } |
|
61 |
|
62 CAknFepUICtrlCandidatePane::~CAknFepUICtrlCandidatePane() |
|
63 { |
|
64 delete iCandidateSelected; |
|
65 delete iNaviArrowBitmapLeft; |
|
66 delete iNaviArrowBitmapLeftMask; |
|
67 delete iNaviArrowBitmapRight; |
|
68 delete iNaviArrowBitmapRightMask; |
|
69 delete iNaviArrowBitmapUp; |
|
70 delete iNaviArrowBitmapUpMask; |
|
71 delete iNaviArrowBitmapDown; |
|
72 delete iNaviArrowBitmapDownMask; |
|
73 if(iCandidateArray) |
|
74 { |
|
75 iCandidateArray->Reset(); |
|
76 delete iCandidateArray; |
|
77 } |
|
78 iCandidateLabelArray.ResetAndDestroy(); |
|
79 iOrdinalLabelArray.ResetAndDestroy(); |
|
80 iCandidateModeArray.Reset(); |
|
81 iPages.Reset(); |
|
82 } |
|
83 |
|
84 const TDesC& CAknFepUICtrlCandidatePane::TextBuffer() const |
|
85 { |
|
86 return iBuffer; |
|
87 } |
|
88 |
|
89 void CAknFepUICtrlCandidatePane::SetCandidateBuffer(const TDesC& aBuffer) |
|
90 { |
|
91 TInt newLength = aBuffer.Length(); |
|
92 TInt oldLength = iBuffer.Length(); |
|
93 if(newLength > EMaxCandidates) |
|
94 { |
|
95 newLength = EMaxCandidates; |
|
96 } |
|
97 if(newLength - 1 < iSelected) |
|
98 { |
|
99 // as far as the client is concerned, they have removed the character that was selected |
|
100 // therefore we must now hide the selected candidate, although the highlighting |
|
101 // state remains unchanged |
|
102 iCandidateSelected->MakeVisible(EFalse); |
|
103 } |
|
104 else |
|
105 { |
|
106 if(iHighlighted) |
|
107 { |
|
108 // make sure that the candidate is visible, as the selection is now |
|
109 // within a visible range (it might have been hidden last time |
|
110 // the buffer was set) |
|
111 iCandidateSelected->MakeVisible(ETrue); |
|
112 } |
|
113 } |
|
114 |
|
115 TPtrC newText = aBuffer.Left(newLength); |
|
116 TPtr ptr = iBuffer.Des(); |
|
117 if(ptr != newText) |
|
118 { |
|
119 for(TInt i = 0; i < newLength; i++) |
|
120 { |
|
121 TBool valueChanged = ETrue; |
|
122 TPtrC newChar = aBuffer.Mid(i, EOneCandidate); |
|
123 if(i < oldLength) |
|
124 { |
|
125 TPtrC oldChar = iBuffer.Mid(i, EOneCandidate); |
|
126 if(newChar == oldChar) |
|
127 { |
|
128 valueChanged = EFalse; |
|
129 } |
|
130 } |
|
131 // only update and redraw label background if the value has changed |
|
132 if(valueChanged) |
|
133 { |
|
134 // we have already allocated enough memory for this |
|
135 CEikLabel* candidateLabel = iCandidateLabelArray[i]; |
|
136 TRAP_IGNORE(candidateLabel->SetTextL(newChar)); |
|
137 |
|
138 // need to update the character if it is in the current selected candidate |
|
139 if(i == iSelected) |
|
140 { |
|
141 iCandidateSelected->SetText(newChar); |
|
142 iCandidateSelected->SetOrdinal(i + 1); |
|
143 DrawDeferred(); |
|
144 } |
|
145 if(i < iVisibleCount) |
|
146 { |
|
147 // only redraw characters that are visible |
|
148 TRect rect = candidateLabel->Rect(); |
|
149 Window().Invalidate(rect); |
|
150 } |
|
151 } |
|
152 } |
|
153 ptr.Copy(newText); |
|
154 LayoutLabels(); |
|
155 LayoutCandidateSelected(); |
|
156 iVisibleCount = newLength; |
|
157 UpdateLabelVisibility(); |
|
158 } |
|
159 } |
|
160 |
|
161 CDesCArrayFlat* CAknFepUICtrlCandidatePane::CandidateArray(void) |
|
162 { |
|
163 return iCandidateArray; |
|
164 } |
|
165 |
|
166 void CAknFepUICtrlCandidatePane::SetCandidateBuffer(void) |
|
167 { |
|
168 if(iPages.Count() == 0) |
|
169 { |
|
170 return; |
|
171 } |
|
172 TPage curPage = iPages[iCurDisplayPage]; |
|
173 iVisibleCount = curPage.iEndIndex - curPage.iStartIndex + 1; |
|
174 |
|
175 if(iVisibleCount - 1 < iSelected) |
|
176 { |
|
177 iCandidateSelected->MakeVisible(EFalse); |
|
178 } |
|
179 else |
|
180 { |
|
181 if(iHighlighted) |
|
182 { |
|
183 iCandidateSelected->MakeVisible(ETrue); |
|
184 } |
|
185 } |
|
186 |
|
187 TBufC<EPhraseLength> buf; |
|
188 TPtr newText = buf.Des(); |
|
189 |
|
190 for(TInt i = 0; i < iVisibleCount; i ++) |
|
191 { |
|
192 CEikLabel* candidateLabel = iCandidateLabelArray[i]; |
|
193 const TDesC* txtLabel = candidateLabel->Text(); |
|
194 newText = (*iCandidateArray)[curPage.iStartIndex + i]; |
|
195 |
|
196 if((txtLabel->Compare(newText) != 0) ) |
|
197 { |
|
198 // we have already allocated enough memory for this |
|
199 TRAP_IGNORE( candidateLabel->SetTextL(newText)); |
|
200 } |
|
201 |
|
202 // need to update the character if it is in the current selected candidate |
|
203 if(i == iSelected) |
|
204 { |
|
205 iCandidateSelected->SetText(newText); |
|
206 iCandidateSelected->SetOrdinal(i + 1); |
|
207 DrawDeferred(); |
|
208 } |
|
209 if(i < iVisibleCount) |
|
210 { |
|
211 // only redraw labels that are visible |
|
212 TRect rect = candidateLabel->Rect(); |
|
213 Window().Invalidate(rect); |
|
214 } |
|
215 } |
|
216 LayoutLabels(); |
|
217 LayoutCandidateSelected(); |
|
218 DrawDeferred(); |
|
219 UpdateLabelVisibility(); |
|
220 } |
|
221 |
|
222 void CAknFepUICtrlCandidatePane::SetHighlighted(TBool aHighlighted) |
|
223 { |
|
224 if(!COMPARE_BOOLS(iHighlighted, aHighlighted)) |
|
225 { |
|
226 iHighlighted = aHighlighted; |
|
227 iCandidateSelected->MakeVisible(aHighlighted); |
|
228 |
|
229 iCandidateSelected->DrawDeferred(); |
|
230 } |
|
231 } |
|
232 |
|
233 TBool CAknFepUICtrlCandidatePane::Highlighted() const |
|
234 { |
|
235 return iHighlighted; |
|
236 } |
|
237 |
|
238 void CAknFepUICtrlCandidatePane::SetCandidateMode(TInt aIndex, TCandidateMode aMode) |
|
239 { |
|
240 __ASSERT_DEBUG(aIndex < EMaxCandidates, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedSetModeOutsideMaxCandidates)); |
|
241 __ASSERT_DEBUG(aIndex >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedSetModeOutsideMaxCandidates)); |
|
242 |
|
243 TCandidateMode oldMode = iCandidateModeArray[aIndex]; |
|
244 if(oldMode != aMode) |
|
245 { |
|
246 iCandidateModeArray[aIndex] = aMode; |
|
247 if(iSelected == aIndex) |
|
248 { |
|
249 LayoutCandidateSelected(); |
|
250 } |
|
251 // only do drawing if visible |
|
252 if(aIndex < iVisibleCount) |
|
253 { |
|
254 LayoutLabel(aIndex); |
|
255 if(iSelected == aIndex && iHighlighted) |
|
256 { |
|
257 iCandidateSelected->DrawDeferred(); |
|
258 } |
|
259 else |
|
260 { |
|
261 CEikLabel* candidateLabel = iCandidateLabelArray[aIndex]; |
|
262 TRect rect = candidateLabel->Rect(); |
|
263 Window().Invalidate(rect); |
|
264 } |
|
265 } |
|
266 } |
|
267 } |
|
268 |
|
269 CAknFepUICtrlCandidatePane::TCandidateMode CAknFepUICtrlCandidatePane::CandidateMode(TInt aIndex) |
|
270 { |
|
271 return iCandidateModeArray[aIndex]; |
|
272 } |
|
273 |
|
274 TBool CAknFepUICtrlCandidatePane::IsShowHorizontalScrollArrows() const |
|
275 { |
|
276 return EFalse; |
|
277 } |
|
278 |
|
279 void CAknFepUICtrlCandidatePane::ShowHorizontalScrollArrows(TBool /*aValue*/) |
|
280 { |
|
281 // If the state is changed, the arrows will be redrawn in the new state. |
|
282 // if(!COMPARE_BOOLS(iShowHorizontalScrollArrows, aValue)) |
|
283 // { |
|
284 // iShowHorizontalScrollArrows = aValue; |
|
285 // TRect rect = iIndiFepArrowLeft.Rect(); |
|
286 // Window().Invalidate(rect); |
|
287 // rect = iIndiFepArrowRight.Rect(); |
|
288 // Window().Invalidate(rect); |
|
289 // } |
|
290 } |
|
291 |
|
292 void CAknFepUICtrlCandidatePane::ShowUpScrollArrows(TBool aValue) |
|
293 { |
|
294 if (iShowUpScrollArrows != aValue) |
|
295 { |
|
296 iShowUpScrollArrows = aValue; |
|
297 TRect rect = iIndiFepArrowUp.Rect(); |
|
298 Window().Invalidate(rect); |
|
299 } |
|
300 } |
|
301 |
|
302 void CAknFepUICtrlCandidatePane::ShowDownScrollArrows(TBool aValue) |
|
303 { |
|
304 if (iShowDownScrollArrows != aValue) |
|
305 { |
|
306 iShowDownScrollArrows = aValue; |
|
307 TRect rect = iIndiFepArrowDown.Rect(); |
|
308 Window().Invalidate(rect); |
|
309 } |
|
310 |
|
311 } |
|
312 |
|
313 void CAknFepUICtrlCandidatePane::ShowLeftScrollArrows(TBool /*aValue*/) |
|
314 { |
|
315 // if (iShowLeftScrollArrows != aValue) |
|
316 // { |
|
317 // iShowLeftScrollArrows = aValue; |
|
318 // TRect rect = iIndiFepArrowLeft.Rect(); |
|
319 // Window().Invalidate(rect); |
|
320 // } |
|
321 } |
|
322 |
|
323 void CAknFepUICtrlCandidatePane::ShowRightScrollArrows(TBool /*aValue*/) |
|
324 { |
|
325 // if (iShowRightScrollArrows != aValue) |
|
326 // { |
|
327 // iShowRightScrollArrows = aValue; |
|
328 // TRect rect = iIndiFepArrowRight.Rect(); |
|
329 // Window().Invalidate(rect); |
|
330 // } |
|
331 } |
|
332 |
|
333 TBool CAknFepUICtrlCandidatePane::IsShowVerticalScrollArrows() const |
|
334 { |
|
335 return iShowVerticalScrollArrows; |
|
336 } |
|
337 |
|
338 void CAknFepUICtrlCandidatePane::ShowVerticalScrollArrows(TBool aValue) |
|
339 { |
|
340 // If the state is changed, the arrows will be redrawn in the new state. |
|
341 if(!COMPARE_BOOLS(iShowVerticalScrollArrows, aValue)) |
|
342 { |
|
343 iShowVerticalScrollArrows = aValue; |
|
344 TRect rect = iIndiFepArrowUp.Rect(); |
|
345 Window().Invalidate(rect); |
|
346 rect = iIndiFepArrowDown.Rect(); |
|
347 Window().Invalidate(rect); |
|
348 } |
|
349 } |
|
350 |
|
351 void CAknFepUICtrlCandidatePane::ShowCandidateOrdinals(TBool aValue) |
|
352 { |
|
353 if(!COMPARE_BOOLS(iShowCandidateOrdinals, aValue)) |
|
354 { |
|
355 iShowCandidateOrdinals = aValue; |
|
356 iCandidateSelected->ShowOrdinal(aValue); |
|
357 UpdateLabelVisibility(); |
|
358 } |
|
359 } |
|
360 |
|
361 TBool CAknFepUICtrlCandidatePane::IsShowCandidateOrdinals() const |
|
362 { |
|
363 return iShowCandidateOrdinals; |
|
364 } |
|
365 |
|
366 TInt CAknFepUICtrlCandidatePane::VisibleCandidateCount() const |
|
367 { |
|
368 return iVisibleCount; |
|
369 } |
|
370 |
|
371 void CAknFepUICtrlCandidatePane::SetVisibleCandidateCount(TInt aCount) |
|
372 { |
|
373 __ASSERT_DEBUG(aCount > 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicNewVisibleCountExceedsRange)); |
|
374 __ASSERT_DEBUG(aCount <= EMaxCandidates, AknFepUiInterfacePanic(EAknFepUiInterfacePanicNewVisibleCountExceedsRange)); |
|
375 if(iVisibleCount != aCount) |
|
376 { |
|
377 if(aCount - 1 < iSelected) |
|
378 { |
|
379 // automatically move the selection to be at the end of the new |
|
380 // candidate buffer |
|
381 SelectIndex(aCount - 1); // ignore return code |
|
382 } |
|
383 iVisibleCount = aCount; |
|
384 UpdateLabelVisibility(); |
|
385 } |
|
386 } |
|
387 |
|
388 TBool CAknFepUICtrlCandidatePane::SelectFirstPhrase() |
|
389 { |
|
390 if(iVisibleCount >= 1) |
|
391 { |
|
392 return SelectIndex(0,EFalse); |
|
393 } |
|
394 else |
|
395 { |
|
396 return EFalse; |
|
397 } |
|
398 } |
|
399 |
|
400 TBool CAknFepUICtrlCandidatePane::SelectFirst() |
|
401 { |
|
402 if(iBuffer.Length()) |
|
403 { |
|
404 return SelectIndex(0); |
|
405 } |
|
406 else |
|
407 { |
|
408 return EFalse; |
|
409 } |
|
410 } |
|
411 |
|
412 TBool CAknFepUICtrlCandidatePane::SelectLastPhrase() |
|
413 { |
|
414 if(iVisibleCount > 1) |
|
415 { |
|
416 return SelectIndex(iVisibleCount - 1); |
|
417 } |
|
418 else |
|
419 { |
|
420 return EFalse; |
|
421 } |
|
422 } |
|
423 |
|
424 TBool CAknFepUICtrlCandidatePane::SelectLast() |
|
425 { |
|
426 TInt length = iBuffer.Length(); |
|
427 if(length) |
|
428 { |
|
429 TInt index = length < iVisibleCount ? length : iVisibleCount; |
|
430 return SelectIndex(index - 1); |
|
431 } |
|
432 else |
|
433 { |
|
434 return EFalse; |
|
435 } |
|
436 } |
|
437 |
|
438 TBool CAknFepUICtrlCandidatePane::SelectNext() |
|
439 { |
|
440 if(iSelected < iVisibleCount - 1) |
|
441 { |
|
442 return SelectIndex(iSelected + 1); |
|
443 } |
|
444 else |
|
445 { |
|
446 return EFalse; |
|
447 } |
|
448 } |
|
449 |
|
450 TBool CAknFepUICtrlCandidatePane::SelectPrev() |
|
451 { |
|
452 if(iSelected > 0) |
|
453 { |
|
454 return SelectIndex(iSelected - 1); |
|
455 } |
|
456 else |
|
457 { |
|
458 return EFalse; |
|
459 } |
|
460 } |
|
461 |
|
462 TBool CAknFepUICtrlCandidatePane::SelectIndex(TInt aIndex, TBool selected) |
|
463 { |
|
464 if(aIndex + 1 > iVisibleCount || aIndex < 0) |
|
465 { |
|
466 return EFalse; |
|
467 } |
|
468 if(iSelected != aIndex) |
|
469 { |
|
470 if(iSelected + 1 > iVisibleCount && iHighlighted) |
|
471 { |
|
472 // candidate selection is currently hidden, as the current |
|
473 // selection is outside the range of valid candidates, therefore |
|
474 // show it again |
|
475 iCandidateSelected->MakeVisible(ETrue); |
|
476 } |
|
477 iSelected = aIndex; |
|
478 // move and repopulate the selected candidate control |
|
479 const TDesC* txtLabel = iCandidateLabelArray[aIndex]->Text(); |
|
480 iCandidateSelected->SetText(*txtLabel); |
|
481 iCandidateSelected->SetOrdinal(iSelected + 1); |
|
482 |
|
483 LayoutCandidateSelected(); |
|
484 if( selected ) |
|
485 { |
|
486 |
|
487 DrawDeferred(); |
|
488 } |
|
489 |
|
490 } |
|
491 return ETrue; |
|
492 } |
|
493 |
|
494 TInt CAknFepUICtrlCandidatePane::SelectedIndex() const |
|
495 { |
|
496 return iSelected; |
|
497 } |
|
498 |
|
499 TPtrC CAknFepUICtrlCandidatePane::CurrentPhraseCandidate() const |
|
500 { |
|
501 __ASSERT_DEBUG(iSelected >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicCurrentSelectionOutsideVisibleCandidates)); |
|
502 if(iVisibleCount > iSelected) |
|
503 { |
|
504 return *(iCandidateLabelArray[iSelected]->Text()); |
|
505 } |
|
506 else |
|
507 { |
|
508 return TPtrC(); |
|
509 } |
|
510 } |
|
511 |
|
512 TPtrC CAknFepUICtrlCandidatePane::CurrentCandidate() const |
|
513 { |
|
514 __ASSERT_DEBUG(iSelected >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicCurrentSelectionOutsideVisibleCandidates)); |
|
515 if(iBuffer.Length() > iSelected) |
|
516 { |
|
517 return iBuffer.Mid(iSelected, EOneCandidate); |
|
518 } |
|
519 else |
|
520 { |
|
521 return TPtrC(); |
|
522 } |
|
523 } |
|
524 |
|
525 TInt CAknFepUICtrlCandidatePane::LabelTextWidthInPixels( TInt aIndex) |
|
526 { |
|
527 TAknLayoutText layoutText; |
|
528 TAknTextLineLayout candidatePaneLayoutText = |
|
529 CAknFepChineseUIDataConv::AnyToTextLine(iLafDataMgr->RequestData( ECandidatePaneTextLine )); |
|
530 |
|
531 layoutText.LayoutText(Rect(), candidatePaneLayoutText); |
|
532 |
|
533 const CFont* font = layoutText.Font(); |
|
534 |
|
535 TInt labelWidthInPixels = 0; |
|
536 if(font) |
|
537 { |
|
538 const TDesC* txtLabel = iCandidateLabelArray[aIndex]->Text(); |
|
539 if(txtLabel->Length() != 0) |
|
540 { |
|
541 labelWidthInPixels = font->TextWidthInPixels(*txtLabel); |
|
542 } |
|
543 } |
|
544 return labelWidthInPixels; |
|
545 } |
|
546 void CAknFepUICtrlCandidatePane::SetPaneLayout(CAknFepUICtrlContainerChinese::TPaneLayout aPaneLayout) |
|
547 { |
|
548 iPaneLayout = aPaneLayout; |
|
549 } |
|
550 |
|
551 void CAknFepUICtrlCandidatePane::SplitPhraseCandidatesIntoPages() |
|
552 { |
|
553 iPages.Reset(); |
|
554 iUnpagedIndex = 0; |
|
555 |
|
556 InternalSpilitPhraseCandidate(); |
|
557 |
|
558 if( iPages.Count() == 0 ) |
|
559 { |
|
560 iVisibleCount = 0; |
|
561 } |
|
562 else |
|
563 { |
|
564 iCurDisplayPage = 0; |
|
565 SetVisibleCandidateCount(iPages[0].iEndIndex - iPages[0].iStartIndex + 1); |
|
566 } |
|
567 } |
|
568 |
|
569 void CAknFepUICtrlCandidatePane::NextCandidatePage(void) |
|
570 { |
|
571 if(iCurDisplayPage == (iPages.Count() - 1)) |
|
572 { |
|
573 if( iUnpagedIndex < iCandidateArray->Count() ) |
|
574 { |
|
575 //continue page |
|
576 InternalSpilitPhraseCandidate(); |
|
577 iCurDisplayPage++; |
|
578 } |
|
579 else |
|
580 { |
|
581 iCurDisplayPage = 0; |
|
582 } |
|
583 } |
|
584 else |
|
585 { |
|
586 iCurDisplayPage ++; |
|
587 } |
|
588 // For fix bug of when the count of character in the last page is less than |
|
589 // the previous page of the last page. And then select the last character of |
|
590 // the previous page of the last page, and select next page. First of the last |
|
591 // page is not refreshed. |
|
592 iSelected = 0; |
|
593 } |
|
594 |
|
595 void CAknFepUICtrlCandidatePane::PreviousCandidatePage(void) |
|
596 { |
|
597 if(iCurDisplayPage == 0) |
|
598 { |
|
599 iCurDisplayPage = iPages.Count() - 1; |
|
600 } |
|
601 else |
|
602 { |
|
603 iCurDisplayPage --; |
|
604 } |
|
605 } |
|
606 |
|
607 void CAknFepUICtrlCandidatePane::SizeChanged() |
|
608 { |
|
609 LayoutRects(); |
|
610 LayoutContainedControls(); |
|
611 } |
|
612 |
|
613 TInt CAknFepUICtrlCandidatePane::CountComponentControls() const |
|
614 { |
|
615 TInt count = 0; |
|
616 count += iCandidateLabelArray.Count(); |
|
617 count += iOrdinalLabelArray.Count(); |
|
618 |
|
619 CCoeControl* controls[] = |
|
620 { |
|
621 iCandidateSelected |
|
622 } ; |
|
623 |
|
624 for (TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)) ; ii++) |
|
625 { |
|
626 if(controls[ii]) |
|
627 { |
|
628 count++ ; |
|
629 } |
|
630 } |
|
631 return count ; |
|
632 } |
|
633 |
|
634 CCoeControl* CAknFepUICtrlCandidatePane::ComponentControl(TInt aIndex) const |
|
635 { |
|
636 TInt candidateCount = iCandidateLabelArray.Count(); |
|
637 TInt ordinalCount = iOrdinalLabelArray.Count(); |
|
638 |
|
639 if(aIndex < candidateCount) |
|
640 { |
|
641 // because this method is const, the const [] operator is selected |
|
642 // which means that the pointer is const, so have to cast away constness |
|
643 // - a possible alternative is to make the array mutable? |
|
644 return CONST_CAST(CEikLabel*, iCandidateLabelArray[aIndex]); |
|
645 } |
|
646 aIndex -= candidateCount; |
|
647 |
|
648 if(aIndex < ordinalCount) |
|
649 { |
|
650 // because this method is const, the const [] operator is selected |
|
651 // which means that the pointer is const, so have to cast away constness |
|
652 // - a possible alternative is to make the array mutable? |
|
653 return CONST_CAST(CEikLabel*, iOrdinalLabelArray[aIndex]); |
|
654 } |
|
655 aIndex -= ordinalCount; |
|
656 |
|
657 CCoeControl* controls[] = |
|
658 { |
|
659 iCandidateSelected |
|
660 } ; |
|
661 |
|
662 for (TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)) ; ii++) |
|
663 { |
|
664 if (controls[ii] && aIndex-- == 0) |
|
665 { |
|
666 return controls[ii] ; |
|
667 } |
|
668 } |
|
669 // shouldn't be called while no components. |
|
670 return NULL ; |
|
671 } |
|
672 |
|
673 void CAknFepUICtrlCandidatePane::Draw(const TRect& /* aRect */) const |
|
674 { |
|
675 CWindowGc& gc = SystemGc(); |
|
676 |
|
677 if(iShowHorizontalScrollArrows) |
|
678 { |
|
679 if (iShowLeftScrollArrows) |
|
680 { |
|
681 iIndiFepArrowLeft.DrawImage(gc, |
|
682 iNaviArrowBitmapLeft, |
|
683 iNaviArrowBitmapLeftMask); |
|
684 } |
|
685 |
|
686 if (iShowRightScrollArrows) |
|
687 { |
|
688 iIndiFepArrowRight.DrawImage(gc, |
|
689 iNaviArrowBitmapRight, |
|
690 iNaviArrowBitmapRightMask); |
|
691 } |
|
692 } |
|
693 if(iShowVerticalScrollArrows) |
|
694 { |
|
695 if (iShowUpScrollArrows) |
|
696 { |
|
697 iIndiFepArrowUp.DrawImage(gc, |
|
698 iNaviArrowBitmapUp, |
|
699 iNaviArrowBitmapUpMask); |
|
700 } |
|
701 |
|
702 if (iShowDownScrollArrows) |
|
703 { |
|
704 iIndiFepArrowDown.DrawImage(gc, |
|
705 iNaviArrowBitmapDown, |
|
706 iNaviArrowBitmapDownMask); |
|
707 } |
|
708 } |
|
709 } |
|
710 |
|
711 void CAknFepUICtrlCandidatePane::ConstructL(RWindow& aParent) |
|
712 { |
|
713 SetContainerWindowL(aParent); |
|
714 ConstructBitmapsL(); |
|
715 |
|
716 TBuf<EOneCandidate> ordinal; |
|
717 for(TInt i = 0; i < EMaxCandidates; i++) |
|
718 { |
|
719 CEikLabel* candidateLabel = new(ELeave) CEikLabel; |
|
720 CleanupStack::PushL(candidateLabel); |
|
721 candidateLabel->SetContainerWindowL(aParent); |
|
722 candidateLabel->SetBufferReserveLengthL(EPhraseLength); |
|
723 // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack |
|
724 User::LeaveIfError(iCandidateLabelArray.Append(candidateLabel)); |
|
725 CleanupStack::Pop(); // candidateLabel |
|
726 |
|
727 CEikLabel* ordinalLabel = new(ELeave) CEikLabel; |
|
728 CleanupStack::PushL(ordinalLabel); |
|
729 ordinalLabel->SetContainerWindowL(aParent); |
|
730 ordinalLabel->SetBufferReserveLengthL(EOneCandidate); |
|
731 ordinal.Num((i+1)%10); // digits are [1, 2,,, 9, 0] - only want the last digit in the case of 10! |
|
732 ordinalLabel->SetTextL(ordinal); |
|
733 // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack |
|
734 User::LeaveIfError(iOrdinalLabelArray.Append(ordinalLabel)); |
|
735 CleanupStack::Pop(); // ordinalLabel |
|
736 |
|
737 User::LeaveIfError(iCandidateModeArray.Append(ECandidateModeNormal)); |
|
738 } |
|
739 |
|
740 iCandidateSelected = CAknFepUICtrlCandidateSelected::NewL(aParent); |
|
741 iCandidateSelected->MakeVisible(iHighlighted); |
|
742 iCandidateSelected->SetMopParent(this); |
|
743 iCandidateArray = new(ELeave) CDesCArrayFlat(1); |
|
744 } |
|
745 |
|
746 void CAknFepUICtrlCandidatePane::ConstructBitmapsL() |
|
747 { |
|
748 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
749 |
|
750 TFileName bmpFile; |
|
751 bmpFile.Copy(_L("z:")); |
|
752 bmpFile.Append(KDC_BITMAP_DIR); |
|
753 bmpFile.Append(KFepUiControlsBitmapFile); |
|
754 |
|
755 AknsUtils::CreateColorIconL( skin, |
|
756 KAknsIIDQgnIndiFepArrowLeft, |
|
757 KAknsIIDQsnIconColors, |
|
758 EAknsCIQsnIconColorsCG20, |
|
759 iNaviArrowBitmapLeft, |
|
760 iNaviArrowBitmapLeftMask, |
|
761 bmpFile, |
|
762 EMbmAknfepuictrlsQgn_indi_fep_arrow_left, |
|
763 EMbmAknfepuictrlsQgn_indi_fep_arrow_left_mask, |
|
764 AKN_LAF_COLOR( 0 ) |
|
765 ); |
|
766 AknsUtils::CreateColorIconL( skin, |
|
767 KAknsIIDQgnIndiFepArrowRight, |
|
768 KAknsIIDQsnIconColors, |
|
769 EAknsCIQsnIconColorsCG20, |
|
770 iNaviArrowBitmapRight, |
|
771 iNaviArrowBitmapRightMask, |
|
772 bmpFile, |
|
773 EMbmAknfepuictrlsQgn_indi_fep_arrow_right, |
|
774 EMbmAknfepuictrlsQgn_indi_fep_arrow_right_mask, |
|
775 AKN_LAF_COLOR( 0 ) |
|
776 ); |
|
777 |
|
778 AknsUtils::CreateColorIconL( skin, |
|
779 KAknsIIDQgnIndiFepArrowUp, |
|
780 KAknsIIDQsnIconColors, |
|
781 EAknsCIQsnIconColorsCG20, |
|
782 iNaviArrowBitmapUp, |
|
783 iNaviArrowBitmapUpMask, |
|
784 bmpFile, |
|
785 EMbmAknfepuictrlsQgn_indi_fep_arrow_up, |
|
786 EMbmAknfepuictrlsQgn_indi_fep_arrow_up_mask, |
|
787 AKN_LAF_COLOR( 0 ) |
|
788 ); |
|
789 AknsUtils::CreateColorIconL( skin, |
|
790 KAknsIIDQgnIndiFepArrowDown, |
|
791 KAknsIIDQsnIconColors, |
|
792 EAknsCIQsnIconColorsCG20, |
|
793 iNaviArrowBitmapDown, |
|
794 iNaviArrowBitmapDownMask, |
|
795 bmpFile, |
|
796 EMbmAknfepuictrlsQgn_indi_fep_arrow_down, |
|
797 EMbmAknfepuictrlsQgn_indi_fep_arrow_down_mask, |
|
798 AKN_LAF_COLOR( 0 ) |
|
799 ); |
|
800 } |
|
801 |
|
802 CAknFepUICtrlCandidatePane::CAknFepUICtrlCandidatePane(CAknFepUiLayoutDataMgr* aLafDataMgr) |
|
803 : |
|
804 iPaneLayout(CAknFepUICtrlContainerChinese::ELayoutCandidate), |
|
805 iHighlighted(EFalse), |
|
806 iShowHorizontalScrollArrows(EFalse), |
|
807 iShowVerticalScrollArrows(EFalse), |
|
808 iShowUpScrollArrows(ETrue), |
|
809 iShowDownScrollArrows(ETrue), |
|
810 iShowLeftScrollArrows(ETrue), |
|
811 iShowRightScrollArrows(ETrue), |
|
812 iShowCandidateOrdinals(ETrue), |
|
813 iCurDisplayPage(0), |
|
814 iOrdinalLableWidth(0) |
|
815 { |
|
816 iLafDataMgr = aLafDataMgr; |
|
817 } |
|
818 |
|
819 void CAknFepUICtrlCandidatePane::LayoutRects() |
|
820 { |
|
821 TRect rect = Rect(); |
|
822 |
|
823 TAknWindowLineLayout candidateWindowLine1 = |
|
824 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine1)); |
|
825 TAknWindowLineLayout candidateWindowLine2 = |
|
826 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine2)); |
|
827 TAknWindowLineLayout candidateWindowLine3 = |
|
828 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine3)); |
|
829 TAknWindowLineLayout candidateWindowLine4 = |
|
830 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine4)); |
|
831 |
|
832 iIndiFepArrowLeft.LayoutRect(rect, candidateWindowLine1); |
|
833 AknIconUtils::SetSize(iNaviArrowBitmapLeft, iIndiFepArrowLeft.Rect().Size()); |
|
834 |
|
835 iIndiFepArrowRight.LayoutRect(rect, candidateWindowLine2); |
|
836 AknIconUtils::SetSize(iNaviArrowBitmapRight, iIndiFepArrowRight.Rect().Size()); |
|
837 |
|
838 iIndiFepArrowUp.LayoutRect(rect, candidateWindowLine3); |
|
839 AknIconUtils::SetSize(iNaviArrowBitmapUp, iIndiFepArrowUp.Rect().Size()); |
|
840 |
|
841 iIndiFepArrowDown.LayoutRect(rect, candidateWindowLine4); |
|
842 AknIconUtils::SetSize( iNaviArrowBitmapDown, iIndiFepArrowDown.Rect().Size() ); |
|
843 } |
|
844 |
|
845 void CAknFepUICtrlCandidatePane::LayoutContainedControls() |
|
846 { |
|
847 LayoutLabels(); |
|
848 LayoutCandidateSelected(); |
|
849 } |
|
850 |
|
851 void CAknFepUICtrlCandidatePane::LayoutLabel(TInt aIndex) |
|
852 { |
|
853 __ASSERT_DEBUG(aIndex >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount)); |
|
854 __ASSERT_DEBUG(aIndex < iVisibleCount, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount)); |
|
855 TRect rect = Rect(); |
|
856 CEikLabel* candidateLabel = iCandidateLabelArray[aIndex]; |
|
857 CEikLabel* ordinalLabel = iOrdinalLabelArray[aIndex]; |
|
858 TAknWindowLineLayout layoutCandidateItem = |
|
859 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem)); |
|
860 TAknTextLineLayout candidateLayout = |
|
861 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine)); |
|
862 |
|
863 // layout candidate label |
|
864 TAknLayoutRect layoutRectCandidateItem; |
|
865 layoutRectCandidateItem.LayoutRect(rect,layoutCandidateItem); |
|
866 TRect rectCandidateItem = layoutRectCandidateItem.Rect(); |
|
867 |
|
868 if(aIndex > 0) |
|
869 { |
|
870 rectCandidateItem.iTl.iX = iCandidateLabelArray[aIndex - 1]->Rect().iBr.iX; |
|
871 } |
|
872 TAknLayoutText layoutText; |
|
873 layoutText.LayoutText(rectCandidateItem,candidateLayout); |
|
874 TRect rectText = layoutText.TextRect(); |
|
875 rectText.SetWidth(LabelTextWidthInPixels(aIndex)); |
|
876 |
|
877 candidateLabel->SetRect(rectText); |
|
878 candidateLabel->SetFont(layoutText.Font()); |
|
879 |
|
880 // layout ordinal label |
|
881 TAknTextLineLayout ordinalLayout = |
|
882 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout)); |
|
883 TBufC16<1> buf; |
|
884 TAknLayoutText layoutOrdinal; |
|
885 TPtr16 ptr = buf.Des(); |
|
886 ptr = (*(ordinalLabel->Text())).Left(EOneCandidate); |
|
887 |
|
888 layoutOrdinal.LayoutText(rectCandidateItem,ordinalLayout); |
|
889 |
|
890 const CFont* font = layoutOrdinal.Font(); |
|
891 |
|
892 TRect rectOrdinal = layoutOrdinal.TextRect(); |
|
893 // align ordinal label and candidate label |
|
894 |
|
895 /* removed in 2006.03.29 |
|
896 rectOrdinal.iTl.iY = rectText.iTl.iY; |
|
897 rectOrdinal.SetWidth(font->TextWidthInPixels(ptr)); |
|
898 rectOrdinal.SetHeight(font->HeightInPixels()); |
|
899 */ |
|
900 |
|
901 // inserted in 2006.03.29 |
|
902 TPoint ordinalPosition; |
|
903 TInt ordinalWidth = font->TextWidthInPixels(ptr); |
|
904 ordinalPosition.iX = rectText.iTl.iX - ordinalWidth; |
|
905 ordinalPosition.iY = rectText.iTl.iY; |
|
906 |
|
907 rectOrdinal = TRect(ordinalPosition, |
|
908 TPoint(ordinalPosition.iX + rectOrdinal.Width(), |
|
909 ordinalPosition.iY + rectOrdinal.Height())); |
|
910 // end inserting |
|
911 |
|
912 ordinalLabel->SetRect(rectOrdinal); |
|
913 ordinalLabel->SetFont(font); |
|
914 iOrdinalLableWidth = rectOrdinal.Width(); |
|
915 |
|
916 // override colours if skin data present |
|
917 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
918 TRgb candidateLabelTextColor = layoutText.Color(); |
|
919 TRgb ordinalLabelTextColor = layoutOrdinal.Color(); |
|
920 |
|
921 AknsUtils::GetCachedColor(skin, candidateLabelTextColor, |
|
922 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19); |
|
923 |
|
924 AknsUtils::GetCachedColor(skin, ordinalLabelTextColor, |
|
925 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19); |
|
926 |
|
927 TRAP_IGNORE( |
|
928 candidateLabel->OverrideColorL(EColorLabelText, candidateLabelTextColor); |
|
929 ordinalLabel->OverrideColorL(EColorLabelText, ordinalLabelTextColor); |
|
930 ); |
|
931 } |
|
932 |
|
933 void CAknFepUICtrlCandidatePane::LayoutLabels() |
|
934 { |
|
935 for(TInt i = 0; i < iVisibleCount; i++) |
|
936 { |
|
937 LayoutLabel(i); |
|
938 } |
|
939 } |
|
940 |
|
941 void CAknFepUICtrlCandidatePane::LayoutCandidateSelected() |
|
942 { |
|
943 TCandidateMode candidateMode = iCandidateModeArray[iSelected]; |
|
944 iCandidateSelected->SetCandidateMode(candidateMode); |
|
945 iCandidateSelected->SetLayout(iPaneLayout); |
|
946 |
|
947 TRect ordinalRect = iOrdinalLabelArray[iSelected]->Rect(); |
|
948 |
|
949 TAknLayoutRect layoutRect; |
|
950 TAknWindowLineLayout layoutCandidateItem = |
|
951 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem)); |
|
952 layoutRect.LayoutRect(Rect(),layoutCandidateItem); |
|
953 |
|
954 TRect rectLayoutCandidateItem = layoutRect.Rect(); |
|
955 rectLayoutCandidateItem.iTl.iX = ordinalRect.iTl.iX; |
|
956 |
|
957 TAknTextLineLayout candidateLayout = |
|
958 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine)); |
|
959 TAknTextLineLayout ordinalLayout = |
|
960 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout)); |
|
961 rectLayoutCandidateItem.SetWidth(iCandidateLabelArray[iSelected]->Rect().Width() + candidateLayout.il - ordinalLayout.il); |
|
962 |
|
963 rectLayoutCandidateItem.SetHeight(rectLayoutCandidateItem.Height() - 1); |
|
964 |
|
965 iCandidateSelected->SetRect(rectLayoutCandidateItem); |
|
966 } |
|
967 |
|
968 void CAknFepUICtrlCandidatePane::UpdateLabelVisibility() |
|
969 { |
|
970 TInt number = 0; |
|
971 // only show the labels corresponding to candidates that have been set |
|
972 if(iPages.Count() != 0) |
|
973 { |
|
974 number = iPages[iCurDisplayPage].iEndIndex - iPages[iCurDisplayPage].iStartIndex + 1; |
|
975 } |
|
976 else |
|
977 { |
|
978 number = iBuffer.Length(); |
|
979 } |
|
980 |
|
981 if(number > iVisibleCount) |
|
982 { |
|
983 number = iVisibleCount; |
|
984 } |
|
985 for(TInt i = 0; i < EMaxCandidates; i++) |
|
986 { |
|
987 CEikLabel* candidateLabel = iCandidateLabelArray[i]; |
|
988 CEikLabel* ordinalLabel = iOrdinalLabelArray[i]; |
|
989 if(i < number) |
|
990 { |
|
991 candidateLabel->MakeVisible(ETrue); |
|
992 ordinalLabel->MakeVisible(iShowCandidateOrdinals); // only show if needed |
|
993 } |
|
994 else |
|
995 { |
|
996 candidateLabel->MakeVisible(EFalse); |
|
997 ordinalLabel->MakeVisible(EFalse); // don't show it as there is no character to go with it |
|
998 } |
|
999 } |
|
1000 } |
|
1001 |
|
1002 void CAknFepUICtrlCandidatePane::ResetCandidateState() |
|
1003 { |
|
1004 iPages.Reset(); |
|
1005 } |
|
1006 |
|
1007 void CAknFepUICtrlCandidatePane::DrawBackground(const TRect& aRect) const |
|
1008 { |
|
1009 // instead of drawing one blank rectangle over each of the 20 labels, |
|
1010 // just draw one big rectangle covering the entire pane |
|
1011 CWindowGc& gc = SystemGc(); |
|
1012 TRgb background = AKN_LAF_COLOR(0); |
|
1013 gc.SetBrushColor(background); |
|
1014 gc.Clear(aRect); |
|
1015 } |
|
1016 |
|
1017 void CAknFepUICtrlCandidatePane::InternalSpilitPhraseCandidate() |
|
1018 { |
|
1019 //__ASSERT_DEBUG(aStartIndex + aCount <= iCandidateArray->Count()); |
|
1020 |
|
1021 TInt phraseCandidateNum = iCandidateArray->Count(); |
|
1022 if( phraseCandidateNum == iUnpagedIndex ) |
|
1023 { |
|
1024 //nothing need to be paged |
|
1025 return; |
|
1026 } |
|
1027 |
|
1028 TPage curPage; |
|
1029 TInt index = iUnpagedIndex; |
|
1030 CEikLabel* candidateLabel; |
|
1031 |
|
1032 curPage.iStartIndex = index; |
|
1033 curPage.iEndIndex = index; |
|
1034 TInt candidateLeftNum = phraseCandidateNum - index > EMaxCandidates? |
|
1035 EMaxCandidates : phraseCandidateNum - index; |
|
1036 |
|
1037 TAknWindowLineLayout layoutCandidateItem = |
|
1038 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem)); |
|
1039 TAknTextLineLayout candidateLayout = |
|
1040 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine)); |
|
1041 |
|
1042 // avoid accessing layout data member |
|
1043 TAknLayoutRect layoutRect; |
|
1044 layoutRect.LayoutRect(Rect(),layoutCandidateItem); |
|
1045 TRect rectLayoutCandidateItem = layoutRect.Rect(); |
|
1046 |
|
1047 TAknLayoutText layoutText; |
|
1048 layoutText.LayoutText(rectLayoutCandidateItem,candidateLayout); |
|
1049 TRect rectText = layoutText.TextRect(); |
|
1050 |
|
1051 TInt distance = rectText.iTl.iX - rectLayoutCandidateItem.iTl.iX + rectLayoutCandidateItem.iBr.iX - rectText.iBr.iX; |
|
1052 rectLayoutCandidateItem.iTl.iX += distance; |
|
1053 |
|
1054 TInt width = 0; |
|
1055 TInt i = 0; |
|
1056 |
|
1057 const TInt candidateWidth = rectLayoutCandidateItem.Width(); |
|
1058 for ( i = 0; i < candidateLeftNum; i ++ ) |
|
1059 { |
|
1060 // Initialization |
|
1061 candidateLabel = iCandidateLabelArray[i]; |
|
1062 // labelWidth in the font |
|
1063 const CFont* font = layoutText.Font(); |
|
1064 TPtrC newText = (*iCandidateArray)[iUnpagedIndex + i]; |
|
1065 TInt labelWidth = font->TextWidthInPixels( newText ); |
|
1066 if ( labelWidth > candidateWidth ) |
|
1067 { |
|
1068 TBufC<EPhraseLength+10> buf1; |
|
1069 TPtr text( buf1.Des() ); |
|
1070 |
|
1071 AknBidiTextUtils::ConvertToVisualAndClip(newText, text, *font, |
|
1072 candidateWidth, candidateWidth, |
|
1073 AknBidiTextUtils::EImplicit,0xFFFF); |
|
1074 |
|
1075 iCandidateArray->Delete( iUnpagedIndex + i ); |
|
1076 TRAP_IGNORE( |
|
1077 { |
|
1078 iCandidateArray->InsertL( iUnpagedIndex + i, text ); |
|
1079 candidateLabel->SetTextL(text); |
|
1080 }); |
|
1081 |
|
1082 } |
|
1083 else |
|
1084 { |
|
1085 TRAP_IGNORE( candidateLabel->SetTextL(newText)); |
|
1086 width = LabelTextWidthInPixels(i)+ iOrdinalLableWidth; |
|
1087 rectLayoutCandidateItem.iTl.iX += width; |
|
1088 } |
|
1089 if (rectLayoutCandidateItem.iTl.iX >= rectLayoutCandidateItem.iBr.iX) |
|
1090 { |
|
1091 if (index>0) |
|
1092 { |
|
1093 curPage.iEndIndex = index - 1; |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 curPage.iEndIndex = index; |
|
1098 } |
|
1099 |
|
1100 iPages.Append(curPage); |
|
1101 break; |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 index ++; |
|
1106 } |
|
1107 |
|
1108 if( i == EMaxCandidates -1 ) |
|
1109 { |
|
1110 curPage.iEndIndex = index - 1; |
|
1111 iPages.Append(curPage); |
|
1112 break; |
|
1113 } |
|
1114 |
|
1115 } |
|
1116 |
|
1117 if( i >= candidateLeftNum ) |
|
1118 { |
|
1119 curPage.iEndIndex = index - 1; |
|
1120 iPages.Append(curPage); |
|
1121 } |
|
1122 |
|
1123 iUnpagedIndex = index; |
|
1124 } |
|
1125 |
|
1126 TBool CAknFepUICtrlCandidatePane::IsFirstPage() |
|
1127 { |
|
1128 return iCurDisplayPage == 0; |
|
1129 } |
|
1130 |
|
1131 TBool CAknFepUICtrlCandidatePane::IsLastPage() |
|
1132 { |
|
1133 if( iCandidateArray->Count() == iUnpagedIndex ) |
|
1134 { |
|
1135 return iCurDisplayPage == iPages.Count() - 1; |
|
1136 } |
|
1137 return EFalse; |
|
1138 } |
|
1139 |
|
1140 void CAknFepUICtrlCandidatePane::SetInVisiable() |
|
1141 { |
|
1142 for (TInt i = 0; i < EMaxCandidates; i ++) |
|
1143 { |
|
1144 CEikLabel* candidateLabel = iCandidateLabelArray[i]; |
|
1145 CEikLabel* ordinalLabel = iOrdinalLabelArray[i]; |
|
1146 candidateLabel->MakeVisible(EFalse); |
|
1147 ordinalLabel->MakeVisible(EFalse); |
|
1148 } |
|
1149 iCandidateSelected->MakeVisible(EFalse); |
|
1150 } |
|
1151 |
|
1152 TBool CAknFepUICtrlCandidatePane::NeedGetNewCandidatePage() |
|
1153 { |
|
1154 return (iCandidateArray->Count() - iUnpagedIndex < CandidateCountLeft); |
|
1155 |
|
1156 } |
|
1157 |
|
1158 //Bug Fixing for ESSG-7P5CSZ |
|
1159 void CAknFepUICtrlCandidatePane::Enable(TBool aEnable) |
|
1160 { |
|
1161 if (!aEnable) |
|
1162 { |
|
1163 for (TInt i=0; i<iVisibleCount; i++) |
|
1164 { |
|
1165 TRAP_IGNORE(iCandidateLabelArray[i]->SetTextL(KNullDesC)); |
|
1166 } |
|
1167 iCandidateArray->Reset(); |
|
1168 iVisibleCount = 0; |
|
1169 DrawNow(); |
|
1170 } |
|
1171 } |
|
1172 // End of file |
|