author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:09:54 +0300 | |
branch | RCL_3 |
changeset 67 | 756ad29ed18e |
parent 62 | f0c0788c4de2 |
permissions | -rw-r--r-- |
54 | 1 |
/* |
2 |
* Copyright (c) 2007-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: Setting page for Image/Video quality.* |
|
15 |
*/ |
|
16 |
||
17 |
#include <AknBidiTextUtils.h> |
|
18 |
#include <AknsUtils.h> |
|
19 |
#include <AknsDrawUtils.h> |
|
20 |
#include <AknUtils.h> |
|
21 |
#include <barsread.h> // resource reader |
|
22 |
#include <aknview.h> |
|
23 |
#include <touchfeedback.h> |
|
24 |
#include <StringLoader.h> |
|
25 |
||
26 |
#include <cameraapp.rsg> |
|
27 |
#include <vgacamsettings.rsg> |
|
28 |
||
29 |
#include "CamShootingModeContainer.h" |
|
30 |
#include "CamUtility.h" |
|
31 |
#include "CamAppUi.h" |
|
32 |
#include "CameraUiConfigManager.h" |
|
33 |
#include "CamSceneListBox.h" |
|
34 |
#include "CamSceneListBoxModel.h" |
|
35 |
#include "CamPanic.h" |
|
36 |
#include "camactivepalettehandler.h" |
|
37 |
||
38 |
#include <aknlayoutscalable_apps.cdl.h> |
|
39 |
#include "akntoolbar.h" |
|
40 |
||
41 |
// CONSTANTS |
|
42 |
||
43 |
const TInt KInfoTooltipDelay = 0; // time (milliseconds) delay when showing the tooltip |
|
44 |
const TInt KInfoTooltipDisplayTime = 5000; // maximum time (milliseconds) the tooltip is displayed |
|
45 |
const TInt KExplTxtGranularity = 6; |
|
46 |
const TUint32 KToolbarExtensionBgColor = 0x00000000; |
|
47 |
const TInt KToolBarExtensionBgAlpha = 0x7F; |
|
48 |
||
49 |
// ================= MEMBER FUNCTIONS ======================= |
|
50 |
||
51 |
// --------------------------------------------------------------------------- |
|
52 |
// CCamShootingModeContainer::NewL |
|
53 |
// Symbian OS two-phased constructor |
|
54 |
// --------------------------------------------------------------------------- |
|
55 |
// |
|
56 |
CCamShootingModeContainer* |
|
57 |
CCamShootingModeContainer::NewL( const TRect& aRect, |
|
58 |
CAknView& aView, |
|
59 |
TCamCameraMode aMode, |
|
60 |
CCamAppController& aController, |
|
61 |
TBool aUserBaseScenes ) |
|
62 |
{ |
|
63 |
CCamShootingModeContainer* self = |
|
64 |
new( ELeave ) CCamShootingModeContainer( aMode, |
|
65 |
aController, |
|
66 |
aView, |
|
67 |
aUserBaseScenes ); |
|
68 |
CleanupStack::PushL( self ); |
|
69 |
self->ConstructL( aRect ); |
|
70 |
CleanupStack::Pop( self ); |
|
71 |
return self; |
|
72 |
} |
|
73 |
||
74 |
||
75 |
CCamShootingModeContainer* |
|
76 |
CCamShootingModeContainer::NewL( const TRect& aRect, |
|
77 |
TBool aFullySkinned, |
|
78 |
CAknView& aView, |
|
79 |
TCamCameraMode aMode, |
|
80 |
CCamAppController& aController, |
|
81 |
TBool aUserBaseScenes ) |
|
82 |
{ |
|
83 |
CCamShootingModeContainer* self = |
|
84 |
new( ELeave ) CCamShootingModeContainer( aMode, |
|
85 |
aController, |
|
86 |
aView, |
|
87 |
aUserBaseScenes, |
|
88 |
aFullySkinned ); |
|
89 |
CleanupStack::PushL( self ); |
|
90 |
self->ConstructL( aRect ); |
|
91 |
CleanupStack::Pop( self ); |
|
92 |
return self; |
|
93 |
} |
|
94 |
||
95 |
// --------------------------------------------------------------------------- |
|
96 |
// CCamShootingModeContainer::~CCamShootingModeContainer |
|
97 |
// Destructor |
|
98 |
// --------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
CCamShootingModeContainer::~CCamShootingModeContainer() |
|
101 |
{ |
|
102 |
PRINT( _L( "Camera => ~CCamShootingModeContainer" ) ); |
|
103 |
||
104 |
iSummaryBitmapArray.ResetAndDestroy(); |
|
105 |
iTitleArray.ResetAndDestroy(); |
|
106 |
iDescArray.ResetAndDestroy(); |
|
107 |
iExplTxtLinesLayout.Close(); |
|
108 |
||
109 |
if ( iListBox ) |
|
110 |
{ |
|
111 |
delete iListBox; |
|
112 |
iListBox = NULL; |
|
113 |
} |
|
114 |
||
115 |
if ( iTooltipController ) |
|
116 |
{ |
|
117 |
delete iTooltipController; |
|
118 |
iTooltipController = NULL; |
|
119 |
} |
|
120 |
||
121 |
if ( iListboxTitle ) |
|
122 |
{ |
|
123 |
delete iListboxTitle; |
|
124 |
iListboxTitle = NULL; |
|
125 |
} |
|
126 |
||
127 |
if ( iCurrentDescLineArray ) |
|
128 |
{ |
|
129 |
iCurrentDescLineArray->Reset(); |
|
130 |
delete iCurrentDescLineArray; |
|
131 |
} |
|
132 |
||
133 |
PRINT( _L( "Camera <= ~CCamShootingModeContainer" ) ); |
|
134 |
} |
|
135 |
||
136 |
// --------------------------------------------------------- |
|
137 |
// CCamShootingModeContainer::ConstructL |
|
138 |
// Symbian OS 2nd phase constructor |
|
139 |
// --------------------------------------------------------- |
|
140 |
// |
|
141 |
void |
|
142 |
CCamShootingModeContainer::ConstructL( const TRect& aRect ) |
|
143 |
{ |
|
144 |
PRINT(_L("Camera => CCamShootingModeContainer::ConstructL") ) |
|
145 |
||
146 |
CCamContainerBase::BaseConstructL( aRect ); |
|
147 |
||
148 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
149 |
iLayoutAreaRect ); |
|
150 |
// layout area rectangle contains the area, where components need to be |
|
151 |
// drawn to. the container size is the whole screen, but the layouts are |
|
152 |
// for the client area. aRect is the container size that might include or |
|
153 |
// might not include statuspane area. calculating area self will |
|
154 |
// go around the problem |
|
155 |
TInt resource = SelectSummaryResourceL(); |
|
156 |
if( 0 <= resource ) |
|
157 |
{ |
|
158 |
ConstructSummaryDetailsFromResourceL( resource ); |
|
159 |
} |
|
160 |
||
161 |
TInt scene = 0; |
|
162 |
if ( iUserBaseScenes ) |
|
163 |
{ |
|
164 |
scene = ECamSettingItemUserSceneBasedOnScene; |
|
165 |
} |
|
166 |
else if ( ECamControllerImage == iMode ) |
|
167 |
{ |
|
168 |
scene = ECamSettingItemDynamicPhotoScene; |
|
169 |
} |
|
170 |
else |
|
171 |
{ |
|
172 |
scene = ECamSettingItemDynamicVideoScene; |
|
173 |
} |
|
174 |
||
175 |
// construct the listbox |
|
176 |
iListBox = new( ELeave ) CCamSceneListBox( iMode, this, iController, iFullySkinned ); |
|
177 |
iListBox->ConstructL( iController, this, iTitleArray, iDescArray, |
|
178 |
iUserBaseScenes ); |
|
179 |
iListBox->InitializeL( iController.IntegerSettingValue( scene ) ); |
|
180 |
iListBox->SetContainerWindowL( *this ); |
|
181 |
iListBox->CreateScrollBarFrameL( ETrue ); |
|
182 |
iListBox->DisableSingleClick( ETrue ); |
|
183 |
||
184 |
TRect listboxRect; |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
185 |
if ( CamUtility::IsNhdDevice() ) |
54 | 186 |
{ |
187 |
listboxRect = TouchLayout(); |
|
188 |
} |
|
189 |
else |
|
190 |
{ |
|
191 |
iCurrentDescLineArray = |
|
192 |
new( ELeave ) CArrayFixFlat<TPtrC>( KExplTxtGranularity ); |
|
193 |
listboxRect = NonTouchLayout(); |
|
194 |
} |
|
195 |
||
196 |
// Determine the height of the listbox; |
|
197 |
// Height needs to be based on the number of items, because the layout |
|
198 |
// height (maxListBoxHeight )might be different |
|
199 |
// than combined height of the max visible listbox items |
|
200 |
||
201 |
CEikScrollBarFrame::TScrollBarVisibility visibility = |
|
202 |
CEikScrollBarFrame::EOff; |
|
203 |
TInt maxListBoxHeight = listboxRect.Height(); |
|
204 |
TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
205 |
iListBox->Model()->NumberOfItems() ); |
|
206 |
if ( maxListBoxHeight < listBoxHeight ) |
|
207 |
{ |
|
208 |
// there are more items than would fit to the listbox rectangle |
|
209 |
||
210 |
// the maximum height is the total height of items |
|
211 |
// that can fit to the maxlistboxheight |
|
212 |
TInt itemHeight = iListBox->ItemHeight(); |
|
213 |
TInt itemsVisible = maxListBoxHeight / itemHeight; |
|
214 |
listBoxHeight = itemsVisible * itemHeight; |
|
215 |
||
216 |
// the scrollbar needs to be turned on |
|
217 |
visibility = CEikScrollBarFrame::EOn; |
|
218 |
} |
|
219 |
||
220 |
// calculate the layout for the listbox with changed height |
|
221 |
const AknLayoutUtils::SAknLayoutControl listboxLayout = |
|
222 |
{ ELayoutEmpty, iListboxLayoutRect.Rect().iTl.iX, listboxRect.iTl.iY, |
|
223 |
ELayoutEmpty, ELayoutEmpty, |
|
224 |
iListboxLayoutRect.Rect().Width(), listBoxHeight }; |
|
225 |
||
226 |
AknLayoutUtils::LayoutControl( iListBox, |
|
227 |
iLayoutAreaRect, listboxLayout); |
|
228 |
||
229 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
230 |
CEikScrollBarFrame::EOff, visibility ); |
|
231 |
iListBox->MakeVisible( ETrue ); |
|
232 |
iListBox->SetFocus( EFalse, ENoDrawNow ); |
|
233 |
iListBox->UpdateScrollBarsL(); |
|
234 |
iListBox->ScrollBarFrame()->DrawScrollBarsNow(); |
|
235 |
iListBox->SetListBoxObserver(this); |
|
236 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
237 |
appUi->SetActivePaletteVisibility( EFalse ); |
|
238 |
||
239 |
// Prevents the system filling invalidated areas with the background |
|
240 |
// colour - helps reduce flicker. |
|
241 |
Window().SetBackgroundColor(); |
|
242 |
||
243 |
if ( iMode == ECamControllerImage ) |
|
244 |
{ |
|
245 |
ConstructContainerTitleFromResourceL( R_CAM_STILL_SCENE_SETTING_TITLE ); |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
ConstructContainerTitleFromResourceL( R_CAM_VIDEO_SCENE_SETTING_TITLE ); |
|
250 |
} |
|
251 |
||
252 |
if ( ! iTooltipController ) |
|
253 |
{ |
|
254 |
iTooltipController = CAknInfoPopupNoteController::NewL(); |
|
255 |
} |
|
256 |
||
257 |
iTooltipController->SetTimeDelayBeforeShow( KInfoTooltipDelay ); |
|
258 |
iTooltipController->SetTimePopupInView( KInfoTooltipDisplayTime ); |
|
259 |
||
260 |
// Position the tooltip |
|
261 |
TPoint position; |
|
262 |
if ( AknsUtils::GetControlPosition( this, position ) != KErrNone ) |
|
263 |
{ |
|
264 |
position = PositionRelativeToScreen(); |
|
265 |
} |
|
266 |
TRect rect( position, Size() ); |
|
267 |
TPoint center = rect.Center(); |
|
268 |
iTooltipController->SetPositionAndAlignment( |
|
269 |
TPoint( center.iX, rect.iTl.iY ), EHLeftVBottom ); |
|
270 |
||
271 |
iTooltipController->SetTimeDelayBeforeShow( KInfoTooltipDelay ); |
|
272 |
iTooltipController->SetTimePopupInView( KInfoTooltipDisplayTime ); |
|
273 |
||
274 |
PRINT(_L("Camera <= CCamShootingModeContainer::ConstructL") ) |
|
275 |
} |
|
276 |
||
277 |
||
278 |
// --------------------------------------------------------------------------- |
|
279 |
// SelectSummaryResourceL |
|
280 |
// --------------------------------------------------------------------------- |
|
281 |
// |
|
282 |
TInt |
|
283 |
CCamShootingModeContainer::SelectSummaryResourceL() |
|
284 |
{ |
|
285 |
TInt resourceId = KErrNotSupported; |
|
286 |
TBool secondCameraOn = |
|
287 |
static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->IsSecondCameraEnabled(); |
|
288 |
// ------------------------------------------------------- |
|
289 |
// Photo mode |
|
290 |
if ( ECamControllerImage == iMode ) |
|
291 |
{ |
|
292 |
if ( secondCameraOn ) |
|
293 |
{ |
|
294 |
//Product does not currently support shooting modes for secondary camera photo mode |
|
295 |
} |
|
296 |
else |
|
297 |
{ |
|
298 |
resourceId = R_CAM_CAPTURE_SETUP_LIST_PHOTO_SHOOTING_MODE_SUMMARY; |
|
299 |
} |
|
300 |
} |
|
301 |
// ------------------------------------------------------- |
|
302 |
// Video mode |
|
303 |
else |
|
304 |
{ |
|
305 |
if ( secondCameraOn ) |
|
306 |
{ |
|
307 |
//Products do not currently support shooting modes for secondary camera video mode |
|
308 |
} |
|
309 |
else |
|
310 |
{ |
|
311 |
resourceId = R_CAM_CAPTURE_SETUP_LIST_VIDEO_SHOOTING_MODE_SUMMARY; |
|
312 |
} |
|
313 |
} |
|
314 |
// ------------------------------------------------------- |
|
315 |
||
316 |
return resourceId; |
|
317 |
} |
|
318 |
||
319 |
||
320 |
// --------------------------------------------------------------------------- |
|
321 |
// CCamShootingModeContainer::CCamShootingModeContainer |
|
322 |
// C++ constructor |
|
323 |
// --------------------------------------------------------------------------- |
|
324 |
// |
|
325 |
CCamShootingModeContainer::CCamShootingModeContainer( |
|
326 |
TCamCameraMode aMode, |
|
327 |
CCamAppController& aController, |
|
328 |
CAknView& aView, |
|
329 |
TBool aUserBaseScenes, |
|
330 |
TBool aFullySkinned ) |
|
331 |
: CCamContainerBase( aController, aView ), |
|
332 |
iListBox( NULL ), |
|
333 |
iMode( aMode ), |
|
334 |
iUserBaseScenes( aUserBaseScenes ), |
|
335 |
iFullySkinned( aFullySkinned ), |
|
336 |
iTooltipController( NULL ), |
|
337 |
iListboxTitle( NULL ), |
|
338 |
iTooltipIndex( -1 ), |
|
339 |
iActivateOnTouchRelease( EFalse ) |
|
340 |
{ |
|
341 |
} |
|
342 |
||
343 |
// ---------------------------------------------------------------- |
|
344 |
// CCamShootingModeContainer::UserSceneHighlighted |
|
345 |
// Returns ETrue if the current selected scene is User |
|
346 |
// ---------------------------------------------------------------- |
|
347 |
// |
|
348 |
TBool CCamShootingModeContainer::UserSceneHighlighted() |
|
349 |
{ |
|
350 |
return (CurrentSettingItemValue() == ECamSceneUser ); |
|
351 |
} |
|
352 |
||
353 |
// ---------------------------------------------------------------- |
|
354 |
// CCamShootingModeContainer::SaveSceneSettingIfChangedL |
|
355 |
// Stores the currently selected scene in the dynamic settings model |
|
356 |
// if it differs from current scene mode |
|
357 |
// ---------------------------------------------------------------- |
|
358 |
// |
|
359 |
TBool CCamShootingModeContainer::SaveSceneSettingIfChangedL() |
|
360 |
{ |
|
361 |
TInt scene = 0; |
|
362 |
if ( iUserBaseScenes ) |
|
363 |
{ |
|
364 |
scene = ECamSettingItemUserSceneBasedOnScene; |
|
365 |
} |
|
366 |
else if ( ECamControllerImage == iMode ) |
|
367 |
{ |
|
368 |
scene = ECamSettingItemDynamicPhotoScene; |
|
369 |
} |
|
370 |
else |
|
371 |
{ |
|
372 |
scene = ECamSettingItemDynamicVideoScene; |
|
373 |
} |
|
374 |
||
375 |
TInt currentSceneMode = iController.IntegerSettingValue( scene ); |
|
376 |
if ( currentSceneMode != CurrentSettingItemValue() ) |
|
377 |
{ |
|
378 |
// The scene mode selection has changed, store new mode |
|
379 |
return SaveSceneSettingL(); |
|
380 |
} |
|
381 |
else |
|
382 |
{ |
|
383 |
// No change, no need to save |
|
384 |
return EFalse; |
|
385 |
} |
|
386 |
} |
|
387 |
||
388 |
// ---------------------------------------------------------------- |
|
389 |
// CCamShootingModeContainer::SaveSceneSetting |
|
390 |
// Stores the currently selected scene in the dynamic settings model |
|
391 |
// ---------------------------------------------------------------- |
|
392 |
// |
|
393 |
TBool CCamShootingModeContainer::SaveSceneSettingL() |
|
394 |
{ |
|
395 |
TInt scene = 0; |
|
396 |
if ( iUserBaseScenes ) |
|
397 |
{ |
|
398 |
scene = ECamSettingItemUserSceneBasedOnScene; |
|
399 |
} |
|
400 |
else if ( ECamControllerImage == iMode ) |
|
401 |
{ |
|
402 |
scene = ECamSettingItemDynamicPhotoScene; |
|
403 |
} |
|
404 |
else |
|
405 |
{ |
|
406 |
scene = ECamSettingItemDynamicVideoScene; |
|
407 |
} |
|
408 |
||
409 |
iController.SetIntegerSettingValueL( scene, |
|
410 |
CurrentSettingItemValue() ); |
|
411 |
static_cast<CCamAppUiBase*>( CEikonEnv::Static()->AppUi() )->APHandler()->UpdateActivePaletteL(); |
|
412 |
||
413 |
||
414 |
// If user selected sports scene from list. |
|
415 |
if ( CurrentSettingItemValue() == ECamSceneSports ) |
|
416 |
{ |
|
417 |
// if the selection was for user scene base scene, and user |
|
418 |
// scene is active, but request was cancelled, return false. |
|
419 |
if ( ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) |
|
420 |
== ECamSceneUser ) && |
|
421 |
( iController.IntegerSettingValue( ECamSettingItemUserSceneBasedOnScene ) |
|
422 |
!= ECamSceneSports ) ) |
|
423 |
{ |
|
424 |
return EFalse; |
|
425 |
} |
|
426 |
// if the selection was for the photo/video scene, but request was |
|
427 |
// cancelled, return false. |
|
428 |
if ( ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) |
|
429 |
!= ECamSceneUser ) && |
|
430 |
( iController.IntegerSettingValue( scene ) != ECamSceneSports ) ) |
|
431 |
{ |
|
432 |
return EFalse; |
|
433 |
} |
|
434 |
} |
|
435 |
// Otherwise, if the user selected user scene from the list, but request |
|
436 |
// was cancelled, return false. |
|
437 |
else if ( ( CurrentSettingItemValue() |
|
438 |
== ECamSceneUser ) && |
|
439 |
( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) |
|
440 |
!= ECamSceneUser ) ) |
|
441 |
{ |
|
442 |
return EFalse; |
|
443 |
} |
|
444 |
||
445 |
// Remove lint warning. |
|
446 |
else |
|
447 |
{ |
|
448 |
} |
|
449 |
||
450 |
// In all other cases, return true. |
|
451 |
return ETrue; |
|
452 |
} |
|
453 |
||
454 |
// ----------------------------------------------------------------------------- |
|
455 |
// CCamShootingModeContainer::CurrentSettingItemValue |
|
456 |
// Returns the Current item's setting value ID |
|
457 |
// ----------------------------------------------------------------------------- |
|
458 |
TInt CCamShootingModeContainer::CurrentSettingItemValue() const |
|
459 |
{ |
|
460 |
return (static_cast<CCamSceneListBoxModel *>(iListBox->Model())->ItemValue(iListBox->CurrentItemIndex())); |
|
461 |
} |
|
462 |
||
463 |
// ----------------------------------------------------------------------------- |
|
464 |
// CCamShootingModeContainer::IndexForValueId() const |
|
465 |
// Returns the index of the item in the array with the specified ValueId |
|
466 |
// ----------------------------------------------------------------------------- |
|
467 |
TInt CCamShootingModeContainer::IndexForValueId( TInt aValueId ) const |
|
468 |
{ |
|
469 |
return static_cast<MCamListboxModel*>( iListBox->Model() )->ValueIndex( aValueId ); |
|
470 |
} |
|
471 |
||
472 |
// ----------------------------------------------------------------------------- |
|
473 |
// CCamShootingModeContainer::HandleSettingValueUpdateL |
|
474 |
// Handles a change to the setting value of the slider |
|
475 |
// ----------------------------------------------------------------------------- |
|
476 |
// |
|
477 |
void CCamShootingModeContainer::HandleSettingValueUpdateL( TInt /*aNewValue*/ ) |
|
478 |
{ |
|
479 |
} |
|
480 |
||
481 |
||
482 |
// --------------------------------------------------------- |
|
483 |
// CCamShootingModeContainer::CountComponentControls |
|
484 |
// Returns the number of controls owned |
|
485 |
// --------------------------------------------------------- |
|
486 |
// |
|
487 |
TInt CCamShootingModeContainer::CountComponentControls() const |
|
488 |
{ |
|
489 |
return CCamContainerBase::CountComponentControls() + 1; |
|
490 |
} |
|
491 |
||
492 |
// --------------------------------------------------------- |
|
493 |
// CCamShootingModeContainer::ComponentControl |
|
494 |
// Returns the requested component control |
|
495 |
// --------------------------------------------------------- |
|
496 |
// |
|
497 |
CCoeControl* CCamShootingModeContainer::ComponentControl( TInt aIndex ) const |
|
498 |
{ |
|
499 |
CCoeControl* control = CCamContainerBase::ComponentControl( aIndex ); |
|
500 |
if( control == NULL ) |
|
501 |
{ |
|
502 |
control = iListBox; |
|
503 |
} |
|
504 |
return control; |
|
505 |
} |
|
506 |
||
507 |
// --------------------------------------------------------- |
|
508 |
// CCamShootingModeContainer::Draw |
|
509 |
// Draw control |
|
510 |
// --------------------------------------------------------- |
|
511 |
// |
|
512 |
void CCamShootingModeContainer::Draw( const TRect& aRect ) const |
|
513 |
{ |
|
514 |
PRINT(_L("Camera => CCamShootingModeContainer::Draw") ) |
|
515 |
||
516 |
CWindowGc& gc = SystemGc(); |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
517 |
if ( CamUtility::IsNhdDevice() ) |
54 | 518 |
{ |
519 |
TRgb color; |
|
520 |
if( iFullySkinned ) |
|
521 |
{ |
|
522 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
523 |
AknsDrawUtils::Background( skin, iBgContext, gc, aRect ); |
|
524 |
AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, |
|
525 |
EAknsCIQsnTextColorsCG6 ); |
|
526 |
} |
|
527 |
else |
|
528 |
{ |
|
529 |
// Fill control with transparency bg colour |
|
530 |
gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
531 |
gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
532 |
color = TRgb( 0,0 ); |
|
533 |
gc.SetBrushColor( color ); |
|
534 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
535 |
gc.DrawRect( aRect ); |
|
536 |
gc.SetBrushColor( color ); |
|
537 |
gc.DrawRect( iTitleTextRectLayout.TextRect() ); |
|
538 |
gc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) ); |
|
539 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
540 |
gc.DrawRect( TRect( iLayoutAreaRect.iTl.iX, |
|
541 |
iLayoutAreaRect.iTl.iY, |
|
542 |
iLayoutAreaRect.iBr.iX, |
|
543 |
iTitleTextRectLayout.TextRect().iBr.iY ) ); |
|
544 |
||
545 |
gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
546 |
color = TRgb( KRgbWhite ); |
|
547 |
} |
|
548 |
iTitleTextRectLayout.DrawText( gc, *iListboxTitle, ETrue, color ); |
|
549 |
} |
|
550 |
else |
|
551 |
{ |
|
552 |
TRAP_IGNORE( DrawSummaryTextL( gc ) ); |
|
553 |
} |
|
554 |
||
555 |
||
556 |
PRINT(_L("Camera <= CCamShootingModeContainer::Draw") ) |
|
557 |
} |
|
558 |
||
559 |
// ---------------------------------------------------------------- |
|
560 |
// CCamShootingModeContainer::OfferKeyEventL |
|
561 |
// Handles this application view's command keys. Forwards other |
|
562 |
// keys to child control(s). |
|
563 |
// ---------------------------------------------------------------- |
|
564 |
// |
|
565 |
TKeyResponse CCamShootingModeContainer::OfferKeyEventL( |
|
566 |
const TKeyEvent& aKeyEvent, |
|
567 |
TEventCode aType ) |
|
568 |
{ |
|
569 |
||
570 |
iController.StartIdleTimer(); |
|
571 |
||
572 |
// If the Ok button is pressed, select the current item |
|
573 |
if ( aKeyEvent.iCode == EKeyOK && aKeyEvent.iRepeats == 0 && aType == EEventKey ) |
|
574 |
{ |
|
575 |
TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
576 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
577 |
return response; |
|
578 |
} |
|
579 |
||
580 |
if ( iController.UiConfigManagerPtr() |
|
581 |
&& iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
582 |
{ |
|
583 |
if( aType == EEventKey && IsShutterKeyL( aKeyEvent, aType ) ) |
|
584 |
{ |
|
585 |
TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
586 |
if( UserSceneHighlighted() ) |
|
587 |
{ |
|
588 |
iView.HandleCommandL( ECamCmdUserSceneSelected ); |
|
589 |
} |
|
590 |
else |
|
591 |
{ |
|
592 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
593 |
} |
|
594 |
return response; |
|
595 |
} |
|
596 |
} |
|
597 |
else if( aType == EEventKey && IsCaptureKeyL( aKeyEvent, aType ) ) |
|
598 |
{ |
|
599 |
TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
600 |
if( UserSceneHighlighted() ) |
|
601 |
{ |
|
602 |
iView.HandleCommandL( ECamCmdUserSceneSelected ); |
|
603 |
} |
|
604 |
else |
|
605 |
{ |
|
606 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
607 |
} |
|
608 |
return response; |
|
609 |
} |
|
610 |
||
611 |
TKeyResponse returnvalue = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
612 |
||
613 |
// for non touch, we use key presses to scroll thru the scene modes |
|
614 |
// for touch with keyboard, key pressing can also scroll thru the scene modes |
|
615 |
// after every up and down key presses we display the tool tip |
|
616 |
if ( EStdKeyUpArrow == aKeyEvent.iScanCode || |
|
617 |
EStdKeyDownArrow == aKeyEvent.iScanCode ) |
|
618 |
{ |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
619 |
if ( CamUtility::IsNhdDevice() ) |
54 | 620 |
{ |
621 |
ShowTooltipL(); |
|
622 |
} |
|
623 |
else |
|
624 |
{ |
|
625 |
DrawDeferred(); // Update explanation text |
|
626 |
} |
|
627 |
} |
|
628 |
||
629 |
return returnvalue; |
|
630 |
} |
|
631 |
||
632 |
// ----------------------------------------------------------------- |
|
633 |
// CCamShootingModeContainer::ConstructSummaryDetailsFromResourceL |
|
634 |
// Sets up the layouts of the summary items |
|
635 |
// ----------------------------------------------------------------- |
|
636 |
void CCamShootingModeContainer::ConstructSummaryDetailsFromResourceL(TInt aResourceId) |
|
637 |
{ |
|
638 |
// Find the name and path of the MBM file for bitmaps |
|
639 |
TFileName mbmFileName; |
|
640 |
CamUtility::ResourceFileName( mbmFileName ); |
|
641 |
||
642 |
TResourceReader reader; |
|
643 |
iEikonEnv->CreateResourceReaderLC( reader, aResourceId ); |
|
644 |
const TInt count = reader.ReadInt16(); |
|
645 |
||
646 |
TInt i = -1; |
|
647 |
TInt bitmapId = -1; |
|
648 |
TInt summarySceneId = -1; |
|
649 |
HBufC16* title = NULL; |
|
650 |
HBufC16* descr = NULL; |
|
651 |
||
652 |
// Read all of the summary entries from the resource file |
|
653 |
for ( i = 0; i < count; i++ ) |
|
654 |
{ |
|
655 |
summarySceneId = reader.ReadInt16(); |
|
656 |
bitmapId = reader.ReadInt32(); |
|
657 |
title = reader.ReadHBufC16L(); |
|
658 |
descr = reader.ReadHBufC16L(); |
|
659 |
||
660 |
// Only add supported scenes. |
|
661 |
if( IsSupportedScene(summarySceneId) ) |
|
662 |
{ |
|
663 |
CFbsBitmap* icon = AknIconUtils::CreateIconL( mbmFileName, bitmapId ); |
|
664 |
CleanupStack::PushL( icon ); |
|
665 |
User::LeaveIfError( iSummaryBitmapArray.Append( icon ) ); |
|
666 |
CleanupStack::Pop( icon ); |
|
667 |
||
668 |
User::LeaveIfError( iTitleArray.Append( title ) ); |
|
669 |
if ( summarySceneId == ECamSceneScenery ) |
|
670 |
{ |
|
671 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
672 |
if ( appUi && appUi->AppController().UiConfigManagerPtr() |
|
673 |
&& appUi->AppController().UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
674 |
{ |
|
675 |
// the description of the icon |
|
676 |
HBufC* Description; |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
677 |
TInt description = R_CAM_SCENE_DESCRIPTION_LANDSCAPE_AUTOFOCUS; |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
678 |
Description = StringLoader::LoadL( description ); |
54 | 679 |
User::LeaveIfError( iDescArray.Append( Description ) ); |
680 |
} |
|
681 |
else |
|
682 |
{ |
|
683 |
User::LeaveIfError( iDescArray.Append( descr ) ); |
|
684 |
} |
|
685 |
} |
|
686 |
else |
|
687 |
{ |
|
688 |
User::LeaveIfError( iDescArray.Append( descr ) ); |
|
689 |
} |
|
690 |
} |
|
691 |
else |
|
692 |
{ |
|
693 |
delete title; |
|
694 |
title = NULL; |
|
695 |
delete descr; |
|
696 |
descr = NULL; |
|
697 |
} |
|
698 |
} |
|
699 |
CleanupStack::PopAndDestroy(); // reader |
|
700 |
} |
|
701 |
||
702 |
||
703 |
||
704 |
||
705 |
||
706 |
// ----------------------------------------------------------------- |
|
707 |
// IsSupportedScene |
|
708 |
// |
|
709 |
// Get whether the given scene is supported. |
|
710 |
// ----------------------------------------------------------------- |
|
711 |
// |
|
712 |
TBool |
|
713 |
CCamShootingModeContainer::IsSupportedScene( TInt aSceneId ) const |
|
714 |
{ |
|
715 |
// NOTE: |
|
716 |
// CamUtility in product changed to return also user scene |
|
717 |
// as one of supported scenes. |
|
718 |
||
719 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
720 |
TBool imageMode = (ECamControllerImage == iMode); |
|
721 |
||
722 |
// Scene must be in supported scenes list. |
|
723 |
TBool supported = iController.IsSceneSupported( aSceneId, imageMode ); |
|
724 |
||
725 |
// Still, user scene is never supported in user scene base list. |
|
726 |
TBool userException = (ECamSceneUser == aSceneId && iUserBaseScenes ); |
|
727 |
||
728 |
if( supported && !userException ) |
|
729 |
{ |
|
730 |
return ETrue; |
|
731 |
} |
|
732 |
else |
|
733 |
{ |
|
734 |
return EFalse; |
|
735 |
} |
|
736 |
} |
|
737 |
||
738 |
// -------------------------------------------------------------------------- |
|
739 |
// CCamShootingModeContainer::HandlePointerEventL |
|
740 |
// -------------------------------------------------------------------------- |
|
741 |
// |
|
742 |
void CCamShootingModeContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
743 |
{ |
|
744 |
||
745 |
RDebug::Print(_L("CCamShootingModeContainer::HandlePointerEventL iType=%d iPosition=(%d, %d)"), |
|
746 |
aPointerEvent.iType, |
|
747 |
aPointerEvent.iPosition.iX, |
|
748 |
aPointerEvent.iPosition.iY ); |
|
749 |
iListBox->HandlePointerEventL(aPointerEvent); |
|
750 |
/*TInt oldListItemIndex = -1; |
|
751 |
TInt newListItemIndex = -1; |
|
752 |
TBool handleItemActivation = EFalse; |
|
753 |
||
754 |
if ( iListBox ) |
|
755 |
{ |
|
756 |
oldListItemIndex = iListBox->CurrentItemIndex(); |
|
757 |
} |
|
758 |
||
759 |
// send to coecontrol -> will inform controls in this container about pointer events |
|
760 |
// (listbox will handle focus changes and scrolling) |
|
761 |
CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
762 |
||
763 |
if ( iListBox ) |
|
764 |
{ |
|
765 |
newListItemIndex = iListBox->CurrentItemIndex(); |
|
766 |
} |
|
767 |
||
768 |
// figure out if item was activated by touch down + release combination on same item |
|
769 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
770 |
{ |
|
771 |
||
772 |
if ( iListBox->Rect().Contains( aPointerEvent.iPosition ) ) |
|
773 |
{ |
|
774 |
if ( newListItemIndex != oldListItemIndex ) |
|
775 |
{ |
|
776 |
iActivateOnTouchRelease = EFalse; |
|
777 |
} |
|
778 |
else |
|
779 |
{ |
|
780 |
// set the current item to be activated on touch release |
|
781 |
iActivateOnTouchRelease = ETrue; |
|
782 |
} |
|
783 |
||
784 |
// show tooltip always when touch event down happens inside listbox |
|
785 |
ShowTooltipL(); |
|
786 |
} |
|
787 |
else |
|
788 |
{ |
|
789 |
iActivateOnTouchRelease = EFalse; |
|
790 |
} |
|
791 |
||
792 |
||
793 |
} |
|
794 |
else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
795 |
{ |
|
796 |
if ( iActivateOnTouchRelease && ( newListItemIndex == oldListItemIndex ) ) |
|
797 |
{ |
|
798 |
// only if list item index has not changed during event |
|
799 |
// and iActivateOnTouchRelease is true |
|
800 |
TInt pointedItemIndex = 0; |
|
801 |
TBool focusableItemPointed = |
|
802 |
iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, |
|
803 |
pointedItemIndex ); |
|
804 |
// check that pointer is in focusable area |
|
805 |
if ( focusableItemPointed ) |
|
806 |
{ |
|
807 |
handleItemActivation = ETrue; |
|
808 |
iActivateOnTouchRelease = EFalse; |
|
809 |
} |
|
810 |
else |
|
811 |
{ |
|
812 |
iActivateOnTouchRelease = EFalse; |
|
813 |
} |
|
814 |
} |
|
815 |
} |
|
816 |
else |
|
817 |
{ |
|
818 |
// aPointerEvent.iType == TPointerEvent::EDrag |
|
819 |
||
820 |
if ( newListItemIndex != oldListItemIndex ) |
|
821 |
{ |
|
822 |
// change only when drag event changes the listitem index |
|
823 |
iActivateOnTouchRelease = EFalse; |
|
824 |
||
825 |
// with drag always update the tooltip |
|
826 |
ShowTooltipL(); |
|
827 |
} |
|
828 |
||
829 |
} |
|
830 |
||
831 |
||
832 |
if ( handleItemActivation ) |
|
833 |
{ |
|
834 |
||
835 |
// no need for tooltips anymore |
|
836 |
HideCurrentTooltipL(); |
|
837 |
||
838 |
if ( UserSceneHighlighted() ) |
|
839 |
{ |
|
840 |
iView.HandleCommandL( ECamCmdUserSceneSelected ); |
|
841 |
} |
|
842 |
else |
|
843 |
{ |
|
844 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
845 |
} |
|
846 |
} |
|
847 |
||
848 |
*/ |
|
849 |
} // end of HandlePointerEventL |
|
850 |
||
851 |
||
852 |
// -------------------------------------------------------------------------- |
|
853 |
// CCamShootingModeContainer::ShowTooltipL |
|
854 |
// -------------------------------------------------------------------------- |
|
855 |
// |
|
856 |
void CCamShootingModeContainer::ShowTooltipL() |
|
857 |
{ |
|
858 |
||
859 |
if ( !iTooltipController || ( iDescArray[iListBox->CurrentItemIndex()]->Length() <= 0 ) ) |
|
860 |
{ |
|
861 |
return; |
|
862 |
} |
|
863 |
||
864 |
if ( iTooltipIndex != iListBox->CurrentItemIndex() ) |
|
865 |
{ |
|
866 |
// make sure that possible already open tooltip is hidden |
|
867 |
iTooltipController->HideInfoPopupNote(); |
|
868 |
iTooltipController->SetTextL( *iDescArray[iListBox->CurrentItemIndex()] ); |
|
869 |
iTooltipController->SetPositionByHighlight( iListBox->HighlightRect() ); |
|
870 |
||
871 |
iTooltipIndex = iListBox->CurrentItemIndex(); |
|
872 |
} |
|
873 |
||
874 |
iTooltipController->ShowInfoPopupNote(); |
|
875 |
} |
|
876 |
||
877 |
||
878 |
// -------------------------------------------------------------------------- |
|
879 |
// CCamShootingModeContainer::HideCurrentTooltipL |
|
880 |
// Hides tooltip for the selected listbox item, if one is visible |
|
881 |
// -------------------------------------------------------------------------- |
|
882 |
// |
|
883 |
void CCamShootingModeContainer::HideCurrentTooltipL() |
|
884 |
{ |
|
885 |
||
886 |
if ( !iTooltipController || ( iDescArray[iListBox->CurrentItemIndex()]->Length() <= 0 ) ) |
|
887 |
{ |
|
888 |
return; |
|
889 |
} |
|
890 |
||
891 |
iTooltipController->HideInfoPopupNote(); |
|
892 |
||
893 |
} |
|
894 |
||
895 |
||
896 |
// -------------------------------------------------------------------------- |
|
897 |
// CCamShootingModeContainer::ConstructContainerTitleFromResourceL |
|
898 |
// -------------------------------------------------------------------------- |
|
899 |
// |
|
900 |
void CCamShootingModeContainer::ConstructContainerTitleFromResourceL( TInt aResourceId ) |
|
901 |
{ |
|
902 |
TResourceReader reader; |
|
903 |
iEikonEnv->CreateResourceReaderLC( reader, aResourceId ); // cleanupstack |
|
904 |
||
905 |
iListboxTitle = reader.ReadHBufC16L(); |
|
906 |
||
907 |
CleanupStack::PopAndDestroy(); // reader |
|
908 |
} |
|
909 |
||
910 |
// -------------------------------------------------------------------------- |
|
911 |
// CCamShootingModeContainer::SelectItem |
|
912 |
// -------------------------------------------------------------------------- |
|
913 |
// |
|
914 |
TBool CCamShootingModeContainer::SelectItem( TInt aItemIndex ) |
|
915 |
{ |
|
916 |
||
917 |
TInt oldListItemIndex = -1; |
|
918 |
TBool returnSelectionSuccess = EFalse; |
|
919 |
||
920 |
if ( iListBox ) |
|
921 |
{ |
|
922 |
oldListItemIndex = iListBox->CurrentItemIndex(); |
|
923 |
||
924 |
if ( oldListItemIndex != aItemIndex ) |
|
925 |
{ |
|
926 |
iListBox->SetCurrentItemIndex( aItemIndex ); |
|
927 |
} |
|
928 |
else |
|
929 |
{ |
|
930 |
// already selected |
|
931 |
returnSelectionSuccess = EFalse; |
|
932 |
} |
|
933 |
} |
|
934 |
else |
|
935 |
{ |
|
936 |
// iListBox == NULL |
|
937 |
returnSelectionSuccess = EFalse; |
|
938 |
} |
|
939 |
||
940 |
return returnSelectionSuccess; |
|
941 |
} |
|
942 |
||
943 |
// ----------------------------------------------------------------- |
|
944 |
// CCamShootingModeContainer::DrawSummaryText (Scene settings) |
|
945 |
// Draws summary title and description text |
|
946 |
// ----------------------------------------------------------------- |
|
947 |
||
948 |
void CCamShootingModeContainer::DrawSummaryTextL( CWindowGc& aGc ) const |
|
949 |
{ |
|
950 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
951 |
appUi->SetTitleL( *iListboxTitle ); |
|
952 |
||
953 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
954 |
AknsDrawUtils::Background( skin, iBgContext, aGc, Rect() ); |
|
955 |
||
956 |
// Draw summary frame |
|
957 |
TRect explTxtRect = iExplanationRect; |
|
958 |
TInt border = iExplIconLayout.Rect().iTl.iX - iExplanationRect.iTl.iX; |
|
959 |
explTxtRect.Shrink( border/2 , border/2 ); //Magic: half of frame |
|
960 |
AknsDrawUtils::DrawFrame( skin, aGc, iExplanationRect, explTxtRect, |
|
961 |
KAknsIIDQsnFrInput, KAknsIIDNone ); //frame |
|
962 |
||
963 |
AknIconUtils::SetSize( iSummaryBitmapArray[iListBox->CurrentItemIndex()], |
|
964 |
iExplIconLayout.Rect().Size() ); |
|
965 |
iExplIconLayout.DrawImage( aGc, |
|
966 |
iSummaryBitmapArray[ iListBox->CurrentItemIndex() ], NULL ); |
|
967 |
||
968 |
TRgb explTitleTxtColor; // same as list highlight text |
|
969 |
TRgb explTxtColor; // same as main area text |
|
970 |
AknsUtils::GetCachedColor( skin, explTitleTxtColor, KAknsIIDQsnTextColors, |
|
971 |
EAknsCIQsnTextColorsCG10 ); |
|
972 |
AknsUtils::GetCachedColor( skin, explTxtColor, KAknsIIDQsnTextColors, |
|
973 |
EAknsCIQsnTextColorsCG6 ); |
|
974 |
iExplTitleLayout.DrawText( aGc, |
|
975 |
iTitleArray[ iListBox->CurrentItemIndex() ]->Des(), |
|
976 |
ETrue, explTitleTxtColor ); |
|
977 |
AknTextUtils::WrapToArrayL( *iDescArray[iListBox->CurrentItemIndex()], |
|
978 |
iExplTxtLinesLayout[0].TextRect().Width(), |
|
979 |
*iExplTxtLinesLayout[0].Font(), |
|
980 |
*iCurrentDescLineArray ); |
|
981 |
TInt lCount = Min( iExplLineCount, iCurrentDescLineArray->Count() ); |
|
982 |
for ( TInt i = 0; i < lCount; i++ ) |
|
983 |
{ |
|
984 |
iExplTxtLinesLayout[i].DrawText( aGc, (*iCurrentDescLineArray)[i], |
|
985 |
ETrue, explTxtColor ); |
|
986 |
} |
|
987 |
} |
|
988 |
||
989 |
||
990 |
||
991 |
// -------------------------------------------------------------------------- |
|
992 |
// CCamShootingModeContainer::TouchLayout |
|
993 |
// -------------------------------------------------------------------------- |
|
994 |
// |
|
995 |
TRect CCamShootingModeContainer::TouchLayout() |
|
996 |
{ |
|
997 |
TRect statusPaneRect; |
|
998 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
999 |
statusPaneRect ); |
|
1000 |
iLayoutAreaRect.BoundingRect( statusPaneRect ); |
|
1001 |
||
1002 |
// get the rect size for listbox in the layout |
|
1003 |
TAknLayoutRect wholeListboxLayoutRect; |
|
1004 |
wholeListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
1005 |
AknLayoutScalable_Apps::main_cset_listscroll_pane( 3 ) ); |
|
1006 |
||
1007 |
// get layout for the listbox rect |
|
1008 |
TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
1009 |
iListBox->Model()->NumberOfItems() ); |
|
1010 |
if ( wholeListboxLayoutRect.Rect().Height() < listBoxHeight ) |
|
1011 |
{ |
|
1012 |
// if scrollbars are used, use scrollbar layout |
|
1013 |
iListboxLayoutRect.LayoutRect( wholeListboxLayoutRect.Rect(), |
|
1014 |
AknLayoutScalable_Apps::main_cset_list_pane( 0 ) ); |
|
1015 |
AknLayoutUtils::LayoutVerticalScrollBar( iListBox->ScrollBarFrame(), |
|
1016 |
wholeListboxLayoutRect.Rect(), |
|
1017 |
AknLayoutScalable_Apps::scroll_pane_cp028( 0 ) ); |
|
1018 |
} |
|
1019 |
else |
|
1020 |
{ |
|
1021 |
iListboxLayoutRect.LayoutRect( wholeListboxLayoutRect.Rect(), |
|
1022 |
AknLayoutScalable_Apps::main_cset_list_pane( 1 ) ); |
|
1023 |
} |
|
1024 |
||
1025 |
// text for the listbox title |
|
1026 |
iTitleTextRectLayout.LayoutText( iLayoutAreaRect, |
|
1027 |
AknLayoutScalable_Apps::main_cam_set_pane_t1( 3 ) ); |
|
1028 |
||
1029 |
return wholeListboxLayoutRect.Rect(); |
|
1030 |
} |
|
1031 |
||
1032 |
// -------------------------------------------------------------------------- |
|
1033 |
// CCamShootingModeContainer::NonTouchLayout (Scene mode) |
|
1034 |
// -------------------------------------------------------------------------- |
|
1035 |
// |
|
1036 |
TRect CCamShootingModeContainer::NonTouchLayout() |
|
1037 |
{ |
|
1038 |
TAknLayoutRect wholeListboxLayoutRect; |
|
1039 |
wholeListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
1040 |
AknLayoutScalable_Apps::main_cset6_listscroll_pane( 3 ) ); |
|
1041 |
TAknLayoutRect listLayoutRect; |
|
1042 |
listLayoutRect.LayoutRect( iLayoutAreaRect, |
|
1043 |
AknLayoutScalable_Apps::main_cset6_listscroll_pane( 4 ) ); |
|
1044 |
TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
1045 |
iListBox->Model()->NumberOfItems() ); |
|
1046 |
if ( wholeListboxLayoutRect.Rect().Height() < listBoxHeight ) |
|
1047 |
{ |
|
1048 |
// if scrollbars are used, use scrollbar layout |
|
1049 |
iListboxLayoutRect.LayoutRect( listLayoutRect.Rect(), |
|
1050 |
AknLayoutScalable_Apps::main_cset_list_pane_copy1( 0 ) ); |
|
1051 |
AknLayoutUtils::LayoutVerticalScrollBar( iListBox->ScrollBarFrame(), |
|
1052 |
listLayoutRect.Rect(), |
|
1053 |
AknLayoutScalable_Apps::scroll_pane_cp028_copy1( 0 ) ); |
|
1054 |
} |
|
1055 |
else |
|
1056 |
{ |
|
1057 |
iListboxLayoutRect.LayoutRect( listLayoutRect.Rect(), |
|
1058 |
AknLayoutScalable_Apps::main_cset_list_pane_copy1( 1 ) ); |
|
1059 |
} |
|
1060 |
||
1061 |
// Explanation ikon, title, and text layout |
|
1062 |
TAknLayoutRect explParent; |
|
1063 |
explParent.LayoutRect( iLayoutAreaRect, |
|
1064 |
AknLayoutScalable_Apps::main_cset6_text2_pane( 0 ) ); |
|
1065 |
TAknLayoutRect explLayoutRect; |
|
1066 |
explLayoutRect.LayoutRect( explParent.Rect(), |
|
1067 |
AknLayoutScalable_Apps::bg_popup_preview_window_pane_cp03( 0 ) ); |
|
1068 |
iExplanationRect = explLayoutRect.Rect(); |
|
1069 |
||
1070 |
iExplIconLayout.LayoutRect( iExplanationRect, |
|
1071 |
AknLayoutScalable_Apps::main_cset6_text2_pane_g1( 0 ) ); |
|
1072 |
iExplTitleLayout.LayoutText( iExplanationRect, |
|
1073 |
AknLayoutScalable_Apps::main_cset6_text2_pane_t1( 0 ) ); |
|
1074 |
iExplTitleLayout.LayoutText( iExplanationRect, |
|
1075 |
AknLayoutScalable_Apps::main_cset6_text2_pane_t1( 0 ) ); |
|
1076 |
||
1077 |
TAknLayoutRect explTxtParent; |
|
1078 |
explTxtParent.LayoutRect( iExplanationRect, |
|
1079 |
AknLayoutScalable_Apps::list_cset_text2_pane(0) ); |
|
1080 |
TAknLayoutScalableParameterLimits listLimits = |
|
1081 |
AknLayoutScalable_Apps::list_cset_text2_pane_t1_ParamLimits( 0 ); |
|
1082 |
iExplLineCount = listLimits.LastRow() + 1; |
|
1083 |
for ( TInt i = 0; i < iExplLineCount; i++ ) |
|
1084 |
{ |
|
1085 |
TAknLayoutText layoutText; |
|
1086 |
layoutText.LayoutText( explTxtParent.Rect(), |
|
1087 |
AknLayoutScalable_Apps::list_cset_text2_pane_t1( 0, 0, i ) ); |
|
1088 |
(void) iExplTxtLinesLayout.Append( layoutText ); // Errors are ignored |
|
1089 |
} |
|
1090 |
||
1091 |
TRect ret = wholeListboxLayoutRect.Rect(); |
|
1092 |
// Non-touch has a visible title & status panes |
|
1093 |
TRect titlePaneRect; |
|
1094 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, |
|
1095 |
titlePaneRect ); |
|
1096 |
ret.Move( 0, -titlePaneRect.Height() ); |
|
1097 |
return ret; |
|
1098 |
} |
|
1099 |
||
1100 |
// -------------------------------------------------------------------------- |
|
1101 |
// CCamShootingModeContainer::HandleListBoxEventL |
|
1102 |
// Handles Listbox events |
|
1103 |
// -------------------------------------------------------------------------- |
|
1104 |
// |
|
1105 |
||
1106 |
void CCamShootingModeContainer::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ) |
|
1107 |
{ |
|
1108 |
switch( aEventType ) |
|
1109 |
{ |
|
1110 |
case EEventItemDoubleClicked: |
|
1111 |
case EEventItemSingleClicked: |
|
1112 |
{ |
|
1113 |
HideCurrentTooltipL(); |
|
1114 |
if ( UserSceneHighlighted() ) |
|
1115 |
{ |
|
1116 |
iView.HandleCommandL( ECamCmdUserSceneSelected ); |
|
1117 |
} |
|
1118 |
else |
|
1119 |
{ |
|
1120 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
1121 |
} |
|
1122 |
} |
|
1123 |
break; |
|
1124 |
||
1125 |
case EEventPenDownOnItem: |
|
1126 |
{ |
|
1127 |
ShowTooltipL(); |
|
1128 |
} |
|
1129 |
break; |
|
1130 |
default: |
|
1131 |
break; |
|
1132 |
} |
|
1133 |
} |
|
1134 |
// End of File |