messagingappbase/msgeditor/mediacontrolinc/MsgFrameControl.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 14 Apr 2010 15:53:21 +0300
branchRCL_3
changeset 15 52d61119153d
parent 0 72b543305e3a
permissions -rw-r--r--
Revision: 201013 Kit: 201015

/*
* Copyright (c) 2005 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:  
*       MsgEditor Frame control
*
*/



#ifndef MSGFRAMECONTROL_H
#define MSGFRAMECONTROL_H

// INCLUDES
#include <coecntrl.h>

// CONSTANTS

// MACROS

// DATA TYPES

// FUNCTION PROTOTYPES

// FORWARD DECLARATIONS

// CLASS DECLARATION

// ==========================================================

/**
*  CMsgFrameControl is a class for drawing a frame
*  around the bitmap of CMsgMediaControl
*/
NONSHARABLE_CLASS( CMsgFrameControl ) : public CCoeControl
    {
    public:  // Constructor and destructor

        /**
        * Symbian constructor
        * @param aParent parent control
        */
        static CMsgFrameControl* NewL( const CCoeControl& aParent );

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

    public:

        /**
        * Called when size is changed.
        * @param aSize New size of the "image" (e.g. icon).
        */
        void SetImageSize( const TSize& aSize );

        /**
        * Size of the frame
        * @return size
        */
        TSize FrameSize() const;
        
        /**
        * Size of the frame borders i.e. thickness of frame.
        * The size includes both borders.
        * @return size
        */
        inline TSize FrameBorderSize() const;

        /**
        * To support media control reloading without creating new control
        */
        inline void ResetFrameSize();

    protected: // from CCoeControl

        /**
        * Draw Control
        * From CCoeControl
        */
        void Draw( const TRect& aRect ) const;
        
        /**
         * Handles resource change events.
         * From CCoeControl
         */
         void HandleResourceChange( TInt aType );
        
    private: // Constructors

        /**
        * Hidden C++ default constructor.
        */
        CMsgFrameControl();

        /**
        * By default Symbian constructor is private.
        * @param aParent parent control
        */
        void ConstructL( const CCoeControl& aParent );
        
        /**
        * Set correct frame size
        */
        void SetFrameSize();
        
    private: //Data

        TSize iFrameBorderSize;
        TSize iFrameSize;
        TBool iImageSizeSet;
    };


// ---------------------------------------------------------
// FrameBorderSize
//
// ---------------------------------------------------------
//
inline TSize CMsgFrameControl::FrameBorderSize() const
    {
    return iFrameBorderSize;
    }


// ---------------------------------------------------------
// ResetFrameSize
//
// ---------------------------------------------------------
//
inline void CMsgFrameControl::ResetFrameSize()
    {
    iFrameSize.iWidth = 0;
    iFrameSize.iHeight = 0;
    }

#endif // MSGFRAMECONTROL_H