|
1 /* |
|
2 * Copyright (c) 2007,2008 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: Implementation of CStartupView class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <aknappui.h> |
|
20 #include <AknsBasicBackgroundControlContext.h> // Skin support |
|
21 #include <AknsDrawUtils.h> // Skin support |
|
22 |
|
23 #include "startupview.h" |
|
24 #include "StartupDefines.h" |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CStartupView::NewL |
|
30 // |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 CStartupView* CStartupView::NewL( const TRect& aRect ) |
|
34 { |
|
35 TRACES("CStartupView::NewL()"); |
|
36 |
|
37 CStartupView* self = new( ELeave ) CStartupView; |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL( aRect ); |
|
40 CleanupStack::Pop( self ); |
|
41 |
|
42 TRACES("CStartupView::NewL(): End"); |
|
43 return self; |
|
44 } |
|
45 |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CStartupView::~CStartupView |
|
49 // |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CStartupView::~CStartupView() |
|
53 { |
|
54 TRACES("CStartupView::~CStartupView()"); |
|
55 delete iBgContext; |
|
56 TRACES("CStartupView::~CStartupView(): End"); |
|
57 } |
|
58 |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CStartupView::SetComponent |
|
62 // |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CStartupView::SetComponent( CCoeControl& aComponent ) |
|
66 { |
|
67 TRACES("CStartupView::SetComponent()"); |
|
68 |
|
69 iComponent = &aComponent; |
|
70 |
|
71 TRACES("CStartupView::SetComponent(): End"); |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CStartupView::RemoveComponent |
|
77 // |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CStartupView::RemoveComponent() |
|
81 { |
|
82 TRACES("CStartupView::RemoveComponent()"); |
|
83 |
|
84 iComponent = NULL; |
|
85 |
|
86 TRACES("CStartupView::RemoveComponent(): End"); |
|
87 } |
|
88 |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CStartupView::SizeChanged |
|
92 // |
|
93 // --------------------------------------------------------------------------- |
|
94 void CStartupView::SizeChanged() |
|
95 { |
|
96 TRACES("CStartupView::SizeChanged()"); |
|
97 |
|
98 if (iBgContext) |
|
99 { |
|
100 iBgContext->SetRect( Rect() ); |
|
101 } |
|
102 |
|
103 if ( iComponent ) |
|
104 { |
|
105 iComponent->SetRect( Rect() ); |
|
106 } |
|
107 |
|
108 DrawNow(); |
|
109 |
|
110 TRACES("CStartupView::SizeChanged(): End"); |
|
111 } |
|
112 |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CStartupView::CountComponentControls |
|
116 // |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 TInt CStartupView::CountComponentControls() const |
|
120 { |
|
121 if ( iComponent ) return 1; |
|
122 return 0; |
|
123 } |
|
124 |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CStartupView::ComponentControl |
|
128 // |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 CCoeControl* CStartupView::ComponentControl( TInt /*aIndex*/ ) const |
|
132 { |
|
133 return iComponent; |
|
134 } |
|
135 |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // CStartupView::Draw |
|
139 // |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 void CStartupView::Draw( const TRect& aRect ) const |
|
143 { |
|
144 TRACES("CStartupView::Draw()"); |
|
145 |
|
146 CWindowGc& gc = SystemGc(); |
|
147 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
148 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
149 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
150 |
|
151 // Draw skin background |
|
152 if ( !AknsDrawUtils::Background( skin, iBgContext, gc, aRect ) ) |
|
153 { |
|
154 // If Skin is missing, clear with default color |
|
155 gc.SetClippingRect( aRect ); |
|
156 gc.SetBrushColor( KRgbWhite ); |
|
157 gc.Clear(); |
|
158 } |
|
159 |
|
160 TRACES("CStartupView::Draw(): End"); |
|
161 } |
|
162 |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CStartupView::CStartupView |
|
166 // |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 CStartupView::CStartupView() |
|
170 { |
|
171 TRACES("CStartupView::CStartupView()"); |
|
172 TRACES("CStartupView::CStartupView(): End"); |
|
173 } |
|
174 |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // CStartupView::ConstructL |
|
178 // |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 void CStartupView::ConstructL( const TRect& aRect ) |
|
182 { |
|
183 TRACES("CStartupView::ConstructL()"); |
|
184 |
|
185 iAvkonAppUi->StatusPane()->MakeVisible( EFalse ); |
|
186 CreateWindowL(); |
|
187 SetRect( aRect ); |
|
188 |
|
189 // Create background drawing context |
|
190 TRect bgrect(aRect.Size()); |
|
191 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
192 KAknsIIDQsnBgScreen, |
|
193 bgrect, EFalse ); |
|
194 |
|
195 ActivateL(); |
|
196 |
|
197 TRACES("CStartupView::ConstructL(): End"); |
|
198 } |