calendarui/views/inc/calenicondrawer.h
author Maximilian Odendahl <maxodendahl@gmail.com>
Sun, 20 Jun 2010 22:55:39 +0200
branchRCL_3
changeset 23 51372538e3d3
parent 0 f979ecb2b13e
child 27 aba12c885d83
permissions -rw-r--r--
Merge both heads

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   Draws alarm/repeat icons in entry viewer
 *
*/



#ifndef CALENICONDRAWER_H
#define CALENICONDRAWER_H

//  INCLUDES
#include <AknUtils.h>
#include <calenservices.h>

// FORWARD DECLARATIONS
class TAknLayoutRect;
class CFbsBitmap;
class CAknIconArray;
class MCalenServices;

// CLASS DECLARATION

/**
*  Icon drawer for entry viewer
*  Draws alarm/repeat icons at the top of the entry viewer.
*
*  @lib CalenDefaultEditors
*  @since Series 60 3.2
*/
NONSHARABLE_CLASS( CCalenIconDrawer ) : public CPicture
    {
    public:     // Constructors and destructor

        /**
        * Two phased constructor.
        */
        static CCalenIconDrawer* NewL( MCalenServices& aServices );

        /**
        * Destructor.
        */
        virtual ~CCalenIconDrawer();

    public:     // From CPicture

        /**
        * Draw
        */
        void Draw( CGraphicsContext& aGc, 
                       const TPoint& aTopLeft,
                       const TRect& aClipRect, 
                       MGraphicsDeviceMap* aMap ) const;

        /**
        * ExternalizeL
        */
        void ExternalizeL( RWriteStream& aStream ) const;

        /**
        * Returns the picture's size in twips.
        * @param aSize Size.
        */
        void GetOriginalSizeInTwips( TSize& aSize ) const;

        void AddIconL( MCalenServices::TCalenIcons aIconIndex );
        void SetIconSizesFromLayout(TInt aNumOfLinesBefLocField = 0);
        TInt WidthInPixels();

    public:
        void HandleResourceChange();

    private:
        CAknIconArray* CreateIconsL( const RArray<MCalenServices::TCalenIcons>& aIndexArray );
        TInt IconIndex( MCalenServices::TCalenIcons aType ) const;
        
        /**
        * Fuction to set map icon size
        */
        void SetMapIconSize(TRect aIconRect);

        enum TCalViewerIconSlot
            {
            ENoIcons,
            EOneIcon,
            ETwoIcons,
            EThreeIcons
            };
        CCalenIconDrawer( MCalenServices& aServices );
        void ConstructL();

        TRect iFirstIconRect;            // First icon Size and position
        TRect iSecondIconRect;           // Second icon Size and position
        TRect iThirdIconRect;            // Third icon Size and position

        TInt iFirstIconIndex;
        TInt iSecondIconIndex;
        TInt iThirdIconIndex;
        TBool isMapIconAdded;
        TCalViewerIconSlot iIconCount;  // Number of icons added to the icon drawer
        CAknIconArray* iIconArray;
        MCalenServices& iServices;
        RArray<MCalenServices::TCalenIcons> iIconIndices;
    };

#endif      // CALENICONDRAWER_H


// End of File