classicui_plat/battery_pane_api/inc/aknbattery.h
changeset 0 2f259fa3e83a
child 5 aabf2c525e0f
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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 "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Control to show battery strength indicator on the
       
    15 *                status pane's battery pane.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef AKNBATTERY_H
       
    21 #define AKNBATTERY_H
       
    22 
       
    23 #include <coecntrl.h>
       
    24 
       
    25 class CEikImage;
       
    26 class CAknBatteryIcon;
       
    27 class CAknBatteryStrength;
       
    28 class CAknBatteryDataObserver;
       
    29 
       
    30 /**
       
    31 * A default control in the status pane's battery pane. 
       
    32 * The control draws battery strength indicator graphics.
       
    33 */
       
    34 class CAknBatteryPane : public CCoeControl
       
    35     {
       
    36 public:
       
    37     /**
       
    38     * Constructor.
       
    39     */
       
    40     IMPORT_C CAknBatteryPane();
       
    41 
       
    42     /**
       
    43     * Destructor.
       
    44     */
       
    45     IMPORT_C ~CAknBatteryPane();
       
    46     
       
    47     /**
       
    48     * Resource constructor.
       
    49     * @param aReader Resource reader.
       
    50     */
       
    51     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
       
    52     
       
    53     /**
       
    54     * Sets battery strength value to the battery indicator.
       
    55     * @param aLevel Battery strength value ( 0 - 7 ).
       
    56     */
       
    57     IMPORT_C void SetBatteryLevel(TInt aLevel);
       
    58 
       
    59     /**
       
    60     * Gets battery strength value from the battery indicator.
       
    61     * @return Battery strength value ( 0 - 7 ).
       
    62     */
       
    63 	TInt BatteryLevel();
       
    64 
       
    65     /**
       
    66     * Sets battery recharging animation on/off.
       
    67     * @param aRecharging ETrue if animation is to be shown.
       
    68     */
       
    69     void SetRecharge(TBool aRecharging);
       
    70 
       
    71     /**
       
    72     * Tells if battery recharging animation is on/off.
       
    73     * @return ETrue if animation is to be shown.
       
    74     */
       
    75 	TBool Recharging();
       
    76 	
       
    77 	/**
       
    78     * Gets the battery state value from the battery indicator.
       
    79     * @return  Battery state value.
       
    80     */
       
    81     TInt BatteryState();
       
    82     
       
    83     /**
       
    84     * Sets the battery state value for the battery indicator.
       
    85     * @param  aState  Battery state value.
       
    86     */
       
    87     void SetBatteryStateL( TInt aState );
       
    88 
       
    89 protected: // From CCoeControl
       
    90 
       
    91     /**
       
    92     * From CCoeControl. Handle the size change events.
       
    93     */
       
    94     IMPORT_C void SizeChanged();
       
    95 
       
    96     /**
       
    97     * From CCoeControl. Handle the position change events.
       
    98     */
       
    99 	IMPORT_C void PositionChanged();
       
   100 
       
   101     /**
       
   102 	 * Handles a change to the control's resources of type aType
       
   103 	 * which are shared across the environment.
       
   104 	 * @param aType Event type.
       
   105 	 */
       
   106     IMPORT_C void HandleResourceChange( TInt aType );
       
   107 
       
   108     /**
       
   109     * From CCoeControl. Returns number of controls inside the context pane control.
       
   110     * @return Number of component controls.
       
   111     */
       
   112     IMPORT_C TInt CountComponentControls() const;
       
   113 
       
   114     /**
       
   115     * From CCoeControl. Returns a control determined by control id.
       
   116     * @param anIndex Index of a control to be returned.
       
   117     * @return Pointer to control
       
   118     */
       
   119     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
       
   120     
       
   121 public:
       
   122     /**
       
   123     * From CCoeControl. Handles pointer event
       
   124     * @param aPointerEvent Pointer event to be handled
       
   125     */
       
   126 	void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   127 
       
   128 private:
       
   129     /**
       
   130     * From CAknControl
       
   131     */
       
   132     IMPORT_C void* ExtensionInterface( TUid aInterface );
       
   133 
       
   134 private:
       
   135     IMPORT_C void ConstructL();
       
   136     
       
   137 private: // From CCoeControl
       
   138     IMPORT_C virtual void Draw(const TRect& aRect) const;
       
   139 
       
   140 private:
       
   141     void DrawInNormalStatusPane(const TRect& aRect) const;
       
   142     void DrawInFlatStatusPane(const TRect& aRect) const;
       
   143     void DrawInStaconPane(const TRect& aRect) const;
       
   144     void SetContainerWindowNonFading(TBool aNonFading);
       
   145 	static TInt TickerCallback(TAny* aThis);
       
   146 	TInt DoTick();
       
   147     
       
   148 private:
       
   149     CAknBatteryIcon*         iBatteryIconControl;
       
   150     CAknBatteryStrength*     iBatteryStrengthControl;
       
   151     TInt                     iPrivateFlags;
       
   152     TInt                     iBatteryLevel;    
       
   153     CAknBatteryDataObserver* iDataObserver;
       
   154     CPeriodic* 			     iTicker;
       
   155     TBool                    iIsActiveIdle;
       
   156     };
       
   157 
       
   158 #endif // AKNBATTERY_H