6025 TRAP(err, TestEdwinDialog::RunDlgLD(R_BASICGUI_EDWIN_DIALOG)); |
6026 TRAP(err, TestEdwinDialog::RunDlgLD(R_BASICGUI_EDWIN_DIALOG)); |
6026 #endif |
6027 #endif |
6027 return err; |
6028 return err; |
6028 } |
6029 } |
6029 |
6030 |
|
6031 |
|
6032 // ----------------------------------------------------------------------------- |
|
6033 // CTestSDKEditors::TPhysicsObserver::ViewPositionChanged |
|
6034 // ----------------------------------------------------------------------------- |
|
6035 // |
|
6036 void CTestSDKEditors::TPhysicsObserver::ViewPositionChanged( |
|
6037 const TPoint& /*aNewPosition*/, TBool /*aDrawNow*/, TUint /*aFlags*/ ) |
|
6038 { |
|
6039 } |
|
6040 |
|
6041 |
|
6042 // ----------------------------------------------------------------------------- |
|
6043 // CTestSDKEditors::TPhysicsObserver::PhysicEmulationEnded |
|
6044 // ----------------------------------------------------------------------------- |
|
6045 // |
|
6046 void CTestSDKEditors::TPhysicsObserver::PhysicEmulationEnded() |
|
6047 { |
|
6048 } |
|
6049 |
|
6050 |
|
6051 // ----------------------------------------------------------------------------- |
|
6052 // CTestSDKEditors::TPhysicsObserver::ViewPosition |
|
6053 // ----------------------------------------------------------------------------- |
|
6054 // |
|
6055 TPoint CTestSDKEditors::TPhysicsObserver::ViewPosition() const |
|
6056 { |
|
6057 TPoint point (0,0); |
|
6058 return point; |
|
6059 } |
|
6060 |
|
6061 |
|
6062 // ----------------------------------------------------------------------------- |
|
6063 // CTestSDKEditors::TestEEnableKineticScrollingPhysicsL |
|
6064 // ----------------------------------------------------------------------------- |
|
6065 // |
|
6066 TInt CTestSDKEditors::TestEEnableKineticScrollingPhysicsL( CStifItemParser& |
|
6067 /*aItem*/ ) |
|
6068 { |
|
6069 CTestEditorsControl* control = CTestEditorsControl::NewL(); |
|
6070 CleanupStack::PushL( control ); |
|
6071 STIF_ASSERT_NOT_NULL( control ); |
|
6072 |
|
6073 CTestSDKEditorsEdwin* edwin = new ( ELeave ) CTestSDKEditorsEdwin; |
|
6074 CleanupStack::PushL( edwin ); |
|
6075 STIF_ASSERT_NOT_NULL( edwin ); |
|
6076 // Enable kinetic scrolling |
|
6077 |
|
6078 TPhysicsObserver obs; |
|
6079 CAknPhysics* physics ( NULL ); |
|
6080 STIF_ASSERT_TRUE ( CAknPhysics::FeatureEnabled() ); |
|
6081 |
|
6082 physics = CAknPhysics::NewL( obs, control ); |
|
6083 CleanupStack::PushL( physics ); |
|
6084 |
|
6085 edwin->EnableKineticScrollingL( physics ); |
|
6086 edwin->SetContainerWindowL( *control ); |
|
6087 |
|
6088 TResourceReader reader; |
|
6089 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_EDWIN ); |
|
6090 edwin->ConstructFromResourceL( reader ); |
|
6091 CleanupStack::PopAndDestroy(); |
|
6092 |
|
6093 // CreateLayoutL |
|
6094 CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(); |
|
6095 CleanupStack::PushL( paraFormatLayer ); |
|
6096 CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); |
|
6097 CleanupStack::PushL( charFormatLayer ); |
|
6098 CGlobalText * globalText = |
|
6099 CGlobalText::NewL( paraFormatLayer, charFormatLayer ); |
|
6100 CleanupStack::PushL( globalText ); |
|
6101 edwin->CreateLayoutL( globalText ); |
|
6102 CleanupStack::Pop( globalText ); |
|
6103 CleanupStack::Pop( charFormatLayer ); |
|
6104 CleanupStack::Pop( paraFormatLayer ); |
|
6105 |
|
6106 edwin->CreateTextViewL(); |
|
6107 |
|
6108 // SetTextL |
|
6109 _LIT( KText, "one text" ); |
|
6110 TBuf<KLength> text( KText ); |
|
6111 edwin->SetTextL( &text ); |
|
6112 |
|
6113 edwin->ForceScrollBarUpdateL(); |
|
6114 edwin->HandleSizeChangedL(); |
|
6115 |
|
6116 // Set selection |
|
6117 const TInt KSelectionPosition( 2 ); |
|
6118 edwin->SetSelectionL( 0, KSelectionPosition ); |
|
6119 TCursorSelection cursorSelection( 0, KSelectionPosition ); |
|
6120 STIF_ASSERT_TRUE( |
|
6121 cursorSelection.iCursorPos == edwin->Selection().iCursorPos ); |
|
6122 STIF_ASSERT_TRUE( |
|
6123 cursorSelection.iAnchorPos == edwin->Selection().iAnchorPos ); |
|
6124 edwin->ClearSelectionL(); |
|
6125 STIF_ASSERT_TRUE( 0 == edwin->Selection().iCursorPos ); |
|
6126 |
|
6127 edwin->MoveCursorL( TCursorPosition::EFRight, ETrue ); |
|
6128 STIF_ASSERT_FALSE( edwin->IdleL( edwin ) ); |
|
6129 |
|
6130 // HandlePointerEventL |
|
6131 TPointerEvent event; |
|
6132 event.iType = TPointerEvent::EButton1Down; |
|
6133 edwin->HandlePointerEventL( event ); |
|
6134 |
|
6135 // HandleScrollEventL |
|
6136 CEikScrollBar* scrollBar = new ( ELeave ) CEikScrollBar; |
|
6137 CleanupStack::PushL( scrollBar ); |
|
6138 STIF_ASSERT_NOT_NULL( scrollBar ); |
|
6139 scrollBar->ConstructL( static_cast<MEikScrollBarObserver*>( edwin ), |
|
6140 control, |
|
6141 CEikScrollBar::EVertical, |
|
6142 KLength, |
|
6143 CEikScrollBar::EEikScrollBarDefaultBehaviour ); |
|
6144 TAknDoubleSpanScrollBarModel doubleModel; |
|
6145 scrollBar->SetModel( &doubleModel ); |
|
6146 edwin->HandleScrollEventL( scrollBar, EEikScrollThumbDragHoriz ); |
|
6147 CleanupStack::PopAndDestroy( scrollBar ); |
|
6148 |
|
6149 CleanupStack::PopAndDestroy( physics ); |
|
6150 CleanupStack::PopAndDestroy( edwin ); |
|
6151 CleanupStack::PopAndDestroy( control ); |
|
6152 |
|
6153 return KErrNone; |
|
6154 } |