|
1 /* |
|
2 * Copyright (c) 2008-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: Marking command handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_GLXCOMMANDHANDLERMARKING_H |
|
22 #define C_GLXCOMMANDHANDLERMARKING_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <glxmedialistcommandhandler.h> |
|
26 #include <mglxsoftkeyhandler.h> |
|
27 |
|
28 class MGlxMediaListProvider; |
|
29 |
|
30 class MGlxVisualList; |
|
31 class CGlxMarkedIconManager; |
|
32 class MGlxSoftkeyHandler; |
|
33 class CGlxUiUtility; |
|
34 class CGlxVisualListManager; |
|
35 class CGlxScreenFurniture; |
|
36 |
|
37 |
|
38 /** |
|
39 * CGlxCommandHandlerMarking |
|
40 * |
|
41 * Marking command handler implementation |
|
42 * |
|
43 * @lib glxcommandhandlermarking |
|
44 * @author M Byrne |
|
45 * @internal reviewed 11/06/2007 by Alex Birkett |
|
46 * @internal reviewed 19/09/2007 by Aki Vanhatalo |
|
47 */ |
|
48 NONSHARABLE_CLASS (CGlxCommandHandlerMarking) : public CGlxMediaListCommandHandler, |
|
49 public MGlxMediaListObserver |
|
50 { |
|
51 public: |
|
52 /** |
|
53 * Static construction function |
|
54 * @param aMediaListProvider pointer to media list owner |
|
55 * @param aKeyHandler pointer to MGlxSoftkeyHandler interface |
|
56 * @param aUpdateMiddleSoftkey Should this command handler update |
|
57 * the middle softkey when not in multiple marking mode. |
|
58 * @return pointer to CGlxCommandHandlerMarking object |
|
59 */ |
|
60 IMPORT_C static CGlxCommandHandlerMarking* NewL( |
|
61 MGlxMediaListProvider* aMediaListProvider, |
|
62 TBool aHasToolbarItem/*, |
|
63 TBool aUpdateMiddleSoftkey = EFalse */); |
|
64 |
|
65 /** Destructor */ |
|
66 IMPORT_C ~CGlxCommandHandlerMarking(); |
|
67 |
|
68 public: // From CGlxCommandHandler |
|
69 void DoActivateL(TInt aViewId); |
|
70 void Deactivate(); |
|
71 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
72 void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, |
|
73 MGlxMediaList* aList); |
|
74 |
|
75 void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); |
|
76 public: // From MGlxMediaListObserver |
|
77 void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, |
|
78 MGlxMediaList* aList); |
|
79 void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, |
|
80 MGlxMediaList* aList); |
|
81 void HandleAttributesAvailableL(TInt aItemIndex, |
|
82 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList); |
|
83 void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, |
|
84 TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); |
|
85 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); |
|
86 void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); |
|
87 |
|
88 protected: // From CGlxCommandHandler |
|
89 void PopulateToolbarL(); |
|
90 |
|
91 protected: // From CGlxMediaListCommandHandler |
|
92 TBool DoExecuteL(TInt aCommand, MGlxMediaList& aList); |
|
93 void DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); |
|
94 TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; |
|
95 |
|
96 private: |
|
97 /** Current marking mode marking or unmarking */ |
|
98 enum TGlxMarkingMode |
|
99 { |
|
100 EMarking, |
|
101 EUnmarking |
|
102 }; |
|
103 |
|
104 /** status of left softkey (in mupltiple marking mode) */ |
|
105 enum TGlxLeftSoftKeyStatus |
|
106 { |
|
107 EGlxLSKUndefined, |
|
108 EGlxLSKBlank, // static item |
|
109 EGlxLSKMark, |
|
110 EGlxLSKUnmark |
|
111 }; |
|
112 |
|
113 /** |
|
114 * 2nd phase construction |
|
115 */ |
|
116 void ConstructL(); |
|
117 |
|
118 /** |
|
119 * Constructor |
|
120 * @param aMediaListProvider pointer to media list owner |
|
121 * @param aKeyHandler pointer to MGlxSoftkeyHandler interface |
|
122 * @param aUpdateMiddleSoftkey Should this command handler update |
|
123 * the middle softkey when not in multiple marking mode. |
|
124 */ |
|
125 CGlxCommandHandlerMarking( MGlxMediaListProvider* aMediaListProvider, |
|
126 TBool aHasToolbarItem/* , TBool aUpdateMiddleSoftkey */); |
|
127 |
|
128 /** |
|
129 * Select/unselect all items |
|
130 * @param aSelect select if ETrue unselect otherwise |
|
131 */ |
|
132 void SelectAllL( TBool aSelect ); |
|
133 |
|
134 /** |
|
135 * Enter multiple marking mode |
|
136 */ |
|
137 void EnterMultipleMarkingModeL(); |
|
138 |
|
139 /** |
|
140 * Exit multiple marking mode |
|
141 */ |
|
142 void ExitMultipleMarkingModeL(); |
|
143 |
|
144 /** |
|
145 * Update mark status of selected item |
|
146 * and update marked item count |
|
147 * @param aList media list |
|
148 * @param aIndex index of item in media list |
|
149 */ |
|
150 void SetSelectedL(MGlxMediaList* aList, TInt aIndex); |
|
151 |
|
152 private: |
|
153 /** Resource offset */ |
|
154 TInt iResourceOffset; |
|
155 |
|
156 /** Flag if basic marking in operation */ |
|
157 TBool iBasicMarking; |
|
158 |
|
159 /** multiple marking mode enabled */ |
|
160 TBool iMultipleMarking; |
|
161 |
|
162 /** Current marking mode (marking or unmarking) */ |
|
163 TGlxMarkingMode iMarkingMode; |
|
164 |
|
165 /** visual list passed through to marking icon manager */ |
|
166 MGlxVisualList* iVisualList; |
|
167 |
|
168 /** ID of view activating command handler */ |
|
169 TInt iViewId; |
|
170 |
|
171 // add current lsk status |
|
172 TGlxLeftSoftKeyStatus iLeftSoftKeyStatus; |
|
173 |
|
174 /** Whether to update the MSK when not in multiple marking mode */ |
|
175 TBool iUpdateMiddleSoftkey; |
|
176 |
|
177 /** Whether context menu is currently enabled */ |
|
178 TBool iOkOptionsMenuEnabled; |
|
179 |
|
180 /** Current middle softkey text resource */ |
|
181 TInt iMskTextResourceId; |
|
182 |
|
183 /** Instance of Ui utility class */ |
|
184 CGlxUiUtility* iUiUtility; |
|
185 |
|
186 /** Instance of Screenfurniture */ |
|
187 CGlxScreenFurniture* iScreenFurniture ; |
|
188 |
|
189 /** Flag to indicate whether full-screen is active or not */ |
|
190 TBool iInFullScreen; |
|
191 |
|
192 HBufC* iRskTextCancel; |
|
193 HBufC* iRskTextBack; |
|
194 HBufC* iMskTextMark; |
|
195 HBufC* iMskTextUnMark; |
|
196 HBufC* iMskTextOpen; |
|
197 |
|
198 }; |
|
199 |
|
200 #endif // C_GLXCOMMANDHANDLERMARKING_H |