|
26
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2006 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: Button state manager for common playback view
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
#ifndef CMPXBUTTONMANAGER_H
|
|
|
21 |
#define CMPXBUTTONMANAGER_H
|
|
|
22 |
|
|
|
23 |
// INCLUDES
|
|
|
24 |
#include <coecntrl.h>
|
|
|
25 |
#include <AknUtils.h>
|
|
|
26 |
|
|
|
27 |
#include "mpxbutton.h"
|
|
|
28 |
#include "mpxplaybackframeworkdefs.h"
|
|
|
29 |
|
|
|
30 |
// FORWARD DECLARATIONS
|
|
|
31 |
class CWindowGc;
|
|
|
32 |
class MAknsControlContext;
|
|
|
33 |
class MMPXPlaybackViewLayout;
|
|
|
34 |
|
|
|
35 |
class CAknButton;
|
|
|
36 |
class CAknViewAppUi;
|
|
|
37 |
class CGulIcon;
|
|
|
38 |
// CLASS DECLARATION
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Button state manager for playback view.
|
|
|
42 |
*
|
|
|
43 |
* @lib mpxplaybackview.dll
|
|
|
44 |
* @since S60 v3.0
|
|
|
45 |
*/
|
|
|
46 |
NONSHARABLE_CLASS( CMPXButtonManager ) :public CCoeControl,
|
|
|
47 |
public MCoeControlObserver,
|
|
|
48 |
public MCoeControlBackground
|
|
|
49 |
{
|
|
|
50 |
public: // Constructors and destructor
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* Two-phased constructor.
|
|
|
54 |
* since 5.0
|
|
|
55 |
* @param aObserver Observer to receive commands from button
|
|
|
56 |
* pushes.
|
|
|
57 |
* @param aLayout Layout for this view
|
|
|
58 |
* @param aContainer Container for this control
|
|
|
59 |
*/
|
|
|
60 |
static CMPXButtonManager* NewL(
|
|
|
61 |
MMPXButtonCmdObserver* aObserver,
|
|
|
62 |
MMPXPlaybackViewLayout* aLayout,
|
|
|
63 |
const CCoeControl &aContainer);
|
|
|
64 |
/**
|
|
|
65 |
* Destructor.
|
|
|
66 |
*/
|
|
|
67 |
virtual ~CMPXButtonManager();
|
|
|
68 |
|
|
|
69 |
public:
|
|
|
70 |
|
|
|
71 |
/**
|
|
|
72 |
* Update button state based on the state of the engine
|
|
|
73 |
* @param aState State of the playback engine
|
|
|
74 |
*/
|
|
|
75 |
void UpdateButtonStates(TMPXPlaybackState aState);
|
|
|
76 |
|
|
|
77 |
/**
|
|
|
78 |
* Handle a key event.
|
|
|
79 |
* @see CCoeControl::OfferKeyEventL
|
|
|
80 |
*/
|
|
|
81 |
TKeyResponse OfferKeyEventL(
|
|
|
82 |
const TKeyEvent& aKeyEvent,
|
|
|
83 |
TEventCode aType);
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
* Set parent rectangle for the button layout
|
|
|
87 |
* @since 3.0
|
|
|
88 |
* @param aRect Parent rectangle
|
|
|
89 |
*/
|
|
|
90 |
void SetParentRect(const TRect& aRect);
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* Sets to enable/display the button or not
|
|
|
94 |
*/
|
|
|
95 |
void SetEnabled( TBool aEnabled );
|
|
|
96 |
|
|
|
97 |
/**
|
|
|
98 |
* Handles losing foreground
|
|
|
99 |
*
|
|
|
100 |
* @since S60 3.0
|
|
|
101 |
*/
|
|
|
102 |
void HandleForegroundLostL();
|
|
|
103 |
|
|
|
104 |
/**
|
|
|
105 |
* From CCoeControl.
|
|
|
106 |
* Gets the number of controls contained in a compound control.
|
|
|
107 |
* since 5.0
|
|
|
108 |
*
|
|
|
109 |
* @return The number of component controls contained by this control.
|
|
|
110 |
*/
|
|
|
111 |
TInt CountComponentControls() const;
|
|
|
112 |
|
|
|
113 |
/**
|
|
|
114 |
* From CCoeControl.
|
|
|
115 |
* Gets an indexed component of a compound control.
|
|
|
116 |
* since 5.0
|
|
|
117 |
*
|
|
|
118 |
* @param aIndex The index of the control.
|
|
|
119 |
* @return The component control with an index of aIndex.
|
|
|
120 |
*/
|
|
|
121 |
CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
|
122 |
|
|
|
123 |
/**
|
|
|
124 |
* From MCoeControlObserver.
|
|
|
125 |
* To handle the button events.
|
|
|
126 |
* since 5.0
|
|
|
127 |
*/
|
|
|
128 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
|
|
|
129 |
|
|
|
130 |
/**
|
|
|
131 |
* From CoeControl.
|
|
|
132 |
* Handles a change to the control's resources.
|
|
|
133 |
* since 5.0
|
|
|
134 |
*
|
|
|
135 |
* @param aType A message UID value.
|
|
|
136 |
*/
|
|
|
137 |
void HandleResourceChange( TInt aType );
|
|
|
138 |
|
|
|
139 |
void CMPXButtonManager::SizeChanged();
|
|
|
140 |
|
|
|
141 |
/**
|
|
|
142 |
* From MCoeControlBackground
|
|
|
143 |
* since 5.0
|
|
|
144 |
*/
|
|
|
145 |
void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const;
|
|
|
146 |
|
|
|
147 |
/**
|
|
|
148 |
* restore button state in some special case
|
|
|
149 |
* @since S60 3.0
|
|
|
150 |
* @param aState State of the playback engine
|
|
|
151 |
*/
|
|
|
152 |
void RestoreButtonStates( TMPXPlaybackState aState );
|
|
|
153 |
|
|
|
154 |
private:
|
|
|
155 |
/**
|
|
|
156 |
* C++ default constructor.
|
|
|
157 |
*/
|
|
|
158 |
CMPXButtonManager(
|
|
|
159 |
MMPXButtonCmdObserver* aObserver,
|
|
|
160 |
MMPXPlaybackViewLayout* aLayout);
|
|
|
161 |
/**
|
|
|
162 |
* By default Symbian 2nd phase constructor is private.
|
|
|
163 |
*/
|
|
|
164 |
void ConstructL(const CCoeControl &aContainer);
|
|
|
165 |
|
|
|
166 |
private: // New functions
|
|
|
167 |
|
|
|
168 |
/**
|
|
|
169 |
* Create the rocker button using multiple avkon buttons
|
|
|
170 |
*/
|
|
|
171 |
void CreateRockerAvkonButtonsL(const CCoeControl &aContainer);
|
|
|
172 |
|
|
|
173 |
/**
|
|
|
174 |
* Sets the avkon rocker button state and send observer commands
|
|
|
175 |
*/
|
|
|
176 |
TKeyResponse SetAvkonButtonStateL( const TKeyEvent& aKeyEvent, TEventCode aType );
|
|
|
177 |
|
|
|
178 |
/**
|
|
|
179 |
* Callback for long-press timer
|
|
|
180 |
*/
|
|
|
181 |
static TInt TimerCallback(TAny* aPtr);
|
|
|
182 |
|
|
|
183 |
/**
|
|
|
184 |
* Handle long press event.
|
|
|
185 |
*/
|
|
|
186 |
void HandleLongPressL();
|
|
|
187 |
|
|
|
188 |
private: // Data
|
|
|
189 |
TRect iParentRect;
|
|
|
190 |
TInt iButton;
|
|
|
191 |
MMPXButtonCmdObserver* iObserver; // not owned
|
|
|
192 |
|
|
|
193 |
TBool iIsEmbedded;
|
|
|
194 |
TBool iProgDownloadMode;
|
|
|
195 |
TBool iIsCDPreview;
|
|
|
196 |
TBool iKeyDownEventReceived;
|
|
|
197 |
MMPXPlaybackViewLayout* iLayout; // not owned
|
|
|
198 |
TBool iEnabled;
|
|
|
199 |
TBool iKeyDownReceived;
|
|
|
200 |
TBool iIsSeeking;
|
|
|
201 |
RPointerArray<CAknButton> iAvkonButtons; // owned
|
|
|
202 |
TInt iRockerAvkonButtonCount;
|
|
|
203 |
TBool iVolumeInRocker;
|
|
|
204 |
TBool iIsTouchUi;
|
|
|
205 |
TBool iStopInRocker;
|
|
|
206 |
TBool iIsLongPress;
|
|
|
207 |
CPeriodic* iLongKeyTimer;
|
|
|
208 |
TInt iLongPressCommandId;
|
|
|
209 |
};
|
|
|
210 |
|
|
|
211 |
#endif // CMPXBUTTONMANAGER_H
|
|
|
212 |
|
|
|
213 |
// End of File
|