33
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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: The MUS application's UI class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "musuibackgroundviewcontainer.h"
|
|
19 |
#include "musuiappui.h"
|
|
20 |
#include "muslogger.h" // debug logging
|
|
21 |
|
|
22 |
#include <AknsControlContext.h>
|
|
23 |
#include <AknsBasicBackgroundControlContext.h>
|
|
24 |
#include <AknsDrawUtils.h>
|
|
25 |
#include <StringLoader.h> // StringLoader
|
|
26 |
#include <aknnotewrappers.h>
|
|
27 |
#include <AknWaitDialog.h>
|
|
28 |
#include <AknGlobalNote.h>
|
|
29 |
#include <AknDef.h>
|
|
30 |
|
|
31 |
|
|
32 |
// Hidden window group. magic number 32 hiddens window
|
|
33 |
_LIT( KMusUiBackgroundWindowGroupName,"32MusUiBackground" );
|
|
34 |
|
|
35 |
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
//
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CMusUiBackgroundViewContainer* CMusUiBackgroundViewContainer::NewL(
|
|
41 |
const TRect& aRect,
|
|
42 |
TInt aOrdinalPosition )
|
|
43 |
{
|
|
44 |
CMusUiBackgroundViewContainer* self =
|
|
45 |
new( ELeave )CMusUiBackgroundViewContainer( aOrdinalPosition );
|
|
46 |
CleanupStack::PushL( self );
|
|
47 |
self->ConstructL( aRect );
|
|
48 |
CleanupStack::Pop( self );
|
|
49 |
return self;
|
|
50 |
}
|
|
51 |
|
|
52 |
// -----------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CMusUiBackgroundViewContainer::CMusUiBackgroundViewContainer(
|
|
57 |
TInt aOrdinalPosition ) : iOrdinalPosition( aOrdinalPosition )
|
|
58 |
{
|
|
59 |
}
|
|
60 |
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
void CMusUiBackgroundViewContainer::ConstructL( const TRect& aRect )
|
|
66 |
{
|
|
67 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::ConstructL()" );
|
|
68 |
|
|
69 |
RWindowGroup iMyWindowGroup = RWindowGroup( iCoeEnv->WsSession() );
|
|
70 |
User::LeaveIfError( iMyWindowGroup.Construct( ( TUint32 )&iMyWindowGroup) );
|
|
71 |
|
|
72 |
iMyWindowGroup.SetName( KMusUiBackgroundWindowGroupName );
|
|
73 |
iMyWindowGroup.SetOrdinalPosition( iOrdinalPosition, ECoeWinPriorityNormal );
|
|
74 |
iMyWindowGroup.EnableReceiptOfFocus( EFalse );
|
|
75 |
iMyWindowGroup.AutoForeground( EFalse );
|
|
76 |
iMyWindowGroup.SetNonFading( ETrue );
|
|
77 |
|
|
78 |
CreateWindowL(&iMyWindowGroup);
|
|
79 |
|
|
80 |
iGroupIdentifier = iMyWindowGroup.Identifier();
|
|
81 |
|
|
82 |
iBackGround = CAknsBasicBackgroundControlContext::NewL(
|
|
83 |
KAknsIIDQsnBgAreaMain,
|
|
84 |
aRect,
|
|
85 |
EFalse );
|
|
86 |
|
|
87 |
SetRect( aRect );
|
|
88 |
|
|
89 |
ActivateL();
|
|
90 |
|
|
91 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::ConstructL()" );
|
|
92 |
}
|
|
93 |
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
CMusUiBackgroundViewContainer::~CMusUiBackgroundViewContainer()
|
|
99 |
{
|
|
100 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::~CMusUiBackgroundViewContainer()" );
|
|
101 |
delete iBackGround;
|
|
102 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::~CMusUiBackgroundViewContainer()" );
|
|
103 |
}
|
|
104 |
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
//
|
|
109 |
void CMusUiBackgroundViewContainer::RefreshView()
|
|
110 |
{
|
|
111 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::RefreshView()" );
|
|
112 |
|
|
113 |
DrawNow();
|
|
114 |
|
|
115 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::RefreshView()" );
|
|
116 |
}
|
|
117 |
|
|
118 |
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
// Set's this group right ordinal position
|
|
121 |
// -----------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
void CMusUiBackgroundViewContainer::SetOrdinalPosition()
|
|
124 |
{
|
|
125 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::SetOrdinalPosition(): %d",
|
|
126 |
iOrdinalPosition );
|
|
127 |
MakeVisible( ETrue );
|
|
128 |
|
|
129 |
iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( iGroupIdentifier,
|
|
130 |
iOrdinalPosition );
|
|
131 |
|
|
132 |
DrawNow();
|
|
133 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::SetOrdinalPosition()" );
|
|
134 |
}
|
|
135 |
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
// Set's this group right ordinal position
|
|
138 |
// -----------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CMusUiBackgroundViewContainer::SetOrdinalPosition( TInt aOrdianlPosition)
|
|
141 |
{
|
|
142 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::SetOrdinalPosition(): %d",
|
|
143 |
aOrdianlPosition );
|
|
144 |
MakeVisible( ETrue );
|
|
145 |
|
|
146 |
iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( iGroupIdentifier,
|
|
147 |
aOrdianlPosition );
|
|
148 |
|
|
149 |
DrawNow();
|
|
150 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::SetOrdinalPosition()" );
|
|
151 |
}
|
|
152 |
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
//
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
void CMusUiBackgroundViewContainer::UpdateOrdinalPositionValue( TBool aUp )
|
|
158 |
{
|
|
159 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::UpdateOrdinalPositionValue(): %d",
|
|
160 |
aUp );
|
|
161 |
if ( aUp )
|
|
162 |
{
|
|
163 |
++iOrdinalPosition;
|
|
164 |
}
|
|
165 |
else
|
|
166 |
{
|
|
167 |
--iOrdinalPosition;
|
|
168 |
}
|
|
169 |
SetOrdinalPosition();
|
|
170 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::UpdateOrdinalPositionValue()" );
|
|
171 |
}
|
|
172 |
|
|
173 |
|
|
174 |
// -----------------------------------------------------------------------------
|
|
175 |
// Called by framework when the view size is changed
|
|
176 |
// -----------------------------------------------------------------------------
|
|
177 |
//
|
|
178 |
void CMusUiBackgroundViewContainer::SizeChanged()
|
|
179 |
{
|
|
180 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::SizeChanged()" );
|
|
181 |
TRect parentRect(Rect());
|
|
182 |
if (iBackGround)
|
|
183 |
{
|
|
184 |
(static_cast<CAknsBasicBackgroundControlContext*>(iBackGround))->SetRect(parentRect);
|
|
185 |
}
|
|
186 |
|
|
187 |
SetOrdinalPosition();
|
|
188 |
//MakeVisible( EFalse );
|
|
189 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::SizeChanged()" );
|
|
190 |
}
|
|
191 |
|
|
192 |
|
|
193 |
// -----------------------------------------------------------------------------
|
|
194 |
// Called by framework when to retrieve the no. of controls.
|
|
195 |
// -----------------------------------------------------------------------------
|
|
196 |
//
|
|
197 |
TInt CMusUiBackgroundViewContainer::CountComponentControls() const
|
|
198 |
{
|
|
199 |
return 0; // return nbr of controls inside this container
|
|
200 |
}
|
|
201 |
|
|
202 |
|
|
203 |
// -----------------------------------------------------------------------------
|
|
204 |
// Called by framework to retrieve the control specified by index.
|
|
205 |
// -----------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
CCoeControl* CMusUiBackgroundViewContainer::ComponentControl( TInt /*aIndex*/ ) const
|
|
208 |
{
|
|
209 |
return NULL;
|
|
210 |
}
|
|
211 |
|
|
212 |
|
|
213 |
// -----------------------------------------------------------------------------
|
|
214 |
// Called by framework to redraw the screen area.
|
|
215 |
// -----------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
void CMusUiBackgroundViewContainer::Draw( const TRect& aRect ) const
|
|
218 |
{
|
|
219 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiBackgroundViewContainer::Draw()" );
|
|
220 |
|
|
221 |
CWindowGc& gc = SystemGc();
|
|
222 |
|
|
223 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
224 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
225 |
if(!AknsDrawUtils::Background( skin, cc,this,gc,aRect,KAknsDrawParamDefault ))
|
|
226 |
{
|
|
227 |
MUS_LOG( "mus: [MUSUI ] Skin not valid or not found" );
|
|
228 |
gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) );
|
|
229 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
230 |
gc.Clear( aRect );
|
|
231 |
}
|
|
232 |
|
|
233 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiBackgroundViewContainer::Draw()" );
|
|
234 |
}
|
|
235 |
|
|
236 |
// -----------------------------------------------------------------------------
|
|
237 |
//
|
|
238 |
// -----------------------------------------------------------------------------
|
|
239 |
//
|
|
240 |
void CMusUiBackgroundViewContainer::HandleControlEventL(
|
|
241 |
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
|
|
242 |
{
|
|
243 |
// TODO: Add your control event handler code here
|
|
244 |
}
|
|
245 |
|
|
246 |
|
|
247 |
// -----------------------------------------------------------------------------
|
|
248 |
// Called by framework to act on key events if required.
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
//
|
|
251 |
TKeyResponse CMusUiBackgroundViewContainer::OfferKeyEventL(
|
|
252 |
const TKeyEvent& /*aKeyEvent*/,
|
|
253 |
TEventCode /*aType*/ )
|
|
254 |
{
|
|
255 |
return EKeyWasNotConsumed;
|
|
256 |
}
|
|
257 |
|
|
258 |
|
|
259 |
// -----------------------------------------------------------------------------
|
|
260 |
// Supply the Mob Object for background skin drawing
|
|
261 |
// -----------------------------------------------------------------------------
|
|
262 |
//
|
|
263 |
TTypeUid::Ptr CMusUiBackgroundViewContainer::MopSupplyObject( TTypeUid aId )
|
|
264 |
{
|
|
265 |
if (aId.iUid == MAknsControlContext::ETypeId && iBackGround )
|
|
266 |
{
|
|
267 |
return MAknsControlContext::SupplyMopObject( aId, iBackGround );
|
|
268 |
}
|
|
269 |
return CCoeControl::MopSupplyObject( aId );
|
|
270 |
}
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
// end of file
|