25
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 - 2010 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 dialer view of PhoneUI
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "phoneconstants.h"
|
|
21 |
#include "cphonedialerview.h"
|
|
22 |
|
|
23 |
#include <eikenv.h>
|
|
24 |
#include <eikapp.h>
|
|
25 |
#include <eikappui.h>
|
|
26 |
#include <eikcmobs.h>
|
|
27 |
|
|
28 |
#include <w32std.h> // iWindowSrvSession
|
|
29 |
|
|
30 |
#include <eikimage.h>
|
|
31 |
#include <coemain.h>
|
|
32 |
#include <gulutil.h> // DrawUtils, egul.lib
|
|
33 |
#include <aknappui.h>
|
|
34 |
#include <AknsLayeredBackgroundControlContext.h>
|
|
35 |
#include <AknsDrawUtils.h>
|
|
36 |
#include <AknsUtils.h>
|
|
37 |
|
|
38 |
#include "cphonestatuspane.h"
|
|
39 |
#include "tphonecmdparambitmap.h"
|
|
40 |
#include "phonelogger.h"
|
|
41 |
|
|
42 |
#include <AknUtils.h> // needed for AKN_LAF_COLOR in 3.0 environment
|
|
43 |
|
|
44 |
|
|
45 |
#include "phoneui.hrh"
|
|
46 |
#include "phoneviewcommanddefinitions.h"
|
|
47 |
// Scalable UI
|
|
48 |
#include <aknlayout.cdl.h>
|
|
49 |
#include <layoutmetadata.cdl.h>
|
|
50 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
51 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
52 |
#include <AknStatuspaneUtils.h>
|
|
53 |
|
|
54 |
enum TPhoneBgLayers
|
|
55 |
{
|
|
56 |
EPhoneBgFirstLayer = 0,
|
|
57 |
EPhoneBgLayersN = 1
|
|
58 |
};
|
|
59 |
|
|
60 |
// ================= MEMBER FUNCTIONS =======================
|
|
61 |
|
|
62 |
// -----------------------------------------------------------------------------
|
|
63 |
// CPhoneDialerView::CPhoneDialerView
|
|
64 |
// C++ default constructor can NOT contain any code, that
|
|
65 |
// might leave.
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
CPhoneDialerView::CPhoneDialerView()
|
|
69 |
{
|
|
70 |
}
|
|
71 |
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
// CPhoneDialerView::ConstructL
|
|
74 |
// Symbian 2nd phase constructor can leave.
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
void CPhoneDialerView::ConstructL( TRect aRect )
|
|
78 |
{
|
|
79 |
// Create background control context for skins.
|
|
80 |
iBgContext = CAknsLayeredBackgroundControlContext::NewL(
|
|
81 |
KAknsIIDQsnBgScreen, aRect, ETrue /*Parent absolute*/,
|
|
82 |
EPhoneBgLayersN );
|
|
83 |
|
|
84 |
CreateWindowL();
|
|
85 |
DrawableWindow()->SetPointerGrab( ETrue );
|
|
86 |
|
|
87 |
SetComponentsToInheritVisibility( ETrue );
|
|
88 |
}
|
|
89 |
|
|
90 |
// -----------------------------------------------------------------------------
|
|
91 |
// CPhoneDialerView::NewL
|
|
92 |
// Two-phased constructor.
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
CPhoneDialerView* CPhoneDialerView::NewL( TRect aRect )
|
|
96 |
{
|
|
97 |
CPhoneDialerView* self = new ( ELeave ) CPhoneDialerView();
|
|
98 |
|
|
99 |
CleanupStack::PushL( self );
|
|
100 |
self->ConstructL( aRect );
|
|
101 |
CleanupStack::Pop( self );
|
|
102 |
return self;
|
|
103 |
}
|
|
104 |
|
|
105 |
// Destructor
|
|
106 |
CPhoneDialerView::~CPhoneDialerView()
|
|
107 |
{
|
|
108 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::~CPhoneDialerView");
|
|
109 |
delete iBgContext;
|
|
110 |
iRegion.Close();
|
|
111 |
}
|
|
112 |
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
// CPhoneDialerView::ViewId
|
|
115 |
// -----------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
TVwsViewId CPhoneDialerView::ViewId() const
|
|
118 |
{
|
|
119 |
TVwsViewId id(
|
|
120 |
iEikonEnv->EikAppUi()->Application()->AppDllUid(),
|
|
121 |
KUidViewId );
|
|
122 |
return id;
|
|
123 |
}
|
|
124 |
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
// CPhoneDialerView::ViewActivatedL
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void CPhoneDialerView::ViewActivatedL(
|
|
130 |
const TVwsViewId& /*aPrevViewId*/,
|
|
131 |
TUid /*aCustomMessageId*/,
|
|
132 |
const TDesC8& /*aCustomMessage*/ )
|
|
133 |
{
|
|
134 |
}
|
|
135 |
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
// CPhoneDialerView::ViewDeactivated
|
|
138 |
// -----------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CPhoneDialerView::ViewDeactivated()
|
|
141 |
{
|
|
142 |
}
|
|
143 |
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
// CPhoneDialerView::SetControl
|
|
146 |
//
|
|
147 |
// Change the control.
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
void CPhoneDialerView::SetControl( CCoeControl* aControl )
|
|
151 |
{
|
|
152 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::SetControl()");
|
|
153 |
iControl = aControl;
|
|
154 |
UpdateControlRect();
|
|
155 |
iControl->MakeVisible( ETrue );
|
|
156 |
}
|
|
157 |
|
|
158 |
|
|
159 |
// -----------------------------------------------------------------------------
|
|
160 |
// CPhoneDialerView::Control
|
|
161 |
// -----------------------------------------------------------------------------
|
|
162 |
//
|
|
163 |
CCoeControl* CPhoneDialerView::Control() const
|
|
164 |
{
|
|
165 |
return iControl;
|
|
166 |
}
|
|
167 |
|
|
168 |
// -----------------------------------------------------------------------------
|
|
169 |
// CPhoneDialerView::ComponentControl
|
|
170 |
// -----------------------------------------------------------------------------
|
|
171 |
//
|
|
172 |
CCoeControl* CPhoneDialerView::ComponentControl( TInt /*aIndex*/ ) const
|
|
173 |
{
|
|
174 |
return iControl;
|
|
175 |
}
|
|
176 |
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
// CPhoneDialerView::CountComponentControls
|
|
179 |
// -----------------------------------------------------------------------------
|
|
180 |
//
|
|
181 |
TInt CPhoneDialerView::CountComponentControls() const
|
|
182 |
{
|
|
183 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::CountComponentControls()");
|
|
184 |
TInt count = 0;
|
|
185 |
|
|
186 |
if ( iControl )
|
|
187 |
{
|
|
188 |
count = 1;
|
|
189 |
}
|
|
190 |
|
|
191 |
return count;
|
|
192 |
}
|
|
193 |
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
// CPhoneDialerView::MopSupplyObject
|
|
196 |
// -----------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
TTypeUid::Ptr CPhoneDialerView::MopSupplyObject( TTypeUid aId )
|
|
199 |
{
|
|
200 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::MopSupplyObject()");
|
|
201 |
// Required during rendering of the background skin in Draw()
|
|
202 |
if (aId.iUid == MAknsControlContext::ETypeId)
|
|
203 |
{
|
|
204 |
return MAknsControlContext::SupplyMopObject( aId, iBgContext );
|
|
205 |
}
|
|
206 |
return CCoeControl::MopSupplyObject( aId );
|
|
207 |
}
|
|
208 |
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
// CPhoneDialerView::SetRect
|
|
211 |
// -----------------------------------------------------------------------------
|
|
212 |
//
|
|
213 |
void CPhoneDialerView::SetRect( const TRect& aRect )
|
|
214 |
{
|
|
215 |
CCoeControl::SetRect( aRect );
|
|
216 |
iControlRect = Rect();
|
|
217 |
// Forward size change to the control only if we are visible. Otherwise the
|
|
218 |
// control rect is just srored and relayed to control when we do become
|
|
219 |
// visible. This way we can avoid unnecessary relayout work for example when
|
|
220 |
// status bar size changes or screen is rotated while in-call ui is active.
|
|
221 |
if ( IsVisible() )
|
|
222 |
{
|
|
223 |
UpdateControlRect();
|
|
224 |
}
|
|
225 |
}
|
|
226 |
|
|
227 |
// -----------------------------------------------------------------------------
|
|
228 |
// CPhoneDialerView::Draw
|
|
229 |
// -----------------------------------------------------------------------------
|
|
230 |
//
|
|
231 |
void CPhoneDialerView::Draw( const TRect& aRect ) const
|
|
232 |
{
|
|
233 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::Draw()");
|
|
234 |
TRect rect = Rect();
|
|
235 |
|
|
236 |
if ( !rect.iTl.iY )
|
|
237 |
{
|
|
238 |
CWindowGc& gc = SystemGc();
|
|
239 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
240 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
241 |
|
|
242 |
if ( !AknsDrawUtils::Background( skin, cc, this, gc, aRect ) )
|
|
243 |
{
|
|
244 |
gc.SetPenStyle(CGraphicsContext::ENullPen);
|
|
245 |
gc.SetBrushColor( AKN_LAF_COLOR( 0 ) ); // 0 for white
|
|
246 |
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
247 |
gc.DrawRect( aRect );
|
|
248 |
}
|
|
249 |
}
|
|
250 |
}
|
|
251 |
|
|
252 |
// -----------------------------------------------------------------------------
|
|
253 |
// CPhoneDialerView::HandlePointerEventL
|
|
254 |
// -----------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
void CPhoneDialerView::HandlePointerEventL( const TPointerEvent& aPointerEvent )
|
|
257 |
{
|
|
258 |
// Calling base class implementation
|
|
259 |
CCoeControl::HandlePointerEventL( aPointerEvent );
|
|
260 |
}
|
|
261 |
|
|
262 |
// -----------------------------------------------------------------------------
|
|
263 |
// CPhoneDialerView::ActivateL
|
|
264 |
// -----------------------------------------------------------------------------
|
|
265 |
//
|
|
266 |
void CPhoneDialerView::ActivateL()
|
|
267 |
{
|
|
268 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::ActivateL()");
|
|
269 |
CCoeControl::ActivateL();
|
|
270 |
}
|
|
271 |
|
|
272 |
// -----------------------------------------------------------------------------
|
|
273 |
// CPhoneDialerView::SizeChanged()
|
|
274 |
//
|
|
275 |
// Expects that the controls are initialised otherwise.
|
|
276 |
// -----------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
void CPhoneDialerView::SizeChanged()
|
|
279 |
{
|
|
280 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::SizeChanged()");
|
|
281 |
AknsUtils::RegisterControlPosition( this );
|
|
282 |
|
|
283 |
TRect screen;
|
|
284 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
|
|
285 |
iBgContext->SetLayerImage( EPhoneBgFirstLayer, KAknsIIDQsnBgScreen );
|
|
286 |
iBgContext->SetParentPos( screen.iTl );
|
|
287 |
iBgContext->SetLayerRect( EPhoneBgFirstLayer, screen ) ;
|
|
288 |
}
|
|
289 |
|
|
290 |
// -----------------------------------------------------------------------------
|
|
291 |
// CPhoneDialerView::PositionChanged
|
|
292 |
// -----------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
void CPhoneDialerView::PositionChanged()
|
|
295 |
{
|
|
296 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::PositionChanged()");
|
|
297 |
AknsUtils::RegisterControlPosition( this );
|
|
298 |
}
|
|
299 |
|
|
300 |
// -----------------------------------------------------------------------------
|
|
301 |
// CPhoneDialerView::FocusChanged
|
|
302 |
// -----------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
void CPhoneDialerView::FocusChanged( TDrawNow /*aDrawNow*/ )
|
|
305 |
{
|
|
306 |
iControl->SetFocus( IsFocused () );
|
|
307 |
}
|
|
308 |
|
|
309 |
// -----------------------------------------------------------------------------
|
|
310 |
// CPhoneDialerView::UpdateControlRect
|
|
311 |
// -----------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
void CPhoneDialerView::UpdateControlRect()
|
|
314 |
{
|
|
315 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::UpdateControlRect()");
|
|
316 |
if ( iControl )
|
|
317 |
{
|
|
318 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
319 |
{
|
|
320 |
if ( Rect() != iControl->Rect() )
|
|
321 |
{
|
|
322 |
iControl->SetRect( Rect() );
|
|
323 |
}
|
|
324 |
}
|
|
325 |
else
|
|
326 |
{
|
|
327 |
iControl->SetRect( iControlRect );
|
|
328 |
}
|
|
329 |
}
|
|
330 |
}
|
|
331 |
|
|
332 |
// -----------------------------------------------------------------------------
|
|
333 |
// CPhoneDialerView::HandleResourceChangeL
|
|
334 |
// -----------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
void CPhoneDialerView::HandleResourceChange( TInt aType )
|
|
337 |
{
|
|
338 |
__LOGMETHODSTARTEND(EPhoneUIView, "CPhoneDialerView::HandleResourceChange()");
|
|
339 |
|
|
340 |
if ( aType == KAknsMessageSkinChange ||
|
|
341 |
aType == KEikDynamicLayoutVariantSwitch )
|
|
342 |
{
|
|
343 |
DrawDeferred();
|
|
344 |
}
|
|
345 |
}
|
|
346 |
|
|
347 |
// -----------------------------------------------------------------------------
|
|
348 |
// CPhoneDialerView::MakeVisible
|
|
349 |
// -----------------------------------------------------------------------------
|
|
350 |
//
|
|
351 |
void CPhoneDialerView::MakeVisible( TBool aVisible )
|
|
352 |
{
|
|
353 |
if ( aVisible )
|
|
354 |
{
|
|
355 |
// Deferred control rect size update before view becomes visible.
|
|
356 |
// We don't relay size changes to our control while view is invisible
|
|
357 |
// to avoid unnecessary layout recalculations.
|
|
358 |
UpdateControlRect();
|
|
359 |
}
|
|
360 |
CCoeControl::MakeVisible( aVisible );
|
|
361 |
}
|
|
362 |
|
|
363 |
// End of File
|