19 // System includes |
19 // System includes |
20 #include <utf.h> |
20 #include <utf.h> |
21 #include <eikapp.h> |
21 #include <eikapp.h> |
22 #include <AknUtils.h> |
22 #include <AknUtils.h> |
23 #include <layoutmetadata.cdl.h> |
23 #include <layoutmetadata.cdl.h> |
24 #include <aknpriv.hrh> |
24 #include <AknPriv.hrh> |
25 |
25 |
26 // User includes |
26 // User includes |
27 #include "xnuiengine.h" |
27 #include "xnuiengine.h" |
28 #include "xnuiengineimpl.h" |
28 #include "xnuiengineimpl.h" |
29 #include "xnuistatelistener.h" |
29 #include "xnuistatelistener.h" |
54 #include "xnpanic.h" |
54 #include "xnpanic.h" |
55 #include "xneffectmanager.h" |
55 #include "xneffectmanager.h" |
56 #include "xneditor.h" |
56 #include "xneditor.h" |
57 #include "xnbackgroundmanager.h" |
57 #include "xnbackgroundmanager.h" |
58 #include "xntexteditor.h" |
58 #include "xntexteditor.h" |
|
59 #include "xnbgcontrol.h" |
59 |
60 |
60 #ifdef _XN_PERFORMANCE_TEST_ |
61 #ifdef _XN_PERFORMANCE_TEST_ |
61 #include "xntimemon.h" |
62 #include "xntimemon.h" |
62 #endif |
63 #endif |
63 |
64 |
269 TReal& aVerticalUnitInPixels, TRect aRect ); |
270 TReal& aVerticalUnitInPixels, TRect aRect ); |
270 static CXnNode* BuildScreenDeviceChangeTriggerNodeLC( |
271 static CXnNode* BuildScreenDeviceChangeTriggerNodeLC( |
271 CXnUiEngine& aUiEngine ); |
272 CXnUiEngine& aUiEngine ); |
272 static void FillFocusCandidatesL( CXnNode* aParent, |
273 static void FillFocusCandidatesL( CXnNode* aParent, |
273 RPointerArray< CXnNode >& aArray ); |
274 RPointerArray< CXnNode >& aArray ); |
274 static TInt DetermineStatusPaneLayout( CXnProperty* aProperty ); |
|
275 static TBool SetAdaptivesL( CXnNode& aNode ); |
275 static TBool SetAdaptivesL( CXnNode& aNode ); |
276 |
276 |
277 static void FindNodeByClassL( CXnNode* aRootNode, const TDesC8& aClassId, |
277 static void FindNodeByClassL( CXnNode* aRootNode, const TDesC8& aClassId, |
278 CXnPointerArray& aArray, const TDesC8& aNamespace ); |
278 CXnPointerArray& aArray, const TDesC8& aNamespace ); |
279 static CXnNode* FindNodeByIdL( CXnNode* aRootNode, const TDesC8& aAreaId, |
279 static CXnNode* FindNodeByIdL( CXnNode* aRootNode, const TDesC8& aAreaId, |
7899 const TDesC8* reasonString( NULL ); |
7899 const TDesC8* reasonString( NULL ); |
7900 |
7900 |
7901 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
7901 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
7902 { |
7902 { |
7903 reasonString = &XnPropertyNames::action::trigger::name:: |
7903 reasonString = &XnPropertyNames::action::trigger::name:: |
7904 uidefinitionmodification::reason::KLandscape; |
7904 orientation::reason::KLandscape; |
7905 } |
7905 } |
7906 else |
7906 else |
7907 { |
7907 { |
7908 reasonString = &XnPropertyNames::action::trigger::name:: |
7908 reasonString = &XnPropertyNames::action::trigger::name:: |
7909 uidefinitionmodification::reason::KPortrait; |
7909 orientation::reason::KPortrait; |
7910 } |
7910 } |
7911 |
7911 |
7912 reasonValue->SetStringValueL( CXnDomPropertyValue::EString, *reasonString ); |
7912 reasonValue->SetStringValueL( CXnDomPropertyValue::EString, *reasonString ); |
7913 |
7913 |
7914 CXnProperty* reason = CXnProperty::NewL( XnPropertyNames::action::trigger:: |
7914 CXnProperty* reason = CXnProperty::NewL( XnPropertyNames::action::trigger:: |
7915 name::uidefinitionmodification::KReason, reasonValue, *sp ); |
7915 name::orientation::KReason, reasonValue, *sp ); |
7916 |
7916 |
7917 CleanupStack::Pop( reasonValue ); |
7917 CleanupStack::Pop( reasonValue ); |
7918 |
7918 |
7919 CleanupStack::PushL( reason ); |
7919 CleanupStack::PushL( reason ); |
7920 |
7920 |
7938 |
7938 |
7939 for ( TInt i = 0; i < children.Count(); i++ ) |
7939 for ( TInt i = 0; i < children.Count(); i++ ) |
7940 { |
7940 { |
7941 FillFocusCandidatesL( children[i], aArray ); |
7941 FillFocusCandidatesL( children[i], aArray ); |
7942 } |
7942 } |
7943 } |
|
7944 |
|
7945 // ----------------------------------------------------------------------------- |
|
7946 // DetermineStatusPaneLayout |
|
7947 // ----------------------------------------------------------------------------- |
|
7948 // |
|
7949 static TInt DetermineStatusPaneLayout( CXnProperty* aProperty ) |
|
7950 { |
|
7951 TInt spane( KErrNotFound ); |
|
7952 |
|
7953 if ( aProperty ) |
|
7954 { |
|
7955 const TDesC8& value( aProperty->StringValue() ); |
|
7956 |
|
7957 // Currently supported status pane layout |
|
7958 if ( value == XnPropertyNames::view::statuspanelayout::KNone ) |
|
7959 { |
|
7960 spane = R_AVKON_STATUS_PANE_LAYOUT_EMPTY; |
|
7961 } |
|
7962 if ( value == XnPropertyNames::view::statuspanelayout::KBasic ) |
|
7963 { |
|
7964 spane = R_AVKON_STATUS_PANE_LAYOUT_IDLE; |
|
7965 } |
|
7966 else if ( value == XnPropertyNames::view::statuspanelayout::KBasicFlat ) |
|
7967 { |
|
7968 spane = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT; |
|
7969 } |
|
7970 else if ( value == |
|
7971 XnPropertyNames::view::statuspanelayout::KWideScreen ) |
|
7972 { |
|
7973 spane = R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE; |
|
7974 } |
|
7975 else if ( value == |
|
7976 XnPropertyNames::view::statuspanelayout::KWideScreenFlat ) |
|
7977 { |
|
7978 spane = R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT; |
|
7979 } |
|
7980 else if ( value == |
|
7981 XnPropertyNames::view::statuspanelayout:: |
|
7982 KWideScreenFlat3Softkeys ) |
|
7983 { |
|
7984 spane = R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS; |
|
7985 } |
|
7986 } |
|
7987 |
|
7988 return spane; |
|
7989 } |
7943 } |
7990 |
7944 |
7991 // ----------------------------------------------------------------------------- |
7945 // ----------------------------------------------------------------------------- |
7992 // SetAdaptivesL |
7946 // SetAdaptivesL |
7993 // ----------------------------------------------------------------------------- |
7947 // ----------------------------------------------------------------------------- |
8540 // CXnUiEngineImpl::SetFocusedNodeL() |
8494 // CXnUiEngineImpl::SetFocusedNodeL() |
8541 // ----------------------------------------------------------------------------- |
8495 // ----------------------------------------------------------------------------- |
8542 // |
8496 // |
8543 void CXnUiEngineImpl::SetFocusedNodeL( CXnNode* aFocusedNode, TInt aSource ) |
8497 void CXnUiEngineImpl::SetFocusedNodeL( CXnNode* aFocusedNode, TInt aSource ) |
8544 { |
8498 { |
8545 iKeyEventDispatcher->SetNodeL( aFocusedNode, aSource ); |
8499 if ( iKeyEventDispatcher ) |
|
8500 { |
|
8501 iKeyEventDispatcher->SetNodeL( aFocusedNode, aSource ); |
|
8502 } |
8546 } |
8503 } |
8547 |
8504 |
8548 // ----------------------------------------------------------------------------- |
8505 // ----------------------------------------------------------------------------- |
8549 // CXnUiEngine::FocusedNode |
8506 // CXnUiEngine::FocusedNode |
8550 // Forwards the call to the ui engine implementation |
8507 // Forwards the call to the ui engine implementation |
8551 // ----------------------------------------------------------------------------- |
8508 // ----------------------------------------------------------------------------- |
8552 // |
8509 // |
8553 CXnNode* CXnUiEngineImpl::FocusedNode() |
8510 CXnNode* CXnUiEngineImpl::FocusedNode() |
8554 { |
8511 { |
8555 return iKeyEventDispatcher->FocusedNode(); |
8512 if ( iKeyEventDispatcher ) |
|
8513 { |
|
8514 return iKeyEventDispatcher->FocusedNode(); |
|
8515 } |
|
8516 |
|
8517 return NULL; |
8556 } |
8518 } |
8557 |
8519 |
8558 // ----------------------------------------------------------------------------- |
8520 // ----------------------------------------------------------------------------- |
8559 // CXnUiEngineImpl::IsEditMode |
8521 // CXnUiEngineImpl::IsEditMode |
8560 // Returns ETrue if the current mode is edit, otherwise EFalse. |
8522 // Returns ETrue if the current mode is edit, otherwise EFalse. |
8577 iCurrentViewControlAdapter = iCurrentView->Control(); |
8539 iCurrentViewControlAdapter = iCurrentView->Control(); |
8578 |
8540 |
8579 iDirtyList.Reset(); |
8541 iDirtyList.Reset(); |
8580 |
8542 |
8581 iRedrawRegions.ResetAndDestroy(); |
8543 iRedrawRegions.ResetAndDestroy(); |
8582 |
|
8583 // Set status pane layout |
|
8584 CXnProperty* prop( iCurrentView->GetPropertyL( |
|
8585 XnPropertyNames::view::KStatusPaneLayout ) ); |
|
8586 |
|
8587 // Is there status pane declaration available |
|
8588 TInt spane( DetermineStatusPaneLayout( prop ) ); |
|
8589 |
|
8590 if ( spane != KErrNotFound ) |
|
8591 { |
|
8592 CEikStatusPane* sp( iAppUiAdapter.StatusPane() ); |
|
8593 |
|
8594 if ( sp && sp->CurrentLayoutResId() != spane ) |
|
8595 { |
|
8596 sp->SwitchLayoutL( spane ); |
|
8597 sp->ApplyCurrentSettingsL(); |
|
8598 } |
|
8599 } |
|
8600 |
8544 |
8601 // Remove previous menubar and stylus popup node |
8545 // Remove previous menubar and stylus popup node |
8602 iMenuNode = NULL; |
8546 iMenuNode = NULL; |
8603 iStylusPopupNode = NULL; |
8547 iStylusPopupNode = NULL; |
8604 |
8548 |
8605 iKeyEventDispatcher->ResetMenuNodeL(); |
8549 if ( iKeyEventDispatcher ) |
8606 |
8550 { |
|
8551 iKeyEventDispatcher->ResetMenuNodeL(); |
|
8552 } |
|
8553 |
8607 RPointerArray< CXnNode >& children( iCurrentView->Children() ); |
8554 RPointerArray< CXnNode >& children( iCurrentView->Children() ); |
8608 |
8555 |
8609 for ( TInt count = children.Count() - 1; count >= 0 ; --count ) |
8556 for ( TInt count = children.Count() - 1; count >= 0 ; --count ) |
8610 { |
8557 { |
8611 CXnNode* node( children[count] ); |
8558 CXnNode* node( children[count] ); |
8633 } |
8580 } |
8634 } |
8581 } |
8635 |
8582 |
8636 // Set menu node even if its NULL, to allow keyevent dispatcher |
8583 // Set menu node even if its NULL, to allow keyevent dispatcher |
8637 // to handle no softkeys |
8584 // to handle no softkeys |
8638 iKeyEventDispatcher->SetMenuNodeL( iMenuNode ); |
8585 if ( iKeyEventDispatcher ) |
8639 |
8586 { |
|
8587 iKeyEventDispatcher->SetMenuNodeL( iMenuNode ); |
|
8588 } |
|
8589 |
8640 ReportScreenDeviceChangeL(); |
8590 ReportScreenDeviceChangeL(); |
8641 |
8591 |
8642 SetClientRectL( iAppUiAdapter.ClientRect(), EFalse ); |
8592 SetClientRectL( iAppUiAdapter.ClientRect(), EFalse ); |
8643 |
8593 |
8644 RootNode()->SetDirtyL(); |
8594 RootNode()->SetDirtyL(); |
8840 // |
8790 // |
8841 void CXnUiEngineImpl::RefreshMenuL() |
8791 void CXnUiEngineImpl::RefreshMenuL() |
8842 { |
8792 { |
8843 if ( iLayoutControl & XnLayoutControl::ERefreshMenu ) |
8793 if ( iLayoutControl & XnLayoutControl::ERefreshMenu ) |
8844 { |
8794 { |
8845 iKeyEventDispatcher->RefreshMenuL(); |
8795 if ( iKeyEventDispatcher ) |
|
8796 { |
|
8797 iKeyEventDispatcher->RefreshMenuL(); |
|
8798 } |
|
8799 |
8846 iLayoutControl &= ~XnLayoutControl::ERefreshMenu; |
8800 iLayoutControl &= ~XnLayoutControl::ERefreshMenu; |
8847 } |
8801 } |
8848 } |
8802 } |
8849 |
8803 |
8850 // ----------------------------------------------------------------------------- |
8804 // ----------------------------------------------------------------------------- |
8935 if(!iSplitScreenState.isPartialScreenEnabled ) |
8889 if(!iSplitScreenState.isPartialScreenEnabled ) |
8936 { |
8890 { |
8937 DisableRenderUiLC(); |
8891 DisableRenderUiLC(); |
8938 HandlePartialTouchInputL( aType ); |
8892 HandlePartialTouchInputL( aType ); |
8939 RootNode()->SetDirtyL(); |
8893 RootNode()->SetDirtyL(); |
|
8894 ForceRenderUIL(); |
8940 CleanupStack::PopAndDestroy(); |
8895 CleanupStack::PopAndDestroy(); |
8941 } |
8896 } |
8942 } |
8897 } |
8943 |
8898 |
8944 if ( aType == KAknSplitInputDisabled ) |
8899 if ( aType == KAknSplitInputDisabled ) |
9026 // Checks whether the menu is displaying or not. |
8982 // Checks whether the menu is displaying or not. |
9027 // ----------------------------------------------------------------------------- |
8983 // ----------------------------------------------------------------------------- |
9028 // |
8984 // |
9029 TBool CXnUiEngineImpl::IsMenuDisplaying() |
8985 TBool CXnUiEngineImpl::IsMenuDisplaying() |
9030 { |
8986 { |
9031 return iKeyEventDispatcher->IsMenuFocused(); |
8987 if ( iKeyEventDispatcher ) |
|
8988 { |
|
8989 return iKeyEventDispatcher->IsMenuFocused(); |
|
8990 } |
|
8991 |
|
8992 return EFalse; |
9032 } |
8993 } |
9033 |
8994 |
9034 // ----------------------------------------------------------------------------- |
8995 // ----------------------------------------------------------------------------- |
9035 // CXnUiEngineImpl::MenubarNode |
8996 // CXnUiEngineImpl::MenubarNode |
9036 // Returns menubar node |
8997 // Returns menubar node |
9055 // CXnUiEngineImpl::AddPassiveFocusedNode |
9016 // CXnUiEngineImpl::AddPassiveFocusedNode |
9056 // ----------------------------------------------------------------------------- |
9017 // ----------------------------------------------------------------------------- |
9057 // |
9018 // |
9058 void CXnUiEngineImpl::AddPassiveFocusedNodeL( CXnNode* aNode ) |
9019 void CXnUiEngineImpl::AddPassiveFocusedNodeL( CXnNode* aNode ) |
9059 { |
9020 { |
9060 iKeyEventDispatcher->AddPassiveFocusedNodeL( aNode ); |
9021 if ( iKeyEventDispatcher ) |
|
9022 { |
|
9023 iKeyEventDispatcher->AddPassiveFocusedNodeL( aNode ); |
|
9024 } |
9061 } |
9025 } |
9062 |
9026 |
9063 // ----------------------------------------------------------------------------- |
9027 // ----------------------------------------------------------------------------- |
9064 // CXnUiEngineImpl::RemovePassiveFocusedNode |
9028 // CXnUiEngineImpl::RemovePassiveFocusedNode |
9065 // ----------------------------------------------------------------------------- |
9029 // ----------------------------------------------------------------------------- |
9066 // |
9030 // |
9067 void CXnUiEngineImpl::RemovePassiveFocusedNodeL( CXnNode* aNode ) |
9031 void CXnUiEngineImpl::RemovePassiveFocusedNodeL( CXnNode* aNode ) |
9068 { |
9032 { |
9069 iKeyEventDispatcher->RemovePassiveFocusedNodeL( aNode ); |
9033 if ( iKeyEventDispatcher ) |
|
9034 { |
|
9035 iKeyEventDispatcher->RemovePassiveFocusedNodeL( aNode ); |
|
9036 } |
9070 } |
9037 } |
9071 |
9038 |
9072 // ----------------------------------------------------------------------------- |
9039 // ----------------------------------------------------------------------------- |
9073 // CXnUiEngineImpl::AddPassiveFocusedNode |
9040 // CXnUiEngineImpl::AddPassiveFocusedNode |
9074 // ----------------------------------------------------------------------------- |
9041 // ----------------------------------------------------------------------------- |
9075 // |
9042 // |
9076 void CXnUiEngineImpl::ClearPassiveFocusedNodesL() |
9043 void CXnUiEngineImpl::ClearPassiveFocusedNodesL() |
9077 { |
9044 { |
9078 iKeyEventDispatcher->ClearPassiveFocusedNodesL(); |
9045 if ( iKeyEventDispatcher ) |
|
9046 { |
|
9047 iKeyEventDispatcher->ClearPassiveFocusedNodesL(); |
|
9048 } |
9079 } |
9049 } |
9080 |
9050 |
9081 // ----------------------------------------------------------------------------- |
9051 // ----------------------------------------------------------------------------- |
9082 // SetNodeDroppedL() |
9052 // SetNodeDroppedL() |
9083 // Sets node's dropped state |
9053 // Sets node's dropped state |
9756 if( !iSplitScreenState.iPartialScreenEditorNode ) |
9726 if( !iSplitScreenState.iPartialScreenEditorNode ) |
9757 { |
9727 { |
9758 return; |
9728 return; |
9759 } |
9729 } |
9760 if ( aType == KAknSplitInputEnabled ) |
9730 if ( aType == KAknSplitInputEnabled ) |
9761 { |
9731 { |
|
9732 // make sure that we always get up event |
|
9733 CCoeControl& bg( iAppUiAdapter.ViewAdapter().BgControl() ); |
|
9734 static_cast<CXnBgControl*>(&bg)->ResetGrabbingL(); |
|
9735 |
9762 // don't remove input from stack if split input is enabled |
9736 // don't remove input from stack if split input is enabled |
9763 XnTextEditorInterface::MXnTextEditorInterface* editorControl = NULL; |
9737 XnTextEditorInterface::MXnTextEditorInterface* editorControl = NULL; |
9764 XnComponentInterface::MakeInterfaceL( editorControl, |
9738 XnComponentInterface::MakeInterfaceL( editorControl, |
9765 iSplitScreenState.iPartialScreenEditorNode->AppIfL() ); |
9739 iSplitScreenState.iPartialScreenEditorNode->AppIfL() ); |
9766 if( editorControl ) |
9740 if( editorControl ) |
9910 // ----------------------------------------------------------------------------- |
9884 // ----------------------------------------------------------------------------- |
9911 // NotifyStatusPaneSizeChanged |
9885 // NotifyStatusPaneSizeChanged |
9912 // ----------------------------------------------------------------------------- |
9886 // ----------------------------------------------------------------------------- |
9913 void CXnUiEngineImpl::NotifyStatusPaneSizeChanged() |
9887 void CXnUiEngineImpl::NotifyStatusPaneSizeChanged() |
9914 { |
9888 { |
9915 TRAP_IGNORE( iUiEngine->SetClientRectL( iAppUiAdapter.ClientRect() ) ); |
9889 TRAP_IGNORE( iUiEngine->SetClientRectL( iAppUiAdapter.ClientRect(), EFalse ) ); |
9916 } |
9890 } |
9917 |
9891 |
9918 // ----------------------------------------------------------------------------- |
9892 // ----------------------------------------------------------------------------- |
9919 // NotifyResourceChanged |
9893 // NotifyResourceChanged |
9920 // ----------------------------------------------------------------------------- |
9894 // ----------------------------------------------------------------------------- |