1 /* |
|
2 * Copyright (c) 2004-2008 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 class that shows the N-Best List |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef VUICNBESTLISTDIALOG_H |
|
19 #define VUICNBESTLISTDIALOG_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <aknlists.h> |
|
23 #include <aknlistquerydialog.h> |
|
24 #include <AknMediatorObserver.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CAknIconArray; |
|
28 class CListQueryDialog; |
|
29 class MKeyCallback; |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * The N-Best List Dialog |
|
37 * @lib VoiceUiRecognition.lib |
|
38 */ |
|
39 NONSHARABLE_CLASS( CNBestListDialog ) : public CCoeControl, |
|
40 public MEikCommandObserver, |
|
41 public MAknDialogMediatorObserver |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 static CNBestListDialog* NewL(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CNBestListDialog(); |
|
54 |
|
55 public: // New functions |
|
56 |
|
57 /** |
|
58 * Registers given object as a key listener |
|
59 */ |
|
60 void RegisterForKeyCallback( MKeyCallback* aKeyCallback ); |
|
61 |
|
62 /** |
|
63 * Creates N-Best List |
|
64 * @param aItems Items that will be shown in the list. Takes ownership of the list. |
|
65 * @param aHeader Optional header text for the list |
|
66 */ |
|
67 void CreateNBestListPopupLC( CDesC16ArrayFlat* aItems, |
|
68 const TDesC& aHeader = KNullDesC ); |
|
69 |
|
70 /** |
|
71 * Shows N-Best List |
|
72 * @return Key value that caused the dialog to be dismissed |
|
73 */ |
|
74 TInt ShowNBestListPopupL(); |
|
75 |
|
76 /** |
|
77 * Sets n-best list softkeys |
|
78 * @param aResourceId Softkey resource id |
|
79 */ |
|
80 void SetSoftkeysL( TInt aResourceId ); |
|
81 |
|
82 /** |
|
83 * Sets optional commands hidder or visible |
|
84 * @param aHidden ETrue if commands should be hidden else EFalse |
|
85 */ |
|
86 void SetCommandsHidden( TBool aHidden ); |
|
87 |
|
88 /** |
|
89 * Takes care of the headset short key presses. Replaces the list with new one |
|
90 * or moves down one item in the list. |
|
91 * @param aItems New items that will be shown in the list. Takes ownership of the list. |
|
92 * @return EFalse if the end of the list is passed else ETrue |
|
93 */ |
|
94 TBool HandleShortKeypressL( CDesC16ArrayFlat* aItems ); |
|
95 |
|
96 /** |
|
97 * Returns currently selected index |
|
98 * @return Index of current n-best list selection |
|
99 */ |
|
100 TInt SelectedIndex(); |
|
101 |
|
102 public: // Functions from base classes |
|
103 |
|
104 /** |
|
105 * From CCoeControl Called when a key is pressed |
|
106 * @see CCoeControl |
|
107 */ |
|
108 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
109 |
|
110 /** |
|
111 * From MEikCommandObserver |
|
112 * @see MEikCommandObserver for more information. |
|
113 */ |
|
114 void ProcessCommandL( TInt aCommandId ); |
|
115 |
|
116 /** |
|
117 * From MAknDialogMediatorObserver |
|
118 * @see MAknDialogMediatorObserver for more information. |
|
119 */ |
|
120 TAknDialogMediatorObserverCommand MediatorCommandL( TUid aDomain, TUid aCategory, |
|
121 TInt aCommandId, |
|
122 const TDesC8& aData ); |
|
123 |
|
124 /** |
|
125 * From MAknDialogMediatorObserver |
|
126 * @see MAknDialogMediatorObserver for more information. |
|
127 */ |
|
128 void NotifyMediatorExit(); |
|
129 |
|
130 private: // New functions |
|
131 |
|
132 /** |
|
133 * Converts key event to one of keypress enumeration values |
|
134 * @param aKeyEvent Original key event |
|
135 * @return One of keypress enumeration values |
|
136 */ |
|
137 TInt ConvertKeyEventL( const TKeyEvent& aKeyEvent ); |
|
138 |
|
139 /** |
|
140 * Creates new icon array. Ownership is transferred to caller. |
|
141 * @return Icon array |
|
142 */ |
|
143 CArrayPtr<CGulIcon>* CreateIconArrayL(); |
|
144 |
|
145 /** |
|
146 * Load a possibly skinned icon (with mask) and append it to an |
|
147 * icon array. |
|
148 * @param aArray Icon array to add the icon to |
|
149 * @param aID Skin ID for the icon |
|
150 * @param aBitmapId Id for the default icon in the MBM file |
|
151 * @param aMaskId Id for the default icon mask in the MBM file |
|
152 */ |
|
153 static void AppendIconToArrayL( CAknIconArray* aArray, |
|
154 const TAknsItemID& aID, |
|
155 TInt aBitmapId, |
|
156 TInt aMaskId ); |
|
157 |
|
158 /** |
|
159 * Creates and sets n-best list data to secondary display |
|
160 * @param aItems New items that will be shown in the list. Takes ownership of the list. |
|
161 */ |
|
162 void CreateAndSetSecondaryDisplayDataL( CDesC16ArrayFlat* aItems ); |
|
163 |
|
164 private: // Constructors |
|
165 |
|
166 /** |
|
167 * C++ default constructor. |
|
168 */ |
|
169 CNBestListDialog(); |
|
170 |
|
171 /** |
|
172 * By default Symbian 2nd phase constructor is private. |
|
173 */ |
|
174 void ConstructL(); |
|
175 |
|
176 private: //data |
|
177 |
|
178 // Dialog |
|
179 CListQueryDialog* iDialog; |
|
180 |
|
181 // Key observer |
|
182 MKeyCallback* iKeyCallback; |
|
183 |
|
184 // Index of currently selected item |
|
185 TInt iCurrentIndex; |
|
186 |
|
187 // Number of tags in the list |
|
188 TInt iTagCount; |
|
189 |
|
190 // Current CBA resource id |
|
191 TInt iCba; |
|
192 }; |
|
193 |
|
194 #endif // VUICNBESTLISTDIALOG_H |
|
195 |
|
196 // End of File |
|