35
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 container pane of end button.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <aknenv.h>
|
|
19 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
20 |
#include <AknsBasicBackgroundControlContext.h>
|
|
21 |
#include <AknsDrawUtils.h>
|
|
22 |
#include <AknsSkinInstance.h>
|
|
23 |
#include <videotelui.rsg>
|
|
24 |
#include <cvtlogger.h>
|
|
25 |
#include <featmgr.h>
|
|
26 |
|
|
27 |
#include "CVtUiEndCallButton.h"
|
|
28 |
#include "CVtUiEndCallButtonPane.h"
|
|
29 |
#include "videotelui.hrh"
|
|
30 |
#include "CVtUiAppUi.h"
|
|
31 |
|
|
32 |
// -----------------------------------------------------------------------------
|
|
33 |
// CVtUiEndCallButtonPane::CVtUiEndCallButtonPane
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
//
|
|
36 |
CVtUiEndCallButtonPane::CVtUiEndCallButtonPane()
|
|
37 |
{
|
|
38 |
// No implementation required
|
|
39 |
}
|
|
40 |
|
|
41 |
// -----------------------------------------------------------------------------
|
|
42 |
// CVtUiEndCallButtonPane::NewL
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
CVtUiEndCallButtonPane* CVtUiEndCallButtonPane::NewL( const TRect& aRect )
|
|
46 |
{
|
|
47 |
CVtUiEndCallButtonPane* self =
|
|
48 |
new (ELeave) CVtUiEndCallButtonPane();
|
|
49 |
CleanupStack::PushL(self);
|
|
50 |
self->ConstructL( aRect );
|
|
51 |
CleanupStack::Pop(); // self;
|
|
52 |
return self;
|
|
53 |
}
|
|
54 |
|
|
55 |
// -----------------------------------------------------------------------------
|
|
56 |
// CVtUiEndCallButtonPane::ConstructL
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
void CVtUiEndCallButtonPane::ConstructL( const TRect& aRect )
|
|
60 |
{
|
|
61 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.ConstructL" )
|
|
62 |
// Create a window for this application view
|
|
63 |
CreateWindowL();
|
|
64 |
|
|
65 |
// Set the windows size
|
|
66 |
SetRect( aRect );
|
|
67 |
|
|
68 |
CreateButtonUsingResourceL();
|
|
69 |
GetButtonLayoutData();
|
|
70 |
|
|
71 |
|
|
72 |
iBgContext = CAknsBasicBackgroundControlContext::NewL(
|
|
73 |
KAknsIIDQsnBgAreaMain, Rect(), ETrue );
|
|
74 |
|
|
75 |
// Activate the window, which makes it ready to be drawn
|
|
76 |
ActivateL();
|
|
77 |
|
|
78 |
// For set non focus and recieve all point event
|
|
79 |
SetNonFocusing();
|
|
80 |
ClaimPointerGrab( ETrue );
|
|
81 |
|
|
82 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.ConstructL" )
|
|
83 |
}
|
|
84 |
|
|
85 |
// -----------------------------------------------------------------------------
|
|
86 |
// CVtUiEndCallButtonPane::CVtUiEndCallButtonPane
|
|
87 |
// -----------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
CVtUiEndCallButtonPane::~CVtUiEndCallButtonPane()
|
|
90 |
{
|
|
91 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.~" )
|
|
92 |
if ( iEndButton )
|
|
93 |
{
|
|
94 |
delete iEndButton;
|
|
95 |
}
|
|
96 |
|
|
97 |
if ( iBgContext )
|
|
98 |
{
|
|
99 |
delete iBgContext;
|
|
100 |
}
|
|
101 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.~" )
|
|
102 |
}
|
|
103 |
|
|
104 |
// -----------------------------------------------------------------------------
|
|
105 |
// CVtUiEndCallButtonPane::CountComponentControls
|
|
106 |
// -----------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
TInt CVtUiEndCallButtonPane::CountComponentControls() const
|
|
109 |
{
|
|
110 |
return iEndButton ? 1 : 0;
|
|
111 |
}
|
|
112 |
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
// CVtUiEndCallButtonPane::ComponentControl
|
|
115 |
// -----------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
CCoeControl* CVtUiEndCallButtonPane::ComponentControl(TInt aIndex) const
|
|
118 |
{
|
|
119 |
return iEndButton;
|
|
120 |
}
|
|
121 |
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
// CVtUiEndCallButtonPane::Draw
|
|
124 |
// -----------------------------------------------------------------------------
|
|
125 |
//
|
|
126 |
void CVtUiEndCallButtonPane::Draw(const TRect& aRect) const
|
|
127 |
{
|
|
128 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.Draw" )
|
|
129 |
CWindowGc& gc = SystemGc();
|
|
130 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
131 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
132 |
AknsDrawUtils::Background( skin, cc, this, gc, Rect() );
|
|
133 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.Draw" )
|
|
134 |
}
|
|
135 |
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
// CVtUiEndCallButtonPane::SizeChanged
|
|
138 |
// -----------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CVtUiEndCallButtonPane::SizeChanged()
|
|
141 |
{
|
|
142 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.SizeChanged" )
|
|
143 |
if( iEndButton )
|
|
144 |
{
|
|
145 |
GetButtonLayoutData();
|
|
146 |
}
|
|
147 |
if( iBgContext )
|
|
148 |
{
|
|
149 |
TRect bgRect;
|
|
150 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, bgRect );
|
|
151 |
iBgContext->SetRect( bgRect );
|
|
152 |
}
|
|
153 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.SizeChanged" )
|
|
154 |
}
|
|
155 |
|
|
156 |
// -----------------------------------------------------------------------------
|
|
157 |
// CVtUiEndCallButtonPane::MopSupplyObject
|
|
158 |
// -----------------------------------------------------------------------------
|
|
159 |
//
|
|
160 |
TTypeUid::Ptr CVtUiEndCallButtonPane::MopSupplyObject(TTypeUid aId)
|
|
161 |
{
|
|
162 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.MopSupplyObject" )
|
|
163 |
// Required during rendering of the background skin in Draw()
|
|
164 |
if (aId.iUid == MAknsControlContext::ETypeId)
|
|
165 |
{
|
|
166 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.MopSupplyObject.1" )
|
|
167 |
return MAknsControlContext::SupplyMopObject( aId, iBgContext );
|
|
168 |
}
|
|
169 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.MopSupplyObject.2" )
|
|
170 |
return CCoeControl::MopSupplyObject( aId );
|
|
171 |
}
|
|
172 |
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
// CVtUiEndCallButtonPane::HandleControlEventL
|
|
175 |
// -----------------------------------------------------------------------------
|
|
176 |
//
|
|
177 |
void CVtUiEndCallButtonPane::HandleControlEventL( CCoeControl* aControl,
|
|
178 |
TCoeEvent aEventType )
|
|
179 |
{
|
|
180 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.HandleControlEventL" )
|
|
181 |
if ( aEventType != EEventStateChanged )
|
|
182 |
{
|
|
183 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.HandleControlEventL" )
|
|
184 |
return;
|
|
185 |
}
|
|
186 |
CVtUiAppUi* appUi = STATIC_CAST( CVtUiAppUi*, CCoeEnv::Static()->AppUi() );
|
|
187 |
appUi->HandleCommandL( EVtUiCmdEndActiveCall );
|
|
188 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.HandleControlEventL" )
|
|
189 |
}
|
|
190 |
|
|
191 |
// -----------------------------------------------------------------------------
|
|
192 |
// CVtUiEndCallButtonPane::CreateButtonUsingResourceL
|
|
193 |
// -----------------------------------------------------------------------------
|
|
194 |
//
|
|
195 |
void CVtUiEndCallButtonPane::CreateButtonUsingResourceL()
|
|
196 |
{
|
|
197 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.CreateButtonUsingResourceL" )
|
|
198 |
iEndButton = CVtUiEndCallButton::NewL();
|
|
199 |
iEndButton->ConstructFromResourceL( R_VIDEOTELUI_END_CALL_BUTTON );
|
|
200 |
iEndButton->SetContainerWindowL( *this );
|
|
201 |
iEndButton->SetRect( Rect() );
|
|
202 |
iEndButton->SetObserver( this );
|
|
203 |
iEndButton->MakeVisible( ETrue );
|
|
204 |
iEndButton->ActivateL();
|
|
205 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.CreateButtonUsingResourceL" )
|
|
206 |
}
|
|
207 |
|
|
208 |
// -----------------------------------------------------------------------------
|
|
209 |
// CVtUiEndCallButtonPane::GetButtonLayoutData
|
|
210 |
// -----------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
void CVtUiEndCallButtonPane::GetButtonLayoutData()
|
|
213 |
{
|
|
214 |
__VTPRINTENTER( "CVtUiEndCallButtonPane.GetButtonLayoutData" )
|
|
215 |
AknLayoutUtils::LayoutControl(
|
|
216 |
iEndButton,
|
|
217 |
Rect(),
|
|
218 |
AknLayoutScalable_Apps::bg_button_pane_cp034( 0, 0, 0) );
|
|
219 |
|
|
220 |
|
|
221 |
TAknLayoutText text;
|
|
222 |
text.LayoutText( Rect(),
|
|
223 |
AknLayoutScalable_Apps::vidtel_button_pane_t1(
|
|
224 |
0 ).LayoutLine());
|
|
225 |
|
|
226 |
TAknLayoutRect icon;
|
|
227 |
icon.LayoutRect( Rect(),
|
|
228 |
AknLayoutScalable_Apps::vidtel_button_pane_g1(
|
|
229 |
0 ).LayoutLine());
|
|
230 |
|
|
231 |
iEndButton->SetIconSize( icon.Rect().Size() );
|
|
232 |
|
|
233 |
iEndButton->SetLayout( text, icon.Rect() );
|
|
234 |
__VTPRINTEXIT( "CVtUiEndCallButtonPane.GetButtonLayoutData" )
|
|
235 |
}
|
|
236 |
|
|
237 |
// -----------------------------------------------------------------------------
|
|
238 |
// CVtUiEndCallButtonPane::SetEnabled
|
|
239 |
// -----------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
void CVtUiEndCallButtonPane::SetEnabled( TBool aEnabled )
|
|
242 |
{
|
|
243 |
iEndButton->SetDimmed( !aEnabled );
|
|
244 |
DrawNow();
|
|
245 |
}
|