williamr@4: /*
williamr@4: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@4: * All rights reserved.
williamr@4: * This component and the accompanying materials are made available
williamr@4: * under the terms of "Eclipse Public License v1.0"
williamr@4: * which accompanies this distribution, and is available
williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4: *
williamr@4: * Initial Contributors:
williamr@4: * Nokia Corporation - initial contribution.
williamr@4: *
williamr@4: * Contributors:
williamr@4: *
williamr@4: * Description:  Defines a concrete public class 
williamr@4: *                CAknsFrameBackgroundControlContext.
williamr@4: *
williamr@4: */
williamr@4: 
williamr@4: 
williamr@4: #ifndef AKNSFRAMEBACKGROUNDCONTROLCONTEXT_H
williamr@4: #define AKNSFRAMEBACKGROUNDCONTROLCONTEXT_H
williamr@4: 
williamr@4: //  INCLUDES
williamr@4: #include <AknsLayeredBackgroundControlContext.h>
williamr@4: 
williamr@4: // CLASS DECLARATION
williamr@4: 
williamr@4: /**
williamr@4: *  Implementation of a control context that provides a layout background 
williamr@4: *  generated from a frame item.
williamr@4: *
williamr@4: *  This is a public class with exported functions.
williamr@4: *  The class is not intended for derivation outside the library.
williamr@4: *
williamr@4: *  @lib AknSkins.lib
williamr@4: *
williamr@4: *  @since 2.0
williamr@4: */
williamr@4: NONSHARABLE_CLASS(CAknsFrameBackgroundControlContext) : 
williamr@4:     public CAknsLayeredBackgroundControlContext
williamr@4:     {
williamr@4:     public:  // Constructors and destructor
williamr@4:         
williamr@4:         /**
williamr@4:         * Two-phased constructor.
williamr@4:         *
williamr@4:         * @since 2.0
williamr@4:         *
williamr@4:         * @param aFrameID Item ID of the entire frame.
williamr@4:         *
williamr@4:         * @param aOuterRect Outer rectangle of the frame.
williamr@4:         *
williamr@4:         * @param aInnerRect Inner rectangle of the frame.
williamr@4:         *
williamr@4:         * @param aParentAbsolute ETrue if parent absolute layout should be
williamr@4:         *   used, EFalse otherwise. If a parent absolute layout is used,
williamr@4:         *   the parent position must be set and updated using SetParentPos.
williamr@4:         *
williamr@4:         * @return Newly constructed object.
williamr@4:         */
williamr@4:         IMPORT_C static CAknsFrameBackgroundControlContext* NewL(
williamr@4:             const TAknsItemID& aFrameID, const TRect& aOuterRect, 
williamr@4:             const TRect& aInnerRect, const TBool aParentAbsolute );
williamr@4:         
williamr@4:         /**
williamr@4:         * Destructor.
williamr@4:         */
williamr@4:         virtual ~CAknsFrameBackgroundControlContext();
williamr@4: 
williamr@4:     public: // New functions
williamr@4:         
williamr@4:         /**
williamr@4:         * Reconstructs the entire frame from the given item ID.
williamr@4:         *
williamr@4:         * @since 2.0
williamr@4:         *
williamr@4:         * @param aID Item ID of the entire frame.
williamr@4:         */
williamr@4:         IMPORT_C void SetFrame( const TAknsItemID& aFrameID );
williamr@4: 
williamr@4:         /**
williamr@4:         * Sets the outer and the inner rectangles of the frame. 
williamr@4:         *
williamr@4:         * @since 2.0
williamr@4:         *
williamr@4:         * @param aOuterRect The outer rectangle of the frame.
williamr@4:         *
williamr@4:         * @param aInnerRect The inner rectangle of the frame.
williamr@4:         */
williamr@4:         IMPORT_C void SetFrameRects( const TRect& aOuterRect, 
williamr@4:             const TRect& aInnerRect );
williamr@4: 
williamr@4:         /**
williamr@4:         * Overrides the center part of the frame.
williamr@4:         *
williamr@4:         * @since 2.0
williamr@4:         *
williamr@4:         * @param aID Item ID of the center part to be used.
williamr@4:         */
williamr@4:         IMPORT_C void SetCenter( const TAknsItemID& aID );
williamr@4: 
williamr@4:         /**
williamr@4:         * Sets the rectangle of a single part of the frame.
williamr@4:         *
williamr@4:         * @since 2.0
williamr@4:         *
williamr@4:         * @param aRect Rectangle of the specific part of the frame.
williamr@4:         *
williamr@4:         * @param aFrameElement Element (index) of the frame element 
williamr@4:         *   to which the rectangle is applied.
williamr@4:         *
williamr@4:         */
williamr@4:         IMPORT_C void SetFramePartRect( const TRect& aRect,
williamr@4:             const TAknsFrameElementIndex aFrameElement );
williamr@4: 
williamr@4:     public: // From MAknsControlContext
williamr@4: 
williamr@4:         /**
williamr@4:         * @copydoc MAknsControlContext::IsCompatibleWithType
williamr@4:         */
williamr@4:         TBool IsCompatibleWithType( const TAknsControlContextType aType ) const;
williamr@4: 
williamr@4:         /**
williamr@4:         * Updates the control context, if necessary.
williamr@4:         * This method is called by the framework before drawing with the 
williamr@4:         * context.
williamr@4:         *
williamr@4:         * Implementation in CAknsFrameBackgroundControlContext updates the
williamr@4:         * items to ensure that transition between single-bitmap and 
williamr@4:         * multi-bitmap frames work as expected.
williamr@4:         *
williamr@4:         * @since 2.6
williamr@4:         *
williamr@4:         * @return Return value reserved for future use. Currently returns 0.
williamr@4:         */
williamr@4:         TInt UpdateContext();
williamr@4: 
williamr@4:     protected: // New methods
williamr@4: 
williamr@4:         /**
williamr@4:         * Updates the type-dependant parameters of the frame.
williamr@4:         *
williamr@4:         * @since 2.6
williamr@4:         *
williamr@4:         * @internal
williamr@4:         */
williamr@4:         void UpdateFrame();
williamr@4:         
williamr@4:     protected:
williamr@4: 
williamr@4:         /**
williamr@4:         * C++ constructor.
williamr@4:         */
williamr@4:         CAknsFrameBackgroundControlContext();
williamr@4: 
williamr@4:         /**
williamr@4:         * Symbian 2nd phase constructor.
williamr@4:         */
williamr@4:         void ConstructL( const TAknsItemID& aFrameID, const TRect& aOuterRect, 
williamr@4:             const TRect& aInnerRect, const TBool aParentAbsolute );
williamr@4: 
williamr@4:     protected: // Data
williamr@4:         TAknsItemID iFrameID;
williamr@4:         TAknsItemID iCenterID;
williamr@4: 
williamr@4:         TRect iInnerRect;
williamr@4:         TRect iOuterRect;
williamr@4: 
williamr@4:         TBool iSingleElementFrame;
williamr@4: 
williamr@4:     };
williamr@4: 
williamr@4: #endif      // AKNSFRAMEBACKGROUNDCONTROLCONTEXT_H
williamr@4:             
williamr@4: // End of File