phoneuis/dialer/inc/cdialerkeypadbutton.h
branchRCL_3
changeset 9 8871b09be73b
parent 0 5f000ab63145
child 14 24062c24fe38
--- a/phoneuis/dialer/inc/cdialerkeypadbutton.h	Tue Feb 02 00:10:04 2010 +0200
+++ b/phoneuis/dialer/inc/cdialerkeypadbutton.h	Fri Feb 19 22:50:26 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,6 +21,9 @@
 
 #include <e32base.h>
 #include <aknbutton.h>
+#include "dialercommon.h"
+
+const TMifDialer KDialerNoIcon = EMbmDialerLastElement;
 
 // CLASS DECLARATION
 
@@ -30,39 +33,185 @@
 *  @lib dialer.lib
 *  @since S60 v5.0
 */
-NONSHARABLE_CLASS( CDialerKeyPadButton ) : public CBase
+NONSHARABLE_CLASS( CDialerKeyPadButton ) : public CAknButton
     {
     public:
     
-        CDialerKeyPadButton();
-
+        /**
+         * @param   aNumberLabel            The number (etc) of the key.
+         *                                  Reference must remain valid until reset with SetNumLabel
+         * @parem   aPrimaryAlphaLabel      The first row of alphabets of the key.
+         *                                  Reference must remain valid until reset with SetPrimaryAlphaLabel
+         * @param   aSecondaryAlphaLabel    The second row of alphabets of the key.
+         *                                  Reference must remain valid until reset with SetSecondaryAlphaLabel
+         * @param   aScanCode               The button scanCode. 
+         * @param   aKeyCode                The button keyCode.
+         * @param   aButtonIconId           The icon for the normal state.
+         * @param   aButtonIconMaskId       The icon mask for the normal state.
+         * @param   aFlags                  CAknButton flags
+         */
+        static CDialerKeyPadButton* NewLC( const TDesC& aNumberLabel,
+                                           const TDesC& aPrimaryAlphaLabel,
+                                           const TDesC& aSecondaryAlphaLabel,
+                                           TInt aScanCode, 
+                                           TInt aKeyCode,
+                                           TMifDialer aButtonIconId, 
+                                           TMifDialer aButtonIconMaskId,
+                                           TInt aFlags );  
+        
+        /**
+         * Destructor
+         */
         ~CDialerKeyPadButton();
-    
+        
     public:
-        CCoeControl* Control() const { return iButton; };
+
+        /**
+         * Scan code associated with the key.
+         */
         TInt ScanCode() const;
+        
+        /**
+         * Key code associated with the key
+         */
         TInt KeyCode() const;
-        void CreateButtonL( const TInt aScanCode,
-                            const TInt aKeyCode, 
-                            const TMifDialer aButtonIcon, 
-                            const TMifDialer aButtonIconMask );
-        void SetIconSize( TSize& aSize );                    
-        void HandleResourceChange( TInt aType );
-        void MapDialerIconToSkinIcon( const TInt aDialerIcon, 
-                                      TAknsItemID& aItemId ) const;  
+        
+        /**
+         * Set layout variety to be used
+         */
+        void SetVariety( TInt aVariety );
+        
+        /**
+         * Set operation mode of the keypad. Operation mode has rules,
+         * which labels are shown and how they are laid out.
+         */
+        void SetOperationMode( TDialerOperationMode aMode );
+        
+        /**
+         * Set number label for the key.
+         * @param   aLabel  Reference to new label text. The reference must remain
+         *                  valid until reset or this button is deleted.
+         */
+        void SetNumLabel( const TDesC& aLabel );
+
+        /**
+         * Set first row alphabet label.
+         * @param   aLabel  Reference to new label text. The reference must remain
+         *                  valid until reset or this button is deleted.
+         */
+        void SetPrimaryAlphaLabel( const TDesC& aLabel );
+        
+        /**
+         * Set second row alphabet label for the key.
+         * @param   aLabel  Reference to new label text. The reference must remain
+         *                  valid until reset or this button is deleted.
+         */
+        void SetSecondaryAlphaLabel( const TDesC& aLabel );
+        
+        /**
+         * Enable or disable audio feedback for this button.
+         * @param   aEnable ETrue if audio feedback should be enabled.
+         *                  EFalse otherwise.
+         */
         void EnableAudioFeedback( const TBool aEnable );
 
+    public: //from CAknButton
+        
+        /**
+         * @see CAknButton
+         */
+        void HandleResourceChange( TInt aType );
+
+    protected: // from CAknButton
+        
+        /**
+         * @see CAknButton
+         */
+        void Draw(const TRect& aRect) const;
+        
+        /**
+         * @see CAknButton
+         */
+        void SizeChanged();
+        
     private:
+
         void UpdateIconL();
+        void DrawIconAndText( CWindowGc& aGc ) const;
+        void GetTextColors( TRgb& aPenColor, TRgb& aBrushColor ) const; 
+        void MapDialerIconToSkinIcon( TInt aDialerIcon, 
+                                      TAknsItemID& aItemId ) const; 
+        
+    private: // constructors    
+        
+        /**
+         * C++ constructor
+         * 
+         * @param aNumberLabel          The number (etc) of the key.
+         * @param aPrimaryAlphaLabel    The first row of alphabets of the key.
+         * @param aSecondaryAlphaLabel  The second row of alphabets of the key.
+         * @param aScanCode             The button scanCode. 
+         * @param aKeyCode              The button keyCode.
+         * @param aButtonIconId         The icon for the normal state.
+         * @param aButtonIconMaskId     The mask icon for the normal state.
+         * @param   aFlags              CAknButton flags
+         */ 
+        CDialerKeyPadButton( const TDesC& aNumberLabel,
+                             const TDesC& aPrimaryAlphaLabel,
+                             const TDesC& aSecondaryAlphaLabel,
+                             TInt aScanCode, 
+                             TInt aKeyCode,
+                             TMifDialer aButtonIconId, 
+                             TMifDialer aButtonIconMaskId,
+                             TInt aFlags );
+        
+        /**
+         * Symbian 2nd phase constructor.
+         *
+         * @param aFlags Flags of the button.
+         */
+        void ConstructL( TInt aFlags );
         
     private: // data
-    
-        CAknButton*  iButton;
-        
+
+        /** Scan code of the key */
         TInt iScanCode;
+        
+        /** Key code of the key */
         TInt iKeyCode;
-        TMifDialer iButtonIcon;
-        TMifDialer iButtonIconMask;
+        
+        /** ID of the icon bitmap */
+        TMifDialer iButtonIconId;
+        
+        /** ID of the icon mask */
+        TMifDialer iButtonIconMaskId;
+        
+        /** Layout variety to use */
+        TInt iVariety;
+        
+        /** Operation mode of the keypad */
+        TDialerOperationMode iOperationMode;
+        
+        /** Layout for number */
+        TAknLayoutText iNumberLayout;
+        
+        /** Layout for primary row of alphabets */
+        TAknLayoutText iPrimaryAlphaLayout;
+        
+        /** Layout for secondar row of alphabets */
+        TAknLayoutText iSecondaryAlphaLayout;
+        
+        /** Label containing the number or hash or asterisk */
+        TPtrC iNumberLabel;
+        
+        /** Label containing first row of alphabets */
+        TPtrC iPrimaryAlphaLabel;  
+        
+        /** Label containing second row of alphabets */
+        TPtrC iSecondaryAlphaLabel;
+        
+        /** Rect inside the button where icon is drawn (if available) */
+        TRect iIconRect;
     };
 
 #endif // C_CDIALERKEYPADBUTTON_H