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 "CamInfoListBoxContainer.h" |
|
18 #include "CamUtility.h" |
|
19 #include <AknBidiTextUtils.h> |
|
20 #include <AknsUtils.h> |
|
21 #include <AknsDrawUtils.h> |
|
22 #include <AknUtils.h> |
|
23 #include <barsread.h> // resource reader |
|
24 #include <aknview.h> |
|
25 #include <aknlayoutscalable_apps.cdl.h> |
|
26 #include <touchfeedback.h> |
|
27 #include <akntoolbar.h> |
|
28 |
|
29 |
|
30 #include "CamAppUi.h" |
|
31 |
|
32 #include "CamInfoListBox.h" |
|
33 #include "CamInfoListBoxModel.h" |
|
34 #include "CamPanic.h" |
|
35 #include <AknInfoPopupNoteController.h> // CAknInfoPopupNoteController |
|
36 |
|
37 #include <cameraapp.rsg> |
|
38 #include <vgacamsettings.rsg> |
|
39 |
|
40 // CONSTANTS |
|
41 const TInt KInfoTooltipDelay = 0; // time (milliseconds) delay when showing the tooltip |
|
42 const TInt KInfoTooltipDisplayTime = 5000; // maximum time (milliseconds) the tooltip is displayed |
|
43 const TInt KExplTxtGranularity = 6; |
|
44 const TUint32 KToolbarExtensionBgColor = 0x00000000; |
|
45 const TInt KToolBarExtensionBgAlpha = 0x7F; |
|
46 |
|
47 // ================= MEMBER FUNCTIONS ======================= |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CCamInfoListBoxContainer::NewL |
|
51 // Symbian OS two-phased constructor |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CCamInfoListBoxContainer* CCamInfoListBoxContainer::NewL( const TRect& aRect, |
|
55 CAknView& aView, |
|
56 CCamAppController& aController, |
|
57 TInt aListBoxResource, |
|
58 TInt aSummaryResource, |
|
59 TInt aSettingValue, |
|
60 TInt aTitleResource, |
|
61 TBool aSkinnedBackGround ) |
|
62 { |
|
63 CCamInfoListBoxContainer* self = |
|
64 new( ELeave ) CCamInfoListBoxContainer( aController, |
|
65 aView, |
|
66 aSettingValue, |
|
67 aSkinnedBackGround ); |
|
68 CleanupStack::PushL( self ); |
|
69 self->ConstructL( aRect, aListBoxResource, aSummaryResource, aTitleResource); |
|
70 CleanupStack::Pop( self ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CCamInfoListBoxContainer::~CCamInfoListBoxContainer |
|
76 // Destructor |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CCamInfoListBoxContainer::~CCamInfoListBoxContainer() |
|
80 { |
|
81 PRINT( _L( "Camera => ~CCamInfoListBoxContainer" ) ); |
|
82 |
|
83 iSummaryBitmapArray.ResetAndDestroy(); |
|
84 iTitleArray.ResetAndDestroy(); |
|
85 iDescArray.ResetAndDestroy(); |
|
86 iExplTxtLinesLayout.Close(); |
|
87 |
|
88 delete iListBox; |
|
89 |
|
90 if ( iTooltipController ) |
|
91 { |
|
92 delete iTooltipController; |
|
93 iTooltipController = NULL; |
|
94 } |
|
95 |
|
96 if ( iListboxTitle ) |
|
97 { |
|
98 delete iListboxTitle; |
|
99 iListboxTitle = NULL; |
|
100 } |
|
101 |
|
102 if ( iCurrentDescLineArray ) |
|
103 { |
|
104 iCurrentDescLineArray->Reset(); |
|
105 delete iCurrentDescLineArray; |
|
106 } |
|
107 |
|
108 PRINT( _L( "Camera <= ~CCamInfoListBoxContainer" ) ); |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // CCamInfoListBoxContainer::ConstructL |
|
113 // Symbian OS 2nd phase constructor |
|
114 // --------------------------------------------------------- |
|
115 // |
|
116 void CCamInfoListBoxContainer::ConstructL( const TRect& aRect, TInt aListBoxResource, TInt aSummaryResource, TInt aTitleResource ) |
|
117 { |
|
118 PRINT(_L("Camera => CCamInfoListBoxContainer::ConstructL") ) |
|
119 |
|
120 CCamContainerBase::BaseConstructL( aRect ); |
|
121 |
|
122 if ( iController.IsTouchScreenSupported() ) |
|
123 { |
|
124 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
125 CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar(); |
|
126 if ( fixedToolbar ) |
|
127 { |
|
128 // Hide toolbar from Light sensitivity etc. settings view |
|
129 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
130 } |
|
131 } |
|
132 |
|
133 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
134 iLayoutAreaRect ); |
|
135 |
|
136 // layout area rectangle contains the area, where components need to be |
|
137 // drawn to. the container size is the whole screen, but the layouts are |
|
138 // for the client area. aRect is the container size that might include or |
|
139 // might not include statuspane area. calculating area self will |
|
140 // go around the problem |
|
141 |
|
142 // Construct the listbox |
|
143 iListBox = new( ELeave ) CCamInfoListBox( this, iController ); |
|
144 iListBox->ConstructL( iController, this, iTitleArray, iDescArray, aListBoxResource, |
|
145 iSkinnedBackGround ); |
|
146 iListBox->DisableSingleClick( ETrue ); |
|
147 |
|
148 // Highlight the currently active setting value |
|
149 iListBox->InitializeL( iSettingValue ); |
|
150 |
|
151 iListBox->SetContainerWindowL( *this ); |
|
152 iListBox->CreateScrollBarFrameL( ETrue ); |
|
153 |
|
154 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
155 TRect listboxRect; |
|
156 if ( CamUtility::IsNhdDevice() ) |
|
157 { |
|
158 listboxRect = TouchLayout(); |
|
159 } |
|
160 else |
|
161 { |
|
162 iCurrentDescLineArray = |
|
163 new( ELeave ) CArrayFixFlat<TPtrC>( KExplTxtGranularity ); |
|
164 appUi->StatusPane()->MakeVisible( ETrue ); |
|
165 SetRect( appUi->ClientRect() ); |
|
166 listboxRect = NonTouchLayout(); |
|
167 } |
|
168 ConstructSummaryDetailsFromResourceL( aSummaryResource ); |
|
169 |
|
170 // Determine the height of the listbox; |
|
171 // Height needs to be based on the number of items, because the layout |
|
172 // height (maxListBoxHeight )might be different |
|
173 // than combined height of the max visible listbox items |
|
174 |
|
175 CEikScrollBarFrame::TScrollBarVisibility visibility = |
|
176 CEikScrollBarFrame::EOff; |
|
177 TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
178 iListBox->Model()->NumberOfItems() ); |
|
179 if ( listboxRect.Height() < listBoxHeight ) |
|
180 { |
|
181 // there are more items than would fit to the listbox rectangle |
|
182 |
|
183 // the maximum height is the total height of items |
|
184 // that can fit to the maxlistboxheight |
|
185 TInt itemHeight = iListBox->ItemHeight(); |
|
186 TInt itemsVisible = listboxRect.Height() / itemHeight; |
|
187 listBoxHeight = itemsVisible * itemHeight; |
|
188 |
|
189 // the scrollbar needs to be turned on |
|
190 visibility = CEikScrollBarFrame::EOn; |
|
191 } |
|
192 |
|
193 // calculate the layout for the listbox with changed height |
|
194 const AknLayoutUtils::SAknLayoutControl listboxLayout = |
|
195 { ELayoutEmpty, listboxRect.iTl.iX, listboxRect.iTl.iY, |
|
196 ELayoutEmpty, ELayoutEmpty, |
|
197 iListboxLayoutRect.Rect().Width(), listBoxHeight }; |
|
198 |
|
199 AknLayoutUtils::LayoutControl( iListBox, iLayoutAreaRect, listboxLayout); |
|
200 |
|
201 // set scrollbars for the listbox |
|
202 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
|
203 visibility ); |
|
204 iListBox->MakeVisible( ETrue ); |
|
205 iListBox->SetFocus( EFalse, ENoDrawNow ); |
|
206 iListBox->UpdateScrollBarsL(); |
|
207 iListBox->ScrollBarFrame()->DrawScrollBarsNow(); |
|
208 iListBox->SetListBoxObserver(this); |
|
209 appUi->SetActivePaletteVisibility( EFalse ); |
|
210 |
|
211 // Prevents the system filling invalidated areas with the background colour - |
|
212 // helps reduce flicker. |
|
213 Window().SetBackgroundColor(); |
|
214 |
|
215 ConstructContainerTitleFromResourceL( aTitleResource ); |
|
216 |
|
217 if ( !iTooltipController ) |
|
218 { |
|
219 iTooltipController = CAknInfoPopupNoteController::NewL(); |
|
220 } |
|
221 |
|
222 iTooltipController->SetTimeDelayBeforeShow( KInfoTooltipDelay ); |
|
223 iTooltipController->SetTimePopupInView( KInfoTooltipDisplayTime ); |
|
224 |
|
225 // Position the tooltip |
|
226 TPoint position; |
|
227 if ( AknsUtils::GetControlPosition( this, position ) != KErrNone ) |
|
228 { |
|
229 position = PositionRelativeToScreen(); |
|
230 } |
|
231 TRect rect( position, Size() ); |
|
232 TPoint center = rect.Center(); |
|
233 iTooltipController->SetPositionAndAlignment( TPoint( center.iX, rect.iTl.iY ), EHLeftVBottom ); |
|
234 |
|
235 iTooltipController->SetTimeDelayBeforeShow( KInfoTooltipDelay ); |
|
236 iTooltipController->SetTimePopupInView( KInfoTooltipDisplayTime ); |
|
237 |
|
238 iController.SetViewfinderWindowHandle( &Window() ); |
|
239 PRINT(_L("Camera <= CCamInfoListBoxContainer::ConstructL") ) |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // CCamInfoListBoxContainer::CCamInfoListBoxContainer |
|
244 // C++ constructor |
|
245 // --------------------------------------------------------------------------- |
|
246 // |
|
247 CCamInfoListBoxContainer::CCamInfoListBoxContainer( CCamAppController& aController, |
|
248 CAknView& aView, |
|
249 TInt aSettingValue, |
|
250 TBool aSkinnedBackGround ) |
|
251 : CCamContainerBase( aController, aView ), iSettingValue( aSettingValue ), |
|
252 iTooltipController(NULL), |
|
253 iShowTooltip(EFalse), |
|
254 iTooltipIndex(-1), |
|
255 iActivateOnTouchRelease(EFalse), |
|
256 iSkinnedBackGround(aSkinnedBackGround) |
|
257 |
|
258 { |
|
259 } |
|
260 |
|
261 |
|
262 // ----------------------------------------------------------------------------- |
|
263 // CCamInfoListBoxContainer::CurrentSettingItemValue |
|
264 // Returns the Current item's setting value ID |
|
265 // ----------------------------------------------------------------------------- |
|
266 TInt CCamInfoListBoxContainer::CurrentSettingItemValue() const |
|
267 { |
|
268 return static_cast<MCamListboxModel*>(iListBox->Model())->ItemValue(iListBox->CurrentItemIndex()); |
|
269 } |
|
270 |
|
271 |
|
272 TBool CCamInfoListBoxContainer::SettingValueChanged() const |
|
273 { |
|
274 return CurrentSettingItemValue() != iSettingValue; |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CCamInfoListBoxContainer::IndexForValueId() const |
|
279 // Returns the index of the item in the array with the specified ValueId |
|
280 // ----------------------------------------------------------------------------- |
|
281 TInt |
|
282 CCamInfoListBoxContainer::IndexForValueId( TInt aValueId ) const |
|
283 { |
|
284 return static_cast<MCamListboxModel*>( iListBox->Model() )->ValueIndex( aValueId ); |
|
285 } |
|
286 |
|
287 // ----------------------------------------------------------------------------- |
|
288 // CCamInfoListBoxContainer::HandleSettingValueUpdateL |
|
289 // Handles a change to the setting value of the slider |
|
290 // ----------------------------------------------------------------------------- |
|
291 // |
|
292 void CCamInfoListBoxContainer::HandleSettingValueUpdateL( TInt aNewValue ) |
|
293 { |
|
294 iController.PreviewSettingChangeL( ECamSettingItemDynamicPhotoLightSensitivity, aNewValue ); |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------- |
|
298 // CCamInfoListBoxContainer::CountComponentControls |
|
299 // Returns the number of controls owned |
|
300 // --------------------------------------------------------- |
|
301 // |
|
302 TInt CCamInfoListBoxContainer::CountComponentControls() const |
|
303 { |
|
304 return CCamContainerBase::CountComponentControls() + 1; |
|
305 } |
|
306 |
|
307 // --------------------------------------------------------- |
|
308 // CCamInfoListBoxContainer::ComponentControl |
|
309 // Returns the requested component control |
|
310 // --------------------------------------------------------- |
|
311 // |
|
312 CCoeControl* CCamInfoListBoxContainer::ComponentControl( TInt aIndex ) const |
|
313 { |
|
314 CCoeControl* control = CCamContainerBase::ComponentControl( aIndex ); |
|
315 if( control == NULL) |
|
316 { |
|
317 control = iListBox; |
|
318 } |
|
319 return control; |
|
320 } |
|
321 |
|
322 // --------------------------------------------------------- |
|
323 // CCamInfoListBoxContainer::Draw |
|
324 // Draw control |
|
325 // ---------------------------------------------------------- |
|
326 // |
|
327 void CCamInfoListBoxContainer::Draw( const TRect& aRect ) const |
|
328 { |
|
329 PRINT(_L("Camera => CCamInfoListBoxContainer::Draw") ) |
|
330 |
|
331 CWindowGc& gc = SystemGc(); |
|
332 if ( CamUtility::IsNhdDevice() ) |
|
333 { |
|
334 TRgb color; |
|
335 if( iSkinnedBackGround ) |
|
336 { |
|
337 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
338 AknsDrawUtils::Background( skin, iBgContext, gc, aRect ); |
|
339 // draw the title text |
|
340 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, |
|
341 EAknsCIQsnTextColorsCG6 ); |
|
342 } |
|
343 else |
|
344 { |
|
345 // Fill control with transparency bg colour |
|
346 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
347 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
348 color = TRgb( 0,0 ); |
|
349 gc.SetBrushColor( color ); |
|
350 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
351 gc.DrawRect( aRect ); |
|
352 gc.SetBrushColor( color ); |
|
353 gc.DrawRect( iTitleTextRectLayout.TextRect() ); |
|
354 // Reset the brush after use (otherwise anything drawn |
|
355 // after the viewfinder will also show viewfinder frames) |
|
356 |
|
357 gc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) ); |
|
358 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
359 gc.DrawRect( TRect( iLayoutAreaRect.iTl.iX, |
|
360 iLayoutAreaRect.iTl.iY, |
|
361 iLayoutAreaRect.iBr.iX, |
|
362 iTitleTextRectLayout.TextRect().iBr.iY ) ); |
|
363 |
|
364 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
365 |
|
366 |
|
367 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
368 appUi->StatusPane()->MakeVisible( EFalse ); |
|
369 |
|
370 color = TRgb( KRgbWhite ); |
|
371 } |
|
372 iTitleTextRectLayout.DrawText( gc, *iListboxTitle, ETrue, color ); |
|
373 } |
|
374 else |
|
375 { |
|
376 TRAP_IGNORE( DrawSummaryTextL( gc ) ); |
|
377 } |
|
378 |
|
379 PRINT(_L("Camera <= CCamInfoListBoxContainer::Draw") ) |
|
380 } |
|
381 |
|
382 // ---------------------------------------------------------------- |
|
383 // CCamInfoListBoxContainer::OfferKeyEventL |
|
384 // Handles this application view's command keys. Forwards other |
|
385 // keys to child control(s). |
|
386 // ---------------------------------------------------------------- |
|
387 // |
|
388 TKeyResponse CCamInfoListBoxContainer::OfferKeyEventL( |
|
389 const TKeyEvent& aKeyEvent, |
|
390 TEventCode aType ) |
|
391 { |
|
392 if( iController.CurrentMode() == ECamControllerIdle || |
|
393 iController.CurrentMode() == ECamControllerShutdown ) |
|
394 { |
|
395 if( !iController.IsViewFinding() && !iSkinnedBackGround |
|
396 && ( IsCaptureKeyL( aKeyEvent, aType ) |
|
397 || IsShutterKeyL( aKeyEvent, aType ) ) ) |
|
398 { |
|
399 PRINT( _L("Camera <> CCamInfoListBoxContainer::OfferKeyEventL coming back from standby" )) |
|
400 ReserveAndStartVF(); |
|
401 } |
|
402 return EKeyWasNotConsumed; |
|
403 } |
|
404 iController.StartIdleTimer(); |
|
405 |
|
406 // If the Ok button or shutter key is pressed, select the current item |
|
407 if ( ( aKeyEvent.iCode == EKeyOK && aKeyEvent.iRepeats == 0 && aType == EEventKey ) || |
|
408 ( aType == EEventKey && |
|
409 ( IsCaptureKeyL( aKeyEvent, aType ) || IsShutterKeyL( aKeyEvent, aType ) ) ) ) |
|
410 { |
|
411 TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
412 iView.HandleCommandL( EAknSoftkeySelect ); |
|
413 return response; |
|
414 } |
|
415 |
|
416 TKeyResponse returnvalue = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
417 |
|
418 if ( EStdKeyUpArrow == aKeyEvent.iScanCode || |
|
419 EStdKeyDownArrow == aKeyEvent.iScanCode ) |
|
420 { |
|
421 ShowTooltipL(); |
|
422 } |
|
423 else // No tooltip |
|
424 { |
|
425 DrawDeferred(); // Update explanation text |
|
426 } |
|
427 |
|
428 return returnvalue; |
|
429 } |
|
430 |
|
431 // ----------------------------------------------------------------- |
|
432 // CCamInfoListBoxContainer::ConstructSummaryDetailsFromResourceL |
|
433 // Sets up the layouts of the summary items |
|
434 // ----------------------------------------------------------------- |
|
435 void CCamInfoListBoxContainer::ConstructSummaryDetailsFromResourceL(TInt aResourceId) |
|
436 { |
|
437 // Find the name and path of the MBM file for bitmaps |
|
438 TFileName mbmFileName; |
|
439 CamUtility::ResourceFileName( mbmFileName ); |
|
440 |
|
441 TResourceReader reader; |
|
442 iEikonEnv->CreateResourceReaderLC( reader, aResourceId ); |
|
443 const TInt count = reader.ReadInt16(); |
|
444 |
|
445 TInt i; |
|
446 TInt bitmapId; |
|
447 |
|
448 // Read all of the summary entries from the resource file |
|
449 for ( i = 0; i < count; i++ ) |
|
450 { |
|
451 reader.ReadInt16(); // The current item enum is not needed |
|
452 bitmapId = reader.ReadInt32(); |
|
453 User::LeaveIfError( iSummaryBitmapArray.Append( AknIconUtils::CreateIconL( mbmFileName, bitmapId ) ) ); |
|
454 |
|
455 User::LeaveIfError( iTitleArray.Append( reader.ReadHBufC16L() ) ); |
|
456 User::LeaveIfError( iDescArray.Append( reader.ReadHBufC16L() ) ); |
|
457 } |
|
458 |
|
459 CleanupStack::PopAndDestroy(); |
|
460 } |
|
461 |
|
462 |
|
463 // -------------------------------------------------------------------------- |
|
464 // CCamInfoListBoxContainer::HandlePointerEventL |
|
465 // -------------------------------------------------------------------------- |
|
466 // |
|
467 void CCamInfoListBoxContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
468 { |
|
469 |
|
470 RDebug::Print(_L("CCamInfoListBoxContainer::HandlePointerEventL iType=%d iPosition=(%d, %d)"), |
|
471 aPointerEvent.iType, |
|
472 aPointerEvent.iPosition.iX, |
|
473 aPointerEvent.iPosition.iY ); |
|
474 |
|
475 if( !iController.IsViewFinding() && !iSkinnedBackGround ) |
|
476 { |
|
477 PRINT ( _L("Camera <> CCamInfoListBoxContainer::HandlePointerEventL start viewfinder") ); |
|
478 ReserveAndStartVF(); |
|
479 } |
|
480 else |
|
481 { |
|
482 PRINT ( _L("Camera <> CCamInfoListBoxContainer::HandlePointerEventL handle selected item") ); |
|
483 iListBox->HandlePointerEventL(aPointerEvent); |
|
484 } |
|
485 |
|
486 /*TInt oldListItemIndex = -1; |
|
487 TInt newListItemIndex = -1; |
|
488 TBool handleItemActivation = EFalse; |
|
489 |
|
490 if ( iListBox ) |
|
491 { |
|
492 oldListItemIndex = iListBox->CurrentItemIndex(); |
|
493 } |
|
494 |
|
495 // send to coecontrol -> will inform controls in this container about pointer events |
|
496 // (listbox will handle focus changes and scrolling) |
|
497 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
498 |
|
499 if ( iListBox ) |
|
500 { |
|
501 newListItemIndex = iListBox->CurrentItemIndex(); |
|
502 } |
|
503 |
|
504 // figure out if item was activated by touch down + release combination on same item |
|
505 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
506 { |
|
507 |
|
508 if ( iListBox->Rect().Contains( aPointerEvent.iPosition ) ) |
|
509 { |
|
510 if ( newListItemIndex != oldListItemIndex ) |
|
511 { |
|
512 iActivateOnTouchRelease = EFalse; |
|
513 } |
|
514 else |
|
515 { |
|
516 // set the current item to be activated on touch release |
|
517 iActivateOnTouchRelease = ETrue; |
|
518 } |
|
519 |
|
520 // show tooltip always when touch event down happens inside listbox |
|
521 ShowTooltipL(); |
|
522 } |
|
523 else |
|
524 { |
|
525 iActivateOnTouchRelease = EFalse; |
|
526 } |
|
527 |
|
528 |
|
529 } |
|
530 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
531 { |
|
532 if ( iActivateOnTouchRelease && ( newListItemIndex == oldListItemIndex ) ) |
|
533 { |
|
534 // only if list item index has not changed during event |
|
535 // and iActivateOnTouchRelease is true |
|
536 TInt pointedItemIndex = 0; |
|
537 TBool focusableItemPointed = |
|
538 iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, |
|
539 pointedItemIndex ); |
|
540 // check that pointer is in focusable area |
|
541 if ( focusableItemPointed ) |
|
542 { |
|
543 handleItemActivation = ETrue; |
|
544 iActivateOnTouchRelease = EFalse; |
|
545 } |
|
546 else |
|
547 { |
|
548 iActivateOnTouchRelease = EFalse; |
|
549 } |
|
550 } |
|
551 } |
|
552 else |
|
553 { |
|
554 // aPointerEvent.iType == TPointerEvent::EDrag |
|
555 |
|
556 if ( newListItemIndex != oldListItemIndex ) |
|
557 { |
|
558 // change only when drag event changes the listitem index |
|
559 iActivateOnTouchRelease = EFalse; |
|
560 |
|
561 // with drag always update the tooltip |
|
562 ShowTooltipL(); |
|
563 } |
|
564 |
|
565 } |
|
566 |
|
567 |
|
568 if ( handleItemActivation ) |
|
569 { |
|
570 iView.HandleCommandL( EAknSoftkeySelect ); |
|
571 }*/ |
|
572 } |
|
573 |
|
574 // -------------------------------------------------------------------------- |
|
575 // CCamInfoListBoxContainer::HandleListBoxEventL |
|
576 // Handles Listbox events |
|
577 // -------------------------------------------------------------------------- |
|
578 // |
|
579 |
|
580 void CCamInfoListBoxContainer::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ) |
|
581 { |
|
582 switch( aEventType ) |
|
583 { |
|
584 case EEventItemDoubleClicked: |
|
585 { |
|
586 iView.HandleCommandL( EAknSoftkeySelect ); |
|
587 } |
|
588 break; |
|
589 |
|
590 case EEventPenDownOnItem: |
|
591 { |
|
592 ShowTooltipL(); |
|
593 } |
|
594 break; |
|
595 |
|
596 case EEventItemClicked: |
|
597 case EEventItemSingleClicked: |
|
598 { |
|
599 TInt settingValue = CurrentSettingItemValue(); |
|
600 |
|
601 if ( iView.Id().iUid == ECamViewIdPhotoUserSceneSetup ) |
|
602 { |
|
603 iController.PreviewSettingChangeL( ECamSettingItemUserSceneLightSensitivity, settingValue ); |
|
604 } |
|
605 else |
|
606 { |
|
607 iController.PreviewSettingChangeL( ECamSettingItemDynamicPhotoLightSensitivity, settingValue ); |
|
608 } |
|
609 } |
|
610 break; |
|
611 default: |
|
612 break; |
|
613 } |
|
614 } |
|
615 |
|
616 // -------------------------------------------------------------------------- |
|
617 // CCamInfoListBoxContainer::ShowTooltipL |
|
618 // -------------------------------------------------------------------------- |
|
619 // |
|
620 void CCamInfoListBoxContainer::ShowTooltipL() |
|
621 { |
|
622 |
|
623 if ( !iTooltipController || ( iDescArray[iListBox->CurrentItemIndex()]->Length() <= 0 ) ) |
|
624 { |
|
625 return; |
|
626 } |
|
627 |
|
628 if ( iTooltipIndex != iListBox->CurrentItemIndex() ) |
|
629 { |
|
630 // make sure that possible already open tooltip is hidden |
|
631 iTooltipController->HideInfoPopupNote(); |
|
632 |
|
633 iTooltipController->SetTextL( *iDescArray[iListBox->CurrentItemIndex()] ); |
|
634 TRect hl = iListBox->HighlightRect(); |
|
635 TPoint tt = hl.Center(); |
|
636 if ( AknLayoutUtils::LayoutMirrored() ) |
|
637 { |
|
638 tt.iX -= hl.Width(); |
|
639 } |
|
640 iTooltipController->SetPositionAndAlignment( tt, EHLeftVBottom ); |
|
641 |
|
642 iTooltipIndex = iListBox->CurrentItemIndex(); |
|
643 } |
|
644 |
|
645 |
|
646 iTooltipController->ShowInfoPopupNote(); |
|
647 |
|
648 } |
|
649 |
|
650 |
|
651 // -------------------------------------------------------------------------- |
|
652 // CCamInfoListBoxContainer::ConstructContainerTitleFromResourceL |
|
653 // -------------------------------------------------------------------------- |
|
654 // |
|
655 void CCamInfoListBoxContainer::ConstructContainerTitleFromResourceL( TInt aResourceId ) |
|
656 { |
|
657 TResourceReader reader; |
|
658 iEikonEnv->CreateResourceReaderLC( reader, aResourceId ); // cleanupstack |
|
659 |
|
660 iListboxTitle = reader.ReadHBufC16L(); |
|
661 |
|
662 CleanupStack::PopAndDestroy(); // reader |
|
663 } |
|
664 |
|
665 |
|
666 // ----------------------------------------------------------------- |
|
667 // CCamInfoListBoxContainer::DrawSummaryText (ISO setting) |
|
668 // Draws summary title and description text |
|
669 // ----------------------------------------------------------------- |
|
670 |
|
671 void CCamInfoListBoxContainer::DrawSummaryTextL( CWindowGc& aGc ) const |
|
672 { |
|
673 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
674 appUi->SetTitleL( *iListboxTitle ); |
|
675 |
|
676 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
677 AknsDrawUtils::Background( skin, iBgContext, aGc, Rect() ); |
|
678 |
|
679 // Draw summary frame |
|
680 TRect explTxtRect = iExplanationRect; |
|
681 TInt border = iExplIconLayout.Rect().iTl.iX - iExplanationRect.iTl.iX; |
|
682 explTxtRect.Shrink( border/2 , border/2 ); |
|
683 AknsDrawUtils::DrawFrame( skin, aGc, iExplanationRect, explTxtRect, |
|
684 KAknsIIDQsnFrInput, KAknsIIDNone ); //frame |
|
685 |
|
686 AknIconUtils::SetSize( iSummaryBitmapArray[iListBox->CurrentItemIndex()], |
|
687 iExplIconLayout.Rect().Size() ); |
|
688 iExplIconLayout.DrawImage( aGc, |
|
689 iSummaryBitmapArray[ iListBox->CurrentItemIndex() ], NULL ); |
|
690 |
|
691 TRgb explTitleTxtColor; // same as list highlight text |
|
692 TRgb explTxtColor; // same as main area text |
|
693 AknsUtils::GetCachedColor( skin, explTitleTxtColor, KAknsIIDQsnTextColors, |
|
694 EAknsCIQsnTextColorsCG10 ); |
|
695 AknsUtils::GetCachedColor( skin, explTxtColor, KAknsIIDQsnTextColors, |
|
696 EAknsCIQsnTextColorsCG6 ); |
|
697 iExplTitleLayout.DrawText( aGc, |
|
698 iTitleArray[ iListBox->CurrentItemIndex() ]->Des(), |
|
699 ETrue, explTitleTxtColor ); |
|
700 AknTextUtils::WrapToArrayL( *iDescArray[iListBox->CurrentItemIndex()], |
|
701 iExplTxtLinesLayout[0].TextRect().Width(), |
|
702 *iExplTxtLinesLayout[0].Font(), |
|
703 *iCurrentDescLineArray ); |
|
704 TInt lCount = Min( iExplLineCount, iCurrentDescLineArray->Count() ); |
|
705 for ( TInt i = 0; i < lCount; i++ ) |
|
706 { |
|
707 iExplTxtLinesLayout[i].DrawText( aGc, (*iCurrentDescLineArray)[i], |
|
708 ETrue, explTxtColor ); |
|
709 } |
|
710 } |
|
711 |
|
712 // -------------------------------------------------------------------------- |
|
713 // CCamInfoListBoxContainer::TouchLayout |
|
714 // -------------------------------------------------------------------------- |
|
715 // |
|
716 TRect CCamInfoListBoxContainer::TouchLayout() |
|
717 { |
|
718 TRect statusPaneRect; |
|
719 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
720 statusPaneRect ); |
|
721 iLayoutAreaRect.BoundingRect( statusPaneRect ); |
|
722 // get the rect size for listbox in the layout |
|
723 TAknLayoutRect wholeListboxLayoutRect; |
|
724 wholeListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
725 AknLayoutScalable_Apps::main_cset_listscroll_pane( 3 ) ); |
|
726 TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
727 iListBox->Model()->NumberOfItems() ); |
|
728 // get layout for the listbox rect |
|
729 if ( wholeListboxLayoutRect.Rect().Height() < listBoxHeight ) |
|
730 { |
|
731 // if scrollbars are used, use scrollbar layout |
|
732 iListboxLayoutRect.LayoutRect( wholeListboxLayoutRect.Rect(), |
|
733 AknLayoutScalable_Apps::main_cset_list_pane( 0 ) ); |
|
734 } |
|
735 else |
|
736 { |
|
737 iListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
738 AknLayoutScalable_Apps::main_cset_listscroll_pane( 2 ) ); //Same as WB |
|
739 } |
|
740 |
|
741 iTitleTextRectLayout.LayoutText( iLayoutAreaRect, |
|
742 AknLayoutScalable_Apps::main_cam_set_pane_t1( 3 ) ); |
|
743 |
|
744 return iListboxLayoutRect.Rect(); |
|
745 } |
|
746 |
|
747 // -------------------------------------------------------------------------- |
|
748 // CCamInfoListBoxContainer::NonTouchLayout |
|
749 // -------------------------------------------------------------------------- |
|
750 // |
|
751 TRect CCamInfoListBoxContainer::NonTouchLayout() |
|
752 { |
|
753 TAknLayoutRect wholeListboxLayoutRect; |
|
754 wholeListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
755 AknLayoutScalable_Apps::main_cset6_listscroll_pane( 3 ) ); |
|
756 TAknLayoutRect listLayoutRect; |
|
757 listLayoutRect.LayoutRect( iLayoutAreaRect, //1 |
|
758 AknLayoutScalable_Apps::main_cset6_listscroll_pane( 4 ) ); |
|
759 TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
760 iListBox->Model()->NumberOfItems() ); |
|
761 if ( wholeListboxLayoutRect.Rect().Height() < listBoxHeight ) |
|
762 { |
|
763 // if scrollbars are used, use scrollbar layout |
|
764 iListboxLayoutRect.LayoutRect( listLayoutRect.Rect(), |
|
765 AknLayoutScalable_Apps::main_cset_list_pane_copy1( 0 ) ); |
|
766 AknLayoutUtils::LayoutVerticalScrollBar( iListBox->ScrollBarFrame(), |
|
767 listLayoutRect.Rect(), |
|
768 AknLayoutScalable_Apps::scroll_pane_cp028_copy1( 0 ) ); |
|
769 } |
|
770 else |
|
771 { |
|
772 iListboxLayoutRect.LayoutRect( listLayoutRect.Rect(), |
|
773 AknLayoutScalable_Apps::main_cset_list_pane_copy1( 1 ) ); |
|
774 } |
|
775 |
|
776 // Explanation ikon, title, and text layout |
|
777 TAknLayoutRect explParent; |
|
778 explParent.LayoutRect( iLayoutAreaRect,//2 |
|
779 AknLayoutScalable_Apps::main_cset6_text2_pane( 0 ) ); |
|
780 TAknLayoutRect explLayoutRect; |
|
781 explLayoutRect.LayoutRect( explParent.Rect(), |
|
782 AknLayoutScalable_Apps::bg_popup_preview_window_pane_cp03( 0 ) ); |
|
783 iExplanationRect = explLayoutRect.Rect(); |
|
784 |
|
785 TRect statusPaneRect; |
|
786 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
787 statusPaneRect ); |
|
788 iExplanationRect.Move( 0, -statusPaneRect.Height() ); |
|
789 |
|
790 iExplIconLayout.LayoutRect( iExplanationRect, |
|
791 AknLayoutScalable_Apps::main_cset6_text2_pane_g1( 0 ) ); |
|
792 iExplTitleLayout.LayoutText( iExplanationRect, |
|
793 AknLayoutScalable_Apps::main_cset6_text2_pane_t1( 0 ) ); |
|
794 iExplTitleLayout.LayoutText( iExplanationRect, |
|
795 AknLayoutScalable_Apps::main_cset6_text2_pane_t1( 0 ) ); |
|
796 |
|
797 TAknLayoutRect explTxtParent; |
|
798 explTxtParent.LayoutRect( iExplanationRect, |
|
799 AknLayoutScalable_Apps::list_cset_text2_pane(0) ); |
|
800 TAknLayoutScalableParameterLimits listLimits = |
|
801 AknLayoutScalable_Apps::list_cset_text2_pane_t1_ParamLimits( 0 ); |
|
802 iExplLineCount = listLimits.LastRow() + 1; |
|
803 for ( TInt i = 0; i < iExplLineCount; i++ ) |
|
804 { |
|
805 TAknLayoutText layoutText; |
|
806 layoutText.LayoutText( explTxtParent.Rect(), |
|
807 AknLayoutScalable_Apps::list_cset_text2_pane_t1( 0, 0, i ) ); |
|
808 (void) iExplTxtLinesLayout.Append( layoutText ); // Errors are ignored |
|
809 } |
|
810 |
|
811 TRect ret = wholeListboxLayoutRect.Rect(); |
|
812 // Non-touch has a visible title & status panes |
|
813 TRect titlePaneRect; |
|
814 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, |
|
815 titlePaneRect ); |
|
816 ret.Move( 0, -titlePaneRect.Height() - statusPaneRect.Height() ); |
|
817 return ret; |
|
818 } |
|
819 // End of File |
|