|
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: Slideshow command handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_GLXCOMMANDHANDLERSLIDESHOW_H |
|
22 #define C_GLXCOMMANDHANDLERSLIDESHOW_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <shwconstants.h> // for playback direction |
|
26 #include <glxmedialistcommandhandler.h> |
|
27 #include <mglxmedialistobserver.h> // for media list observer |
|
28 |
|
29 // Forward Declarations |
|
30 class CGlxDefaultAttributeContext; |
|
31 class MGlxMediaListProvider; |
|
32 class TGlxMedia; |
|
33 class CGlxUiUtility; |
|
34 |
|
35 /** |
|
36 * @class CGlxCommandHandlerSlideshow |
|
37 * |
|
38 * Command handler that either launches slideshow with the selected items |
|
39 * from a media list or launches the slideshow settings. |
|
40 * @internal reviewed 07/06/2007 by Kimmo Hoikka |
|
41 */ |
|
42 NONSHARABLE_CLASS (CGlxCommandHandlerSlideshow) : |
|
43 public CGlxMediaListCommandHandler, |
|
44 public MGlxMediaListObserver |
|
45 { |
|
46 public: |
|
47 /** |
|
48 * Two-phase constructor |
|
49 * @param aMediaListProvider object that provides the media list |
|
50 * @param aStepBack EFalse if the command handler should not change |
|
51 * the path's level. E.g. this may depend on whether the view's media |
|
52 * list contains media items or if it is a "list of lists" |
|
53 * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) |
|
54 * @param aFileName resource file |
|
55 */ |
|
56 IMPORT_C static CGlxCommandHandlerSlideshow* NewL( |
|
57 MGlxMediaListProvider* aMediaListProvider, TBool aStepBack, |
|
58 TBool aHasToolbarItem, const TDesC& aFileName); |
|
59 |
|
60 /** Destructor */ |
|
61 IMPORT_C ~CGlxCommandHandlerSlideshow(); |
|
62 |
|
63 protected: |
|
64 |
|
65 /** @ref CGlxMediaListCommandHandler::ActivateL */ |
|
66 void DoActivateL(TInt aViewId); |
|
67 /** @ref CGlxMediaListCommandHandler::DoExecuteL */ |
|
68 TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); |
|
69 /// @ref CGlxMediaListCommandHandler::DoIsDisabled |
|
70 TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; |
|
71 /// @ref CGlxMediaListCommandHandler::BypassFiltersForExecute |
|
72 TBool BypassFiltersForExecute() const; |
|
73 /// @ref CGlxCommandHandler::PopulateToolbar |
|
74 void PopulateToolbarL(); |
|
75 private: // From MGlxMediaListObserver |
|
76 void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, |
|
77 MGlxMediaList* aList); |
|
78 void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); |
|
79 void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, |
|
80 MGlxMediaList* aList); |
|
81 void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, |
|
82 MGlxMediaList* aList); |
|
83 void HandleAttributesAvailableL(TInt aItemIndex, |
|
84 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList); |
|
85 void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, |
|
86 TInt aOldIndex, MGlxMediaList* aList); |
|
87 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); |
|
88 void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); |
|
89 void HandlePopulatedL( MGlxMediaList* aList ); |
|
90 |
|
91 private: |
|
92 /** Second phase constructor */ |
|
93 void ConstructL(const TDesC& aFileName); |
|
94 |
|
95 /** Constructor */ |
|
96 CGlxCommandHandlerSlideshow(MGlxMediaListProvider* aMediaListProvider, |
|
97 TBool aStepBack, TBool aHasToolbarItem ); |
|
98 |
|
99 /** |
|
100 * Helper function to activate the view with the relevant playback |
|
101 * direction |
|
102 */ |
|
103 void ActivateViewL( NShwSlideshow::TPlayDirection aPlaybackDirection ); |
|
104 |
|
105 /** |
|
106 * Called when the owning view is deactivated |
|
107 */ |
|
108 void Deactivate(); |
|
109 |
|
110 /** |
|
111 * To check whether the focused container contains any slideshow playable item. |
|
112 * @param aCommandId The Command id |
|
113 * @param aList MediaList reference |
|
114 * @return TBool ETrue if container is not slideshow playable |
|
115 */ |
|
116 TBool IsSlideshowNotPlayableOnFocusedContainer(TInt aCommandId, MGlxMediaList& aList); |
|
117 |
|
118 /** |
|
119 * To update the floating toolbar in case of non-touch |
|
120 */ |
|
121 void UpdateToolbar(); |
|
122 |
|
123 private: |
|
124 // ID of owning view |
|
125 TInt iViewId; |
|
126 // Not owned - HUI utility |
|
127 CGlxUiUtility* iUiUtility; |
|
128 /// Resource file offset |
|
129 TInt iResourceOffset; |
|
130 // Flag to control where in the list we should be |
|
131 TBool iStepBack; |
|
132 // Buffer used by the stream |
|
133 CBufFlat* iBufFlat; |
|
134 // Storage buffer to pass the path to the view |
|
135 HBufC* iBuffer; |
|
136 /** Whether the command is shown in the active palette */ |
|
137 TBool iShowInToolbar; |
|
138 }; |
|
139 |
|
140 #endif // C_GLXCOMMANDHANDLERSLIDESHOW_H |