epoc32/include/mw/akncontext.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 akncontext.h
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     A default control in the status pane's context pane.
       
    16 *     
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef AKNCONTEXT_H
       
    22 #define AKNCONTEXT_H
       
    23 
       
    24 #include <AknControl.h>
       
    25 
       
    26 class CEikImage;
       
    27 class CAknContextPaneExtension;
       
    28 
       
    29 /**
       
    30  * A default control in the status pane's context pane.
       
    31  */
       
    32 class CAknContextPane : public CAknControl
       
    33 	{
       
    34 public:
       
    35 
       
    36     DECLARE_TYPE_ID(0x101F8741) 
       
    37 
       
    38 public:
       
    39     
       
    40     /**
       
    41     * Standard constructor
       
    42     */
       
    43     IMPORT_C CAknContextPane();
       
    44     
       
    45     /**
       
    46     * Destructor
       
    47     */
       
    48     IMPORT_C ~CAknContextPane();
       
    49     
       
    50     /** 
       
    51     * 2nd phase construction
       
    52     *
       
    53     */
       
    54     IMPORT_C void ConstructL();
       
    55     
       
    56     /** 
       
    57     * Construct from resources.
       
    58     * @param aReader resource reader.
       
    59     */
       
    60     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
       
    61     
       
    62     /**
       
    63     * Sets bitmap with mask to the context pane and shows it in the status pane's 
       
    64     * context pane. Context pane object takes ownership of the bitmap.
       
    65     * @param aBitmap new bitmap to the context pane.
       
    66     * @param aMaskBitmap mask of the bitmap.
       
    67     */
       
    68     IMPORT_C void SetPicture(const CFbsBitmap* aBitmap, 
       
    69         const CFbsBitmap* aMaskBitmap = NULL);
       
    70     
       
    71     /**
       
    72     * Sets bitmap to the context pane and shows it in the status pane's 
       
    73     * context pane. Context pane object takes ownership of the bitmap.
       
    74     * @param aImage new bitmap and its mask.
       
    75     */
       
    76     IMPORT_C void SetPicture(CEikImage* aImage);
       
    77     
       
    78     /**
       
    79     * Sets bitmap to the context pane from file and shows it in the status pane's 
       
    80     * context pane.
       
    81     * @param aFileName name of the bitmap file.
       
    82     * @param aMainId id of the bitmap in the bitmap file.
       
    83     * @param aMaskId id of the bitmap's mask in the bitmap file.
       
    84     */
       
    85     IMPORT_C void SetPictureFromFileL(const TDesC& aFileName, 
       
    86                                                                TInt aMainId, TInt aMaskId = -1);
       
    87     
       
    88     /**
       
    89     * Set data from resource file and show it in the status pane's context pane.
       
    90     */
       
    91     IMPORT_C void SetFromResourceL(TResourceReader& aReader);
       
    92     
       
    93     /**
       
    94     * Show context pane's default bitmap. Application's AIF file icon is used if it exists.
       
    95     */
       
    96     IMPORT_C void SetPictureToDefaultL();
       
    97     
       
    98     /**
       
    99     * Returns a reference to the current context pane bitmap. The reference is lost when
       
   100     * context pane bitmap is changed with any Set -method including 
       
   101     * SetPictureToDefaultL and SwapPicture)
       
   102     * @return Reference to the current context pane bitmap.
       
   103     */
       
   104     IMPORT_C const CEikImage& Picture() const;
       
   105     
       
   106     /**
       
   107     * Sets bitmap with mask to the context pane and shows it in the status pane's 
       
   108     * context pane. Context pane object takes ownership of the bitmap.
       
   109     * Old bitmap is returned and the caller is responsible of deleting the returned object.
       
   110     * @param aNewImage new bitmap to the context pane. This object takes ownership of aNewImage.
       
   111     * @return Previous context pane bitmap. The caller is responsible of deleting the returned object.
       
   112     */
       
   113     IMPORT_C CEikImage* SwapPicture(CEikImage* aNewImage);
       
   114 
       
   115     /** 
       
   116     * Set the background type. This method is used by the UI framework for 
       
   117     * for syncronizing this components background type with navipane 
       
   118     * background type.
       
   119     * 
       
   120     * Available backgroud types are:
       
   121     *      EAknNaviPaneBackgroundTypeNotDefined  
       
   122     *      EAknNaviPaneBackgroundTypeWipe        
       
   123     *      EAknNaviPaneBackgroundTypeSolid       
       
   124     *
       
   125     * @param aType Background type.
       
   126     */
       
   127     void SetNaviPaneBackgroundType(TInt aType);
       
   128 
       
   129     /**
       
   130      * From CCoeControl.     
       
   131      * Handles pointer events
       
   132      */
       
   133     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   134     
       
   135 protected: // from CCoeControl
       
   136 
       
   137     /**
       
   138     * From CCoeControl. Handle the size change events.
       
   139     */
       
   140     IMPORT_C virtual void SizeChanged();
       
   141 
       
   142     /**
       
   143 	 * Handles a change to the control's resources of type aType
       
   144 	 * which are shared across the environment, e.g. color scheme change.
       
   145 	 * @param aType Event type.
       
   146 	 */
       
   147     IMPORT_C virtual void HandleResourceChange(TInt aType);
       
   148 
       
   149     /**
       
   150     * From CCoeControl. Returns number of controls inside the context pane control.
       
   151     * @return Number of component controls.
       
   152     */
       
   153     IMPORT_C virtual TInt CountComponentControls() const;
       
   154 
       
   155     /**
       
   156     * From CCoeControl. Returns a control determined by control id.
       
   157     * @param anIndex Index of a control to be returned.
       
   158     * @return Pointer to control
       
   159     */
       
   160     IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const;
       
   161 
       
   162 private: // new functions
       
   163     void CommonConstructL();
       
   164     
       
   165     /** 
       
   166     * Returns application's Uid. In embedded applications, root application's Uid is returned.
       
   167     * @return Application's Uid. Root application's Uid is returned in embedded applications.
       
   168     */
       
   169     TUid AppUid();
       
   170     void ReadFromResourceFileL(TResourceReader& aReader);
       
   171     void LoadNaviWipeBitmapL();
       
   172     void InitL();
       
   173     void SetPictureSize(CFbsBitmap* aPicture, TSize aSize);
       
   174 
       
   175 private: // From CCoeControl
       
   176     IMPORT_C virtual void Draw(const TRect& aRect) const;
       
   177 
       
   178 private:
       
   179     /**
       
   180     * From CAknControl
       
   181     */
       
   182     IMPORT_C void* ExtensionInterface( TUid aInterface );
       
   183 
       
   184 protected:
       
   185     // from CCoeControl
       
   186     TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
   187 
       
   188 private:
       
   189     CAknContextPaneExtension* iExtension;
       
   190 	};
       
   191 
       
   192 
       
   193 #endif // AKNCONTEXT_H