uifw/AvKon/akncompamode/inc/akncompabutton.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 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:  Compatibility mode keyboard button
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __AKNCOMPABUTTON_H__
       
    20 #define __AKNCOMPABUTTON_H__
       
    21 
       
    22 #include <coecobs.h>    // MCoeControlObserver
       
    23 #include <aknbutton.h>
       
    24 
       
    25 /**
       
    26  * Compatibility mode keyboard button
       
    27  *
       
    28  * Single button of compa-keyboard
       
    29  *
       
    30  * @since S60 v5.0
       
    31  */
       
    32 NONSHARABLE_CLASS(CAknCompaButton) : public CAknButton,
       
    33     public MCoeControlObserver
       
    34     {
       
    35 public: // types
       
    36     enum TButtonState
       
    37         {
       
    38         EButtonUp,
       
    39         EButtonDown,
       
    40         ENumStates
       
    41         };
       
    42 
       
    43 public: // constructors
       
    44 
       
    45     static CAknCompaButton* NewLC(TResourceReader& aReader);
       
    46 
       
    47 public: // new functions
       
    48 
       
    49     void SetButtonUpL();
       
    50     TInt ScanCode();
       
    51     void UpdateColors();
       
    52     void LayoutIconAndText();
       
    53     TBool IsLockedDown();
       
    54     TBool IsPressed();
       
    55     TBool IsRocker();
       
    56    
       
    57 protected: // from CAknButton
       
    58 
       
    59     void ConstructFromResourceL(TResourceReader& aReader);
       
    60 
       
    61     void ActivateL();
       
    62 
       
    63     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    64    
       
    65 //    void Draw( const TRect& aRect ) const;
       
    66     
       
    67 private: // functions
       
    68     CAknCompaButton(TInt aFlags);   
       
    69 
       
    70     void FeedEventToAknButtonL(TButtonState aState);
       
    71     void TactileFeedback();
       
    72     CGulIcon* GetIconLC(TInt aBmpId, TInt aMaskId);
       
    73 
       
    74 private: // from MCoeControlObserver
       
    75 
       
    76     /**
       
    77     * This function is called when a control for which this control is the
       
    78     * observer calls CCoeControl::ReportEventL(). Button pointer events are
       
    79     * handled here.
       
    80     * @param aControl The control that sent the event.
       
    81     * @param aEventType The event type. 
       
    82     */
       
    83     void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType);
       
    84 
       
    85     void HandleResourceChange(TInt aType);
       
    86 
       
    87 private: // data
       
    88     TInt iScanCode;
       
    89     TSize iIconSize;
       
    90    
       
    91     struct
       
    92         {
       
    93         bool iHasIcon:1;
       
    94         bool iHasText:1;
       
    95         bool iLongTap:1; // long tap event received
       
    96         bool iIsRocker:1; // button is a rocker button
       
    97         } iFlags;
       
    98     };
       
    99 
       
   100 #endif // __AKNCOMPABUTTON_H__