1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef ATCONFIGURATIONAPPGUILISTBOX_H |
|
19 #define ATCONFIGURATIONAPPGUILISTBOX_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <coecntrl.h> |
|
23 #include <analyzetool/atstorageserverclnt.h> |
|
24 |
|
25 #include "atconfigurationappguilistboxview.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MEikCommandObserver; |
|
29 class CAknDoubleStyleListBox; |
|
30 class CEikTextListBox; |
|
31 |
|
32 /** |
|
33 * Container class for ATConfigurationAppGuiListBox |
|
34 * |
|
35 * @class CATConfigurationAppGuiListBox ATConfigurationAppGuiListBox.h |
|
36 */ |
|
37 class CATConfigurationAppGuiListBox : public CCoeControl, public MEikListBoxObserver |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * C++ default constructor. |
|
42 */ |
|
43 CATConfigurationAppGuiListBox(); |
|
44 |
|
45 /** |
|
46 * Two-phased constructor that can leave. |
|
47 * @return A new instance of this class |
|
48 */ |
|
49 static CATConfigurationAppGuiListBox* NewL( |
|
50 const TRect& aRect, |
|
51 CATConfigurationAppGuiListBoxView* aParent, |
|
52 MEikCommandObserver* aCommandObserver ); |
|
53 |
|
54 /** |
|
55 * Two-phased constructor that can leave and leaves a pointer |
|
56 * on the cleanup stack. |
|
57 * @return A new instance of this class |
|
58 */ |
|
59 static CATConfigurationAppGuiListBox* NewLC( |
|
60 const TRect& aRect, |
|
61 CATConfigurationAppGuiListBoxView* aParent, |
|
62 MEikCommandObserver* aCommandObserver ); |
|
63 |
|
64 /** |
|
65 * Symbian 2nd phase constructor. |
|
66 */ |
|
67 void ConstructL( |
|
68 const TRect& aRect, |
|
69 CATConfigurationAppGuiListBoxView* aParent, |
|
70 MEikCommandObserver* aCommandObserver ); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 virtual ~CATConfigurationAppGuiListBox(); |
|
76 |
|
77 public: |
|
78 |
|
79 /** |
|
80 * From CCoeControl. |
|
81 */ |
|
82 TInt CountComponentControls() const; |
|
83 |
|
84 /** |
|
85 * From CCoeControl. |
|
86 */ |
|
87 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
88 |
|
89 /** |
|
90 * From CCoeControl. |
|
91 */ |
|
92 TKeyResponse OfferKeyEventL( |
|
93 const TKeyEvent& aKeyEvent, |
|
94 TEventCode aType ); |
|
95 |
|
96 /** |
|
97 * From CCoeControl. |
|
98 */ |
|
99 void HandleResourceChange( TInt aType ); |
|
100 |
|
101 /** |
|
102 * Updates view's components. |
|
103 */ |
|
104 void UpdateViewL(); |
|
105 |
|
106 /** |
|
107 * From CCoeControl. |
|
108 */ |
|
109 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
110 |
|
111 /** |
|
112 * From MEikListBoxObserver. |
|
113 */ |
|
114 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
115 |
|
116 protected: |
|
117 /** |
|
118 * From CCoeControl. |
|
119 */ |
|
120 void SizeChanged(); |
|
121 |
|
122 private: |
|
123 /** |
|
124 * From CCoeControl. |
|
125 */ |
|
126 void Draw( const TRect& aRect ) const; |
|
127 |
|
128 private: |
|
129 /** |
|
130 * Initializes all the controls in the class. |
|
131 */ |
|
132 void InitializeControlsL(); |
|
133 |
|
134 /** |
|
135 * Layouts controls according to the screen size. |
|
136 */ |
|
137 void LayoutControls(); |
|
138 |
|
139 // Active control |
|
140 CCoeControl* iFocusControl; |
|
141 // Command observer |
|
142 MEikCommandObserver* iCommandObserver; |
|
143 public: |
|
144 /** |
|
145 * Adds an item to the listbox. |
|
146 * @param aListBox pointer to the listbox |
|
147 * @param aString a text about to be shown in the listbox. |
|
148 */ |
|
149 static void AddListBoxItemL( |
|
150 CEikTextListBox* aListBox, |
|
151 const TDesC& aString ); |
|
152 |
|
153 /** |
|
154 * Returns selected listbox items. |
|
155 * @param aListBox pointer to the listbox |
|
156 * @return RArray< TInt >* array of selected items |
|
157 */ |
|
158 static RArray< TInt >* GetSelectedListBoxItemsLC( CEikTextListBox* aListBox ); |
|
159 |
|
160 /** |
|
161 * Deletes selected listbox items. |
|
162 * @param aListBox pointer to the listbox |
|
163 */ |
|
164 static void DeleteSelectedListBoxItemsL( CEikTextListBox* aListBox ); |
|
165 |
|
166 /** |
|
167 * Returns this controls listbox. |
|
168 */ |
|
169 CAknDoubleStyleListBox* ListBox(); |
|
170 |
|
171 /** |
|
172 * Creates listbox item from the given text. |
|
173 * @param aBuffer text to be appended to the listbox |
|
174 * @param aMainText a text for the first line of the item |
|
175 * @param aSecondaryText a text for the second line of the item |
|
176 */ |
|
177 static void CreateListBoxItemL( TDes& aBuffer, |
|
178 const TDesC& aMainText, |
|
179 const TDesC& aSecondaryText ); |
|
180 |
|
181 /** |
|
182 * Starts adding listbox items from the resource. |
|
183 * @param aResourceId resource id of the text |
|
184 */ |
|
185 void AddListBoxResourceArrayItemL( TInt aResourceId ); |
|
186 |
|
187 /** |
|
188 * Setups listbox icons. |
|
189 */ |
|
190 void SetupListBoxIconsL(); |
|
191 |
|
192 /** |
|
193 * Handles listbox command. |
|
194 * @param aCommand command id |
|
195 */ |
|
196 TBool HandleMarkableListCommandL( TInt aCommand ); |
|
197 |
|
198 /** |
|
199 * Gets current highlighted listbox index. |
|
200 * @return TInt listbox index |
|
201 */ |
|
202 TInt GetCurrentItemIndex(); |
|
203 |
|
204 /** |
|
205 * Updates processes in the view. |
|
206 */ |
|
207 void UpdateProcessesL(); |
|
208 |
|
209 private: |
|
210 // Listbox |
|
211 CAknDoubleStyleListBox* iListBox; |
|
212 |
|
213 // Array of processes under testing |
|
214 RArray<TATProcessInfo> iProcesses; |
|
215 CATConfigurationAppGuiListBoxView* iParent; |
|
216 public: |
|
217 /** |
|
218 * @enum TControls |
|
219 * Defines controls. |
|
220 */ |
|
221 enum TControls |
|
222 { |
|
223 EListBox, /**< Listbox control. */ |
|
224 ELastControl /**< Last control in the view. */ |
|
225 }; |
|
226 /** |
|
227 * @enum TListBoxImages |
|
228 * Defines listbox icons. |
|
229 */ |
|
230 enum TListBoxImages |
|
231 { |
|
232 EListBoxFirstUserImageIndex /**< First icon in listbox. */ |
|
233 }; |
|
234 }; |
|
235 |
|
236 #endif // ATCONFIGURATIONAPPGUILISTBOX_H |
|