imageeditor/ImageEditorUI/src/ImageEditorUIContainer.cpp
changeset 12 18b321db4884
parent 1 edfc90759b9f
equal deleted inserted replaced
1:edfc90759b9f 12:18b321db4884
    65 
    65 
    66 	//	Activate container control
    66 	//	Activate container control
    67 	ActivateL();
    67 	ActivateL();
    68 	}
    68 	}
    69 
    69 
       
    70 //judge if it is draw plug-in
       
    71 EXPORT_C void CImageEditorUIContainer::IsDrawPlugin(TBool aFlag)
       
    72 	{
       
    73 	iIsDrawPlugin = aFlag;
       
    74 	}
       
    75 
    70 //=============================================================================
    76 //=============================================================================
    71 CImageEditorUIContainer::~CImageEditorUIContainer()
    77 CImageEditorUIContainer::~CImageEditorUIContainer()
    72 	{
    78 	{
    73 	delete iWaitIndicator;
    79 	delete iWaitIndicator;
    74 	delete iBgContext;
    80 	delete iBgContext;
    93 	{
    99 	{
    94 	iControl = aControl;
   100 	iControl = aControl;
    95 	if (iControl)
   101 	if (iControl)
    96 		{
   102 		{
    97 		((CImageEditorControlBase *)iControl)->SetView(iEditorView);
   103 		((CImageEditorControlBase *)iControl)->SetView(iEditorView);
    98 		iControl->SetRect(Rect() );
   104 		if(!iIsDrawPlugin)
       
   105 			{
       
   106 			iControl->SetRect(Rect() );
       
   107 			}		
    99 		}
   108 		}
   100 	DrawDeferred();
   109 	DrawDeferred();
   101 	}
   110 	}
   102 
   111 
   103 //=============================================================================
   112 //=============================================================================
   109 		}
   118 		}
   110 	iEditorView = aView;
   119 	iEditorView = aView;
   111 	}
   120 	}
   112 
   121 
   113 //=============================================================================
   122 //=============================================================================
   114 TKeyResponse CImageEditorUIContainer::OfferKeyEventL(
   123 TKeyResponse CImageEditorUIContainer::OfferKeyEventL(const TKeyEvent & aKeyEvent, TEventCode aType)
   115 		const TKeyEvent & aKeyEvent, TEventCode aType)
       
   116 	{
   124 	{
   117 	if (Busy() )
   125 	if (Busy() )
   118 		{
   126 		{
   119 		return EKeyWasConsumed;
   127 		return EKeyWasConsumed;
   120 		}
   128 		}
   121 	else
   129 	else
   122 		{
   130 		{
   123 		TKeyResponse res = EKeyWasNotConsumed;
   131 		TKeyResponse res = EKeyWasNotConsumed;
   124 		if (iControl)
   132 		if (iControl)
   125 			{
   133 			{
   126 			res = ((CCoeControl*)iControl)->OfferKeyEventL(aKeyEvent,
   134 			res = ((CCoeControl*)iControl)->OfferKeyEventL(aKeyEvent,aType);
   127 					aType);
       
   128 			}
   135 			}
   129 		return res;
   136 		return res;
   130 		}
   137 		}
   131 	}
   138 	}
   132 
   139 
   145 
   152 
   146 	iWaitIndicator->SetItemRect(Rect() );
   153 	iWaitIndicator->SetItemRect(Rect() );
   147 	}
   154 	}
   148 
   155 
   149 //=============================================================================
   156 //=============================================================================
   150 void CImageEditorUIContainer::HandlePointerEventL(
   157 void CImageEditorUIContainer::HandlePointerEventL(const TPointerEvent &aPointerEvent)
   151 		const TPointerEvent &aPointerEvent)
       
   152 	{
   158 	{
   153 	if (Busy() )
   159 	if (Busy() )
   154 		{
   160 		{
   155 		return;
   161 		return;
   156 		}
   162 		}
   160 			{
   166 			{
   161 			((CCoeControl*)iControl)->HandlePointerEventL(aPointerEvent);
   167 			((CCoeControl*)iControl)->HandlePointerEventL(aPointerEvent);
   162 			}
   168 			}
   163 		else
   169 		else
   164 			{
   170 			{
   165 
       
   166 			switch (aPointerEvent.iType)
   171 			switch (aPointerEvent.iType)
   167 				{
   172 				{
   168 				case TPointerEvent::EButton1Down:
   173 				case TPointerEvent::EButton1Down:
   169 					{
   174 					{					
   170 					
       
   171 #ifdef RD_TACTILE_FEEDBACK
   175 #ifdef RD_TACTILE_FEEDBACK
   172 						if ( iTouchFeedBack )
   176 						if ( iTouchFeedBack )
   173 							{
   177 							{
   174 							iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic );
   178 							iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic );
   175 							RDebug::Printf( "ImageEditor::ImageEditorUIContainer: ETouchFeedback" );
   179 							RDebug::Printf( "ImageEditor::ImageEditorUIContainer: ETouchFeedback" );
   176 							}
   180 							}
   177 #endif /* RD_TACTILE_FEEDBACK  */
   181 #endif /* RD_TACTILE_FEEDBACK  */
   178 						
   182 						if ( !iEditorView->InZoomingState() )
   179 					if ( !iEditorView->InZoomingState() )
       
   180 						{
   183 						{
   181 						iEditorView->HandleCommandL(EImageEditorMenuCmdApplyEffect);
   184 						iEditorView->HandleCommandL(EImageEditorMenuCmdApplyEffect);
   182 						}
   185 						}
   183 					else
   186 					else
   184 						{
   187 						{
   186 						}
   189 						}
   187 					break;
   190 					break;
   188 					}
   191 					}
   189 				case TPointerEvent::EDrag:
   192 				case TPointerEvent::EDrag:
   190 					{
   193 					{
   191 					iXDirChange = iTappedPosition.iX
   194 					iXDirChange = iTappedPosition.iX - aPointerEvent.iPosition.iX;
   192 							- aPointerEvent.iPosition.iX;
   195 					iYDirChange = iTappedPosition.iY - aPointerEvent.iPosition.iY;
   193 					iYDirChange = iTappedPosition.iY
       
   194 							- aPointerEvent.iPosition.iY;
       
   195 
   196 
   196 					// Compare total change in pixels (absolute value) to 
   197 					// Compare total change in pixels (absolute value) to 
   197 					// threshold value. This is to prevent calling engine's 
   198 					// threshold value. This is to prevent calling engine's 
   198 					// Pan-function in every minimal movement                                                         
   199 					// Pan-function in every minimal movement                                                         
   199 					if ( (Abs(iXDirChange) + Abs(iYDirChange) )
   200 					if ( (Abs(iXDirChange) + Abs(iYDirChange) )	> KTouchPanTotalMoveThreshold )
   200 							> KTouchPanTotalMoveThreshold)
       
   201 						{
   201 						{
   202 						iTappedPosition = aPointerEvent.iPosition;
   202 						iTappedPosition = aPointerEvent.iPosition;
   203 						iEditorView->HandleCommandL(EImageEditorCmdTouchPan);
   203 						iEditorView->HandleCommandL(EImageEditorCmdTouchPan);
   204 						}
   204 						}
   205 
       
   206 					break;
   205 					break;
   207 					}
   206 					}
   208 				case TPointerEvent::EButton1Up:
   207 				case TPointerEvent::EButton1Up:
   209 					{
   208 					{
   210 					iTappedPosition = aPointerEvent.iPosition;
   209 					iTappedPosition = aPointerEvent.iPosition;
   214 				default:
   213 				default:
   215 					{
   214 					{
   216 					break;
   215 					break;
   217 					}
   216 					}
   218 				}
   217 				}
   219 
   218 			}
   220 			}
   219 		}
   221 
       
   222 		}
       
   223 
       
   224 	}
   220 	}
   225 
   221 
   226 //=============================================================================
   222 //=============================================================================
   227 TInt CImageEditorUIContainer::CountComponentControls() const
   223 TInt CImageEditorUIContainer::CountComponentControls() const
   228 	{
   224 	{
   312 			// Draw skin background
   308 			// Draw skin background
   313 			MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   309 			MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   314 			MAknsControlContext* cc = AknsDrawUtils::ControlContext( this);
   310 			MAknsControlContext* cc = AknsDrawUtils::ControlContext( this);
   315 			AknsDrawUtils::DrawBackground(skin, cc, this, gc, TPoint(0, 0),
   311 			AknsDrawUtils::DrawBackground(skin, cc, this, gc, TPoint(0, 0),
   316 					Rect(), KAknsDrawParamDefault);
   312 					Rect(), KAknsDrawParamDefault);
   317 
   313 			}
   318 			}
   314 		}
   319 		}
       
   320 
       
   321 	iWaitIndicator->DrawItem(gc);
   315 	iWaitIndicator->DrawItem(gc);
   322 	}
   316 	}
   323 
   317 
   324 //=============================================================================
   318 //=============================================================================
   325 void CImageEditorUIContainer::HandleControlEventL(CCoeControl * /*aControl*/,
   319 void CImageEditorUIContainer::HandleControlEventL(CCoeControl * /*aControl*/,
   326 		TCoeEvent /*aEventType*/
   320 		TCoeEvent /*aEventType*/)
   327 )
       
   328 	{
   321 	{
   329 
   322 
   330 	}
   323 	}
   331 
   324 
   332 //=============================================================================
   325 //=============================================================================