phoneapp/phoneuiview/inc/mphonedialercontroller.h
branchRCL_3
changeset 3 8871b09be73b
parent 0 5f000ab63145
equal deleted inserted replaced
2:c84cf270c54f 3:8871b09be73b
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007 - 2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 #ifndef MPHONEDIALERCONTROLLER_H_
    18 #ifndef MPHONEDIALERCONTROLLER_H_
    19 #define MPHONEDIALERCONTROLLER_H_
    19 #define MPHONEDIALERCONTROLLER_H_
    20 
    20 
    21 // Forward declarations
    21 #include <e32cmn.h>
    22 class CAknToolbar;
    22 #include <gulicon.h>
       
    23 
    23 
    24 
    24 /**
    25 /**
    25  *  Abstract custom dialer interface.
    26  *  Abstract dialer controller interface.
    26  *
    27  *  Dialer controller provides data to be shown on dialer UI
       
    28  *  (e.g. prompt text and toolbar button contents), but is
       
    29  *  agnostic to implementation details and layout of the
       
    30  *  dialer UI components.
    27  *
    31  *
    28  *  @lib PhoneUiView.lib
    32  *  @lib PhoneUiView.lib
    29  *  @since S60 v5.0
    33  *  @since S60 v5.0
    30  */
    34  */
    31 class MPhoneDialerController
    35 class MPhoneDialerController
    32     {
    36     {
    33 
    37 public: // data types
       
    38     
       
    39     /** 
       
    40      * Indices to refer to visual button slots in the dialer toolbar. 
       
    41      * The index order in not necessarily the same as the visual
       
    42      * order of the buttons. The index names correspond to the button
       
    43      * functions in the normal dialer mode.
       
    44      * @since S60 v5.2
       
    45      */
       
    46     enum TButtonIndex
       
    47         {
       
    48         EClearButton = 0,   //< Button normally used for backspce
       
    49         ECallButton,        //< Button normally used for "call" and "log"
       
    50         EPhonebookButton,   //< Button normally used for "Phonebook" and "Add to Phonebook"
       
    51         
       
    52         ENumberOfButtons    //< Total number of buttons in the toolbar.
       
    53         };
       
    54     
       
    55     /**
       
    56      * Struct-like class encapsulating data of one toolbar button function.
       
    57      * @since S60 v5.2
       
    58      */
       
    59     class CButtonData : public CBase
       
    60         {
       
    61     public: // data
       
    62         TInt iCommandId;
       
    63         CGulIcon* iIcon; // OWN
       
    64         HBufC* iTooltip; // OWN
       
    65     public: // constructors & destructor
       
    66         inline CButtonData() {}
       
    67         inline CButtonData( TInt aCommandId, CGulIcon* aIcon, HBufC* aTooltip ) :
       
    68             iCommandId( aCommandId ), iIcon( aIcon ), iTooltip( aTooltip ) {}
       
    69         inline ~CButtonData() { delete iIcon; delete iTooltip; }
       
    70         };
       
    71     
    34 public:
    72 public:
    35 
       
    36     /**
       
    37     * Initializes the controller. 
       
    38     * @param    aToolbar    CAknToolbar instance.
       
    39     * @since    S60 v5.1
       
    40     */
       
    41     virtual void InitializeL( CAknToolbar& aToolbar ) = 0;
       
    42     
    73     
    43     /**
    74     /**
    44     * Returns Cba resource id
    75     * Returns Cba resource id
    45     * @return Resource Id of the softkeys
    76     * @return Resource Id of the softkeys
    46     * @since S60 v5.1
    77     * @since S60 v5.1
    58     * Returns number entry prompt text
    89     * Returns number entry prompt text
    59     * @return Reference to text to be shown on number entry
    90     * @return Reference to text to be shown on number entry
    60     * @since S60 v5.1
    91     * @since S60 v5.1
    61     */
    92     */
    62     virtual const TDesC& NumberEntryPromptTextL() = 0;
    93     virtual const TDesC& NumberEntryPromptTextL() = 0;
       
    94 
       
    95     /**
       
    96      * Get contents for given toolbar button. One button may have zero or more
       
    97      * different functions. Which one is set active, depends on the return value
       
    98      * of the member function ButtonState().
       
    99      * @param   aIndex  Index of the button for which data is queried.
       
   100      * @param   aData   On return, contains all the possible states for the button.
       
   101      * @return  KErrNone if action was succesful. 
       
   102      *          System wide error code if something went wrong.
       
   103      * @since S60 v5.2
       
   104      */
       
   105     virtual TInt GetButtonData( TButtonIndex aIndex, RPointerArray<CButtonData>& aData ) const = 0;
    63     
   106     
    64     /**
   107     /**
    65     * Handles the number entry empty event
   108      * Function used to tell controller if number entry is empty or not.
    66     * @param aEmpty ETrue if numberentry is empty
   109      * In many cases this has an influence on the status of some or all toolbar buttons.
    67     * @since S60 v5.1
   110      * @param   aEmpty  ETrue if number entry is empty, EFalse othwerwise.
    68     */
   111      * @since S60 v5.2
    69     virtual void HandleNumberEntryIsEmpty( TBool aEmpty ) = 0;
   112      */
    70 
   113     virtual void SetNumberEntryIsEmpty( TBool aEmpty ) = 0;
       
   114     
    71     /**
   115     /**
    72     * Sets visibility of buttons created by the implementation
   116      * Gets current state of the given button.
    73     * @param aShow ETrue if numberentry is empty
   117      * @param   aIndex  Index of the button for which state is queried.
    74     * @since S60 v5.1
   118      * @return  Index of the button state which should be active. 
    75     */
   119      *          KErrNotFound if the given button has no states.
    76     virtual void ShowButtons( TBool aShow ) = 0;
   120      * @since S60 v5.2
       
   121      */
       
   122     virtual TInt ButtonState( TButtonIndex aIndex ) const = 0;
       
   123     
       
   124     /**
       
   125      * Gets dimming status of the given button
       
   126      * @param   aIndex  Index of the button for which dimming status is queried.
       
   127      * @return  ETrue   if the given button should be dimmed.
       
   128      *          EFalse  otherwise.
       
   129      * @since S60 v5.2
       
   130      */
       
   131     virtual TBool ButtonDimmed( TButtonIndex aIndex ) const = 0;
       
   132     
       
   133     /**
       
   134      * Gets value indicating whether using Easy Dialing should be allowed in
       
   135      * the current Dialer mode.
       
   136      * @return  ETrue   if Easy Dialing can be enabled.
       
   137      *          EFalse  if Easy Dialing must not be enabled.
       
   138      * @since S60 v5.2
       
   139      */
       
   140     virtual TBool EasyDialingAllowed() const = 0;
    77     };
   141     };
    78 
   142 
    79 #endif /*MDIALERCONTROLLER_H_*/
   143 #endif /*MDIALERCONTROLLER_H_*/
    80 
   144 
    81 
   145