157 } |
157 } |
158 |
158 |
159 /** |
159 /** |
160 * Inserts a new Item. |
160 * Inserts a new Item. |
161 */ |
161 */ |
162 void CMIDForm::InsertItemL(MMIDItem& aItem, TInt aIndex) |
162 void CMIDForm::InsertItemL(MMIDItem& aItem,TInt aIndex) |
163 { |
163 { |
164 DEBUG("CMIDForm::InsertItemL"); |
164 DEBUG("CMIDForm::InsertItemL"); |
165 |
165 |
166 User::LeaveIfError(iItems.Insert(&aItem,aIndex)); |
166 User::LeaveIfError(iItems.Insert(&aItem,aIndex)); |
167 CMIDControlItem& ci = ControlItem(aIndex); |
167 CMIDControlItem& ci = ControlItem(aIndex); |
223 CMIDControlItem& ci = ControlItem(aIndex); |
223 CMIDControlItem& ci = ControlItem(aIndex); |
224 RemoveItemFromForm(ci); |
224 RemoveItemFromForm(ci); |
225 if (&ci == iPointedControl) |
225 if (&ci == iPointedControl) |
226 { |
226 { |
227 iPointedControl = NULL; |
227 iPointedControl = NULL; |
|
228 iLastPointedControl = KErrNotFound; |
228 } |
229 } |
229 |
230 |
230 iItems.Remove(aIndex); |
231 iItems.Remove(aIndex); |
231 |
232 |
232 if (iFocused != KErrNotFound && updateFocused) |
233 if (iFocused != KErrNotFound && updateFocused) |
336 if (iFocused != KErrNotFound) |
339 if (iFocused != KErrNotFound) |
337 { |
340 { |
338 CMIDControlItem& controlItem = ControlItem(iFocused); |
341 CMIDControlItem& controlItem = ControlItem(iFocused); |
339 TRect controlRect = GetControlRect(iFocused); |
342 TRect controlRect = GetControlRect(iFocused); |
340 TBool visible = RectPartiallyVisible(controlRect); |
343 TBool visible = RectPartiallyVisible(controlRect); |
341 |
|
342 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
343 TInt numItemCommands = controlItem.CommandList()->Count(); |
|
344 |
|
345 // If focused form item does not have any commands, |
|
346 // and select key was pressed try to show screen\help option menu. |
|
347 // ChoiceGroup and DateField handles this case separately. |
|
348 // Gauge enter key is also handled here, |
|
349 // so it would behave the same way as selection key. |
|
350 if (numItemCommands == 0 && aType == EEventKey && |
|
351 controlItem.Type() != MMIDComponent::EChoiceGroup && |
|
352 controlItem.Type() != MMIDComponent::EDateField && |
|
353 (aKeyEvent.iScanCode == EStdKeyDevice3 || |
|
354 (aKeyEvent.iScanCode == EStdKeyEnter && |
|
355 controlItem.Type() == MMIDComponent::EGauge))) |
|
356 { |
|
357 iDisplayable.ShowScreenOrHelpOptionsMenuL(); |
|
358 } |
|
359 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
360 |
344 |
361 // arrow key events are not sent to the hidden focused item |
345 // arrow key events are not sent to the hidden focused item |
362 if ((visible || !isArrowKey) && |
346 if ((visible || !isArrowKey) && |
363 controlItem.OfferKeyEventL(aKeyEvent,aType) == EKeyWasConsumed) |
347 controlItem.OfferKeyEventL(aKeyEvent,aType) == EKeyWasConsumed) |
364 { |
348 { |
637 |
621 |
638 iCanDragFocus = EFalse; |
622 iCanDragFocus = EFalse; |
639 iFocusChangingWithPen = EFalse; |
623 iFocusChangingWithPen = EFalse; |
640 iScrollOnPointerDown = EFalse; |
624 iScrollOnPointerDown = EFalse; |
641 iIndexPointedControl = -1; |
625 iIndexPointedControl = -1; |
|
626 iLastPointedControl = KErrNotFound; |
642 |
627 |
643 break; |
628 break; |
644 } |
629 } |
645 |
630 |
646 case TPointerEvent::EDrag: |
631 case TPointerEvent::EDrag: |
2002 { // actions for the item loosing focus |
1987 { // actions for the item loosing focus |
2003 CMIDControlItem& control = ControlItem(iFocused); |
1988 CMIDControlItem& control = ControlItem(iFocused); |
2004 control.PostFocusTransferEvent(EFalse, aDirection); |
1989 control.PostFocusTransferEvent(EFalse, aDirection); |
2005 // setting highlight must be called before setting focus |
1990 // setting highlight must be called before setting focus |
2006 control.SetHighlight(EFalse); |
1991 control.SetHighlight(EFalse); |
2007 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
2008 if (IsChoiceGroup(control)) |
|
2009 { |
|
2010 CMIDChoiceGroupItem& cg = static_cast< CMIDChoiceGroupItem& >(control); |
|
2011 cg.SetHighlight(EFalse); |
|
2012 } |
|
2013 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
2014 control.SetFocus(EFalse); |
1992 control.SetFocus(EFalse); |
2015 UpdateItemCommands(NULL, NULL); |
1993 UpdateItemCommands(NULL, NULL); |
2016 } |
1994 } |
2017 |
1995 |
2018 iFocused = aFocusIdx; |
1996 iFocused = aFocusIdx; |
2037 } |
2015 } |
2038 |
2016 |
2039 if (iFocused != KErrNotFound) |
2017 if (iFocused != KErrNotFound) |
2040 { // actions for the item gaining focus |
2018 { // actions for the item gaining focus |
2041 CMIDControlItem& control = ControlItem(iFocused); |
2019 CMIDControlItem& control = ControlItem(iFocused); |
|
2020 |
2042 SetHighlightBackgroundRects(); |
2021 SetHighlightBackgroundRects(); |
|
2022 |
2043 control.PostFocusTransferEvent(ETrue, aDirection); |
2023 control.PostFocusTransferEvent(ETrue, aDirection); |
2044 control.SetHighlight(ETrue); |
2024 control.SetHighlight(ETrue); |
2045 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
2046 if (IsChoiceGroup(control)) |
|
2047 { |
|
2048 CMIDChoiceGroupItem& cg = static_cast< CMIDChoiceGroupItem& >(control); |
|
2049 cg.SetHighlight(ETrue); |
|
2050 } |
|
2051 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
2052 control.SetFocus(ETrue); |
2025 control.SetFocus(ETrue); |
2053 // msk: deliver also the possible MSK command to displayable |
2026 // msk: deliver also the possible MSK command to displayable |
2054 UpdateItemCommands(control.CommandList(), control.GetMSKCommand()); |
2027 UpdateItemCommands(control.CommandList(), control.GetMSKCommand()); |
2055 } |
2028 } |
2056 } |
2029 } |
2344 KAknsIIDQsnBgAreaMainListGene, Rect(), ETrue, |
2317 KAknsIIDQsnBgAreaMainListGene, Rect(), ETrue, |
2345 KAknsIIDQsnBgColumnAB, Rect()) ; // Rect parameters are only place-holders |
2318 KAknsIIDQsnBgColumnAB, Rect()) ; // Rect parameters are only place-holders |
2346 |
2319 |
2347 // Background for highlighted item, frame rects are set later |
2320 // Background for highlighted item, frame rects are set later |
2348 iHighlightedBackgroundCc = CAknsFrameBackgroundControlContext::NewL( |
2321 iHighlightedBackgroundCc = CAknsFrameBackgroundControlContext::NewL( |
|
2322 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
2323 KAknsIIDQsnFrPopupPreview, |
|
2324 #else |
2349 KAknsIIDQsnFrInput, |
2325 KAknsIIDQsnFrInput, |
|
2326 #endif // RD_JAVA_S60_RELEASE_9_2 |
2350 TRect(), TRect(), ETrue); |
2327 TRect(), TRect(), ETrue); |
2351 |
2328 |
2352 iDisplayable.SetComponentL(*this); |
2329 iDisplayable.SetComponentL(*this); |
2353 |
2330 |
2354 // get the layout from shared data so we can tell what our |
2331 // get the layout from shared data so we can tell what our |
3182 void CMIDForm::InsertContainerItemsL(CMIDStringItem& aStringItem, |
3159 void CMIDForm::InsertContainerItemsL(CMIDStringItem& aStringItem, |
3183 CMIDItemLabel& aTextControl, TBool aIsStringItemContent) |
3160 CMIDItemLabel& aTextControl, TBool aIsStringItemContent) |
3184 { |
3161 { |
3185 TInt numLines = aTextControl.NumLines(); |
3162 TInt numLines = aTextControl.NumLines(); |
3186 for (TInt j = 0; j < numLines; j++) |
3163 for (TInt j = 0; j < numLines; j++) |
3187 { |
3164 { // insert every line as a CMIDLabelContainerItem |
3188 CEikLabel* label = aTextControl.LabelAtIdx(j); |
3165 CreateAndAddLabelContainerItemL( |
3189 |
3166 aStringItem, *(aTextControl.LabelAtIdx(j)), aIsStringItemContent); |
3190 if (label) |
|
3191 { |
|
3192 CGraphicsContext::TTextAlign align = aTextControl.LabelAtIdx(j)->iAlignment.TextAlign(); |
|
3193 |
|
3194 // If aLabel aligment is incorrect relayout aLabel |
|
3195 if ((align != CGraphicsContext::ERight && |
|
3196 iInitialAlignment == MMIDItem::ERight) || |
|
3197 (align != CGraphicsContext::ELeft && |
|
3198 iInitialAlignment == MMIDItem::ELeft) || |
|
3199 (align != CGraphicsContext::ECenter && |
|
3200 iInitialAlignment == MMIDItem::ECenter)) |
|
3201 { |
|
3202 aTextControl.LayoutItemLabel(); |
|
3203 } |
|
3204 |
|
3205 // insert every line as a CMIDLabelContainerItem |
|
3206 CreateAndAddLabelContainerItemL( |
|
3207 aStringItem, *(label), aIsStringItemContent); |
|
3208 } |
|
3209 |
3167 |
3210 if (j != (numLines-1)) |
3168 if (j != (numLines-1)) |
3211 { // insert a row break except for the last line |
3169 { // insert a row break except for the last line |
3212 CreateNewRowAndSetAsCurrentL(); |
3170 CreateNewRowAndSetAsCurrentL(); |
3213 } |
3171 } |
3394 |
3352 |
3395 // Restore pointed control |
3353 // Restore pointed control |
3396 if (iLastPointedControl != KErrNotFound) |
3354 if (iLastPointedControl != KErrNotFound) |
3397 { |
3355 { |
3398 iPointedControl = &ControlItem(iLastPointedControl); |
3356 iPointedControl = &ControlItem(iLastPointedControl); |
|
3357 iLastPointedControl = KErrNotFound; |
3399 } |
3358 } |
3400 } |
3359 } |
3401 |
3360 |
3402 /** Return true if the item is an unconstrained string item, false otherwise */ |
3361 /** Return true if the item is an unconstrained string item, false otherwise */ |
3403 TBool CMIDForm::ItemIsUnconstrained(TInt aIndex) const |
3362 TBool CMIDForm::ItemIsUnconstrained(TInt aIndex) const |
3580 return EFalse; |
3539 return EFalse; |
3581 } |
3540 } |
3582 return (aControlItem.iMMidItem->Type() == MMIDComponent::EGauge); |
3541 return (aControlItem.iMMidItem->Type() == MMIDComponent::EGauge); |
3583 } |
3542 } |
3584 |
3543 |
|
3544 TBool CMIDForm::IsInteractiveGaugeItem(CMIDControlItem& aControlItem) |
|
3545 { |
|
3546 if (IsGaugeItem(aControlItem)) |
|
3547 { |
|
3548 CMIDGaugeItem* gauge = static_cast<CMIDGaugeItem*>(&aControlItem); |
|
3549 if (gauge) |
|
3550 { |
|
3551 return gauge->IsInteractive(); |
|
3552 } |
|
3553 } |
|
3554 return EFalse; |
|
3555 } |
|
3556 |
3585 TBool CMIDForm::IsTextFieldItem(CMIDControlItem& aControlItem) |
3557 TBool CMIDForm::IsTextFieldItem(CMIDControlItem& aControlItem) |
3586 { |
3558 { |
3587 if (!aControlItem.iMMidItem) |
3559 if (!aControlItem.iMMidItem) |
3588 { |
3560 { |
3589 return EFalse; |
3561 return EFalse; |
3596 if (!aControlItem.iMMidItem) |
3568 if (!aControlItem.iMMidItem) |
3597 { |
3569 { |
3598 return EFalse; |
3570 return EFalse; |
3599 } |
3571 } |
3600 return (aControlItem.iMMidItem->Type() == MMIDComponent::EChoiceGroup); |
3572 return (aControlItem.iMMidItem->Type() == MMIDComponent::EChoiceGroup); |
3601 } |
|
3602 |
|
3603 TBool CMIDForm::IsPopupChoiceGroup(CMIDControlItem& aControlItem) |
|
3604 { |
|
3605 if (aControlItem.iMMidItem |
|
3606 && aControlItem.iMMidItem->Type() == MMIDComponent::EChoiceGroup) |
|
3607 { |
|
3608 CMIDChoiceGroupItem& cgItem = static_cast<CMIDChoiceGroupItem&>(aControlItem); |
|
3609 CMIDChoiceGroupControl* cgControl = |
|
3610 static_cast<CMIDChoiceGroupControl*>(cgItem.ComponentControl(1)); |
|
3611 if (cgControl && cgControl->ChoiceType() == MMIDChoiceGroup::EPopup) |
|
3612 { |
|
3613 return ETrue; |
|
3614 } |
|
3615 } |
|
3616 return EFalse; |
|
3617 } |
3573 } |
3618 |
3574 |
3619 TBool CMIDForm::IsDateField(CMIDControlItem& aControlItem) |
3575 TBool CMIDForm::IsDateField(CMIDControlItem& aControlItem) |
3620 { |
3576 { |
3621 if (!aControlItem.iMMidItem) |
3577 if (!aControlItem.iMMidItem) |
3665 { |
3621 { |
3666 CMIDChoiceGroupItem* cgItem = static_cast<CMIDChoiceGroupItem*>(&item); |
3622 CMIDChoiceGroupItem* cgItem = static_cast<CMIDChoiceGroupItem*>(&item); |
3667 cgItem->PostPendingUpEventL(); |
3623 cgItem->PostPendingUpEventL(); |
3668 } |
3624 } |
3669 } |
3625 } |
3670 } |
|
3671 |
|
3672 TInt CMIDForm::FormRowIndex(CMIDFormRow* aRow) |
|
3673 { |
|
3674 return iRows.Find(aRow); |
|
3675 } |
|
3676 |
|
3677 CMIDFormRow* CMIDForm::FormRow(TInt aIndex) |
|
3678 { |
|
3679 if (iRows.Count() > aIndex) |
|
3680 { |
|
3681 return iRows[aIndex]; |
|
3682 } |
|
3683 return NULL; |
|
3684 } |
3626 } |
3685 #endif // RD_JAVA_S60_RELEASE_9_2 |
3627 #endif // RD_JAVA_S60_RELEASE_9_2 |
3686 |
3628 |
3687 // returns: The number of new lines before an item. |
3629 // returns: The number of new lines before an item. |
3688 // This only takes into account new lines that come from |
3630 // This only takes into account new lines that come from |
3747 // To avoid any problems with using iPointedControl, which |
3689 // To avoid any problems with using iPointedControl, which |
3748 // could points to invalid object (e.g. used in |
3690 // could points to invalid object (e.g. used in |
3749 // CMIDForm::HandleHighlightTimer or |
3691 // CMIDForm::HandleHighlightTimer or |
3750 // in CMIDForm::HandlePhysicsPointerEventL), |
3692 // in CMIDForm::HandlePhysicsPointerEventL), |
3751 // iPointedControl must be set to NULL. |
3693 // iPointedControl must be set to NULL. |
3752 if (iPointedControl) |
3694 if (iPointedControl && !iUpEventSent) |
3753 { |
3695 { |
3754 // Store the index to last poited control. It will |
3696 // Store the index to last poited control. It will |
3755 // be restored after item are placed to new rows |
3697 // be restored after item are placed to new rows |
3756 // (see CMIDForm::AssignItemsToRowsL). |
3698 // (see CMIDForm::AssignItemsToRowsL). |
3757 iLastPointedControl = ItemIndex(*iPointedControl); |
3699 iLastPointedControl = ItemIndex(*iPointedControl); |
4057 return iPopupController; |
3999 return iPopupController; |
4058 } |
4000 } |
4059 |
4001 |
4060 TInt CMIDForm::GetMidpNaviPos() |
4002 TInt CMIDForm::GetMidpNaviPos() |
4061 { |
4003 { |
|
4004 // get main pane size from CEikAppU |
|
4005 TRect mainPane = iAvkonAppUi->ApplicationRect(); |
|
4006 |
|
4007 // get screen size in pixels |
4062 TAknLayoutRect mainMidpPane; |
4008 TAknLayoutRect mainMidpPane; |
4063 |
|
4064 // get main pane size from Avkon (size in pixels) |
|
4065 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
4066 TRect mainPane; |
|
4067 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPane); |
|
4068 mainMidpPane.LayoutRect(mainPane, |
|
4069 AknLayoutScalable_Avkon::main_midp_pane().LayoutLine()); |
|
4070 #else |
|
4071 mainMidpPane.LayoutRect(iEikonEnv->ScreenDevice()->SizeInPixels(), |
4009 mainMidpPane.LayoutRect(iEikonEnv->ScreenDevice()->SizeInPixels(), |
4072 AknLayoutScalable_Avkon::main_midp_pane().LayoutLine()); |
4010 AknLayoutScalable_Avkon::main_midp_pane().LayoutLine()); |
4073 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
4074 |
4011 |
4075 // getting form size depends on screen orientation |
4012 // getting form size depends on screen orientation |
4076 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
4013 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
4077 iMidpFormRect.LayoutRect(mainMidpPane.Rect(), |
4014 iMidpFormRect.LayoutRect(mainMidpPane.Rect(), |
4078 AknLayoutScalable_Avkon::midp_form_pane(variety).LayoutLine()); |
4015 AknLayoutScalable_Avkon::midp_form_pane(variety).LayoutLine()); |
4225 iPreventPhysicsScrolling = EFalse; |
4162 iPreventPhysicsScrolling = EFalse; |
4226 iFlickStoppedOnDownEvent = iFlickOngoing; |
4163 iFlickStoppedOnDownEvent = iFlickOngoing; |
4227 iFeedbackExecutedInPointerDown = EFalse; |
4164 iFeedbackExecutedInPointerDown = EFalse; |
4228 iPhysics->Stop(); |
4165 iPhysics->Stop(); |
4229 CMIDControlItem* ci = ControlItemAtPoint(aPointerEvent.iPosition); |
4166 CMIDControlItem* ci = ControlItemAtPoint(aPointerEvent.iPosition); |
|
4167 |
|
4168 if (ci && IsInteractiveGaugeItem(*ci)) |
|
4169 { |
|
4170 CMIDGaugeItem* gauge = static_cast<CMIDGaugeItem*>(ci); |
|
4171 this->iLastGaugeValue = gauge->GetValue(); |
|
4172 } |
4230 |
4173 |
4231 // Physics scrolling was not ongoing and tap hit already selected item. |
4174 // Physics scrolling was not ongoing and tap hit already selected item. |
4232 // Then forward pointer event to the item. |
4175 // Then forward pointer event to the item. |
4233 if (ci && IsCurrentItem((CMIDItem*)ci) && !iFlickStoppedOnDownEvent) |
4176 if (ci && IsCurrentItem((CMIDItem*)ci) && !iFlickStoppedOnDownEvent) |
4234 { |
4177 { |
4261 iHighlightTimer->Cancel(); |
4204 iHighlightTimer->Cancel(); |
4262 // Start highlight timer if some any control is tapped. |
4205 // Start highlight timer if some any control is tapped. |
4263 if (iPointedControl) |
4206 if (iPointedControl) |
4264 { |
4207 { |
4265 TInt highlightTimeout = iPhysics->HighlightDelay() * 1000; |
4208 TInt highlightTimeout = iPhysics->HighlightDelay() * 1000; |
4266 if (IsPopupChoiceGroup(*iPointedControl)) |
|
4267 { |
|
4268 highlightTimeout /= 2; |
|
4269 } |
|
4270 iHighlightTimer->Start(TTimeIntervalMicroSeconds32(highlightTimeout), |
4209 iHighlightTimer->Start(TTimeIntervalMicroSeconds32(highlightTimeout), |
4271 TTimeIntervalMicroSeconds32(highlightTimeout), |
4210 TTimeIntervalMicroSeconds32(highlightTimeout), |
4272 TCallBack(HighlightTimerCallback, this)); |
4211 TCallBack(HighlightTimerCallback, this)); |
4273 } |
4212 } |
4274 } |
4213 } |
4289 iDisplayable.TryDetectLongTapL(aPointerEvent); |
4228 iDisplayable.TryDetectLongTapL(aPointerEvent); |
4290 |
4229 |
4291 // Override triggering of physicsScrolling in case of doing text painting in TextField-item |
4230 // Override triggering of physicsScrolling in case of doing text painting in TextField-item |
4292 // or moving slider in Gauge-item. |
4231 // or moving slider in Gauge-item. |
4293 if (!iPreventPhysicsScrolling && iPointedControl && iPointedControl->iMMidItem && |
4232 if (!iPreventPhysicsScrolling && iPointedControl && iPointedControl->iMMidItem && |
4294 iPointedControl->iMMidItem->Type() == MMIDComponent::ETextField) |
4233 (iPointedControl->iMMidItem->Type() == MMIDComponent::ETextField || |
|
4234 IsInteractiveGaugeItem(*iPointedControl))) |
4295 { |
4235 { |
4296 // If physics scrolling is not ongoing (abs(dragY) < DragTreshold) |
4236 // If physics scrolling is not ongoing (abs(dragY) < DragTreshold) |
4297 // then stop flicking and forward event to the item (iPreventPhysicsScrolling = ETrue). |
4237 // then stop flicking and forward event to the item (iPreventPhysicsScrolling = ETrue). |
4298 if ((Abs(dragX) > iPhysics->DragThreshold()) && (Abs(dragY) < iPhysics->DragThreshold() |
4238 if ((Abs(dragX) > iPhysics->DragThreshold()) && (Abs(dragY) < iPhysics->DragThreshold() |
4299 && !iPanningOngoing)) |
4239 && !iPanningOngoing)) |
4314 if ((iFocused != KErrNotFound) |
4254 if ((iFocused != KErrNotFound) |
4315 && IsTextFieldItem(ControlItem(iFocused))) |
4255 && IsTextFieldItem(ControlItem(iFocused))) |
4316 { |
4256 { |
4317 ControlItem(iFocused).HandlePointerEventL(aPointerEvent); |
4257 ControlItem(iFocused).HandlePointerEventL(aPointerEvent); |
4318 } |
4258 } |
|
4259 if (iPointedControl && IsInteractiveGaugeItem(*iPointedControl)) |
|
4260 { |
|
4261 CMIDGaugeItem* gauge = static_cast<CMIDGaugeItem*>(iPointedControl); |
|
4262 |
|
4263 // If panning is started here (i.e. dragging of slider |
|
4264 // didn't exceed the horizontal threshold), reset |
|
4265 // gauge value to original value (from pointer down). |
|
4266 // To ensure that slider updates its visual appearance |
|
4267 // (i.e. thumb will be displayed as released), |
|
4268 // lets send dummy event with original position. |
|
4269 TPointerEvent newEvent; |
|
4270 newEvent.iType = TPointerEvent::EButton1Up; |
|
4271 newEvent.iPosition = iStartPosition; |
|
4272 ForwardPointerEventToItemL(newEvent); |
|
4273 |
|
4274 // reset value |
|
4275 gauge->SetValueL(iLastGaugeValue); |
|
4276 |
|
4277 // post event to ensure that item state listener is notified |
|
4278 // about change |
|
4279 iEnv->PostJavaEvent(*this, EDisplayable, Index(iPointedControl)); |
|
4280 } |
4319 } |
4281 } |
4320 // If panning is already ongoing. Update panning position. Also we redraw entire Form |
4282 // If panning is already ongoing. Update panning position. Also we redraw entire Form |
4321 // to prevent unexpected behavior(artifacts on the screen) during flick scrolling and |
4283 // to prevent unexpected behavior(artifacts on the screen) during flick scrolling and |
4322 // to make scrolling smoother. |
4284 // to make scrolling smoother. |
4323 else if (iPanningOngoing) |
4285 else if (iPanningOngoing) |
4372 |
4334 |
4373 // If physics scrolling is not ongoing then only |
4335 // If physics scrolling is not ongoing then only |
4374 // forward event to the item. |
4336 // forward event to the item. |
4375 if (!iUpEventSent) |
4337 if (!iUpEventSent) |
4376 { |
4338 { |
4377 ForwardPointerEventToItemL(aPointerEvent); |
4339 if (iPointedControl && IsInteractiveGaugeItem(*iPointedControl)) |
|
4340 { |
|
4341 // In case that pointed control is GaugeItem and |
|
4342 // pointer up happened outside of its bound, |
|
4343 // reset gauge value to original value (from pointer down). |
|
4344 CMIDGaugeItem* gauge = static_cast<CMIDGaugeItem*>(iPointedControl); |
|
4345 if (!gauge->Rect().Contains(aPointerEvent.iPosition)) |
|
4346 { |
|
4347 // To ensure that slider updates its visual appearance |
|
4348 // (i.e. thumb will be displayed as released), |
|
4349 // lets send dummy event with original position. |
|
4350 TPointerEvent newEvent; |
|
4351 newEvent.iType = TPointerEvent::EButton1Up; |
|
4352 newEvent.iPosition = iStartPosition; |
|
4353 ForwardPointerEventToItemL(newEvent); |
|
4354 |
|
4355 // reset value |
|
4356 gauge->SetValueL(iLastGaugeValue); |
|
4357 |
|
4358 // post event to ensure that item state listener is notified |
|
4359 // about change |
|
4360 iEnv->PostJavaEvent(*this, EDisplayable, Index(iPointedControl)); |
|
4361 } |
|
4362 else |
|
4363 { |
|
4364 // Pointer up happened inside of GaugeItem, |
|
4365 // forward pointer event to item. |
|
4366 ForwardPointerEventToItemL(aPointerEvent); |
|
4367 } |
|
4368 } |
|
4369 else |
|
4370 { |
|
4371 ForwardPointerEventToItemL(aPointerEvent); |
|
4372 } |
4378 iUpEventSent = ETrue; |
4373 iUpEventSent = ETrue; |
4379 } |
4374 } |
4380 |
4375 |
4381 iPanningOngoing = EFalse; |
4376 iPanningOngoing = EFalse; |
4382 iCanDragFocus = EFalse; |
4377 iCanDragFocus = EFalse; |
|
4378 iLastPointedControl = KErrNotFound; |
4383 break; |
4379 break; |
4384 } |
4380 } |
4385 default: |
4381 default: |
4386 { |
4382 { |
4387 ForwardPointerEventToItemL(aPointerEvent); |
4383 ForwardPointerEventToItemL(aPointerEvent); |
4404 if (!iFlickStoppedOnDownEvent && |
4400 if (!iFlickStoppedOnDownEvent && |
4405 !(IsCustomItem(*iPointedControl) && aPointerEvent.iType == TPointerEvent::EDrag)) |
4401 !(IsCustomItem(*iPointedControl) && aPointerEvent.iType == TPointerEvent::EDrag)) |
4406 { |
4402 { |
4407 if (iFocused != KErrNotFound) |
4403 if (iFocused != KErrNotFound) |
4408 { |
4404 { |
4409 if (IsPopupChoiceGroup(*iPointedControl)) |
4405 ControlItem(iFocused).HandlePointerEventL(aPointerEvent); |
4410 { |
|
4411 iPointedControl->HandlePointerEventL(aPointerEvent); |
|
4412 } |
|
4413 else |
|
4414 { |
|
4415 ControlItem(iFocused).HandlePointerEventL(aPointerEvent); |
|
4416 } |
|
4417 } |
4406 } |
4418 |
4407 |
4419 if (LayoutPending()) |
4408 if (LayoutPending()) |
4420 { |
4409 { |
4421 LayoutFormL(); |
4410 LayoutFormL(); |