|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Draws empty rect. Prevents flickering in mce launch. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <eikenv.h> |
|
23 #include <aknenv.h> |
|
24 #include <AknsDrawUtils.h> |
|
25 #include <AknsBasicBackgroundControlContext.h> |
|
26 #include "MceMainViewEmptyListContainer.h" |
|
27 |
|
28 |
|
29 // ================= MEMBER FUNCTIONS ======================= |
|
30 |
|
31 // C++ default constructor can NOT contain any code that |
|
32 // might leave. |
|
33 // |
|
34 CMceMainViewEmptyListContainer::CMceMainViewEmptyListContainer() |
|
35 { |
|
36 } |
|
37 |
|
38 // Symbian OS default constructor can leave. |
|
39 void CMceMainViewEmptyListContainer::ConstructL( const TRect& aRect ) |
|
40 { |
|
41 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
42 KAknsIIDQsnBgAreaMainMessage, aRect, ETrue); |
|
43 CreateWindowL(); |
|
44 SetRect( aRect ); |
|
45 ActivateL(); |
|
46 MakeVisible( ETrue ); |
|
47 } |
|
48 |
|
49 // Two-phased constructor. |
|
50 CMceMainViewEmptyListContainer* CMceMainViewEmptyListContainer::NewL( const TRect& aRect ) |
|
51 { |
|
52 CMceMainViewEmptyListContainer* self = new ( ELeave ) CMceMainViewEmptyListContainer(); |
|
53 CleanupStack::PushL( self ); |
|
54 self->ConstructL( aRect ); |
|
55 CleanupStack::Pop( self ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 |
|
60 // Destructor |
|
61 CMceMainViewEmptyListContainer::~CMceMainViewEmptyListContainer() |
|
62 { |
|
63 delete iBgContext; |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------- |
|
68 // CMceMainViewEmptyListContainer::OfferKeyEventL |
|
69 // --------------------------------------------------------- |
|
70 // |
|
71 TKeyResponse CMceMainViewEmptyListContainer::OfferKeyEventL( |
|
72 const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) |
|
73 { |
|
74 return EKeyWasConsumed; |
|
75 } |
|
76 // --------------------------------------------------------- |
|
77 // CMceMainViewEmptyListContainer::MopSupplyObject |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 TTypeUid::Ptr CMceMainViewEmptyListContainer::MopSupplyObject(TTypeUid aId) |
|
81 { |
|
82 if (aId.iUid == MAknsControlContext::ETypeId) |
|
83 { |
|
84 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
85 } |
|
86 return CCoeControl::MopSupplyObject(aId); |
|
87 } |
|
88 // --------------------------------------------------------- |
|
89 // CMceMainViewEmptyListContainer::SizeChanged |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 void CMceMainViewEmptyListContainer::SizeChanged() |
|
93 { |
|
94 if ( iBgContext ) |
|
95 { |
|
96 iBgContext->SetRect( Rect() ); |
|
97 iBgContext->SetParentPos( PositionRelativeToScreen() ); |
|
98 } |
|
99 } |
|
100 // --------------------------------------------------------- |
|
101 // CMceMainViewEmptyListContainer::Draw |
|
102 // --------------------------------------------------------- |
|
103 // |
|
104 void CMceMainViewEmptyListContainer::Draw(const TRect& /*aRect*/ ) const |
|
105 { |
|
106 CWindowGc& gc = SystemGc(); |
|
107 TRect aRect = Rect(); |
|
108 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
109 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
110 |
|
111 if( !AknsDrawUtils::Background( skin, cc, this, gc, aRect ) ) |
|
112 { |
|
113 // Same as CCoeControl draw for blank controls |
|
114 CGraphicsContext& gcBlank = SystemGc(); |
|
115 gcBlank.SetPenStyle( CGraphicsContext::ENullPen ); |
|
116 gcBlank.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
117 gcBlank.DrawRect( aRect ); |
|
118 } |
|
119 |
|
120 } |
|
121 |
|
122 // End of File |