epoc32/include/mw/eikhkeyt.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 eikhkeyt.h
     1 /*
       
     2 * Copyright (c) 2002-2006 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Class declaration for EIKON hotkey table.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __EIKHKEYT_H__
       
    20 #define __EIKHKEYT_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32keys.h>
       
    24 
       
    25 /**
       
    26  * Hotkey parameters. This can be added to a hotkey table using
       
    27  * the functions provided by the @c CEikHotKeyTable class.
       
    28  */
       
    29 struct SEikHotKey
       
    30 	{
       
    31 	TInt iCommandId; ///< The command ID associated with the hotkey.
       
    32 	TInt iKeycode;   ///< The key code associated with the hotkey.
       
    33 	};
       
    34 
       
    35 /**
       
    36  * An array for hotkey commands and their associated key codes and modifiers.
       
    37  *
       
    38  * @lib eikcoctl.lib
       
    39  * @since S60 0.9
       
    40  */
       
    41 class CEikHotKeyTable : public CArrayFixFlat<SEikHotKey>
       
    42 	{
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Default C++ constructor.
       
    47      */
       
    48 	IMPORT_C CEikHotKeyTable();
       
    49 	
       
    50 	/**
       
    51      * Destructor
       
    52      */
       
    53 	IMPORT_C ~CEikHotKeyTable();
       
    54 	
       
    55 	/**
       
    56      * Gets the hotkey code and modifier for the specified command ID.
       
    57      *
       
    58      * @param      aCommandId  The ID of the hotkey for which the key code and
       
    59      *                         modifiers are obtained.
       
    60      * @param[out] aKeycode    On return, the key code for the
       
    61      *                         specified command ID.
       
    62      * @param[out] aModifiers  On return, the modifier for the
       
    63      *                         specified command ID.
       
    64      *
       
    65      * @return     @c ETrue if the hotkey exists, @c EFalse otherwise
       
    66      */
       
    67 	IMPORT_C TBool HotKeyFromCommandId( TInt aCommandId,
       
    68 	                                    TInt& aKeycode,
       
    69 	                                    TInt& aModifiers) const;
       
    70 	
       
    71 	/**
       
    72      * Gets the command ID associated with the specified key code and modifier.
       
    73      *
       
    74      * @param aKeycode   The key code for which the command ID is obtained.
       
    75      * @param aModifiers The key modifier for which the command ID is obtained.
       
    76      *
       
    77      * @return The command ID for the specified key code and modifier.
       
    78      */
       
    79 	IMPORT_C TInt CommandIdFromHotKey(TInt aKeycode,TInt aModifiers) const;
       
    80 	
       
    81 	/**
       
    82      * Adds the specified hotkey to the hotkey array.
       
    83      *
       
    84      * @param aCommandId  The command associated with the hotkey.
       
    85      * @param aKeycode    The key code used to invoke the command.
       
    86      * @param aModifiers  Any modifiers used to invoke the command,
       
    87      *                    shift or control for example.
       
    88      *
       
    89      * @leave KErrNotSupported If the specified modifier is not supported
       
    90      */
       
    91 	IMPORT_C void AddItemL(TInt aCommandId,TInt aKeycode,TInt aModifiers);
       
    92 	
       
    93 	/**
       
    94      * Removes the item specified by command ID from the array.
       
    95      *
       
    96      * @param aCommandId The ID of the item to remove.
       
    97      * @panic EIKCOCTL-7 If the array contains no hotkeys.
       
    98      */
       
    99 	IMPORT_C void RemoveItem(TInt aCommandId);
       
   100 	
       
   101 	/**
       
   102      * Constructs an empty array from resource.
       
   103      *
       
   104      * @param aResourceId  The ID if the resource reader to use to
       
   105      *                     construct the array.
       
   106      */
       
   107 	IMPORT_C void ConstructFromResourceL(TInt aResourceId);
       
   108 	
       
   109 	/**
       
   110      * Resets the hotkey array.
       
   111      */
       
   112 	IMPORT_C void Reset();
       
   113 	
       
   114 private:
       
   115 	TInt iNumberPlain;
       
   116 	TInt iNumberCtrl;
       
   117 	TInt iNumberShiftCtrl;
       
   118 	TInt iSpare;
       
   119 	};
       
   120 
       
   121 #endif // __EIKHKEYT_H__