26
|
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: Interface to Alf Objects
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef _GLXMULMODELPROVIDERBASE_H_
|
|
22 |
#define _GLXMULMODELPROVIDERBASE_H_
|
|
23 |
|
|
24 |
#include<e32base.h> // Container Base Class
|
|
25 |
#include <alf/ialfwidgeteventhandler.h> // The interface for event handlers used by widget controls
|
|
26 |
#include <mglxmedialistobserver.h> // Observes for changes in media list
|
|
27 |
#include <mul/imulmodel.h> // An interface for the data model
|
|
28 |
#include <mul/imulmodelprovider.h> // An interface for requesting the data provider for data
|
|
29 |
#include <mul/imulwidget.h>
|
|
30 |
//constants
|
|
31 |
static const TInt LAST_INDEX = -1;
|
|
32 |
|
|
33 |
class CAlfEnv; // This is the UI Accelerator Toolkit environment object
|
|
34 |
class CGlxBinding; // The binding is created by the binding set factory
|
|
35 |
class MGlxBoundCommand; // Handles user commands
|
|
36 |
class TGlxMedia; // Reference to a media item in the item pool
|
|
37 |
class CGlxNavigationalState; // Class that stores the navigational state of the application
|
|
38 |
class CGlxDrmGifTextureCreator;
|
|
39 |
|
|
40 |
namespace Alf
|
|
41 |
{
|
|
42 |
class IMulModel; // An interface for the data model
|
|
43 |
class IMulWidget; // An interface for all Multimedia widgets
|
|
44 |
class MulVisualItem; // Client need to use this class to add data in data model
|
|
45 |
}
|
|
46 |
|
|
47 |
NONSHARABLE_CLASS( CGlxMulModelProviderBase ) : public CBase, public Alf::IAlfWidgetEventHandler,
|
|
48 |
public MGlxMediaListObserver, public Alf::IMulModelProvider
|
|
49 |
{
|
|
50 |
protected:
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Constructor
|
|
54 |
* @param aWidget The widget to which the model is to be set
|
|
55 |
*/
|
|
56 |
CGlxMulModelProviderBase( Alf::IMulWidget& aWidget );
|
|
57 |
|
|
58 |
/**
|
|
59 |
* BaseConstructL
|
|
60 |
* @param aEnv Alf environment
|
|
61 |
* @param aDefaultTemplate The default template of the widget
|
|
62 |
*/
|
|
63 |
void BaseConstructL( CAlfEnv& aEnv, Alf::mulwidget::TLogicalTemplate aDefaultTemplate, TInt aDataWindowSize );
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Destructor
|
|
67 |
*/
|
|
68 |
~CGlxMulModelProviderBase();
|
|
69 |
/**
|
|
70 |
* CreateModelL
|
|
71 |
*/
|
|
72 |
void CreateModelL();
|
|
73 |
/**
|
|
74 |
* InsertItemsL
|
|
75 |
* @param aIndex Start index
|
|
76 |
* @param aCount Number of items to insert
|
|
77 |
* @param aMediaListFocusIndex Focus Index to set in Model
|
|
78 |
*/
|
|
79 |
void InsertItemsL( TInt aIndex, TInt aCount, TInt aMediaListFocusIndex = NULL );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* RemoveItem
|
|
83 |
* @param aAtIndex media list index
|
|
84 |
*/
|
|
85 |
void RemoveItems( TInt aIndex, TInt aCount );
|
|
86 |
|
|
87 |
/**
|
|
88 |
* UpdateItemL
|
|
89 |
* @param aBinding Binding used to update the item
|
|
90 |
* @param aMedia media item which has the updated data
|
|
91 |
* @param aAtIndex media list index
|
|
92 |
*/
|
|
93 |
void SetDataT( const CGlxBinding& aBinding, const TGlxMedia& aMedia,
|
|
94 |
TInt aAtIndex );
|
|
95 |
|
|
96 |
/// @todo docs
|
|
97 |
void UpdateItems( TInt aIndex, TInt aCount );
|
|
98 |
|
|
99 |
/**
|
|
100 |
* FocusIndex
|
|
101 |
*/
|
|
102 |
TInt FocusIndex() const;
|
|
103 |
|
|
104 |
/**
|
|
105 |
* BoundCommand
|
|
106 |
*@param aVisualItemIndex index of visual item
|
|
107 |
*@return MGlxBoundCommand for that visual item
|
|
108 |
*/
|
|
109 |
MGlxBoundCommand* BoundCommand( TInt aVisualItemIndex ) const;
|
|
110 |
|
|
111 |
// @todo docs
|
|
112 |
void SetFocusIndex( TInt aIndex );
|
|
113 |
|
|
114 |
void AddWidgetEventHandler();
|
|
115 |
/**
|
|
116 |
* HandleOrientationChanged
|
|
117 |
* Icon Size change notification to be implemented dependent on Orientation
|
|
118 |
*/
|
|
119 |
virtual void HandleOrientationChanged();
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Enable/disable animation
|
|
123 |
* @param aAnimate enable/disable animation
|
|
124 |
*/
|
|
125 |
void AnimateDRMGifItem( TBool aAnimate );
|
|
126 |
|
|
127 |
private:
|
|
128 |
|
|
129 |
/**
|
|
130 |
* CreateItemT
|
|
131 |
* @param aBinding Binding used to update the item
|
|
132 |
* @param aMedia media item which has the updated data
|
|
133 |
* @param aIsFocused
|
|
134 |
*/
|
|
135 |
std::auto_ptr<Alf::MulVisualItem> CGlxMulModelProviderBase::CreateItemT( const CGlxBinding& aBinding,
|
|
136 |
const TGlxMedia& aMedia, TBool aIsFocused );
|
|
137 |
/**
|
|
138 |
* IsFocused
|
|
139 |
* @param aIndex Media list index
|
|
140 |
*/
|
|
141 |
TBool IsFocused( TInt aIndex ) const;
|
|
142 |
|
|
143 |
// From MGlxMediaListObserver
|
|
144 |
void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
|
|
145 |
void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
|
|
146 |
void HandleAttributesAvailableL( TInt aItemIndex,
|
|
147 |
const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList );
|
|
148 |
void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType,
|
|
149 |
TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList );
|
|
150 |
void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList );
|
|
151 |
void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList );
|
|
152 |
void HandleError( TInt aError );
|
|
153 |
void HandleCommandCompleteL( TAny* /*aSessionId*/, CMPXCommand* aCommandResult, TInt aError,
|
|
154 |
MGlxMediaList* aList );
|
|
155 |
void HandleMediaL( TInt aListIndex, MGlxMediaList* aList );
|
|
156 |
void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList );
|
|
157 |
|
|
158 |
// From IAlfWidgetEventHandler
|
|
159 |
bool accept( Alf::CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const;
|
|
160 |
Alf::AlfEventStatus offerEvent( Alf::CAlfWidgetControl& aControl, const TAlfEvent& aEvent );
|
|
161 |
void setActiveStates( unsigned int /*aStates*/ );
|
|
162 |
void setEventHandlerData( const Alf::AlfWidgetEventHandlerInitData& /*aData*/ );
|
|
163 |
Alf::AlfWidgetEventHandlerInitData* eventHandlerData();
|
|
164 |
Alf::IAlfInterfaceBase* makeInterface(const Alf::IfId& /*aType */);
|
|
165 |
AlfEventHandlerType eventHandlerType() ;
|
|
166 |
AlfEventHandlerExecutionPhase eventExecutionPhase() ;
|
|
167 |
|
|
168 |
/**
|
|
169 |
* HandleFocusChanged
|
|
170 |
* Focus change notification to implemented class
|
|
171 |
*/
|
|
172 |
virtual void HandleFocusChanged( TInt aNewFocusIndex, TInt aPreviousFocusIndex );
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Item
|
|
176 |
*@param aIndex index of visual item
|
|
177 |
*@return MulVisualItem the visual item at that index
|
|
178 |
*/
|
|
179 |
const Alf::MulVisualItem& Item( TInt aIndex ) const;
|
|
180 |
|
|
181 |
private:
|
|
182 |
//The widget to which the model will be set
|
|
183 |
/// Never expose this widget to any other class so that the osn-symbian interface
|
|
184 |
/// is minimised to here. (i.e., try/catch vs. trap/leave)
|
|
185 |
Alf::IMulWidget& iWidget;
|
|
186 |
|
|
187 |
//Owned: Model
|
|
188 |
/// Never expose this model to any other class so that the osn-symbian interface
|
|
189 |
/// is minimised to here. (i.e., try/catch vs. trap/leave)
|
|
190 |
Alf::IMulModel* iModel;
|
|
191 |
|
|
192 |
TBool iWithinFocusChangeCall;
|
|
193 |
|
|
194 |
//previous focus index
|
|
195 |
TInt iPreviousFocusIndex;
|
|
196 |
|
|
197 |
CAlfEnv* iEnv;
|
|
198 |
|
|
199 |
Alf::mulwidget::TLogicalTemplate iDefaultTemplate;
|
|
200 |
|
|
201 |
TInt iDataWindowSize;
|
|
202 |
|
|
203 |
// Create navigational state
|
|
204 |
CGlxNavigationalState* iNavigationalState;
|
|
205 |
CGlxDrmGifTextureCreator* iDrmGifTextureCreator;
|
|
206 |
};
|
|
207 |
|
|
208 |
#endif // _GLXMULMODELPROVIDERBASE_H_
|