9512 { |
9547 { |
9513 return *iHitTest; |
9548 return *iHitTest; |
9514 } |
9549 } |
9515 |
9550 |
9516 // ----------------------------------------------------------------------------- |
9551 // ----------------------------------------------------------------------------- |
9517 // CXnUiEngineImpl::PositionStylusPopupL |
|
9518 // ----------------------------------------------------------------------------- |
|
9519 // |
|
9520 void CXnUiEngineImpl::PositionStylusPopupL( CXnNode& aNode, |
|
9521 CXnNode& aReference, const TPoint& aPosition ) |
|
9522 { |
|
9523 CXnDomStringPool* sp( aNode.DomNode()->StringPool() ); |
|
9524 TXnDirtyRegion* dirtyRegion = FindDirtyRegionL( *iCurrentView ); |
|
9525 RRegion region; |
|
9526 region.Copy( dirtyRegion->iRegion ); |
|
9527 CleanupClosePushL( region ); |
|
9528 |
|
9529 // Set initial position to (0, 0) to calculate popup metrics |
|
9530 CXnProperty* top = CXnProperty::NewL( |
|
9531 XnPropertyNames::style::common::KTop, 0, |
|
9532 CXnDomPropertyValue::EPx, *sp ); |
|
9533 CleanupStack::PushL( top ); |
|
9534 aNode.SetPropertyL( top ); |
|
9535 CleanupStack::Pop( top ); |
|
9536 top = NULL; |
|
9537 CXnProperty* left = CXnProperty::NewL( |
|
9538 XnPropertyNames::style::common::KLeft, 0, |
|
9539 CXnDomPropertyValue::EPx, *sp ); |
|
9540 CleanupStack::PushL( left ); |
|
9541 aNode.SetPropertyL( left ); |
|
9542 CleanupStack::Pop( left ); |
|
9543 left = NULL; |
|
9544 |
|
9545 // Make it visible |
|
9546 CXnProperty* display = CXnProperty::NewL( |
|
9547 XnPropertyNames::style::common::KDisplay, |
|
9548 XnPropertyNames::style::common::display::KBlock, |
|
9549 CXnDomPropertyValue::EString, *sp ); |
|
9550 CleanupStack::PushL( display ); |
|
9551 aNode.SetPropertyL( display ); |
|
9552 CleanupStack::Pop( display ); |
|
9553 |
|
9554 if ( !aNode.IsLaidOut() || !aReference.IsLaidOut() ) |
|
9555 { |
|
9556 ForceRenderUIL( ETrue ); |
|
9557 } |
|
9558 |
|
9559 if ( !aNode.IsLaidOut() || !aReference.IsLaidOut() ) |
|
9560 { |
|
9561 // Something went wrong |
|
9562 CleanupStack::PopAndDestroy( ®ion ); |
|
9563 |
|
9564 return; |
|
9565 } |
|
9566 |
|
9567 TRect rectToFit( aReference.MarginRect() ); |
|
9568 TRect marginRect( aNode.MarginRect() ); |
|
9569 |
|
9570 if ( marginRect.Height() > rectToFit.Height() || |
|
9571 marginRect.Width() > rectToFit.Width() ) |
|
9572 { |
|
9573 // Won't fit even how much is moved |
|
9574 CleanupStack::PopAndDestroy( ®ion ); |
|
9575 |
|
9576 return; |
|
9577 } |
|
9578 |
|
9579 TPoint tl; |
|
9580 TPoint br; |
|
9581 |
|
9582 // Remove the initial 0,0 from redraw region and rects |
|
9583 dirtyRegion->iRegion.Clear(); |
|
9584 ClearRects( aNode, ETrue ); |
|
9585 CXnProperty* positionHint( aNode.GetPropertyL( |
|
9586 XnPropertyNames::styluspopup::KPositionHint ) ); |
|
9587 |
|
9588 // Default |
|
9589 const TDesC8* value( &XnPropertyNames::styluspopup::positionhint::KAbove ); |
|
9590 |
|
9591 if ( positionHint ) |
|
9592 { |
|
9593 value = &positionHint->StringValue(); |
|
9594 } |
|
9595 |
|
9596 if ( *value == XnPropertyNames::styluspopup::positionhint::KAbove ) |
|
9597 { |
|
9598 if ( AknLayoutUtils::LayoutMirrored() ) |
|
9599 { |
|
9600 tl = aPosition; |
|
9601 tl.iY -= marginRect.Height(); |
|
9602 tl.iX -= marginRect.Width(); |
|
9603 |
|
9604 // Will the popup float out? |
|
9605 if ( !rectToFit.Contains( tl ) ) |
|
9606 { |
|
9607 // top left floated out |
|
9608 TInt y( rectToFit.iTl.iY - tl.iY + 1 ); |
|
9609 |
|
9610 if ( y >= 0 ) |
|
9611 { |
|
9612 // y-coordinate floated out, move it position |
|
9613 // so that it will be inside reference rect |
|
9614 tl.iY = tl.iY + y; |
|
9615 } |
|
9616 |
|
9617 TInt x( rectToFit.iTl.iX - tl.iX + 1 ); |
|
9618 |
|
9619 if ( x >= 0 ) |
|
9620 { |
|
9621 // x-coordinate floated out, move it position |
|
9622 // so that it will be inside reference rect |
|
9623 tl.iX = tl.iX + x; |
|
9624 } |
|
9625 } |
|
9626 } |
|
9627 else |
|
9628 { |
|
9629 tl = aPosition; |
|
9630 tl.iY -= marginRect.Height(); |
|
9631 |
|
9632 // Will the popup float out? |
|
9633 if ( !rectToFit.Contains( tl ) ) |
|
9634 { |
|
9635 // top left floated out |
|
9636 TInt y( rectToFit.iTl.iY - tl.iY + 1 ); |
|
9637 |
|
9638 if ( y >= 0 ) |
|
9639 { |
|
9640 // y-coordinate floated out, move it position |
|
9641 // so that it will be inside reference rect |
|
9642 tl.iY = tl.iY + y; |
|
9643 } |
|
9644 } |
|
9645 |
|
9646 br = TPoint( tl.iX + marginRect.Width(), |
|
9647 tl.iY + marginRect.Height() ); |
|
9648 |
|
9649 if ( !rectToFit.Contains( br ) ) |
|
9650 { |
|
9651 // bottom right floated out |
|
9652 TInt x( br.iX - rectToFit.iBr.iX + 1 ); |
|
9653 |
|
9654 if ( x >= 0 ) |
|
9655 { |
|
9656 // x-coordinate floated out, move it position |
|
9657 // so that it will be inside reference rect |
|
9658 tl.iX = tl.iX - x; |
|
9659 } |
|
9660 } |
|
9661 } |
|
9662 } |
|
9663 else // value == XnPropertyNames::styluspopup::positionhint::KBelow |
|
9664 { |
|
9665 if ( AknLayoutUtils::LayoutMirrored() ) |
|
9666 { |
|
9667 tl = aPosition; |
|
9668 tl.iX = tl.iX - marginRect.Width(); |
|
9669 |
|
9670 if ( !rectToFit.Contains( tl ) ) |
|
9671 { |
|
9672 // Top left floated out |
|
9673 TInt x( rectToFit.iTl.iX - tl.iX + 1 ); |
|
9674 |
|
9675 if ( x >= 0 ) |
|
9676 { |
|
9677 // x-coordinate floated out, move it position |
|
9678 // so that it will be inside reference rect |
|
9679 tl.iX = tl.iX + x; |
|
9680 } |
|
9681 } |
|
9682 |
|
9683 br = TPoint( tl.iX + marginRect.Width(), |
|
9684 tl.iY + marginRect.Height() ); |
|
9685 |
|
9686 if ( !rectToFit.Contains( br ) ) |
|
9687 { |
|
9688 // bottom right floated out |
|
9689 TInt y( br.iY - rectToFit.iBr.iY + 1 ); |
|
9690 |
|
9691 if ( y >= 0 ) |
|
9692 { |
|
9693 // y-coordinate floated out, move it position |
|
9694 // so that it will be inside reference rect |
|
9695 tl.iY = tl.iY - y; |
|
9696 } |
|
9697 } |
|
9698 } |
|
9699 else |
|
9700 { |
|
9701 tl = aPosition; |
|
9702 br = TPoint( tl.iX + marginRect.Width(), |
|
9703 tl.iY + marginRect.Height() ); |
|
9704 |
|
9705 // Will the popup float out? |
|
9706 if ( !rectToFit.Contains( br ) ) |
|
9707 { |
|
9708 // Bottom right floated out |
|
9709 TInt x( br.iX - rectToFit.iBr.iX + 1 ); |
|
9710 |
|
9711 if ( x >= 0 ) |
|
9712 { |
|
9713 // x-coordinate floated out, move it position |
|
9714 // so that it will be inside reference rect |
|
9715 tl.iX = tl.iX - x; |
|
9716 } |
|
9717 |
|
9718 TInt y( br.iY - rectToFit.iBr.iY + 1 ); |
|
9719 |
|
9720 if ( y >= 0 ) |
|
9721 { |
|
9722 // y-coordinate floated out, move it position |
|
9723 // so that it will be inside reference rect |
|
9724 tl.iY = tl.iY - y; |
|
9725 } |
|
9726 } |
|
9727 } |
|
9728 } |
|
9729 |
|
9730 // Set positions |
|
9731 top = CXnProperty::NewL( |
|
9732 XnPropertyNames::style::common::KTop, tl.iY, |
|
9733 CXnDomPropertyValue::EPx, *sp ); |
|
9734 CleanupStack::PushL( top ); |
|
9735 aNode.SetPropertyL( top ); |
|
9736 CleanupStack::Pop( top ); |
|
9737 left = CXnProperty::NewL( |
|
9738 XnPropertyNames::style::common::KLeft, tl.iX, |
|
9739 CXnDomPropertyValue::EPx, *sp ); |
|
9740 CleanupStack::PushL( left ); |
|
9741 aNode.SetPropertyL( left ); |
|
9742 CleanupStack::Pop( left ); |
|
9743 |
|
9744 // Copy stored region back |
|
9745 dirtyRegion->iRegion.Copy( region ); |
|
9746 CleanupStack::PopAndDestroy( ®ion ); |
|
9747 } |
|
9748 |
|
9749 // ----------------------------------------------------------------------------- |
|
9750 // CXnUiEngineImpl::GetThemeResource |
9552 // CXnUiEngineImpl::GetThemeResource |
9751 // ----------------------------------------------------------------------------- |
9553 // ----------------------------------------------------------------------------- |
9752 // |
9554 // |
9753 TInt CXnUiEngineImpl::GetThemeResource( const TDesC& aPath, RFile& aFile ) |
9555 TInt CXnUiEngineImpl::GetThemeResource( const TDesC& aPath, RFile& aFile ) |
9754 { |
9556 { |
9945 |
9747 |
9946 CleanupStack::PopAndDestroy(); // trigger |
9748 CleanupStack::PopAndDestroy(); // trigger |
9947 } |
9749 } |
9948 |
9750 |
9949 // ----------------------------------------------------------------------------- |
9751 // ----------------------------------------------------------------------------- |
|
9752 // CXnUiEngineImpl::HandlePartialTouchInputL() |
|
9753 // ----------------------------------------------------------------------------- |
|
9754 void CXnUiEngineImpl::HandlePartialTouchInputL( TInt aType ) |
|
9755 { |
|
9756 if( !iSplitScreenState.iPartialScreenEditorNode ) |
|
9757 { |
|
9758 return; |
|
9759 } |
|
9760 if ( aType == KAknSplitInputEnabled ) |
|
9761 { |
|
9762 // don't remove input from stack if split input is enabled |
|
9763 XnTextEditorInterface::MXnTextEditorInterface* editorControl = NULL; |
|
9764 XnComponentInterface::MakeInterfaceL( editorControl, |
|
9765 iSplitScreenState.iPartialScreenEditorNode->AppIfL() ); |
|
9766 if( editorControl ) |
|
9767 { |
|
9768 editorControl->HandleEditorEvent(CXnTextEditor::KKeepSplitInputInStack); |
|
9769 } |
|
9770 |
|
9771 RPointerArray<CXnNode> plugins = *Plugins(); |
|
9772 |
|
9773 for( TInt i=0; i<plugins.Count(); i++ ) |
|
9774 { |
|
9775 CXnNode* pluginNode = plugins[i]; |
|
9776 CXnNode* editorplugin = FindPlugin( *iSplitScreenState.iPartialScreenEditorNode ); |
|
9777 |
|
9778 if ( pluginNode != editorplugin ) |
|
9779 { |
|
9780 SetNodeVisibleL(pluginNode, EFalse); |
|
9781 } |
|
9782 } |
|
9783 |
|
9784 StorePartialScreenBlockProgressionL(); |
|
9785 |
|
9786 iSplitScreenState.isPartialScreenEnabled = ETrue; |
|
9787 SetPartialScreenBlockProgressionL( |
|
9788 XnPropertyNames::style::common::block_progression::KBT ); |
|
9789 iAppUiAdapter.StatusPane()->MakeVisible( EFalse ); |
|
9790 } |
|
9791 |
|
9792 if ( aType == KAknSplitInputDisabled ) |
|
9793 { |
|
9794 |
|
9795 // set remove stack true if disable event does not come from widget controls |
|
9796 if(iSplitScreenState.isPartialScreenOpen) |
|
9797 { |
|
9798 XnTextEditorInterface::MXnTextEditorInterface* editorControl = NULL; |
|
9799 XnComponentInterface::MakeInterfaceL( editorControl, |
|
9800 iSplitScreenState.iPartialScreenEditorNode->AppIfL() ); |
|
9801 if( editorControl ) |
|
9802 { |
|
9803 editorControl->HandleEditorEvent(CXnTextEditor::KRemoveSplitInputFromStack); |
|
9804 } |
|
9805 } |
|
9806 |
|
9807 RPointerArray<CXnNode> plugins = *Plugins(); |
|
9808 |
|
9809 for( TInt i=0; i<plugins.Count(); i++ ) |
|
9810 { |
|
9811 CXnNode* pluginNode = plugins[i]; |
|
9812 |
|
9813 if ( pluginNode != iSplitScreenState.iPartialScreenEditorNode ) |
|
9814 { |
|
9815 SetNodeVisibleL(pluginNode, ETrue); |
|
9816 } |
|
9817 } |
|
9818 |
|
9819 if( iSplitScreenState.iPartialScreenBlock == NULL ) |
|
9820 { |
|
9821 SetPartialScreenBlockProgressionL( |
|
9822 XnPropertyNames::style::common::block_progression::KTB ); |
|
9823 } |
|
9824 else |
|
9825 { |
|
9826 SetPartialScreenBlockProgressionL(iSplitScreenState.iPartialScreenBlock->Des()); |
|
9827 } |
|
9828 |
|
9829 iSplitScreenState.isPartialScreenEnabled = EFalse; |
|
9830 iAppUiAdapter.StatusPane()->MakeVisible(ETrue); |
|
9831 } |
|
9832 } |
|
9833 |
|
9834 // ----------------------------------------------------------------------------- |
9950 // ----------------------------------------------------------------------------- |
9835 // ----------------------------------------------------------------------------- |
9951 CCoeControl* CXnUiEngineImpl::WindowOwningControl( CXnNode& aNode ) |
9836 CCoeControl* CXnUiEngineImpl::WindowOwningControl( CXnNode& aNode ) |
9952 { |
9837 { |
9953 CXnNode* parent = &aNode; |
9838 CXnNode* parent = &aNode; |
9954 while( parent ) |
9839 while( parent ) |
10036 void CXnUiEngineImpl::NotifyResourceChanged( TInt aType ) |
9921 void CXnUiEngineImpl::NotifyResourceChanged( TInt aType ) |
10037 { |
9922 { |
10038 TRAP_IGNORE( HandleResourceChangeL( aType ) ); |
9923 TRAP_IGNORE( HandleResourceChangeL( aType ) ); |
10039 } |
9924 } |
10040 |
9925 |
|
9926 // ----------------------------------------------------------------------------- |
|
9927 // EnablePartialTouchInput |
|
9928 // ----------------------------------------------------------------------------- |
|
9929 void CXnUiEngineImpl::EnablePartialTouchInput( CXnNode& aNode, TBool aEnable ) |
|
9930 { |
|
9931 iSplitScreenState.iPartialScreenEditorNode = &aNode; |
|
9932 iSplitScreenState.isPartialScreenOpen = aEnable; |
|
9933 } |
|
9934 |
|
9935 // ----------------------------------------------------------------------------- |
|
9936 // SetNodeVisibleL |
|
9937 // ----------------------------------------------------------------------------- |
|
9938 void CXnUiEngineImpl::SetNodeVisibleL( CXnNode* aNode , TBool aVisible ) |
|
9939 { |
|
9940 CXnDomStringPool* sp( iUiEngine->ODT()->DomDocument().StringPool()); |
|
9941 |
|
9942 if(!aVisible) |
|
9943 { |
|
9944 CXnProperty* display = CXnProperty::NewL( |
|
9945 XnPropertyNames::style::common::KDisplay, |
|
9946 XnPropertyNames::style::common::display::KNone, |
|
9947 CXnDomPropertyValue::EString, *sp ); |
|
9948 |
|
9949 CleanupStack::PushL( display ); |
|
9950 aNode->SetPropertyL(display); |
|
9951 CleanupStack::Pop( display ); |
|
9952 } |
|
9953 else |
|
9954 { |
|
9955 CXnProperty* visible = CXnProperty::NewL( |
|
9956 XnPropertyNames::style::common::KDisplay, |
|
9957 XnPropertyNames::style::common::display::KBlock, |
|
9958 CXnDomPropertyValue::EString, *sp ); |
|
9959 |
|
9960 CleanupStack::PushL( visible ); |
|
9961 aNode->SetPropertyL(visible); |
|
9962 CleanupStack::Pop( visible ); |
|
9963 } |
|
9964 } |
|
9965 |
|
9966 // ----------------------------------------------------------------------------- |
|
9967 // SetPartialScreenBlockProgressionL |
|
9968 // ----------------------------------------------------------------------------- |
|
9969 void CXnUiEngineImpl::SetPartialScreenBlockProgressionL( const TDesC8& aBlockProgression ) |
|
9970 { |
|
9971 CXnNode* plugin = FindPlugin( *iSplitScreenState.iPartialScreenEditorNode ); |
|
9972 CXnNode* parent( NULL ); |
|
9973 if( plugin ) |
|
9974 { |
|
9975 parent = plugin->Parent(); |
|
9976 } |
|
9977 |
|
9978 CXnDomStringPool* sp( iUiEngine->ODT()->DomDocument().StringPool()); |
|
9979 if(parent) |
|
9980 { |
|
9981 CXnProperty* block_progression = CXnProperty::NewL( |
|
9982 XnPropertyNames::style::common::KBlockProgression, |
|
9983 aBlockProgression, |
|
9984 CXnDomPropertyValue::EString, *sp ); |
|
9985 |
|
9986 CleanupStack::PushL( block_progression ); |
|
9987 parent->SetPropertyL(block_progression); |
|
9988 CleanupStack::Pop( block_progression ); |
|
9989 } |
|
9990 } |
|
9991 |
|
9992 // ----------------------------------------------------------------------------- |
|
9993 // SetPartialScreenBlockProgressionL |
|
9994 // ----------------------------------------------------------------------------- |
|
9995 void CXnUiEngineImpl::StorePartialScreenBlockProgressionL() |
|
9996 { |
|
9997 CXnNode* parent = iSplitScreenState.iPartialScreenEditorNode->Parent(); |
|
9998 |
|
9999 if(parent) |
|
10000 { |
|
10001 CXnProperty* blocProgressionProperty( |
|
10002 parent->GetPropertyL( XnPropertyNames::style::common::KBlockProgression ) ); |
|
10003 |
|
10004 HBufC* blocProgressionValue (blocProgressionProperty->StringValueL()); |
|
10005 CleanupStack::PushL( blocProgressionValue ); |
|
10006 if(iSplitScreenState.iPartialScreenBlock) |
|
10007 { |
|
10008 delete iSplitScreenState.iPartialScreenBlock; |
|
10009 iSplitScreenState.iPartialScreenBlock = NULL; |
|
10010 } |
|
10011 iSplitScreenState.iPartialScreenBlock = |
|
10012 CnvUtfConverter::ConvertFromUnicodeToUtf8L(blocProgressionValue->Des() ); |
|
10013 CleanupStack::PopAndDestroy( blocProgressionValue ); |
|
10014 } |
|
10015 } |
|
10016 |
|
10017 // ----------------------------------------------------------------------------- |
|
10018 // isPartialInputActive |
|
10019 // ----------------------------------------------------------------------------- |
|
10020 TBool CXnUiEngineImpl::IsPartialInputActive() |
|
10021 { |
|
10022 return iSplitScreenState.isPartialScreenEnabled; |
|
10023 } |
|
10024 |
|
10025 |
10041 // End of file |
10026 // End of file |