|
1 /* |
|
2 * Copyright (c) 2007 - 2009 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: Definition of MPhoneDialerController class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MPHONEDIALERCONTROLLER_H_ |
|
19 #define MPHONEDIALERCONTROLLER_H_ |
|
20 |
|
21 #include <e32cmn.h> |
|
22 #include <gulicon.h> |
|
23 |
|
24 |
|
25 /** |
|
26 * Abstract dialer controller interface. |
|
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. |
|
31 * |
|
32 * @lib PhoneUiView.lib |
|
33 * @since S60 v5.0 |
|
34 */ |
|
35 class MPhoneDialerController |
|
36 { |
|
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 |
|
72 public: |
|
73 |
|
74 /** |
|
75 * Returns Cba resource id |
|
76 * @return Resource Id of the softkeys |
|
77 * @since S60 v5.1 |
|
78 */ |
|
79 virtual TInt CbaResourceId() const = 0; |
|
80 |
|
81 /** |
|
82 * Returns Menu resource id |
|
83 * @return Id of the menu resource |
|
84 * @since S60 v5.1 |
|
85 */ |
|
86 virtual TInt MenuResourceId() const = 0; |
|
87 |
|
88 /** |
|
89 * Returns number entry prompt text |
|
90 * @return Reference to text to be shown on number entry |
|
91 * @since S60 v5.1 |
|
92 */ |
|
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; |
|
106 |
|
107 /** |
|
108 * Function used to tell controller if number entry is empty or not. |
|
109 * In many cases this has an influence on the status of some or all toolbar buttons. |
|
110 * @param aEmpty ETrue if number entry is empty, EFalse othwerwise. |
|
111 * @since S60 v5.2 |
|
112 */ |
|
113 virtual void SetNumberEntryIsEmpty( TBool aEmpty ) = 0; |
|
114 |
|
115 /** |
|
116 * Gets current state of the given button. |
|
117 * @param aIndex Index of the button for which state is queried. |
|
118 * @return Index of the button state which should be active. |
|
119 * KErrNotFound if the given button has no states. |
|
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; |
|
141 }; |
|
142 |
|
143 #endif /*MDIALERCONTROLLER_H_*/ |
|
144 |
|
145 |
|
146 |
|
147 |