56
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2008 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: Tab control for the status pane's navigation pane.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef AKNTABGRP_H
|
|
20 |
#define AKNTABGRP_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <AknControl.h>
|
|
24 |
#include <coeccntx.h>
|
|
25 |
#include <coecobs.h>
|
|
26 |
#include <AknNaviDecoratorObserver.h>
|
|
27 |
#include "aknconsts.h"
|
|
28 |
#include "AknUtils.h"
|
|
29 |
|
|
30 |
#include <avkon.mbg>
|
|
31 |
|
|
32 |
|
|
33 |
// FORWARD DECLARATIONS
|
|
34 |
|
|
35 |
class CEikLabel;
|
|
36 |
class CEikImage;
|
|
37 |
class CAknTabGroup;
|
|
38 |
class CAknTabGroupExtension;
|
|
39 |
class MAknTabObserver;
|
|
40 |
class MAknNaviDecoratorObserver;
|
|
41 |
class TAknWindowLineLayout;
|
|
42 |
class CAknTabExtension;
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Tab item control used inside a tab group.
|
|
46 |
*
|
|
47 |
* @lib avkon.lib
|
|
48 |
* @since 0.9
|
|
49 |
*/
|
|
50 |
NONSHARABLE_CLASS( CAknTab ) : public CAknControl
|
|
51 |
{
|
|
52 |
friend class CAknTabGroup;
|
|
53 |
|
|
54 |
public:
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Indicates a tab title's type
|
|
58 |
*/
|
|
59 |
enum TAknTabDataType
|
|
60 |
{
|
|
61 |
/** Tab title is empty.*/
|
|
62 |
EAknTabNone,
|
|
63 |
/** Tab title has only text. */
|
|
64 |
EAknTabText,
|
|
65 |
/** Tab title has only icon */
|
|
66 |
EAknTabIcon,
|
|
67 |
/** Tab title has both text and icon. */
|
|
68 |
EAknTabTextAndIcon
|
|
69 |
};
|
|
70 |
|
|
71 |
public:
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Destructor
|
|
75 |
*/
|
|
76 |
~CAknTab();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Two-phased constructor.
|
|
80 |
*
|
|
81 |
* @param aParent Reference to parent control.
|
|
82 |
* @param aReader Reference to resource reader.
|
|
83 |
*
|
|
84 |
* @return A pointer to constructed @c CAknTab object.
|
|
85 |
*/
|
|
86 |
static CAknTab* NewL( const CCoeControl& aParent,
|
|
87 |
TResourceReader& aReader );
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Two-phased constructor.
|
|
91 |
*
|
|
92 |
* @param aParent Reference to parent control.
|
|
93 |
* @param aReader Reference to resource reader.
|
|
94 |
*
|
|
95 |
* @return A pointer to constructed @c CAknTab object.
|
|
96 |
*/
|
|
97 |
static CAknTab* NewLC( const CCoeControl& aParent,
|
|
98 |
TResourceReader& aReader );
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Two-phased constructor.
|
|
102 |
*
|
|
103 |
* @param aId Tab ID.
|
|
104 |
* @param aParent Reference to parent control.
|
|
105 |
* @param aTabText Reference to title text.
|
|
106 |
*
|
|
107 |
* @return A pointer to constructed @c CAknTab object.
|
|
108 |
*/
|
|
109 |
static CAknTab* NewL( TInt aId,
|
|
110 |
const CCoeControl& aParent,
|
|
111 |
const TDesC& aTabText );
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Two-phased constructor.
|
|
115 |
*
|
|
116 |
* @param aId Tab ID.
|
|
117 |
* @param aParent Reference to parent control.
|
|
118 |
* @param aTabText Reference to title text.
|
|
119 |
*
|
|
120 |
* @return A pointer to constructed @c CAknTab object.
|
|
121 |
*/
|
|
122 |
static CAknTab* NewLC( TInt aId,
|
|
123 |
const CCoeControl& aParent,
|
|
124 |
const TDesC& aTabText );
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Two-phased constructor.
|
|
128 |
*
|
|
129 |
* @param aId Tab ID.
|
|
130 |
* @param aParent Reference to parent control.
|
|
131 |
* @param aTabText Reference to title text.
|
|
132 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
133 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
134 |
*
|
|
135 |
* @return A pointer to constructed @c CAknTab object.
|
|
136 |
*/
|
|
137 |
static CAknTab* NewL( TInt aId,
|
|
138 |
const CCoeControl& aParent,
|
|
139 |
const TDesC& aTabText,
|
|
140 |
const CFbsBitmap* aTabBitmap,
|
|
141 |
const CFbsBitmap* aMask = NULL );
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Two-phased constructor.
|
|
145 |
*
|
|
146 |
* @param aId Tab ID.
|
|
147 |
* @param aParent Reference to parent control.
|
|
148 |
* @param aTabText Reference to title text.
|
|
149 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
150 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
151 |
*
|
|
152 |
* @return A pointer to constructed @c CAknTab object.
|
|
153 |
*/
|
|
154 |
static CAknTab* NewLC( TInt aId,
|
|
155 |
const CCoeControl& aParent,
|
|
156 |
const TDesC& aTabText,
|
|
157 |
const CFbsBitmap* aTabBitmap,
|
|
158 |
const CFbsBitmap* aMask = NULL );
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Two-phased constructor.
|
|
162 |
*
|
|
163 |
* @param aId Tab ID.
|
|
164 |
* @param aParent Reference to parent control.
|
|
165 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
166 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
167 |
*
|
|
168 |
* @return A pointer to constructed @c CAknTab object.
|
|
169 |
*/
|
|
170 |
static CAknTab* NewL( TInt aId,
|
|
171 |
const CCoeControl& aParent,
|
|
172 |
const CFbsBitmap* aTabBitmap,
|
|
173 |
const CFbsBitmap* aMask = NULL );
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Two-phased constructor.
|
|
177 |
*
|
|
178 |
* @param aId Tab ID.
|
|
179 |
* @param aParent Reference to parent control.
|
|
180 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
181 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
182 |
*
|
|
183 |
* @return A pointer to constructed @c CAknTab object.
|
|
184 |
*/
|
|
185 |
static CAknTab* NewLC( TInt aId,
|
|
186 |
const CCoeControl& aParent,
|
|
187 |
const CFbsBitmap* aTabBitmap,
|
|
188 |
const CFbsBitmap* aMask = NULL );
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Replace the tab title.
|
|
192 |
*
|
|
193 |
* @param aTabText New title text.
|
|
194 |
*/
|
|
195 |
void ReplaceTextL( const TDesC& aTabText );
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Activate or deactive this tab.
|
|
199 |
*
|
|
200 |
* @param aActive @c ETrue for activation, @c EFalse for deactivation.
|
|
201 |
* @param aDrawNow Indicates whether control need to be redrawn.
|
|
202 |
*/
|
|
203 |
void SetActive( TBool aActive, TDrawNow aDrawNow );
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Determines whether this tab is active.
|
|
207 |
*
|
|
208 |
* @return @c ETrue if a tab is active, @c EFalse if not.
|
|
209 |
*/
|
|
210 |
TBool Active() const;
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Gets tab's ID.
|
|
214 |
*
|
|
215 |
* @return Tabs' ID.
|
|
216 |
*/
|
|
217 |
TInt Id() const;
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Gets this tab's type.
|
|
221 |
*
|
|
222 |
* @return Tab's type.
|
|
223 |
*/
|
|
224 |
enum TAknTabDataType TabType() const;
|
|
225 |
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Sets the total amount of tabs in the tabgroup where this tab belongs to.
|
|
229 |
*/
|
|
230 |
void SetTotalAmountOfTabs( TInt aAmount );
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Sets the narrow tab layout.
|
|
234 |
* @internal Used by the UI framework.
|
|
235 |
* Applications can set the narrow layout using @c CAknNaviDecorator class.
|
|
236 |
*/
|
|
237 |
void SetNarrowTabLayout( TBool aNarrow );
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Sets the flag indicating whether or not this tab contains
|
|
241 |
* a multi-colored title icon.
|
|
242 |
*
|
|
243 |
* The multi-color mode should be used with color icons,
|
|
244 |
* otherwise the tab icon is drawn using a color
|
|
245 |
* defined in the current skin.
|
|
246 |
*
|
|
247 |
* @param aMultiColor @c ETrue to set the multi-color mode on,
|
|
248 |
* @c EFalse to turn it off.
|
|
249 |
*/
|
|
250 |
void SetMultiColorMode( TBool aMultiColor );
|
|
251 |
|
|
252 |
/**
|
|
253 |
* Checks whether or not this tab is drawn using multi-color mode or not.
|
|
254 |
*
|
|
255 |
* @return @c ETrue if this tab contains a multi-color icon,
|
|
256 |
* @c EFalse otherwise.
|
|
257 |
*/
|
|
258 |
TBool MultiColorMode() const;
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Sets the long tab layout.
|
|
262 |
* @internal Used by the UI framework.
|
|
263 |
*/
|
|
264 |
void SetLongTabLayout( TBool aLongTab );
|
|
265 |
|
|
266 |
public: // From base class @c CCoeControl.
|
|
267 |
|
|
268 |
/**
|
|
269 |
* Gets the minimum size of the tab.
|
|
270 |
*
|
|
271 |
* @return Minimum size of the tab.
|
|
272 |
*/
|
|
273 |
virtual TSize MinimumSize();
|
|
274 |
|
|
275 |
/**
|
|
276 |
* Sets the tab dimmed.
|
|
277 |
*
|
|
278 |
* @param aDimmed @c ETrue to dim the control,
|
|
279 |
* @c EFalse to set the control as not dimmed.
|
|
280 |
*/
|
|
281 |
virtual void SetDimmed( TBool aDimmed );
|
|
282 |
|
|
283 |
/**
|
|
284 |
* Gets the list of logical colors employed
|
|
285 |
* in the drawing of the control, paired with an explanation of how
|
|
286 |
* they are used. Appends the list into @c aColorUseList.
|
|
287 |
*
|
|
288 |
* @param[in,out] aColorUseList The color list.
|
|
289 |
*/
|
|
290 |
virtual void GetColorUseListL(
|
|
291 |
CArrayFix<TCoeColorUse>& aColorUseList ) const;
|
|
292 |
|
|
293 |
protected: // From base class @c CCoeControl.
|
|
294 |
|
|
295 |
/**
|
|
296 |
* Responds to size changes events to sets the size and
|
|
297 |
* position of the contents of this control.
|
|
298 |
*/
|
|
299 |
virtual void SizeChanged();
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Gets the number of controls contained in a compound control.
|
|
303 |
*
|
|
304 |
* @return The number of component controls contained by this control.
|
|
305 |
*/
|
|
306 |
virtual TInt CountComponentControls() const;
|
|
307 |
|
|
308 |
/**
|
|
309 |
* Gets the specified component of a compound control.
|
|
310 |
*
|
|
311 |
* @param aIndex The index of the control to get.
|
|
312 |
*
|
|
313 |
* @return The component control with an index of @c aIndex.
|
|
314 |
|
|
315 |
*/
|
|
316 |
virtual CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
317 |
|
|
318 |
/**
|
|
319 |
* Handles pointer events.
|
|
320 |
* This function is called by framework whenever a pointer event
|
|
321 |
* occurs in the control.
|
|
322 |
*
|
|
323 |
* @param aPointerEvent The pointer event.
|
|
324 |
*/
|
|
325 |
virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
326 |
|
|
327 |
private: // From base class @c CAknControl.
|
|
328 |
|
|
329 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
|
330 |
|
|
331 |
private: // From base class @c CCoeControl.
|
|
332 |
|
|
333 |
virtual void Draw( const TRect& aRect ) const;
|
|
334 |
|
|
335 |
private:
|
|
336 |
|
|
337 |
CAknTab( TInt aId );
|
|
338 |
|
|
339 |
void ConstructFromResourceL( TResourceReader& aReader );
|
|
340 |
|
|
341 |
void ConstructL( const TDesC& aTabText );
|
|
342 |
|
|
343 |
void ConstructL( const CFbsBitmap* aTabBitmap,
|
|
344 |
const CFbsBitmap* aMask = NULL );
|
|
345 |
|
|
346 |
void LoadColorBitmapL();
|
|
347 |
|
|
348 |
/**
|
|
349 |
* Handles a change to the control's resources.
|
|
350 |
*
|
|
351 |
* @param aType The event type.
|
|
352 |
*/
|
|
353 |
void HandleResourceChange( TInt aType );
|
|
354 |
|
|
355 |
void SizeChangedInNormalLayout();
|
|
356 |
void SizeChangedInFlatLayout();
|
|
357 |
void SizeChangedInNarrowLayout();
|
|
358 |
|
|
359 |
/**
|
|
360 |
* Sets the flag to indicate the highlight status
|
|
361 |
*
|
|
362 |
* @param aHighlight highlight status
|
|
363 |
* default is EFalse
|
|
364 |
*/
|
|
365 |
void SetHighlight(TBool aHighlight);
|
|
366 |
|
|
367 |
|
|
368 |
private:
|
|
369 |
|
|
370 |
CEikLabel* iLabel;
|
|
371 |
TInt iId;
|
|
372 |
TBool iActive;
|
|
373 |
|
|
374 |
const CFbsBitmap* iBitmap;
|
|
375 |
const CFbsBitmap* iBitmapMask;
|
|
376 |
TAknLayoutRect iBitmapRect;
|
|
377 |
|
|
378 |
CAknTabExtension* iExtension;
|
|
379 |
|
|
380 |
typedef CArrayPtrFlat<CFbsBitmap> CAknTabColorBitmapArray;
|
|
381 |
CAknTabColorBitmapArray* iColorBitmaps;
|
|
382 |
};
|
|
383 |
|
|
384 |
|
|
385 |
/**
|
|
386 |
* Tab group functionality for navigation pane.
|
|
387 |
*
|
|
388 |
* @lib avkon.lib
|
|
389 |
* @since 0.9
|
|
390 |
*/
|
|
391 |
class CAknTabGroup : public CAknControl,
|
|
392 |
public MCoeControlObserver,
|
|
393 |
public MCoeControlContext,
|
|
394 |
public MAknNaviDecoratorObserver
|
|
395 |
{
|
|
396 |
public:
|
|
397 |
/**
|
|
398 |
* Destructor.
|
|
399 |
*/
|
|
400 |
IMPORT_C ~CAknTabGroup();
|
|
401 |
|
|
402 |
/**
|
|
403 |
* Creates new tab group.
|
|
404 |
*
|
|
405 |
* @param aParent Parent control.
|
|
406 |
*/
|
|
407 |
IMPORT_C static CAknTabGroup* NewL( const CCoeControl& aParent );
|
|
408 |
|
|
409 |
/**
|
|
410 |
* Creates new tab group and pushes it to the clean up stack.
|
|
411 |
*
|
|
412 |
* @param aParent Parent control.
|
|
413 |
*/
|
|
414 |
IMPORT_C static CAknTabGroup* NewLC( const CCoeControl& aParent );
|
|
415 |
|
|
416 |
public:
|
|
417 |
|
|
418 |
/**
|
|
419 |
* Add a tab to the tab group from resources.
|
|
420 |
*
|
|
421 |
* @param aReader Resource reader.
|
|
422 |
*
|
|
423 |
* @return ID of the added tab.
|
|
424 |
*/
|
|
425 |
IMPORT_C TInt AddTabL( TResourceReader& aReader );
|
|
426 |
|
|
427 |
/**
|
|
428 |
* Add a tab to the tab group.
|
|
429 |
*
|
|
430 |
* @param aTabId ID of the tab to be added.
|
|
431 |
* @param aTabText Text for the tab.
|
|
432 |
*/
|
|
433 |
IMPORT_C void AddTabL( TInt aTabId, const TDesC& aText );
|
|
434 |
|
|
435 |
/**
|
|
436 |
* Add a tab to the tab group.
|
|
437 |
*
|
|
438 |
* @param aTabId ID of the tab.
|
|
439 |
* @param aTabText Text for the tab.
|
|
440 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
441 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
442 |
*/
|
|
443 |
IMPORT_C void AddTabL( TInt aTabId,
|
|
444 |
const TDesC& aText,
|
|
445 |
const CFbsBitmap* aTabBitmap,
|
|
446 |
const CFbsBitmap* aMask = NULL );
|
|
447 |
|
|
448 |
/**
|
|
449 |
* Add a tab to the tab group.
|
|
450 |
*
|
|
451 |
* @param aTabId ID of the tab.
|
|
452 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
453 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
454 |
*/
|
|
455 |
IMPORT_C void AddTabL( TInt aTabId,
|
|
456 |
const CFbsBitmap* aTabBitmap,
|
|
457 |
const CFbsBitmap* aMask = NULL );
|
|
458 |
/**
|
|
459 |
* Replaces a tab with a new one from resources.
|
|
460 |
* Tab with same ID is replaced.
|
|
461 |
*
|
|
462 |
* @param aReader Resource reader.
|
|
463 |
*/
|
|
464 |
IMPORT_C void ReplaceTabL( TResourceReader& aReader );
|
|
465 |
|
|
466 |
/**
|
|
467 |
* Replaces a tab with a new one.
|
|
468 |
*
|
|
469 |
* @param aTabId ID of the tab to be replaced.
|
|
470 |
* @param aTabText Text for the new tab.
|
|
471 |
*/
|
|
472 |
IMPORT_C void ReplaceTabL( TInt aTabId, const TDesC& aText );
|
|
473 |
|
|
474 |
/**
|
|
475 |
* Replaces a tab with a new one.
|
|
476 |
*
|
|
477 |
* @param aTabId ID of the tab to be replaced.
|
|
478 |
* @param aTabText Text for the new tab.
|
|
479 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
480 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
481 |
*/
|
|
482 |
IMPORT_C void ReplaceTabL( TInt aTabId,
|
|
483 |
const TDesC& aText,
|
|
484 |
const CFbsBitmap* aTabBitmap,
|
|
485 |
const CFbsBitmap* aMask = NULL );
|
|
486 |
|
|
487 |
/**
|
|
488 |
* Replaces a tab with a new one.
|
|
489 |
*
|
|
490 |
* @param aTabId ID of the tab to be replaced.
|
|
491 |
* @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken.
|
|
492 |
* @param aMask Bitmap's mask. Ownership of the mask is taken.
|
|
493 |
*/
|
|
494 |
IMPORT_C void ReplaceTabL( TInt aTabId,
|
|
495 |
const CFbsBitmap* aTabBitmap,
|
|
496 |
const CFbsBitmap* aMask = NULL );
|
|
497 |
|
|
498 |
/**
|
|
499 |
* Replaces a tab text with a new one.
|
|
500 |
*
|
|
501 |
* @param aTabId ID of the tab containing the text to be replaced.
|
|
502 |
* @param aTabText New tab text.
|
|
503 |
*/
|
|
504 |
IMPORT_C void ReplaceTabTextL( TInt aTabId, const TDesC& aTabText );
|
|
505 |
|
|
506 |
/**
|
|
507 |
* Delete a tab from the tab group.
|
|
508 |
*
|
|
509 |
* @param aTabId ID of the tab to be deleted.
|
|
510 |
*/
|
|
511 |
IMPORT_C void DeleteTabL( TInt aTabId );
|
|
512 |
|
|
513 |
/**
|
|
514 |
* Activate (highlight) a tab.
|
|
515 |
*
|
|
516 |
* @param aTabId ID of the tab to be highlighted.
|
|
517 |
*/
|
|
518 |
IMPORT_C void SetActiveTabById( TInt aTabId );
|
|
519 |
|
|
520 |
/**
|
|
521 |
* Activate (highlight) a tab.
|
|
522 |
*
|
|
523 |
* @param aTabIndex Index of the tab to be highlighted.
|
|
524 |
*/
|
|
525 |
IMPORT_C void SetActiveTabByIndex( TInt aTabIndex );
|
|
526 |
|
|
527 |
/**
|
|
528 |
* Returns the ID of the currently active (highlighted) tab.
|
|
529 |
*
|
|
530 |
* @return ID of the highlighted tab.
|
|
531 |
*/
|
|
532 |
IMPORT_C TInt ActiveTabId() const;
|
|
533 |
|
|
534 |
/**
|
|
535 |
* Returns the index of the currently active (highlighted) tab.
|
|
536 |
*
|
|
537 |
* @return Index of the highlighted tab.
|
|
538 |
*/
|
|
539 |
IMPORT_C TInt ActiveTabIndex() const;
|
|
540 |
|
|
541 |
/**
|
|
542 |
* Set width of each tab.
|
|
543 |
* This width determines what tab layout is used.
|
|
544 |
* To get a specific tab layout, use the following constants:
|
|
545 |
* - KTabWidthWithOneTab One tab layout
|
|
546 |
* - KTabWidthWithTwoTabs Two tabs layout
|
|
547 |
* - KTabWidthWithThreeTabs Three tabs layout
|
|
548 |
* - KTabWidthWithFourTabs Four tabs layout
|
|
549 |
* - KTabWidthWithTwoLongTabs Two long tabs layout
|
|
550 |
* - KTabWidthWithThreeLongTabs Three long tabs layout
|
|
551 |
*
|
|
552 |
* @param aWidth Width of each tab, @see aknconsts.h.
|
|
553 |
*/
|
|
554 |
IMPORT_C void SetTabFixedWidthL( TInt aWidth );
|
|
555 |
|
|
556 |
/**
|
|
557 |
* Sets a tab dimmed/not dimmed.
|
|
558 |
*
|
|
559 |
* @param aTabId ID of the tab.
|
|
560 |
* @param aDimmed @c ETrue to set the tab dimmed,
|
|
561 |
* @c EFalse otherwise.
|
|
562 |
*/
|
|
563 |
IMPORT_C void DimTab( TInt aTabId, TBool aDimmed );
|
|
564 |
|
|
565 |
/**
|
|
566 |
* Used to check whether or not a tab is dimmed.
|
|
567 |
*
|
|
568 |
* @param aTabId ID of the tab.
|
|
569 |
*
|
|
570 |
* @return @c ETrue if the tab is dimmed, @c EFalse otherwise.
|
|
571 |
*/
|
|
572 |
IMPORT_C virtual TBool IsTabDimmed( TInt aTabId ) const;
|
|
573 |
|
|
574 |
/**
|
|
575 |
* Returns the index of a tab.
|
|
576 |
*
|
|
577 |
* @param aTabId ID of a tab.
|
|
578 |
*
|
|
579 |
* @return Index of the tab.
|
|
580 |
*/
|
|
581 |
IMPORT_C virtual TInt TabIndexFromId( TInt aTabId ) const;
|
|
582 |
|
|
583 |
/**
|
|
584 |
* Returns the ID of a tab.
|
|
585 |
*
|
|
586 |
* @param aTabIndex Index of a tab.
|
|
587 |
*
|
|
588 |
* @return ID of the tab.
|
|
589 |
*/
|
|
590 |
IMPORT_C virtual TInt TabIdFromIndex( TInt aTabIndex ) const;
|
|
591 |
|
|
592 |
/**
|
|
593 |
* Number of tabs in the tab group.
|
|
594 |
*
|
|
595 |
* @return Number of tabs in the tab group.
|
|
596 |
*/
|
|
597 |
IMPORT_C virtual TInt TabCount() const;
|
|
598 |
|
|
599 |
/**
|
|
600 |
* Sets the tab observer for this tab group.
|
|
601 |
*
|
|
602 |
* @param aObserver Tab observer to set.
|
|
603 |
*/
|
|
604 |
IMPORT_C void SetObserver( MAknTabObserver* aObserver );
|
|
605 |
|
|
606 |
public: // From base class @c CCoeControl.
|
|
607 |
|
|
608 |
/**
|
|
609 |
* Return minimum size of the control.
|
|
610 |
*
|
|
611 |
* @return Minimum size of the control.
|
|
612 |
*/
|
|
613 |
IMPORT_C virtual TSize MinimumSize();
|
|
614 |
|
|
615 |
/**
|
|
616 |
* Handles key events.
|
|
617 |
*
|
|
618 |
* @param aKeyEvent The key event.
|
|
619 |
* @param aType The type of the event.
|
|
620 |
*
|
|
621 |
* @return Indicates whether or not the key event was used by this control.
|
|
622 |
*/
|
|
623 |
IMPORT_C virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
624 |
TEventCode aType );
|
|
625 |
|
|
626 |
/**
|
|
627 |
* Gets the list of logical colors employed in the drawing of the control,
|
|
628 |
* paired with an explanation of how they are used.
|
|
629 |
* Appends the list into @c aColorUseList.
|
|
630 |
*
|
|
631 |
* @param[in,out] aColorUseList The color list.
|
|
632 |
*/
|
|
633 |
IMPORT_C virtual void GetColorUseListL(
|
|
634 |
CArrayFix<TCoeColorUse>& aColorUseList ) const;
|
|
635 |
|
|
636 |
/**
|
|
637 |
* Handles a change to the control's resources.
|
|
638 |
*
|
|
639 |
* @param aType The type of resource change.
|
|
640 |
*/
|
|
641 |
void HandleResourceChange( TInt aType );
|
|
642 |
|
|
643 |
/**
|
|
644 |
* Handles pointer events in tabs.
|
|
645 |
*
|
|
646 |
* @param aPointerEvent Pointer event to be handled.
|
|
647 |
*/
|
|
648 |
IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
649 |
|
|
650 |
public: // From base class @c MCoeControlObserver.
|
|
651 |
|
|
652 |
/**
|
|
653 |
* Handles an event from an observed control.
|
|
654 |
*
|
|
655 |
* @param aControl Control that caused the event.
|
|
656 |
* @param aEventType Type of the event.
|
|
657 |
*/
|
|
658 |
IMPORT_C virtual void HandleControlEventL( CCoeControl* aControl,
|
|
659 |
TCoeEvent aEventType );
|
|
660 |
|
|
661 |
public: // From base class @c MCoeControlContext.
|
|
662 |
|
|
663 |
/**
|
|
664 |
* Allows to modify graphics context before Draw.
|
|
665 |
*
|
|
666 |
* @param aGc Graphics context to be modified.
|
|
667 |
*/
|
|
668 |
IMPORT_C virtual void PrepareContext( CWindowGc& aGc ) const;
|
|
669 |
|
|
670 |
public: // From base class @c MAknNaviDecoratorObserver.
|
|
671 |
|
|
672 |
/*
|
|
673 |
* Handles events from navi decorator parent control.
|
|
674 |
*
|
|
675 |
* @param aEventID ID of event to be handled.
|
|
676 |
*/
|
|
677 |
IMPORT_C virtual void HandleNaviDecoratorEventL( TInt aEventID );
|
|
678 |
|
|
679 |
protected: // From base class @c CCoeControl.
|
|
680 |
|
|
681 |
/**
|
|
682 |
* Handles the size change events.
|
|
683 |
*/
|
|
684 |
IMPORT_C virtual void SizeChanged();
|
|
685 |
|
|
686 |
/**
|
|
687 |
* Returns number of controls inside this control.
|
|
688 |
*
|
|
689 |
* @return Number of component controls.
|
|
690 |
*/
|
|
691 |
IMPORT_C virtual TInt CountComponentControls() const;
|
|
692 |
|
|
693 |
/**
|
|
694 |
* Returns a component control determined by control index.
|
|
695 |
*
|
|
696 |
* @param aIndex Index of a control to be returned.
|
|
697 |
*
|
|
698 |
* @return Pointer to the control.
|
|
699 |
*/
|
|
700 |
IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
701 |
|
|
702 |
/**
|
|
703 |
* This is called when the focus is changed.
|
|
704 |
*
|
|
705 |
* @param aDrawNow Whether or not to draw the control.
|
|
706 |
*/
|
|
707 |
IMPORT_C virtual void FocusChanged( TDrawNow aDrawNow );
|
|
708 |
|
|
709 |
/**
|
|
710 |
* Reverse the order of tabs in tab array.
|
|
711 |
*/
|
|
712 |
void ReverseTabOrderL();
|
|
713 |
|
|
714 |
private:
|
|
715 |
|
|
716 |
/*
|
|
717 |
* Reserved
|
|
718 |
*/
|
|
719 |
IMPORT_C virtual void Reserved1();
|
|
720 |
|
|
721 |
/*
|
|
722 |
* Reserved
|
|
723 |
*/
|
|
724 |
IMPORT_C virtual void Reserved2();
|
|
725 |
|
|
726 |
/*
|
|
727 |
* Reserved
|
|
728 |
*/
|
|
729 |
IMPORT_C virtual void Reserved3();
|
|
730 |
|
|
731 |
|
|
732 |
private:
|
|
733 |
IMPORT_C CAknTabGroup();
|
|
734 |
|
|
735 |
/**
|
|
736 |
* Tab groups can be mirrored depending on current locale. To client
|
|
737 |
* application everything always seems like tabs are not mirrored but
|
|
738 |
* the internal order of tabs in tab group may or may not be mirrored.
|
|
739 |
* If mirroring is off then this function just returns given
|
|
740 |
* parameter as it is. If mirroring is on then this function returns
|
|
741 |
* unmirrored index if given index was mirrord and vice versa. Two
|
|
742 |
* nested calls to this function cancels its effect
|
|
743 |
* (ConvertTabIndex(ConvertTabIndex(aIndex)) == aIndex).
|
|
744 |
*
|
|
745 |
* @param aIndex Index to be converted.
|
|
746 |
* @return Converted index.
|
|
747 |
*/
|
|
748 |
TInt ConvertTabIndex(TInt aIndex) const;
|
|
749 |
|
|
750 |
private: // From base class @c CCoeControl.
|
|
751 |
|
|
752 |
IMPORT_C virtual void Draw( const TRect& aRect ) const;
|
|
753 |
|
|
754 |
private: // From base class @c CAknControl.
|
|
755 |
|
|
756 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
|
757 |
|
|
758 |
public: // New methods
|
|
759 |
|
|
760 |
/**
|
|
761 |
* Sets the multi-color drawing mode of a tab.
|
|
762 |
* This should be called after adding a tab to the tab group
|
|
763 |
* if the icon in the tab should be drawn as multi-colored.
|
|
764 |
* The tab icon will be drawn using a color specified in the
|
|
765 |
* active skin if multi-color mode is not defined.
|
|
766 |
*
|
|
767 |
* This function should be called right after a tab containing
|
|
768 |
* a multi-color icon is added to the tab group.
|
|
769 |
*
|
|
770 |
* @param aTabId ID of the tab.
|
|
771 |
* @param aMultiColor @c ETrue to set the multi-color mode on,
|
|
772 |
* @c EFalse to turn it off.
|
|
773 |
*/
|
|
774 |
IMPORT_C void SetTabMultiColorMode( TInt aTabId, TBool aMultiColor );
|
|
775 |
|
|
776 |
/** Directions in which the tab group focus can be moved. */
|
|
777 |
enum TDirection
|
|
778 |
{
|
|
779 |
ELeft,
|
|
780 |
ERight
|
|
781 |
};
|
|
782 |
|
|
783 |
private:
|
|
784 |
void ConstructL();
|
|
785 |
void CommonAddTabL(CAknTab* aTab);
|
|
786 |
void CommonReplaceTabL(CAknTab* aTab);
|
|
787 |
void HandleTabStateChanged(CCoeControl* aControl);
|
|
788 |
TInt Index(TInt aTabId) const;
|
|
789 |
TBool CycleFocus(TDirection aDirection,TDrawNow aDrawNow);
|
|
790 |
TInt LeftMostTabIndex() const;
|
|
791 |
TInt RightMostTabIndex() const;
|
|
792 |
void DrawLowerBorder(TDrawNow aDrawNow) const;
|
|
793 |
void DoDrawLowerBorder() const;
|
|
794 |
void ReportNavigationEvent();
|
|
795 |
void LoadTabBitmapsL(TInt aNumberOfTabsShown, TBool aLongTabs);
|
|
796 |
TBool TabsVisibleInCurrentLayout() const;
|
|
797 |
void CurrentLayout( TAknWindowLineLayout& aLayout ) const;
|
|
798 |
void InitTabGroupGraphicsL();
|
|
799 |
|
|
800 |
void InitTabAnimationEventTimer();
|
|
801 |
void CancelTabAnimationEventTimer();
|
|
802 |
static TInt TabAnimationEvent(TAny * aPtr);
|
|
803 |
void DoTabAnimationEvent();
|
|
804 |
|
|
805 |
TBool NarrowTabLayoutNext();
|
|
806 |
TBool NarrowTabLayout();
|
|
807 |
|
|
808 |
public:
|
|
809 |
|
|
810 |
/**
|
|
811 |
* Sets the navigation decorator layout so that it corresponds
|
|
812 |
* the current tab group layout.
|
|
813 |
*
|
|
814 |
* @param aNarrow @c ETrue if narrow tab group layout is used,
|
|
815 |
* @c EFalse if normal layout is used.
|
|
816 |
*/
|
|
817 |
void SetDecoratorLayout( TBool aNarrow );
|
|
818 |
|
|
819 |
private:
|
|
820 |
|
|
821 |
void SizeChangedInNormalLayout();
|
|
822 |
void SizeChangedInFlatLayout();
|
|
823 |
void SizeChangedInNarrowLayout();
|
|
824 |
void InitTabAnimationL();
|
|
825 |
|
|
826 |
|
|
827 |
/**
|
|
828 |
* Gets the rectangle for the tab group.
|
|
829 |
* If the tab arrows are not shown, then the tab group gets a wider
|
|
830 |
* rectangle.
|
|
831 |
*
|
|
832 |
* @param aArrowsUsed @c ETrue if tab arrows are shown,
|
|
833 |
* @c EFalse otherwise.
|
|
834 |
*/
|
|
835 |
static TRect ParentRect( TBool aArrowsUsed );
|
|
836 |
|
|
837 |
/**
|
|
838 |
* @internal Used by the UI framework.
|
|
839 |
*
|
|
840 |
* Starts the animation shown when tab focus is cycled.
|
|
841 |
* Note that this starts the animation only when required, i.e.
|
|
842 |
* when layout that needs cycle animation is used and when the first
|
|
843 |
* shown tab in the tab group changes.
|
|
844 |
*
|
|
845 |
* @param aDirection Direction which the focus in cycled to.
|
|
846 |
* @param aNewTab Index of the tab that receives the focus.
|
|
847 |
*/
|
|
848 |
void StartCycleAnimationL( TDirection aDirection, TInt aNewTab );
|
|
849 |
|
|
850 |
/**
|
|
851 |
* Called on the dynamic layout switch event, switches the current tab
|
|
852 |
* layout to a corresponding one that is usable in the new layout.
|
|
853 |
*/
|
|
854 |
void SwitchTabLayoutL();
|
|
855 |
|
|
856 |
public:
|
|
857 |
|
|
858 |
/**
|
|
859 |
* @internal Used by the UI framework.
|
|
860 |
* Applications can set the narrow layout using @c CAknNaviDecorator class.
|
|
861 |
*/
|
|
862 |
void SetNarrowTabLayoutL( TBool aNarrow, TBool aUseAnimation = EFalse );
|
|
863 |
|
|
864 |
/**
|
|
865 |
* @internal Used by the UI framework.
|
|
866 |
*
|
|
867 |
* Sets the tab arrows' visibility.
|
|
868 |
*
|
|
869 |
* @param aVisible @c ETrue to set the arrows visible,
|
|
870 |
* @c EFalse to hide them.
|
|
871 |
*/
|
|
872 |
void SetNaviArrowsVisible( TBool aVisible );
|
|
873 |
|
|
874 |
private:
|
|
875 |
/**
|
|
876 |
* Resets the highlight status for tabs
|
|
877 |
*/
|
|
878 |
void ResetHighlightStatus();
|
|
879 |
|
|
880 |
|
|
881 |
private:
|
|
882 |
CArrayPtr<CAknTab>* iTabArray;
|
|
883 |
TInt iActiveTab;
|
|
884 |
TRect iSpareRect;
|
|
885 |
|
|
886 |
TInt iTabFixedWidth;
|
|
887 |
TBool iLongTabs;
|
|
888 |
TInt iNumberOfTabsShown;
|
|
889 |
TInt iFirstShownTab;
|
|
890 |
|
|
891 |
CFbsBitmap* iTabBitmaps[KTabNumberOfTabBitmaps];
|
|
892 |
CFbsBitmap* iTabMaskBitmaps[KTabNumberOfTabBitmaps];
|
|
893 |
|
|
894 |
TInt iBitmapNames[KTabNumberOfTabBitmaps];
|
|
895 |
TInt iBitmapMaskNames[KTabNumberOfTabBitmaps];
|
|
896 |
CAknTabGroupExtension* iExtension;
|
|
897 |
|
|
898 |
MAknTabObserver* iTabObserver;
|
|
899 |
TBool iMirrored;
|
|
900 |
};
|
|
901 |
|
|
902 |
#endif // AKNTABGRP_H
|