akntabgrp.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name        : akntabgrp.h
00004 *  Part of     : UI Framework / AVKON
00005 *  Description : Implements tab control to the status
00006 *                pane's navigation pane.
00007 *  Version     : %version: tr1s60#24 %
00008 *
00009 *  Copyright © 2002-2007 Nokia.  All rights reserved.
00010 *  This material, including documentation and any related computer
00011 *  programs, is protected by copyright controlled by Nokia.  All
00012 *  rights are reserved.  Copying, including reproducing, storing,
00013 *  adapting or translating, any or all of this material requires the
00014 *  prior written consent of Nokia.  This material also contains
00015 *  confidential information which may not be disclosed to others
00016 *  without the prior written consent of Nokia.
00017 * ============================================================================
00018 */
00019 
00020 #ifndef AKNTABGRP_H
00021 #define AKNTABGRP_H
00022 
00023 //  INCLUDES
00024 #include <akncontrol.h>
00025 #include <coeccntx.h>
00026 #include <coecobs.h>
00027 #include <aknnavidecoratorobserver.h>
00028 #include "aknconsts.h"
00029 #include "aknutils.h"
00030 
00031 #include <avkon.mbg>
00032 
00033 
00034 // FORWARD DECLARATIONS
00035 
00036 class CEikLabel;
00037 class CEikImage;
00038 class CAknTabGroup;
00039 class CAknTabGroupExtension;
00040 class MAknTabObserver;
00041 class MAknNaviDecoratorObserver;
00042 class TAknWindowLineLayout;
00043 class CAknTabExtension;
00044 
00050 NONSHARABLE_CLASS(CAknTab) : public CAknControl
00051     {
00052 friend class CAknTabGroup;
00053 
00054 public:
00058     enum TAknTabDataType
00059         {
00061         EAknTabNone,
00063         EAknTabText,
00065         EAknTabIcon,
00067         EAknTabTextAndIcon
00068         };
00069 
00070 public:
00074     ~CAknTab();
00075 
00082     static CAknTab* NewL(const CCoeControl& aParent,TResourceReader& aReader);
00083 
00090     static CAknTab* NewLC(const CCoeControl& aParent,TResourceReader& aReader);
00091 
00099     static CAknTab* NewL( TInt aId,
00100                           const CCoeControl& aParent,
00101                           const TDesC& aTabText );
00102 
00110     static CAknTab* NewLC( TInt aId,
00111                            const CCoeControl& aParent,
00112                            const TDesC& aTabText );
00113 
00123     static CAknTab* NewL( TInt aId,
00124                           const CCoeControl& aParent,
00125                           const TDesC& aTabText,
00126                           const CFbsBitmap* aTabBitmap,
00127                           const CFbsBitmap* aMask = NULL );
00128 
00138     static CAknTab* NewLC( TInt aId,
00139                            const CCoeControl& aParent,
00140                            const TDesC& aTabText,
00141                            const CFbsBitmap* aTabBitmap,
00142                            const CFbsBitmap* aMask = NULL );
00143 
00152     static CAknTab* NewL( TInt aId,
00153                           const CCoeControl& aParent,
00154                           const CFbsBitmap* aTabBitmap,
00155                           const CFbsBitmap* aMask = NULL );
00156 
00165     static CAknTab* NewLC( TInt aId,
00166                            const CCoeControl& aParent,
00167                            const CFbsBitmap* aTabBitmap,
00168                            const CFbsBitmap* aMask = NULL );
00169 
00174     void ReplaceTextL(const TDesC& aTabText);
00175 
00181     void SetActive(TBool aActive,TDrawNow aDrawNow);
00182 
00187     TBool Active() const;
00188 
00193     TInt Id() const;
00194 
00199     enum TAknTabDataType TabType() const;
00200 
00201 
00205     void SetTotalAmountOfTabs(TInt aAmount);
00206 
00212     void SetNarrowTabLayout(TBool aNarrow);
00213 
00214 public: // from CCoeControl
00215 
00220     virtual TSize MinimumSize();
00221 
00227     virtual void SetDimmed(TBool aDimmed);
00228 
00235     virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00236 
00237 protected: // from CCoeControl
00238 
00243     virtual void SizeChanged();
00244 
00251     virtual TInt CountComponentControls() const;
00252 
00259     virtual CCoeControl* ComponentControl(TInt aIndex) const;
00260 
00268     virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00269 
00270 private:
00274     IMPORT_C void* ExtensionInterface( TUid aInterface );
00275 
00276 private:
00277     virtual void Draw(const TRect& aRect) const;
00278 
00279 private:
00280     CAknTab(TInt aId);
00281 
00282     void ConstructFromResourceL(TResourceReader& aReader);
00283     void ConstructL(const TDesC& aTabText);
00284     void ConstructL( const CFbsBitmap* aTabBitmap,
00285                      const CFbsBitmap* aMask = NULL );
00286 
00287     void LoadColorBitmapL();
00288 
00294     void HandleResourceChange( TInt aType );
00295 
00296     void SizeChangedInNormalLayout();
00297     void SizeChangedInFlatLayout();
00298     void SizeChangedInNarrowLayout();
00299 
00300 private:
00301     CEikLabel* iLabel;
00302     TInt iId;
00303     TBool iActive;
00304 
00305     const CFbsBitmap* iBitmap;
00306     const CFbsBitmap* iBitmapMask;
00307     TAknLayoutRect    iBitmapRect;
00308 
00309     CAknTabExtension* iExtension;
00310     typedef CArrayPtrFlat<CFbsBitmap> CAknTabColorBitmapArray;
00311     CAknTabColorBitmapArray* iColorBitmaps;
00312     };
00313 
00314 
00318 class CAknTabGroup : public CAknControl,
00319                      public MCoeControlObserver,
00320                      public MCoeControlContext,
00321                      public MAknNaviDecoratorObserver
00322     {
00323 public:
00327     IMPORT_C ~CAknTabGroup();
00328 
00334     IMPORT_C static CAknTabGroup* NewL(const CCoeControl& aParent);
00335 
00341     IMPORT_C static CAknTabGroup* NewLC(const CCoeControl& aParent);
00342 
00343 public:
00350     IMPORT_C TInt AddTabL(TResourceReader& aReader);
00351 
00358     IMPORT_C void AddTabL(TInt aTabId, const TDesC& aText);
00359 
00368     IMPORT_C void AddTabL( TInt aTabId,
00369                            const TDesC& aText,
00370                            const CFbsBitmap* aTabBitmap,
00371                            const CFbsBitmap* aMask = NULL );
00372 
00380     IMPORT_C void AddTabL(TInt aTabId, const CFbsBitmap* aTabBitmap,
00381                                         const CFbsBitmap* aMask = NULL);
00388     IMPORT_C void ReplaceTabL(TResourceReader& aReader);
00389 
00396     IMPORT_C void ReplaceTabL(TInt aTabId, const TDesC& aText);
00397 
00406     IMPORT_C void ReplaceTabL( TInt aTabId,
00407                                const TDesC& aText,
00408                                const CFbsBitmap* aTabBitmap,
00409                                const CFbsBitmap* aMask = NULL );
00410 
00418     IMPORT_C void ReplaceTabL(TInt aTabId, const CFbsBitmap* aTabBitmap,
00419                                         const CFbsBitmap* aMask = NULL);
00420 
00427     IMPORT_C void ReplaceTabTextL(TInt aTabId, const TDesC& aTabText);
00428 
00434     IMPORT_C void DeleteTabL(TInt aTabId);
00435 
00441     IMPORT_C void SetActiveTabById(TInt aTabId);
00442 
00448     IMPORT_C void SetActiveTabByIndex(TInt aTabIndex);
00449 
00455     IMPORT_C TInt ActiveTabId() const;
00456 
00462     IMPORT_C TInt ActiveTabIndex() const;
00463 
00473     IMPORT_C void SetTabFixedWidthL(TInt aWidth);
00474 
00475     IMPORT_C void DimTab(TInt aTabId,TBool aDimmed);
00476 
00477     IMPORT_C virtual TBool IsTabDimmed(TInt aTabId) const;
00478 
00485     IMPORT_C virtual TInt TabIndexFromId(TInt aTabId) const;
00486 
00493     IMPORT_C virtual TInt TabIdFromIndex(TInt aTabIndex) const;
00494 
00500     IMPORT_C virtual TInt TabCount() const;
00501 
00507     IMPORT_C void SetObserver(MAknTabObserver* aObserver);
00508 
00509 public: // from CCoeControl
00510 
00516     IMPORT_C virtual TSize MinimumSize();
00517 
00524     IMPORT_C virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
00525                                                   TEventCode aType );
00526 
00532     IMPORT_C virtual void GetColorUseListL(
00533         CArrayFix<TCoeColorUse>& aColorUseList ) const;
00534 
00538     void HandleResourceChange(TInt aType);
00539 
00545     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00546 
00547 public: // from MCoeControlObserver
00548 
00554     IMPORT_C virtual void HandleControlEventL( CCoeControl* aControl,
00555                                                TCoeEvent aEventType );
00556 
00557 public: // from MCoeControlContext
00558 
00564     IMPORT_C virtual void PrepareContext(CWindowGc& aGc) const;
00565 
00566 public:
00567     /*
00568     * From MAknNaviDecoratorObserver
00569     * Handles events from NaviDecorator
00570     * @param aEventID ID of event to be handled
00571     */
00572     IMPORT_C virtual void HandleNaviDecoratorEventL( TInt aEventID );
00573 
00574 protected:  // from CCoeControl
00575 
00579     IMPORT_C virtual void SizeChanged();
00580 
00587     IMPORT_C virtual TInt CountComponentControls() const;
00588 
00594     IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const;
00595 
00599     IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
00600 
00604     void ReverseTabOrderL();
00605 private:
00606     /*
00607     * Reserved
00608     */
00609     IMPORT_C virtual void Reserved1();
00610 
00611     /*
00612     * Reserved
00613     */
00614     IMPORT_C virtual void Reserved2();
00615 
00616     /*
00617     * Reserved
00618     */
00619     IMPORT_C virtual void Reserved3();
00620 
00621 
00622 private:
00623     IMPORT_C CAknTabGroup();
00624 
00638     TInt ConvertTabIndex(TInt aIndex) const;
00639 
00640 private:
00641     IMPORT_C virtual void Draw(const TRect& aRect) const;
00642 
00643 private:
00647     IMPORT_C void* ExtensionInterface( TUid aInterface );
00648 
00649 private:
00650     enum TDirection
00651         {
00652         ELeft,
00653         ERight
00654         };
00655 
00656 private:
00657     void ConstructL();
00658     void CommonAddTabL(CAknTab* aTab);
00659     void CommonReplaceTabL(CAknTab* aTab);
00660     void HandleTabStateChanged(CCoeControl* aControl);
00661     TInt Index(TInt aTabId) const;
00662     TBool CycleFocus(TDirection aDirection,TDrawNow aDrawNow);
00663     TInt LeftMostTabIndex() const;
00664     TInt RightMostTabIndex() const;
00665     void DrawLowerBorder(TDrawNow aDrawNow) const;
00666     void DoDrawLowerBorder() const;
00667     void ReportNavigationEvent();
00668     void LoadTabBitmapsL(TInt aNumberOfTabsShown, TBool aLongTabs);
00669     TBool TabsVisibleInCurrentLayout() const;
00670     void CurrentLayout( TAknWindowLineLayout& aLayout ) const;
00671     void InitTabGroupGraphicsL();
00672 
00673     void InitTabAnimationEventTimer();
00674     void CancelTabAnimationEventTimer();
00675     static TInt TabAnimationEvent(TAny * aPtr);
00676     void DoTabAnimationEvent();
00677 
00678     TBool NarrowTabLayoutNext();
00679     TBool NarrowTabLayout();
00680     void SetDecoratorLayout(TBool aNarrow);
00681 
00682     void SizeChangedInNormalLayout();
00683     void SizeChangedInFlatLayout();
00684     void SizeChangedInNarrowLayout();
00685     void InitTabAnimationDoubleBufferL( TBool aCreateDoubleBuffer,
00686                                         TBool aForcedDraw );
00687 
00688     static TRect ParentRect();
00689 
00690 public:
00691 
00692     /*
00693      * Used by the UI framework. Applications can set the narrow
00694      * layout using CAknNaviDecorator class.
00695      */
00696     void SetNarrowTabLayoutL(TBool aNarrow);
00697 
00698 private:
00699     CArrayPtr<CAknTab>* iTabArray;
00700     TInt iActiveTab;
00701     TRect iSpareRect;
00702 
00703     TInt iTabFixedWidth;
00704     TBool iLongTabs;
00705     TInt iNumberOfTabsShown;
00706     TInt iFirstShownTab;
00707 
00708     CFbsBitmap* iTabBitmaps[KTabNumberOfTabBitmaps];
00709     CFbsBitmap* iTabMaskBitmaps[KTabNumberOfTabBitmaps];
00710 
00711     TInt iBitmapNames[KTabNumberOfTabBitmaps];
00712     TInt iBitmapMaskNames[KTabNumberOfTabBitmaps];
00713     CAknTabGroupExtension*  iExtension;
00714 
00715     MAknTabObserver* iTabObserver;
00716     TBool            iMirrored;
00717     };
00718 
00719 // AKNTABGRP_H
00720 #endif

Copyright © Nokia Corporation 2001-2008
Back to top