williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * A default control in the status pane's context pane. williamr@2: * williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef AKNCONTEXT_H williamr@2: #define AKNCONTEXT_H williamr@2: williamr@2: #include williamr@2: williamr@2: class CEikImage; williamr@2: class CAknContextPaneExtension; williamr@2: williamr@2: /** williamr@2: * A default control in the status pane's context pane. williamr@2: */ williamr@2: class CAknContextPane : public CAknControl williamr@2: { williamr@2: public: williamr@2: williamr@2: DECLARE_TYPE_ID(0x101F8741) williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Standard constructor williamr@2: */ williamr@2: IMPORT_C CAknContextPane(); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknContextPane(); williamr@2: williamr@2: /** williamr@2: * 2nd phase construction williamr@2: * williamr@2: */ williamr@2: IMPORT_C void ConstructL(); williamr@2: williamr@2: /** williamr@2: * Construct from resources. williamr@2: * @param aReader resource reader. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: /** williamr@2: * Sets bitmap with mask to the context pane and shows it in the status pane's williamr@2: * context pane. Context pane object takes ownership of the bitmap. williamr@2: * @param aBitmap new bitmap to the context pane. williamr@2: * @param aMaskBitmap mask of the bitmap. williamr@2: */ williamr@2: IMPORT_C void SetPicture(const CFbsBitmap* aBitmap, williamr@2: const CFbsBitmap* aMaskBitmap = NULL); williamr@2: williamr@2: /** williamr@2: * Sets bitmap to the context pane and shows it in the status pane's williamr@2: * context pane. Context pane object takes ownership of the bitmap. williamr@2: * @param aImage new bitmap and its mask. williamr@2: */ williamr@2: IMPORT_C void SetPicture(CEikImage* aImage); williamr@2: williamr@2: /** williamr@2: * Sets bitmap to the context pane from file and shows it in the status pane's williamr@2: * context pane. williamr@2: * @param aFileName name of the bitmap file. williamr@2: * @param aMainId id of the bitmap in the bitmap file. williamr@2: * @param aMaskId id of the bitmap's mask in the bitmap file. williamr@2: */ williamr@2: IMPORT_C void SetPictureFromFileL(const TDesC& aFileName, williamr@2: TInt aMainId, TInt aMaskId = -1); williamr@2: williamr@2: /** williamr@2: * Set data from resource file and show it in the status pane's context pane. williamr@2: */ williamr@2: IMPORT_C void SetFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: /** williamr@2: * Show context pane's default bitmap. Application's AIF file icon is used if it exists. williamr@2: */ williamr@2: IMPORT_C void SetPictureToDefaultL(); williamr@2: williamr@2: /** williamr@2: * Returns a reference to the current context pane bitmap. The reference is lost when williamr@2: * context pane bitmap is changed with any Set -method including williamr@2: * SetPictureToDefaultL and SwapPicture) williamr@2: * @return Reference to the current context pane bitmap. williamr@2: */ williamr@2: IMPORT_C const CEikImage& Picture() const; williamr@2: williamr@2: /** williamr@2: * Sets bitmap with mask to the context pane and shows it in the status pane's williamr@2: * context pane. Context pane object takes ownership of the bitmap. williamr@2: * Old bitmap is returned and the caller is responsible of deleting the returned object. williamr@2: * @param aNewImage new bitmap to the context pane. This object takes ownership of aNewImage. williamr@2: * @return Previous context pane bitmap. The caller is responsible of deleting the returned object. williamr@2: */ williamr@2: IMPORT_C CEikImage* SwapPicture(CEikImage* aNewImage); williamr@2: williamr@2: /** williamr@2: * Set the background type. This method is used by the UI framework for williamr@2: * for syncronizing this components background type with navipane williamr@2: * background type. williamr@2: * williamr@2: * Available backgroud types are: williamr@2: * EAknNaviPaneBackgroundTypeNotDefined williamr@2: * EAknNaviPaneBackgroundTypeWipe williamr@2: * EAknNaviPaneBackgroundTypeSolid williamr@2: * williamr@2: * @param aType Background type. williamr@2: */ williamr@2: void SetNaviPaneBackgroundType(TInt aType); williamr@2: williamr@2: /** williamr@2: * From CCoeControl. williamr@2: * Handles pointer events williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: protected: // from CCoeControl williamr@2: williamr@2: /** williamr@2: * From CCoeControl. Handle the size change events. williamr@2: */ williamr@2: IMPORT_C virtual void SizeChanged(); williamr@2: williamr@2: /** williamr@2: * Handles a change to the control's resources of type aType williamr@2: * which are shared across the environment, e.g. color scheme change. williamr@2: * @param aType Event type. williamr@2: */ williamr@2: IMPORT_C virtual void HandleResourceChange(TInt aType); williamr@2: williamr@2: /** williamr@2: * From CCoeControl. Returns number of controls inside the context pane control. williamr@2: * @return Number of component controls. williamr@2: */ williamr@2: IMPORT_C virtual TInt CountComponentControls() const; williamr@2: williamr@2: /** williamr@2: * From CCoeControl. Returns a control determined by control id. williamr@2: * @param anIndex Index of a control to be returned. williamr@2: * @return Pointer to control williamr@2: */ williamr@2: IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const; williamr@2: williamr@2: private: // new functions williamr@2: void CommonConstructL(); williamr@2: williamr@2: /** williamr@2: * Returns application's Uid. In embedded applications, root application's Uid is returned. williamr@2: * @return Application's Uid. Root application's Uid is returned in embedded applications. williamr@2: */ williamr@2: TUid AppUid(); williamr@2: void ReadFromResourceFileL(TResourceReader& aReader); williamr@2: void LoadNaviWipeBitmapL(); williamr@2: void InitL(); williamr@2: void SetPictureSize(CFbsBitmap* aPicture, TSize aSize); williamr@2: williamr@2: private: // From CCoeControl williamr@2: IMPORT_C virtual void Draw(const TRect& aRect) const; williamr@2: williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: williamr@2: protected: williamr@2: // from CCoeControl williamr@2: TTypeUid::Ptr MopSupplyObject(TTypeUid aId); williamr@2: williamr@2: private: williamr@2: CAknContextPaneExtension* iExtension; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // AKNCONTEXT_H