phoneuis/BubbleManager/Inc/BMTouchPane.h
changeset 0 5f000ab63145
child 34 b68fcd923911
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Container control for touch controls.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_BUBBLECTOUCHPANE_H
       
    20 #define C_BUBBLECTOUCHPANE_H
       
    21 
       
    22 #include <coecntrl.h>
       
    23 #include "BMTouchPaneInterface.h"
       
    24 
       
    25 class CBubbleTouchPaneButton;
       
    26 class CAknButton;
       
    27 class TResourceReader;
       
    28 
       
    29 /**
       
    30  *  Container control for touch buttons.
       
    31  *
       
    32  *
       
    33  *  @lib bubblemanager.lib
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 class CBubbleTouchPane : public CCoeControl,
       
    37                          public MBubbleTouchPaneInterface,
       
    38                          public MCoeControlObserver
       
    39     {
       
    40     public:
       
    41     
       
    42         /**
       
    43         * Two phase constructor.
       
    44         * @return New instance
       
    45         */
       
    46         static CBubbleTouchPane* NewL();
       
    47         
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CBubbleTouchPane();
       
    52         
       
    53         /**
       
    54         * To be called when skin is changed and icons
       
    55         * should be reloaded from skin server.
       
    56         */
       
    57         void HandleResourceChange( TInt aType );
       
    58         
       
    59         /**
       
    60         * To be called when BubbleManager is within start and end 
       
    61         * changes block. TouchPane doesn't draw itself during
       
    62         * update.
       
    63         * @param aUpdating ETrue when ui update is in progress
       
    64         *                  otherwise EFalse.
       
    65         */
       
    66         void SetUpdating( TBool aUpdating ); 
       
    67 
       
    68     protected: // From MBubbleTouchPaneInterface.
       
    69     
       
    70         /**
       
    71         * From MBubbleTouchPaneInterface.
       
    72         */    
       
    73         TInt SetButtonSet( TInt aResourceId );
       
    74         
       
    75         /**
       
    76         * From MBubbleTouchPaneInterface.
       
    77         */
       
    78         void SetButtonState( TInt aCommand );
       
    79         
       
    80         /**
       
    81         * From MBubbleTouchPaneInterface.
       
    82         */
       
    83         void SetButtonDimmed( TInt aCommand, TBool aDimmed );
       
    84         
       
    85         /**
       
    86         * From MBubbleTouchPaneInterface.
       
    87         */
       
    88         TInt NumberOfButtonsInPane()  const;
       
    89         
       
    90         /**
       
    91         * From MBubbleTouchPaneInterface.
       
    92         */
       
    93         TInt ButtonCommandId( TInt aButtonIndex ) const;
       
    94         
       
    95         /**
       
    96         * From MBubbleTouchPaneInterface.
       
    97         */
       
    98         TInt ReplaceButton( TInt aButtonIndex, TInt aResourceId );
       
    99         
       
   100         /**
       
   101         * From MBubbleTouchPaneInterface.
       
   102         */
       
   103         TBool ButtonHasState( TInt aButtonIndex, TInt aCommand ) const;
       
   104         
       
   105         /**
       
   106         * From MBubbleTouchPaneInterface.
       
   107         */
       
   108         void SetIconProvider(
       
   109             MBubbleTouchPaneIconProvider* aIconProvider );
       
   110 
       
   111     protected: // From CCoeControl
       
   112     
       
   113         /**
       
   114         * From CCoeControl.
       
   115         */
       
   116         void SizeChanged();
       
   117         
       
   118         /**
       
   119         * From CCoeControl.
       
   120         */
       
   121         TInt CountComponentControls() const;
       
   122         
       
   123         /**
       
   124         * From CCoeControl.
       
   125         */
       
   126         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   127         
       
   128         /**
       
   129         * From CCoeControl.
       
   130         */
       
   131         void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   132 
       
   133     protected: // MCoeControlObserver
       
   134     
       
   135         /**
       
   136         * From MCoeControlObserver.
       
   137         */
       
   138         void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType);    
       
   139 
       
   140     private:
       
   141     
       
   142         /**
       
   143         * Handles callback.
       
   144         */
       
   145         static TInt IdleCallback( TAny* aThis );
       
   146         
       
   147         /**
       
   148         * Resets and destroyes touch pane buttons.
       
   149         */
       
   150         void DoDeleteButtonsInIdle();
       
   151         
       
   152         /**
       
   153         * Creates buttons.
       
   154         */
       
   155         void LoadButtonsFromResourceL( TResourceReader& aReader );
       
   156         
       
   157         /**
       
   158         * Sets used button resource.
       
   159         */
       
   160         void SetButtonSetL( TInt aResourceId );
       
   161         
       
   162         /**
       
   163         * Replaces button with other.
       
   164         */
       
   165         void ReplaceButtonL( TInt aButtonIndex, TInt aResourceId );
       
   166         
       
   167     private:
       
   168 
       
   169         /**
       
   170         * C++ default constructor.
       
   171         */
       
   172         CBubbleTouchPane();
       
   173         
       
   174         /**
       
   175         * Symbian OS default constructor.
       
   176         */
       
   177         void ConstructL();
       
   178         
       
   179         
       
   180     private: // data
       
   181     
       
   182         // Array of buttons.
       
   183         RPointerArray<CBubbleTouchPaneButton> iButtons;
       
   184         
       
   185         // Owned.
       
   186         CIdle* iIdleProcessor;
       
   187         
       
   188         // Async delete information.
       
   189         TBool iDeleteButtonsAsync;
       
   190         
       
   191         // Button set id.
       
   192         TInt iCurrentButtonSetId;
       
   193         
       
   194         // Array of buttons to be deleted.
       
   195         RPointerArray<CBubbleTouchPaneButton> iButtonsToBeDeleted;
       
   196         
       
   197         // Icon provider.
       
   198         MBubbleTouchPaneIconProvider* iIconProvider;
       
   199         
       
   200         // UI updating status flag.
       
   201         TBool iUpdating;
       
   202     };
       
   203 
       
   204 #endif // C_BUBBLECTOUCHPANE_H