21
|
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 definition.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
#ifndef __AKN_FEP_AVKON_CANDIDATE_PANE_H__
|
|
31 |
#define __AKN_FEP_AVKON_CANDIDATE_PANE_H__
|
|
32 |
|
|
33 |
#include <e32std.h>
|
|
34 |
#include <coecntrl.h>
|
|
35 |
|
|
36 |
#include "AknFepUICtrlCandidatePane.h"
|
|
37 |
#include "AknFepUIAvkonCtrlContainerChinese.h"
|
|
38 |
|
|
39 |
class CAknFepUICtrlCandidateSelected;
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Pane which displays the Chinese Candidates.
|
|
43 |
*/
|
|
44 |
NONSHARABLE_CLASS(CAknFepUICtrlCandidatePane) : public CCoeControl, public MAknFepUICtrlCandidatePane
|
|
45 |
{
|
|
46 |
public:
|
|
47 |
/**
|
|
48 |
* first phase construction
|
|
49 |
*/
|
|
50 |
static CAknFepUICtrlCandidatePane* NewL(RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr);
|
|
51 |
/**
|
|
52 |
* destructor
|
|
53 |
*/
|
|
54 |
~CAknFepUICtrlCandidatePane();
|
|
55 |
public:
|
|
56 |
/**
|
|
57 |
* Get a buffer that can be filled with candidate characters,
|
|
58 |
* which will subsequently be displayed.
|
|
59 |
*
|
|
60 |
* @output the text buffer of the Pane
|
|
61 |
*/
|
|
62 |
const TDesC& TextBuffer() const;
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Allows the client to set a descriptor pointer into an existing buffer of
|
|
66 |
* data, avoiding unnecessary copying of data.
|
|
67 |
* <p> Note that if the buffer contains less characters than the current
|
|
68 |
* visible count, then the remaining characters will not be displayed.
|
|
69 |
* <p> Note also that if the current selection falls outside the range
|
|
70 |
* of the size of the new buffer, it will be made not visible.
|
|
71 |
* However, the current highlighted state remains, so if the selection
|
|
72 |
* is set once more to a valid entry (or if the buffer is set to a length that
|
|
73 |
* includes the currently selected position), and the highlight is still enabled,
|
|
74 |
* the highlight will reappear.
|
|
75 |
*
|
|
76 |
* @param aBufferPtr descriptor that contains the candidates for display,
|
|
77 |
* could be a pointer into a subset of a larger descriptor
|
|
78 |
* that contains all the candidates. Note that only the
|
|
79 |
* first EMaxCandidates of aBuffer will be used.
|
|
80 |
* Length must be > 0.
|
|
81 |
*/
|
|
82 |
void SetCandidateBuffer(const TDesC& aBuffer);
|
|
83 |
|
|
84 |
/**
|
|
85 |
* This function sets the highlighted status of the pane for rendering purposes.
|
|
86 |
* If the Pane is highlighted it displays the current selected Candidate,
|
|
87 |
* plus numbers with each of the other Candidates.
|
|
88 |
*
|
|
89 |
* @param aHighlighted ETrue if the highlight is to be set
|
|
90 |
* EFalse if the highlight is to be removed
|
|
91 |
*/
|
|
92 |
void SetHighlighted(TBool aHighlighted);
|
|
93 |
|
|
94 |
/**
|
|
95 |
* This function returns the highlighted status of the Pane.
|
|
96 |
*
|
|
97 |
* @return ETrue if highlight was set
|
|
98 |
* EFalse if highlight was not set
|
|
99 |
*
|
|
100 |
*/
|
|
101 |
TBool Highlighted() const;
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Set the candidate mode for the specified candidate. This is used for
|
|
105 |
* setting the colour of the font for components in stroke mode
|
|
106 |
*
|
|
107 |
* @param aMode the new mode
|
|
108 |
*/
|
|
109 |
void SetCandidateMode(TInt aIndex, TCandidateMode aMode);
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Get the candidate mode for the specified candidate.
|
|
113 |
*
|
|
114 |
* @return aMode the new mode
|
|
115 |
*/
|
|
116 |
TCandidateMode CandidateMode(TInt aIndex);
|
|
117 |
|
|
118 |
/**
|
|
119 |
* are the Horizontal Scroll Arrows enabled?
|
|
120 |
*
|
|
121 |
* @return if arrows not enabled, returns EFalse
|
|
122 |
*/
|
|
123 |
TBool IsShowHorizontalScrollArrows() const;
|
|
124 |
|
|
125 |
/**
|
|
126 |
* enable/disable the rendering of the Horizontal Scroll Arrows.
|
|
127 |
*
|
|
128 |
* @param aValue if ETrue, enable the arrows
|
|
129 |
* if EFalse, disable the arrrows
|
|
130 |
*/
|
|
131 |
void ShowHorizontalScrollArrows(TBool aValue);
|
|
132 |
|
|
133 |
|
|
134 |
/**
|
|
135 |
* enable/disable the rendering of the up Scroll Arrows.
|
|
136 |
*
|
|
137 |
* @param aValue if ETrue, enable the arrows
|
|
138 |
* if EFalse, disable the arrrows
|
|
139 |
*/
|
|
140 |
void ShowUpScrollArrows(TBool aValue);
|
|
141 |
|
|
142 |
/**
|
|
143 |
* enable/disable the rendering of the down Scroll Arrows.
|
|
144 |
*
|
|
145 |
* @param aValue if ETrue, enable the arrows
|
|
146 |
* if EFalse, disable the arrrows
|
|
147 |
*/
|
|
148 |
void ShowDownScrollArrows(TBool aValue);
|
|
149 |
|
|
150 |
/**
|
|
151 |
* enable/disable the rendering of the left Scroll Arrows.
|
|
152 |
*
|
|
153 |
* @param aValue if ETrue, enable the arrows
|
|
154 |
* if EFalse, disable the arrrows
|
|
155 |
*/
|
|
156 |
void ShowLeftScrollArrows(TBool aValue);
|
|
157 |
|
|
158 |
/**
|
|
159 |
* enable/disable the rendering of the right Scroll Arrows.
|
|
160 |
*
|
|
161 |
* @param aValue if ETrue, enable the arrows
|
|
162 |
* if EFalse, disable the arrrows
|
|
163 |
*/
|
|
164 |
void ShowRightScrollArrows(TBool aValue);
|
|
165 |
|
|
166 |
/**
|
|
167 |
* are the Vertical Scroll Arrows enabled?
|
|
168 |
*
|
|
169 |
* @return if arrows not enabled, returns EFalse
|
|
170 |
*/
|
|
171 |
TBool IsShowVerticalScrollArrows() const;
|
|
172 |
|
|
173 |
/**
|
|
174 |
* enable/disable the rendering of the Vertical Scroll Arrows.
|
|
175 |
*
|
|
176 |
* @param aValue if ETrue, enable the arrows
|
|
177 |
* if EFalse, disable the arrrows
|
|
178 |
*/
|
|
179 |
void ShowVerticalScrollArrows(TBool aValue);
|
|
180 |
|
|
181 |
/**
|
|
182 |
* enable/disable the rendering of the candidate ordinal numbers
|
|
183 |
*
|
|
184 |
* @param aValue if ETrue, enable the ordinals
|
|
185 |
* if EFalse, disable the ordinals
|
|
186 |
*
|
|
187 |
*/
|
|
188 |
void ShowCandidateOrdinals(TBool aValue);
|
|
189 |
|
|
190 |
/**
|
|
191 |
* enable/disable the rendering of the candidate ordinal numbers
|
|
192 |
*
|
|
193 |
* @return if not shown, return EFalse
|
|
194 |
*/
|
|
195 |
TBool IsShowCandidateOrdinals() const;
|
|
196 |
|
|
197 |
/**
|
|
198 |
* This function returns the number of Candidates that are visible in the pane
|
|
199 |
* in its current configuration.
|
|
200 |
*
|
|
201 |
* @return number of candidates that are currently visible
|
|
202 |
*/
|
|
203 |
TInt VisibleCandidateCount() const;
|
|
204 |
|
|
205 |
/**
|
|
206 |
* This function sets the number of candidates that are visible.
|
|
207 |
* This will affect the size of the control as determined by the layout.
|
|
208 |
*
|
|
209 |
* @param aCount the new visible count,
|
|
210 |
* must be 1 <= aCount <= EMaxCandidates
|
|
211 |
*/
|
|
212 |
void SetVisibleCandidateCount(TInt aCount);
|
|
213 |
|
|
214 |
/**
|
|
215 |
* Select the first visible item in the candidate buffer
|
|
216 |
*
|
|
217 |
* @return ETrue if success, EFalse if no items visible
|
|
218 |
*
|
|
219 |
*/
|
|
220 |
TBool SelectFirst();
|
|
221 |
|
|
222 |
/**
|
|
223 |
* Select the first visible phrase item in the candidate buffer
|
|
224 |
*
|
|
225 |
* @return ETrue if success, EFalse if no items visible
|
|
226 |
*
|
|
227 |
*/
|
|
228 |
TBool SelectFirstPhrase();
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Select the last visible item in the candidate buffer
|
|
232 |
*
|
|
233 |
* @return ETrue if success, EFalse if no items visible
|
|
234 |
*
|
|
235 |
*/
|
|
236 |
TBool SelectLast();
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Select the last visible phrase item in the candidate buffer
|
|
240 |
*
|
|
241 |
* @return ETrue if success, EFalse if no items visible
|
|
242 |
*
|
|
243 |
*/
|
|
244 |
TBool SelectLastPhrase();
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Select the next visible item
|
|
248 |
*
|
|
249 |
* @return ETrue if success,
|
|
250 |
* EFalse if no items visible, or if already on last visible item
|
|
251 |
*/
|
|
252 |
TBool SelectNext();
|
|
253 |
/**
|
|
254 |
* Select the previous visible item
|
|
255 |
*
|
|
256 |
* @return ETrue if success,
|
|
257 |
* EFalse if no items visible, or if already on first visible item
|
|
258 |
*/
|
|
259 |
TBool SelectPrev();
|
|
260 |
|
|
261 |
/**
|
|
262 |
* This function selects the given index.
|
|
263 |
* <p> Note that if the new selected index is within the visible count,
|
|
264 |
* but falls on a candidate that is not valid (i.e. if it falls outside the
|
|
265 |
* length of the candidate buffer) then nothing happens and EFalse is returned
|
|
266 |
*
|
|
267 |
* @param aIndex If aIndex falls outside length of candidate buffer,
|
|
268 |
* then return EFalse to indicate failure.
|
|
269 |
* @return ETrue if index was valid, EFalse if index not valid
|
|
270 |
*/
|
|
271 |
TBool SelectIndex(TInt aIndex, TBool selected = ETrue);
|
|
272 |
|
|
273 |
/**
|
|
274 |
* This function returns the selected index of the Candidate Pane.
|
|
275 |
*
|
|
276 |
* @return the index of the selected item. If the Pane is not highlighted it returns 0.
|
|
277 |
*
|
|
278 |
*/
|
|
279 |
TInt SelectedIndex() const;
|
|
280 |
|
|
281 |
/**
|
|
282 |
* This function returns the character at index of the current selection
|
|
283 |
*
|
|
284 |
* @return a descrptor containing the character that is currently selected.
|
|
285 |
* If the currect selection falls outside the length of the current buffer,
|
|
286 |
* then return a null descriptor
|
|
287 |
*
|
|
288 |
*/
|
|
289 |
TPtrC CurrentCandidate() const;
|
|
290 |
/**
|
|
291 |
* This function returns the phrase at index of the current selection
|
|
292 |
*
|
|
293 |
* @return a descrptor containing the character that is currently selected.
|
|
294 |
* If the currect selection falls outside the length of the current buffer,
|
|
295 |
* then return a null descriptor
|
|
296 |
*
|
|
297 |
*/
|
|
298 |
TPtrC CurrentPhraseCandidate() const;
|
|
299 |
/**
|
|
300 |
* This function calculate the input pane's size for phrase input layout
|
|
301 |
* @return input pane's size
|
|
302 |
*
|
|
303 |
*/
|
|
304 |
TInt LabelTextWidthInPixels(TInt aIndex);
|
|
305 |
/**
|
|
306 |
* Set layout
|
|
307 |
* @param aPaneLayout the new panelayout
|
|
308 |
*
|
|
309 |
*/
|
|
310 |
void SetPaneLayout(CAknFepUICtrlContainerChinese::TPaneLayout aPaneLayout);
|
|
311 |
/**
|
|
312 |
* Split phrase candidates into pages
|
|
313 |
*/
|
|
314 |
void SplitPhraseCandidatesIntoPages();
|
|
315 |
|
|
316 |
/**
|
|
317 |
* Navigate to next page
|
|
318 |
*/
|
|
319 |
void NextCandidatePage(void);
|
|
320 |
|
|
321 |
/**
|
|
322 |
* Navigate to previous page
|
|
323 |
*/
|
|
324 |
void PreviousCandidatePage(void);
|
|
325 |
|
|
326 |
/**
|
|
327 |
* Return candidate array
|
|
328 |
*/
|
|
329 |
CDesCArrayFlat* CandidateArray(void);
|
|
330 |
|
|
331 |
/**
|
|
332 |
* Set phrase candidate buffer
|
|
333 |
*/
|
|
334 |
void SetCandidateBuffer(void);
|
|
335 |
|
|
336 |
/**
|
|
337 |
* Reset candidate pane state and variables
|
|
338 |
*/
|
|
339 |
void ResetCandidateState();
|
|
340 |
|
|
341 |
/**
|
|
342 |
* To test whether current page is the first page
|
|
343 |
*/
|
|
344 |
TBool IsFirstPage();
|
|
345 |
|
|
346 |
/**
|
|
347 |
* To test whether current page is the last page
|
|
348 |
*/
|
|
349 |
TBool IsLastPage();
|
|
350 |
|
|
351 |
/**
|
|
352 |
* To set all the cnadidate label invisible(phrase creation)
|
|
353 |
*/
|
|
354 |
void SetInVisiable();
|
|
355 |
/**
|
|
356 |
* To test whether need to get new candidate page
|
|
357 |
*/
|
|
358 |
TBool NeedGetNewCandidatePage();
|
|
359 |
|
|
360 |
public: // from CCoeControl
|
|
361 |
/**
|
|
362 |
* size changed
|
|
363 |
*/
|
|
364 |
virtual void SizeChanged();
|
|
365 |
|
|
366 |
/**
|
|
367 |
* count component controls
|
|
368 |
*
|
|
369 |
* @return number of contained controls
|
|
370 |
*/
|
|
371 |
TInt CountComponentControls() const;
|
|
372 |
|
|
373 |
/**
|
|
374 |
* Component control
|
|
375 |
*
|
|
376 |
* @param aIndex the control to return, must be between 0 and the number of controls
|
|
377 |
* @return pointer to contained control, ownership is not passed
|
|
378 |
*
|
|
379 |
*/
|
|
380 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
|
381 |
|
|
382 |
/**
|
|
383 |
* draw
|
|
384 |
*
|
|
385 |
* @param aRect rectangle
|
|
386 |
*
|
|
387 |
*/
|
|
388 |
virtual void Draw(const TRect& aRect) const;
|
|
389 |
|
|
390 |
|
|
391 |
void Enable(TBool aEnable);
|
|
392 |
|
|
393 |
protected:
|
|
394 |
/**
|
|
395 |
* second phase construction
|
|
396 |
*/
|
|
397 |
void ConstructL(RWindow& aParent);
|
|
398 |
|
|
399 |
/**
|
|
400 |
* Construct all the bitmap classes
|
|
401 |
*/
|
|
402 |
void ConstructBitmapsL();
|
|
403 |
|
|
404 |
/**
|
|
405 |
* constructor
|
|
406 |
*/
|
|
407 |
CAknFepUICtrlCandidatePane( CAknFepUiLayoutDataMgr* aLafDataMgr );
|
|
408 |
|
|
409 |
/**
|
|
410 |
* layout the rectangles
|
|
411 |
*/
|
|
412 |
void LayoutRects();
|
|
413 |
|
|
414 |
/**
|
|
415 |
* layout contained controls
|
|
416 |
*/
|
|
417 |
void LayoutContainedControls();
|
|
418 |
|
|
419 |
/**
|
|
420 |
* layout the labels for a single candidate
|
|
421 |
*/
|
|
422 |
void LayoutLabel(TInt aIndex);
|
|
423 |
|
|
424 |
/**
|
|
425 |
* layout the labels for all the candidates (even those that are not currently visible)
|
|
426 |
*/
|
|
427 |
void LayoutLabels();
|
|
428 |
|
|
429 |
/**
|
|
430 |
* layout selected candidate
|
|
431 |
* <p> Note that there is only one instance, as there can
|
|
432 |
* only be one selected candidate at a time. Therefore, the control
|
|
433 |
* is placed in the position that is correct based on the current selection
|
|
434 |
*
|
|
435 |
* @param aIndex the index of the new position of the selected candidate
|
|
436 |
*
|
|
437 |
*/
|
|
438 |
void LayoutCandidateSelected();
|
|
439 |
|
|
440 |
/**
|
|
441 |
* set label vilisibilty, according to the current pane layout
|
|
442 |
*/
|
|
443 |
void UpdateLabelVisibility();
|
|
444 |
|
|
445 |
/**
|
|
446 |
* draw background color
|
|
447 |
*
|
|
448 |
* @param aRect rect in which to draw
|
|
449 |
*/
|
|
450 |
void DrawBackground(const TRect& aRect) const;
|
|
451 |
|
|
452 |
/**
|
|
453 |
* Internal candidate paging function,
|
|
454 |
* Only paging once per call.
|
|
455 |
*
|
|
456 |
*/
|
|
457 |
void InternalSpilitPhraseCandidate();
|
|
458 |
|
|
459 |
private: // the following are owned
|
|
460 |
CAknFepUICtrlCandidateSelected* iCandidateSelected;
|
|
461 |
CFbsBitmap* iNaviArrowBitmapLeft;
|
|
462 |
CFbsBitmap* iNaviArrowBitmapLeftMask;
|
|
463 |
CFbsBitmap* iNaviArrowBitmapRight;
|
|
464 |
CFbsBitmap* iNaviArrowBitmapRightMask;
|
|
465 |
CFbsBitmap* iNaviArrowBitmapUp;
|
|
466 |
CFbsBitmap* iNaviArrowBitmapUpMask;
|
|
467 |
CFbsBitmap* iNaviArrowBitmapDown;
|
|
468 |
CFbsBitmap* iNaviArrowBitmapDownMask;
|
|
469 |
private: // the following need resetting
|
|
470 |
RPointerArray<CEikLabel> iCandidateLabelArray;
|
|
471 |
RPointerArray<CEikLabel> iOrdinalLabelArray;
|
|
472 |
RArray<TCandidateMode> iCandidateModeArray;
|
|
473 |
private: // the following are members
|
|
474 |
CAknFepUiLayoutDataMgr* iLafDataMgr;
|
|
475 |
TAknLayoutRect iIndiFepArrowLeft;
|
|
476 |
TAknLayoutRect iIndiFepArrowRight;
|
|
477 |
TAknLayoutRect iIndiFepArrowUp;
|
|
478 |
TAknLayoutRect iIndiFepArrowDown;
|
|
479 |
TBufC<EMaxCandidates> iBuffer;
|
|
480 |
CAknFepUICtrlContainerChinese::TPaneLayout iPaneLayout;
|
|
481 |
TInt iVisibleCount;
|
|
482 |
TInt iSelected;
|
|
483 |
TBool iHighlighted;
|
|
484 |
TBool iShowHorizontalScrollArrows;
|
|
485 |
TBool iShowVerticalScrollArrows;
|
|
486 |
TBool iShowUpScrollArrows;
|
|
487 |
TBool iShowDownScrollArrows;
|
|
488 |
TBool iShowLeftScrollArrows;
|
|
489 |
TBool iShowRightScrollArrows;
|
|
490 |
TBool iShowCandidateOrdinals;
|
|
491 |
RArray<TPage> iPages;
|
|
492 |
//next paging candidate index
|
|
493 |
TInt iUnpagedIndex;
|
|
494 |
TInt iCurDisplayPage;
|
|
495 |
CDesCArrayFlat* iCandidateArray;
|
|
496 |
TInt iOrdinalLableWidth;
|
|
497 |
};
|
|
498 |
|
|
499 |
#endif //__AKN_FEP_AVKON_CANDIDATE_PANE_H__
|
|
500 |
|
|
501 |
// End of file
|