email/imum/Utils/Inc/IMSSoftkeyControl.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 "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:  IMSSoftkeyControl.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CIMSSOFTKEYCONTROL_H
       
    20 #define CIMSSOFTKEYCONTROL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <eikbtgpc.h>           // CEikButtonGroupContainer
       
    25 #include <eikcmobs.h>           // MEikCommandObserver
       
    26 #include <muiuflags.h>          // TMuiuFlags
       
    27 
       
    28 // CONSTANTS
       
    29 // MACROS
       
    30 // DATA TYPES
       
    31 enum TISCFlags
       
    32     {
       
    33     // Keep these flags and TISCObservedKeys in same order!
       
    34     EISCObservingLeftSoftkey = 0,
       
    35     EISCObservingUnknownKey,
       
    36     EISCObservingRightSoftkey,
       
    37     EISCObservingMiddleSoftkey,
       
    38     // Allow changing the middle soft key label
       
    39     EISCAllowMiddleSoftkeyLabelChange,
       
    40     EISCLastFlag
       
    41     };
       
    42 
       
    43 enum TISCObservedKeys
       
    44     {
       
    45     // Keep these keys and related flags in same order!
       
    46     EISCLeftSoftkey = 0,
       
    47     EISCUnknownKey,
       
    48     EISCRightSoftkey,
       
    49     EISCMiddleSoftkey
       
    50     };
       
    51 
       
    52 // FUNCTION PROTOTYPES
       
    53 // FORWARD DECLARATIONS
       
    54 // CLASS DECLARATION
       
    55 
       
    56 /**
       
    57 *
       
    58 *  @lib
       
    59 *  @since S60 3.1
       
    60 */
       
    61 NONSHARABLE_CLASS( CIMSSoftkeyControl ) : public CBase
       
    62     {
       
    63     public:  // Constructors and destructor
       
    64 
       
    65         /**
       
    66         * Creates object from CIMSSoftkeyControl and leaves it to cleanup stack
       
    67         * @since S60 3.1
       
    68         * @return, Constructed object
       
    69         */
       
    70         static CIMSSoftkeyControl* NewLC(
       
    71             CEikButtonGroupContainer& aSoftkeys );
       
    72 
       
    73         /**
       
    74         * Create object from CIMSSoftkeyControl
       
    75         * @since S60 3.1
       
    76         * @return, Constructed object
       
    77         */
       
    78         static CIMSSoftkeyControl* NewL(
       
    79             CEikButtonGroupContainer& aSoftkeys );
       
    80 
       
    81         /**
       
    82         * Destructor
       
    83         * @since S60 3.1
       
    84         */
       
    85         virtual ~CIMSSoftkeyControl();
       
    86 
       
    87     public: // New operators
       
    88 
       
    89         /**
       
    90         * Get a direct access to softkeys
       
    91         * @since S60 3.1
       
    92         * @return Reference to softkey container
       
    93         */
       
    94         CEikButtonGroupContainer& operator()();
       
    95 
       
    96     public: // New functions
       
    97 
       
    98 
       
    99         /**
       
   100         * Sets the observer to the specific key
       
   101         * @since S60 3.1
       
   102         * @param aSoftkey Key to be observed
       
   103         * @param aCommandObserver The observer for the key events
       
   104         * @return KErrNone, when setting the observer is succesful
       
   105         */
       
   106         TInt SetObserver(
       
   107             const TISCObservedKeys aSoftkey,
       
   108             MEikCommandObserver& aCommandObserver );
       
   109 
       
   110         /**
       
   111         * Sets/Removes the observers for the softkeys
       
   112         * @since S60 3.1
       
   113         * @param aLeftSoftkey Set/Remove left softkey observer
       
   114         * @param aRightSoftkey Set/Remove right softkey observer
       
   115         * @param aMiddleSoftkey Set/Remove middle softkey observer
       
   116         * @param aCommandObserver The observer for the key events
       
   117         * @return KErrNone, when setting the observer is succesful
       
   118         */
       
   119         TInt SetObserver(
       
   120             const TBool aLeftSoftkey,
       
   121             const TBool aRightSoftkey,
       
   122             const TBool aMiddleSoftkey,
       
   123             MEikCommandObserver& aCommandObserver );
       
   124 
       
   125         /**
       
   126         * Removes the observer
       
   127         * @since S60 3.1
       
   128         * @param aSoftkey
       
   129         */
       
   130         void RemoveObserver(
       
   131             const TISCObservedKeys aSoftkey );
       
   132 
       
   133         /**
       
   134         * Defines a new softkey
       
   135         * @since S60 3.1
       
   136         * @param aLabelResource Resource of the text for the softkey label
       
   137         * @param aSoftkeyPos Position of the softkey
       
   138         * @param aSoftkeyCmd Command executed by pressing the softkey
       
   139         * @param aCommandObserver Observer to receive the events
       
   140         */
       
   141         void DefineCustomSoftkeyL(
       
   142             const TInt aLabelResource,
       
   143             const TISCObservedKeys aSoftkeyPos,
       
   144             const TInt aSoftkeyCmd,
       
   145             MEikCommandObserver* aCommandObserver );
       
   146 
       
   147         /**
       
   148         * Defines a new softkey
       
   149         * @since S60 3.1
       
   150         * @param aSoftkeyLabel Text for the softkey label
       
   151         * @param aSoftkeyPos Position of the softkey
       
   152         * @param aSoftkeyCmd Command executed by pressing the softkey
       
   153         * @param aCommandObserver Observer to receive the events
       
   154         */
       
   155         void DefineCustomSoftkeyL(
       
   156             const TDesC& aSoftkeyLabel,
       
   157             const TISCObservedKeys aSoftkeyPos,
       
   158             const TInt aSoftkeyCmd,
       
   159             MEikCommandObserver* aCommandObserver );
       
   160 
       
   161         /**
       
   162         * Checks the current status of MSK label updating availability
       
   163         * @since S60 3.1
       
   164         * @return ETrue, when MSK label change is allowed
       
   165         * @return EFalse, when MSK label change is not allowed
       
   166         */
       
   167         TBool MSKLabelling();
       
   168 
       
   169         /**
       
   170         * Sets the status of MSK label updating
       
   171         * @since S60 3.1
       
   172         * @param aNewState Allow/Disallow MSK label change
       
   173         */
       
   174         void SetMSKLabelling( const TBool aNewState );
       
   175 
       
   176         /**
       
   177         * Changes the label of the middle softkey
       
   178         * @since S60 3.1
       
   179         * @param aLabelResource Resource of the text for the softkey label
       
   180         * @param aCommandId Command executed by pressing the softkey
       
   181         * @param aCommandObserver Observer to receive the events
       
   182         */
       
   183         void UpdateMiddleSoftkeyLabelL(
       
   184             const TInt aLabelResource,
       
   185             const TInt aCommandId,
       
   186             MEikCommandObserver* aCommandObserver );
       
   187 
       
   188         /**
       
   189         * Hides softkeys. Preserves the possibility to show softkeys again,
       
   190         * functionality is to be coded
       
   191         * @since S60 3.2
       
   192         * @param aVisible tells if buttons should be showed
       
   193         * @param aCommandObserver Observer to receive the events
       
   194         */
       
   195         void SetVisibility(
       
   196             const TBool aVisible,
       
   197             MEikCommandObserver* aCommandObserver );
       
   198 
       
   199     public: // Functions from base classes
       
   200 
       
   201     protected:  // Constructors
       
   202 
       
   203         /**
       
   204         * Default constructor for classCIMSSoftkeyControl
       
   205         * @since S60 3.1
       
   206         * @return, Constructed object
       
   207         */
       
   208         CIMSSoftkeyControl(
       
   209             CEikButtonGroupContainer& aSoftkeys );
       
   210 
       
   211         /**
       
   212         * Symbian 2-phase constructor
       
   213         * @since S60 3.1
       
   214         */
       
   215         void ConstructL();
       
   216 
       
   217     protected:  // New virtual functions
       
   218     protected:  // New functions
       
   219     protected:  // Functions from base classes
       
   220 
       
   221     private:  // New virtual functions
       
   222     private:  // New functions
       
   223 
       
   224         /**
       
   225         *
       
   226         * @since S60 3.1
       
   227         */
       
   228         TInt ChangeObserver(
       
   229             const TBool aOn,
       
   230             const TISCObservedKeys aSoftkey,
       
   231             MEikCommandObserver& aCommandObserver );
       
   232 
       
   233     private:  // Functions from base classes
       
   234 
       
   235     public:     // Data
       
   236     protected:  // Data
       
   237     private:    // Data
       
   238 
       
   239         // Softkey container
       
   240         CEikButtonGroupContainer&   iSoftkeys;
       
   241         // Container for the flags
       
   242         TMuiuFlags                  iFlags;
       
   243         // Container for the last used resource for MSK
       
   244         TInt                        iPreviousMskLabelResource;
       
   245 
       
   246     };
       
   247 
       
   248 #endif //  CIMSSOFTKEYCONTROL_H
       
   249 
       
   250 // End of File
       
   251