34
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2007 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: Handles publishing to title pane.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <eikbtgpc.h>
|
|
20 |
#include <aknappui.h>
|
|
21 |
#include <StringLoader.h>
|
|
22 |
#include <gulicon.h>
|
|
23 |
#include <AknIconUtils.h>
|
|
24 |
#include <AknsConstants.h>
|
|
25 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
26 |
#include <AknStatuspaneUtils.h>
|
|
27 |
#include <layoutmetadata.cdl.h>
|
|
28 |
#include <AknUtils.h>
|
|
29 |
#include <eiksoftkeyimage.h>
|
|
30 |
#include <AknSgcc.h>
|
|
31 |
|
|
32 |
// User includes
|
|
33 |
#include <hscontentpublisher.h>
|
|
34 |
#include <hspublisherinfo.h>
|
|
35 |
|
|
36 |
#include <AiNativeUi.rsg>
|
|
37 |
|
|
38 |
#include "ainativeui.hrh"
|
|
39 |
#include "aisoftkeyrenderer.h"
|
|
40 |
#include "ainativeuiplugins.h"
|
|
41 |
|
|
42 |
using namespace AiNativeUiController;
|
|
43 |
|
|
44 |
// Constants
|
|
45 |
// Index for left softkey; defined in avkon
|
|
46 |
//const TInt KNativeUiLeftSoftkeyId = 0;
|
|
47 |
|
|
48 |
// Index for right softkey; defined in avkon
|
|
49 |
//const TInt KNativeUiRightSoftkeyId = 2;
|
|
50 |
|
|
51 |
const TInt KControlArrayCBAButton1Posn =0;
|
|
52 |
const TInt KControlArrayCBAButton2Posn =2;
|
|
53 |
const TInt KControlArrayCBAButtonMiddlePosn =3;
|
|
54 |
|
|
55 |
const TInt KWideScreenWidth = 640;
|
|
56 |
|
|
57 |
// ======== LOCAL FUNCTIONS ========
|
|
58 |
inline TAknWindowComponentLayout DoCompose( TAknWindowComponentLayout aLine1,
|
|
59 |
TAknWindowComponentLayout aLine2 )
|
|
60 |
{
|
|
61 |
return TAknWindowComponentLayout::Compose( aLine1, aLine2 );
|
|
62 |
}
|
|
63 |
|
|
64 |
inline TAknTextComponentLayout DoComposeText( TAknWindowComponentLayout aLine1,
|
|
65 |
TAknTextComponentLayout aLine2 )
|
|
66 |
{
|
|
67 |
return TAknWindowComponentLayout::ComposeText( aLine1, aLine2 );
|
|
68 |
}
|
|
69 |
|
|
70 |
|
|
71 |
// -----------------------------------------------------------------------------
|
|
72 |
//
|
|
73 |
// Calculate (whole) softkey area for Bottom button (landscape)
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
static TBool HDLayoutActive()
|
|
76 |
{
|
|
77 |
TInt resourceId = 0;
|
|
78 |
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
|
|
79 |
|
|
80 |
if ( statusPane ) // Return the resource ID of app statuspane if it exists.
|
|
81 |
{
|
|
82 |
resourceId = statusPane->CurrentLayoutResId();
|
|
83 |
}
|
|
84 |
else // If this app does not have statuspane, then we ask the layout from AknCapServer.
|
|
85 |
{
|
|
86 |
resourceId = CAknSgcClient::CurrentStatuspaneResource();
|
|
87 |
}
|
|
88 |
|
|
89 |
TBool retVal = EFalse;
|
|
90 |
|
|
91 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
92 |
{
|
|
93 |
// Can be widescreen only in landscape orientation.
|
|
94 |
retVal = ( resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL ||
|
|
95 |
resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE ||
|
|
96 |
resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ||
|
|
97 |
resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT );
|
|
98 |
}
|
|
99 |
|
|
100 |
return retVal;
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
// -----------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
// Calculate softkey image graphics area for Bottom button (landscape)
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
static TRect SoftkeyRectBottomGraphics()
|
|
109 |
{
|
|
110 |
TRect screen;
|
|
111 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
|
|
112 |
|
|
113 |
TAknWindowComponentLayout rightAreaLayout(
|
|
114 |
AknLayoutScalable_Avkon::area_side_right_pane( 0 ) );
|
|
115 |
|
|
116 |
TAknWindowComponentLayout bottomSKLayout(
|
|
117 |
DoCompose( rightAreaLayout,
|
|
118 |
AknLayoutScalable_Avkon::sctrl_sk_bottom_pane() ) );
|
|
119 |
|
|
120 |
// Calculate softkey rects.
|
|
121 |
// Left (bottom in landscape) softkey layout.
|
|
122 |
TAknLayoutRect leftSoftkeyLayoutRect;
|
|
123 |
leftSoftkeyLayoutRect.LayoutRect( screen,
|
|
124 |
bottomSKLayout.LayoutLine() );
|
|
125 |
TRect leftSoftKeyButtonRect( leftSoftkeyLayoutRect.Rect() );
|
|
126 |
|
|
127 |
// Calculate softkey image layout.
|
|
128 |
// Left (bottom in landscape) softkey layout.
|
|
129 |
TAknWindowLineLayout leftSoftkeyImageLayout(
|
|
130 |
DoCompose(
|
|
131 |
bottomSKLayout,
|
|
132 |
AknLayoutScalable_Avkon::sctrl_sk_bottom_pane_g1() ).LayoutLine() );
|
|
133 |
|
|
134 |
|
|
135 |
TAknLayoutRect qgn_graf_sk_left;
|
|
136 |
qgn_graf_sk_left.LayoutRect( screen, leftSoftkeyImageLayout );
|
|
137 |
|
|
138 |
return qgn_graf_sk_left.Rect();
|
|
139 |
}
|
|
140 |
|
|
141 |
|
|
142 |
// -----------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
// Calculate softkey image graphics area for Top button (landscape)
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
static TRect SoftkeyRectTopGraphics()
|
|
147 |
{
|
|
148 |
TRect screen;
|
|
149 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
|
|
150 |
|
|
151 |
TAknWindowComponentLayout rightAreaLayout(
|
|
152 |
AknLayoutScalable_Avkon::area_side_right_pane( 0 ) );
|
|
153 |
|
|
154 |
TAknWindowComponentLayout topSKLayout(
|
|
155 |
DoCompose( rightAreaLayout,
|
|
156 |
AknLayoutScalable_Avkon::sctrl_sk_top_pane() ) );
|
|
157 |
|
|
158 |
// Calculate softkey rects.
|
|
159 |
// Right (top in landscape) softkey layout.
|
|
160 |
TAknLayoutRect rightSoftkeyLayoutRect;
|
|
161 |
rightSoftkeyLayoutRect.LayoutRect( screen,
|
|
162 |
topSKLayout.LayoutLine() );
|
|
163 |
TRect rightSoftKeyButtonRect( rightSoftkeyLayoutRect.Rect() );
|
|
164 |
|
|
165 |
// Left (bottom in landscape) softkey layout.
|
|
166 |
// Right (top in landscape) softkey layout.
|
|
167 |
TAknWindowLineLayout rightSoftkeyImageLayout(
|
|
168 |
DoCompose(
|
|
169 |
topSKLayout,
|
|
170 |
AknLayoutScalable_Avkon::sctrl_sk_top_pane_g1() ).LayoutLine() );
|
|
171 |
|
|
172 |
TAknLayoutRect qgn_graf_sk_right;
|
|
173 |
qgn_graf_sk_right.LayoutRect( screen, rightSoftkeyImageLayout );
|
|
174 |
return qgn_graf_sk_right.Rect();
|
|
175 |
}
|
|
176 |
|
|
177 |
|
|
178 |
// -----------------------------------------------------------------------------
|
|
179 |
// SoftkeyRectL
|
|
180 |
// Calculate soft key rect
|
|
181 |
// -----------------------------------------------------------------------------
|
|
182 |
static TRect SoftkeyRectL( CEikButtonGroupContainer& aContainer, TInt aPos, TBool aImageOn )
|
|
183 |
{
|
|
184 |
TRect rect;
|
|
185 |
|
|
186 |
if( AknStatuspaneUtils::StaconPaneActive() )
|
|
187 |
{
|
|
188 |
TInt variety( 0 );
|
|
189 |
|
|
190 |
if( AknStatuspaneUtils::StaconSoftKeysLeft() )
|
|
191 |
{
|
|
192 |
variety = 1;
|
|
193 |
}
|
|
194 |
|
|
195 |
TRect parentRect( iAvkonAppUi->ApplicationRect() );
|
|
196 |
|
|
197 |
switch( aPos )
|
|
198 |
{
|
|
199 |
case KControlArrayCBAButton1Posn:
|
|
200 |
{
|
|
201 |
TAknWindowComponentLayout layout0( AknLayoutScalable_Avkon::area_bottom_pane( 2 ) );
|
|
202 |
TAknWindowComponentLayout layout1( AknLayoutScalable_Avkon::stacon_bottom_pane() );
|
|
203 |
|
|
204 |
// If clock is shown in stacon, cba area is smaller.
|
|
205 |
TInt bottomCbaVariety( variety );
|
|
206 |
|
|
207 |
if( AknStatuspaneUtils::ExtendedStaconPaneActive() )
|
|
208 |
{
|
|
209 |
bottomCbaVariety += 2;
|
|
210 |
}
|
|
211 |
|
|
212 |
TAknWindowComponentLayout layout2( AknLayoutScalable_Avkon::control_bottom_pane_stacon( bottomCbaVariety ) );
|
|
213 |
|
|
214 |
if( aImageOn )
|
|
215 |
{
|
|
216 |
// Icon layout
|
|
217 |
TAknWindowComponentLayout iconLayout( AknLayoutScalable_Avkon::control_bottom_pane_stacon_g1() );
|
|
218 |
|
|
219 |
TAknWindowComponentLayout lskIconLayout( DoCompose( layout0,
|
|
220 |
DoCompose( layout1, DoCompose( layout2, iconLayout ) ) ) );
|
|
221 |
|
|
222 |
TAknWindowLineLayout lskIcon( lskIconLayout.LayoutLine() );
|
|
223 |
|
|
224 |
TAknLayoutRect qgn_icon_lsk;
|
|
225 |
|
|
226 |
qgn_icon_lsk.LayoutRect( parentRect, lskIcon );
|
|
227 |
|
|
228 |
rect = qgn_icon_lsk.Rect();
|
|
229 |
}
|
|
230 |
else
|
|
231 |
{
|
|
232 |
// Text layout
|
|
233 |
TAknTextComponentLayout textLayout( AknLayoutScalable_Avkon::control_bottom_pane_stacon_t1( variety ) );
|
|
234 |
|
|
235 |
TAknTextComponentLayout lskTextLayout( DoComposeText( layout0,
|
|
236 |
DoComposeText( layout1, DoComposeText( layout2, textLayout ) ) ) );
|
|
237 |
|
|
238 |
TAknTextLineLayout lskText( lskTextLayout.LayoutLine() );
|
|
239 |
|
|
240 |
TAknLayoutText qgn_text_lsk;
|
|
241 |
|
|
242 |
qgn_text_lsk.LayoutText( parentRect, lskText );
|
|
243 |
|
|
244 |
rect = qgn_text_lsk.TextRect();
|
|
245 |
}
|
|
246 |
}
|
|
247 |
break;
|
|
248 |
case KControlArrayCBAButton2Posn:
|
|
249 |
{
|
|
250 |
TAknWindowComponentLayout layout0( AknLayoutScalable_Avkon::area_top_pane( 2 ) );
|
|
251 |
TAknWindowComponentLayout layout1( AknLayoutScalable_Avkon::stacon_top_pane() );
|
|
252 |
|
|
253 |
TInt topCbaVariety( variety );
|
|
254 |
|
|
255 |
if( AknStatuspaneUtils::ExtendedStaconPaneActive() )
|
|
256 |
{
|
|
257 |
topCbaVariety += 4;
|
|
258 |
}
|
|
259 |
|
|
260 |
TAknWindowComponentLayout layout2( AknLayoutScalable_Avkon::control_top_pane_stacon( topCbaVariety ) );
|
|
261 |
|
|
262 |
if( aImageOn )
|
|
263 |
{
|
|
264 |
// Icon layout
|
|
265 |
TAknWindowComponentLayout iconLayout( AknLayoutScalable_Avkon::control_top_pane_stacon_g1() );
|
|
266 |
|
|
267 |
TAknWindowComponentLayout rskIconLayout( DoCompose( layout0,
|
|
268 |
DoCompose( layout1, DoCompose( layout2, iconLayout ) ) ) );
|
|
269 |
|
|
270 |
TAknWindowLineLayout rskIcon( rskIconLayout.LayoutLine() );
|
|
271 |
|
|
272 |
TAknLayoutRect qgn_icon_rsk;
|
|
273 |
|
|
274 |
qgn_icon_rsk.LayoutRect( parentRect, rskIcon );
|
|
275 |
|
|
276 |
rect = qgn_icon_rsk.Rect();
|
|
277 |
}
|
|
278 |
else
|
|
279 |
{
|
|
280 |
// Text layout
|
|
281 |
TAknTextComponentLayout textLayout( AknLayoutScalable_Avkon::control_top_pane_stacon_t1( variety ) );
|
|
282 |
|
|
283 |
TAknTextComponentLayout rskTextLayout( DoComposeText( layout0,
|
|
284 |
DoComposeText( layout1, DoComposeText( layout2, textLayout ) ) ) );
|
|
285 |
|
|
286 |
TAknTextLineLayout rskText( rskTextLayout.LayoutLine() );
|
|
287 |
|
|
288 |
TAknLayoutText qgn_text_rsk;
|
|
289 |
|
|
290 |
qgn_text_rsk.LayoutText( parentRect, rskText );
|
|
291 |
|
|
292 |
rect = qgn_text_rsk.TextRect();
|
|
293 |
}
|
|
294 |
}
|
|
295 |
break;
|
|
296 |
default:
|
|
297 |
User::Leave( KErrNotSupported );
|
|
298 |
break;
|
|
299 |
|
|
300 |
}
|
|
301 |
}
|
|
302 |
else
|
|
303 |
{
|
|
304 |
TInt textVariety( 0 );
|
|
305 |
TInt graphVariety( 0 );
|
|
306 |
|
|
307 |
TBool mskEnabled( AknLayoutUtils::MSKEnabled() && Layout_Meta_Data::IsMSKEnabled() );
|
|
308 |
|
|
309 |
if ( mskEnabled )
|
|
310 |
{
|
|
311 |
textVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 3;
|
|
312 |
graphVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 4;
|
|
313 |
}
|
|
314 |
else
|
|
315 |
{
|
|
316 |
textVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0;
|
|
317 |
graphVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 4;
|
|
318 |
}
|
|
319 |
|
|
320 |
CEikCba* cba( static_cast< CEikCba* >( aContainer.ButtonGroup() ) );
|
|
321 |
|
|
322 |
TRect parentRect( cba->Rect() );
|
|
323 |
|
|
324 |
switch( aPos )
|
|
325 |
{
|
|
326 |
case KControlArrayCBAButton1Posn:
|
|
327 |
{
|
|
328 |
if( aImageOn )
|
|
329 |
{
|
|
330 |
if ( HDLayoutActive() &&
|
|
331 |
AKN_LAYOUT_WINDOW_screen.iW == KWideScreenWidth )
|
|
332 |
{
|
|
333 |
rect = SoftkeyRectBottomGraphics();
|
|
334 |
}
|
|
335 |
else
|
|
336 |
{
|
|
337 |
|
|
338 |
TAknLayoutRect qgn_icon_lsk;
|
|
339 |
|
|
340 |
qgn_icon_lsk.LayoutRect( parentRect,
|
|
341 |
AknLayoutScalable_Avkon::control_pane_g1( graphVariety ).LayoutLine() );
|
|
342 |
|
|
343 |
rect = qgn_icon_lsk.Rect();
|
|
344 |
}
|
|
345 |
}
|
|
346 |
else
|
|
347 |
{
|
|
348 |
TAknLayoutText qgn_text_lsk;
|
|
349 |
|
|
350 |
qgn_text_lsk.LayoutText( parentRect,
|
|
351 |
AknLayoutScalable_Avkon::control_pane_t1( textVariety ).LayoutLine() );
|
|
352 |
|
|
353 |
rect = qgn_text_lsk.TextRect();
|
|
354 |
}
|
|
355 |
}
|
|
356 |
break;
|
|
357 |
case KControlArrayCBAButton2Posn:
|
|
358 |
{
|
|
359 |
if( aImageOn )
|
|
360 |
{
|
|
361 |
if ( HDLayoutActive() &&
|
|
362 |
AKN_LAYOUT_WINDOW_screen.iW == KWideScreenWidth )
|
|
363 |
{
|
|
364 |
rect = SoftkeyRectTopGraphics();
|
|
365 |
}
|
|
366 |
else
|
|
367 |
{
|
|
368 |
TAknLayoutRect qgn_icon_rsk;
|
|
369 |
|
|
370 |
qgn_icon_rsk.LayoutRect( parentRect,
|
|
371 |
AknLayoutScalable_Avkon::control_pane_g2( graphVariety ).LayoutLine() );
|
|
372 |
|
|
373 |
rect = qgn_icon_rsk.Rect();
|
|
374 |
}
|
|
375 |
}
|
|
376 |
else
|
|
377 |
{
|
|
378 |
TAknLayoutText qgn_text_rsk;
|
|
379 |
|
|
380 |
qgn_text_rsk.LayoutText( parentRect,
|
|
381 |
AknLayoutScalable_Avkon::control_pane_t2( textVariety ).LayoutLine() );
|
|
382 |
|
|
383 |
rect = qgn_text_rsk.TextRect();
|
|
384 |
}
|
|
385 |
}
|
|
386 |
break;
|
|
387 |
case KControlArrayCBAButtonMiddlePosn:
|
|
388 |
{
|
|
389 |
if( !mskEnabled || aImageOn )
|
|
390 |
{
|
|
391 |
// No msk, or asking image size for msk
|
|
392 |
User::Leave( KErrNotSupported );
|
|
393 |
}
|
|
394 |
else
|
|
395 |
{
|
|
396 |
TAknLayoutText qgn_text_msk;
|
|
397 |
|
|
398 |
qgn_text_msk.LayoutText( parentRect,
|
|
399 |
AknLayoutScalable_Avkon::control_pane_t3( textVariety ).LayoutLine() );
|
|
400 |
|
|
401 |
rect = qgn_text_msk.TextRect();
|
|
402 |
}
|
|
403 |
}
|
|
404 |
break;
|
|
405 |
default:
|
|
406 |
User::Leave( KErrNotFound );
|
|
407 |
break;
|
|
408 |
}
|
|
409 |
}
|
|
410 |
|
|
411 |
return rect;
|
|
412 |
}
|
|
413 |
|
|
414 |
|
|
415 |
// -----------------------------------------------------------------------------
|
|
416 |
// SoftkeySizeL
|
|
417 |
// Calculate soft key size
|
|
418 |
// -----------------------------------------------------------------------------
|
|
419 |
static TSize SoftkeySizeL( CEikButtonGroupContainer& aContainer, TInt aPos, TBool aImageOn )
|
|
420 |
{
|
|
421 |
TSize size( SoftkeyRectL( aContainer, aPos, aImageOn ).Size() );
|
|
422 |
|
|
423 |
return size;
|
|
424 |
}
|
|
425 |
|
|
426 |
// ======== MEMBER FUNCTIONS ========
|
|
427 |
// ----------------------------------------------------------------------------
|
|
428 |
// CAiSoftKeyRenderer::ConstructL()
|
|
429 |
//
|
|
430 |
// ----------------------------------------------------------------------------
|
|
431 |
//
|
|
432 |
void CAiSoftKeyRenderer::ConstructL()
|
|
433 |
{
|
|
434 |
// load default soft key labels from resource
|
|
435 |
CreateDefaultSoftKeysL();
|
|
436 |
}
|
|
437 |
|
|
438 |
// ----------------------------------------------------------------------------
|
|
439 |
// CAiSoftKeyRenderer::NewLC()
|
|
440 |
//
|
|
441 |
// ----------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
CAiSoftKeyRenderer* CAiSoftKeyRenderer::NewLC()
|
|
444 |
{
|
|
445 |
CAiSoftKeyRenderer* self = new( ELeave ) CAiSoftKeyRenderer();
|
|
446 |
CleanupStack::PushL( self );
|
|
447 |
self->ConstructL();
|
|
448 |
return self;
|
|
449 |
}
|
|
450 |
|
|
451 |
// ----------------------------------------------------------------------------
|
|
452 |
// CAiSoftKeyRenderer::~CAiSoftKeyRenderer()
|
|
453 |
//
|
|
454 |
// ----------------------------------------------------------------------------
|
|
455 |
//
|
|
456 |
CAiSoftKeyRenderer::~CAiSoftKeyRenderer()
|
|
457 |
{
|
|
458 |
delete iText;
|
|
459 |
|
|
460 |
if ( iCba )
|
|
461 |
{
|
|
462 |
CEikCba* cba =
|
|
463 |
static_cast< CEikCba* >( iCba->ButtonGroup() );
|
|
464 |
iAppUi->RemoveFromStack( cba );
|
|
465 |
}
|
|
466 |
delete iCba;
|
|
467 |
}
|
|
468 |
|
|
469 |
// ----------------------------------------------------------------------------
|
|
470 |
// CAiSoftKeyRenderer::CAiSoftKeyRenderer()
|
|
471 |
//
|
|
472 |
// ----------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
CAiSoftKeyRenderer::CAiSoftKeyRenderer()
|
|
475 |
{
|
|
476 |
iAppUi = iAvkonAppUi;
|
|
477 |
}
|
|
478 |
|
|
479 |
// ----------------------------------------------------------------------------
|
|
480 |
// CAiSoftKeyRenderer::DoPublishL()
|
|
481 |
//
|
|
482 |
// ----------------------------------------------------------------------------
|
|
483 |
//
|
|
484 |
void CAiSoftKeyRenderer::DoPublishL( CHsContentPublisher& /*aPlugin*/,
|
|
485 |
TInt /*aContent*/, const TDesC16& /*aText*/, TInt /*aIndex*/ )
|
|
486 |
{
|
|
487 |
User::Leave( KErrNotFound );
|
|
488 |
}
|
|
489 |
|
|
490 |
// ----------------------------------------------------------------------------
|
|
491 |
// CAiSoftKeyRenderer::DoPublishL()
|
|
492 |
//
|
|
493 |
// ----------------------------------------------------------------------------
|
|
494 |
//
|
|
495 |
void CAiSoftKeyRenderer::DoPublishL( CHsContentPublisher& /*aPlugin*/,
|
|
496 |
TInt /*aContent*/, TInt /*aResource*/, TInt /*aIndex*/ )
|
|
497 |
{
|
|
498 |
User::Leave( KErrNotFound );
|
|
499 |
}
|
|
500 |
|
|
501 |
// ----------------------------------------------------------------------------
|
|
502 |
// CAiSoftKeyRenderer::DoPublishL()
|
|
503 |
//
|
|
504 |
// ----------------------------------------------------------------------------
|
|
505 |
//
|
|
506 |
void CAiSoftKeyRenderer::DoPublishL( CHsContentPublisher& /*aPlugin*/,
|
|
507 |
TInt /*aContent*/, const TDesC8& /*aBuf*/, TInt /*aIndex*/ )
|
|
508 |
{
|
|
509 |
User::Leave( KErrNotFound );
|
|
510 |
}
|
|
511 |
|
|
512 |
// ----------------------------------------------------------------------------
|
|
513 |
// CAiSoftKeyRenderer::CreateDefaultSoftKeysL()
|
|
514 |
//
|
|
515 |
// ----------------------------------------------------------------------------
|
|
516 |
//
|
|
517 |
void CAiSoftKeyRenderer::CreateDefaultSoftKeysL()
|
|
518 |
{
|
|
519 |
// If we already have cba, then do nothing.
|
|
520 |
if ( iCba )
|
|
521 |
{
|
|
522 |
return;
|
|
523 |
}
|
|
524 |
|
|
525 |
// Otherwise create brand new cba.
|
|
526 |
iCba = CEikButtonGroupContainer::NewL(
|
|
527 |
CEikButtonGroupContainer::ECba,
|
|
528 |
CEikButtonGroupContainer::EHorizontal,
|
|
529 |
iAppUi,
|
|
530 |
R_NATIVEUI_SOFTKEYS_DEFAULT,
|
|
531 |
0 ); // Does not add to stack
|
|
532 |
|
|
533 |
iCba->SetBoundingRect( iAppUi->ApplicationRect() );
|
|
534 |
|
|
535 |
CCoeControl* cba = iCba->ButtonGroup()->AsControl();
|
|
536 |
|
|
537 |
static_cast<CEikCba*>(cba)->SetSkinBackgroundId(
|
|
538 |
KAknsIIDQsnBgAreaControlIdle );
|
|
539 |
|
|
540 |
cba->MakeVisible( ETrue );
|
|
541 |
|
|
542 |
iAppUi->RemoveFromStack( cba ); // Well, it is not in stack
|
|
543 |
iAppUi->AddToStackL( cba,
|
|
544 |
KNativeUiCbaPriority,
|
|
545 |
ECoeStackFlagRefusesFocus | ECoeStackFlagRefusesAllKeys );
|
|
546 |
}
|
|
547 |
|
|
548 |
// ----------------------------------------------------------------------------
|
|
549 |
// CAiSoftKeyRenderer::UpdateSoftKeyL()
|
|
550 |
//
|
|
551 |
// ----------------------------------------------------------------------------
|
|
552 |
//
|
|
553 |
void CAiSoftKeyRenderer::UpdateSoftKeyL( TInt /*aKey*/, CGulIcon* /*aIcon*/ )
|
|
554 |
{
|
|
555 |
if( !iCba )
|
|
556 |
{
|
|
557 |
iCba = iAppUi->Cba();
|
|
558 |
}
|
|
559 |
|
|
560 |
// remove the locked flag if any
|
|
561 |
// NOTE ai_shortcut_command_api has been removed!
|
|
562 |
//aKey &= KScutBitMaskLocked;
|
|
563 |
|
|
564 |
/*TInt buttonPosImage;
|
|
565 |
TInt buttonPosText;
|
|
566 |
TInt buttonCmd;
|
|
567 |
|
|
568 |
if( aKey == KLeftSoftkeyId )
|
|
569 |
{
|
|
570 |
buttonPosImage = KControlArrayCBAButton1Posn;
|
|
571 |
buttonPosText = KNativeUiLeftSoftkeyId;
|
|
572 |
buttonCmd = ENativeUiSoftkeyLeft;
|
|
573 |
}
|
|
574 |
else if(aKey == KRightSoftkeyId)
|
|
575 |
{
|
|
576 |
buttonPosImage = KControlArrayCBAButton2Posn;
|
|
577 |
buttonPosText = KNativeUiRightSoftkeyId;
|
|
578 |
buttonCmd = ENativeUiSoftkeyRight;
|
|
579 |
}
|
|
580 |
else
|
|
581 |
{
|
|
582 |
delete aIcon;
|
|
583 |
return;
|
|
584 |
}
|
|
585 |
|
|
586 |
if( aIcon )
|
|
587 |
{
|
|
588 |
CleanupStack::PushL( aIcon );
|
|
589 |
|
|
590 |
TSize size( SoftkeySizeL( *iCba, buttonPosImage, ETrue ) );
|
|
591 |
|
|
592 |
AknIconUtils::SetSize( aIcon->Bitmap(), size, EAspectRatioPreserved );
|
|
593 |
AknIconUtils::SetSize( aIcon->Mask(), size, EAspectRatioPreserved );
|
|
594 |
|
|
595 |
CEikImage* image = new ( ELeave ) CEikImage;
|
|
596 |
image->SetPictureOwnedExternally( EFalse );
|
|
597 |
// Bitmap and mask ownerships are transferred
|
|
598 |
image->SetPicture( aIcon->Bitmap(), aIcon->Mask() );
|
|
599 |
aIcon->SetBitmapsOwnedExternally( ETrue );
|
|
600 |
|
|
601 |
// Image ownership is transferred
|
|
602 |
EikSoftkeyImage::SetImage( iCba, *image, aKey == KLeftSoftkeyId );
|
|
603 |
|
|
604 |
CleanupStack::PopAndDestroy( aIcon );
|
|
605 |
}
|
|
606 |
else
|
|
607 |
{
|
|
608 |
EikSoftkeyImage::SetLabel( iCba, aKey == KLeftSoftkeyId );
|
|
609 |
iCba->SetCommandL( buttonPosText,
|
|
610 |
buttonCmd,
|
|
611 |
*iText );
|
|
612 |
}
|
|
613 |
|
|
614 |
iCba->DrawDeferred();*/
|
|
615 |
}
|
|
616 |
|
|
617 |
// End of file
|