3 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
5 * Licensed under the Flora License, Version 1.1 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #include <internal/widget_view/widget_view_impl.h>
24 #include <dali/public-api/common/stage.h>
25 #include <dali/public-api/events/touch-data.h>
26 #include <dali/public-api/events/wheel-event.h>
27 #include <dali/public-api/images/native-image.h>
28 #include <dali/public-api/object/type-registry.h>
29 #include <dali/public-api/object/type-registry-helper.h>
30 #include <dali-toolkit/public-api/visuals/visual-properties.h>
31 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
32 #include <dali/integration-api/debug.h>
34 #include <Ecore_Input.h>
35 #include <widget_service.h>
36 #include <widget_instance.h>
37 #include <tzplatform_config.h>
38 #include <wayland-extension/tizen-extension-client-protocol.h>
39 #include <aul_rsm_viewer.h>
53 #define WIDGET_VIEW_RESOURCE_DEFAULT_IMG "/widget_viewer_dali/images/unknown.png"
55 #if defined(DEBUG_ENABLED)
56 Integration::Log::Filter* gWidgetViewLogging = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_WIDGET_VIEW" );
61 return Dali::BaseHandle();
64 // Setup properties, signals and actions using the type-registry.
65 DALI_TYPE_REGISTRATION_BEGIN( Dali::WidgetView::WidgetView, Toolkit::Control, Create );
66 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "widgetId", BOOLEAN, WIDGET_ID )
67 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "instanceId", BOOLEAN, INSTANCE_ID )
68 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "contentInfo", BOOLEAN, CONTENT_INFO )
69 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "title", BOOLEAN, TITLE )
70 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "updatePeriod", BOOLEAN, UPDATE_PERIOD )
71 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "preview", MAP, PREVIEW )
72 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "loadingText", MAP, LOADING_TEXT )
73 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "widgetStateFaulted", BOOLEAN, WIDGET_STATE_FAULTED )
74 DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "permanentDelete", BOOLEAN, PERMANENT_DELETE )
77 DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetAdded", SIGNAL_WIDGET_ADDED )
78 DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetDeleted", SIGNAL_WIDGET_DELETED )
79 DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetCreationAborted", SIGNAL_WIDGET_CREATION_ABORTED )
80 DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetContentUpdated", SIGNAL_WIDGET_CONTENT_UPDATED )
81 DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetUpdatePeriodChanged", SIGNAL_WIDGET_UPDATE_PERIOD_CHANGED )
82 DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetFaulted", SIGNAL_WIDGET_FAULTED )
85 DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "pauseWidget", ACTION_WIDGETVIEW_PAUSE_WIDGET );
86 DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "resumeWidget", ACTION_WIDGETVIEW_RESUME_WIDGET );
87 DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "cancelTouchEvent", ACTION_WIDGETVIEW_CANCEL_TOUCH_EVENT );
88 DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "activateFaultedWidget", ACTION_WIDGETVIEW_ACTIVATE_FAULTED_WIDGET );
90 DALI_TYPE_REGISTRATION_END()
92 static void OnBufferUpdate( struct tizen_remote_surface* surface, wl_buffer* buffer, uint32_t time, void* data )
94 Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
98 if( !widgetView->IsWidgetImageView() )
100 tizen_remote_surface_transfer_visibility( surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
102 widgetView->CreateWidgetImageView();
103 widgetView->ConnectSignal( surface );
106 //get tbm surface from buffer
107 tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
108 widgetView->UpdateImageSource( tbmSurface );
112 static void OnSurfaceMissing( struct tizen_remote_surface* surface, void* data )
114 Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
118 widgetView->CloseRemoteSurface();
123 static struct aul_rsm_handler_s remoteSurfaceHandler = {
128 } // unnamed namespace
130 Dali::WidgetView::WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod )
132 // Create the implementation, temporarily owned on stack
133 IntrusivePtr< WidgetView > internalWidgetView = new WidgetView( widgetId, contentInfo, width, height, updatePeriod );
135 // Pass ownership to CustomActor
136 Dali::WidgetView::WidgetView widgetView( *internalWidgetView );
138 // Second-phase init of the implementation
139 // This can only be done after the CustomActor connection has been made...
140 internalWidgetView->Initialize();
145 WidgetView::WidgetView()
146 : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
154 mUpdatePeriod( 0.0 ),
155 mPreviewVisible( true ),
156 mStateTextVisible( true ),
157 mPermanentDelete( false ),
158 mRemoteSurface( NULL )
162 WidgetView::WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod )
163 : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
164 mWidgetId( widgetId ),
166 mContentInfo( contentInfo ),
171 mUpdatePeriod( updatePeriod ),
172 mPreviewVisible( true ),
173 mStateTextVisible( true ),
174 mPermanentDelete( false ),
175 mRemoteSurface( NULL )
179 WidgetView::~WidgetView()
181 if( !mWidgetId.empty() && !mInstanceId.empty() )
183 widget_instance_terminate( mInstanceId.c_str() );
185 if( mPermanentDelete )
187 widget_instance_destroy( mInstanceId.c_str() );
192 bool WidgetView::PauseWidget()
194 int ret = widget_instance_pause( mInstanceId.c_str() );
197 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::PauseWidget: Fail to pause widget(%s, %s) [%d]\n", mWidgetId.c_str(), mInstanceId.c_str(), ret );
201 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::PauseWidget: Widget is paused (%s, %s)\n", mWidgetId.c_str(), mInstanceId.c_str() );
206 bool WidgetView::ResumeWidget()
208 int ret = widget_instance_resume( mInstanceId.c_str() );
211 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ResumeWidget: Fail to resume widget(%s, %s) [%d]\n", mWidgetId.c_str(), mInstanceId.c_str(), ret );
215 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ResumeWidget: Widget is resumed (%s, %s)\n", mWidgetId.c_str(), mInstanceId.c_str() );
220 const std::string& WidgetView::GetWidgetId() const
225 const std::string& WidgetView::GetInstanceId() const
230 const std::string& WidgetView::GetContentInfo()
232 widget_instance_h instance;
233 char* contentInfo = NULL;
235 mContentInfo.clear();
237 if( mWidgetId.empty() || mInstanceId.empty() )
239 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::GetContentInfo: Widget id (%s) or instance id (%s) is invalid.\n", mWidgetId.c_str(), mInstanceId.c_str() );
243 instance = widget_instance_get_instance( mWidgetId.c_str(), mInstanceId.c_str() );
246 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::GetContentInfo: widget_instance_get_instance is failed. [%s]\n", mInstanceId.c_str() );
250 if( widget_instance_get_content( instance, &contentInfo ) < 0 )
252 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::GetContentInfo: Failed to get content of widget. [%s]\n", mInstanceId.c_str() );
256 mContentInfo = reinterpret_cast< char* >( contentInfo );
261 const std::string& WidgetView::GetTitle()
263 //ToDo: We should add some codes by considering widget_viewer_evas
266 mTitle = widget_service_get_name( mWidgetId.c_str(), NULL );
269 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::GetTitle: title = %s\n", mTitle.c_str() );
274 float WidgetView::GetUpdatePeriod() const
276 return mUpdatePeriod;
279 bool WidgetView::CancelTouchEvent()
283 tizen_remote_surface_transfer_touch_cancel( mRemoteSurface );
290 void WidgetView::ShowPreview( bool show )
292 if( mPreviewImage && show != mPreviewVisible )
294 mPreviewVisible = show;
295 mPreviewImage.SetVisible( show );
299 bool WidgetView::IsPreviewVisible()
301 return mPreviewVisible;
304 void WidgetView::ShowStateText( bool show )
306 if( mStateText && mStateTextVisible != show )
308 mStateTextVisible = show;
309 mStateText.SetVisible( show );
313 bool WidgetView::IsStateTextVisible()
315 return mStateTextVisible;
318 void WidgetView::ActivateFaultedWidget()
322 // Esable preview and text
323 if( mPreviewVisible )
325 mPreviewImage.SetVisible( true );
328 if( mStateTextVisible )
330 mStateText.SetVisible( true );
333 // launch widget again
334 mPid = widget_instance_launch( mInstanceId.c_str(), (char *)mContentInfo.c_str(), mWidth, mHeight );
337 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ActivateFaultedWidget: widget_instance_launch is failed. [%s]\n", mWidgetId.c_str() );
340 Dali::WidgetView::WidgetView handle( GetOwner() );
341 mWidgetCreationAbortedSignal.Emit( handle );
346 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ActivateFaultedWidget: widget_instance_launch is called. [%s, mPid = %d]\n", mWidgetId.c_str(), mPid );
350 bool WidgetView::IsWidgetFaulted()
352 return mPid < 0 ? true : false;
355 void WidgetView::SetPermanentDelete( bool permanentDelete )
357 mPermanentDelete = permanentDelete;
360 bool WidgetView::IsPermanentDelete()
362 return mPermanentDelete;
365 void WidgetView::CreateWidgetImageView()
368 mImageSource = Dali::NativeImageSource::New( source );
369 Dali::NativeImage image = Dali::NativeImage::New( *mImageSource );
371 mWidgetImageView = Dali::Toolkit::ImageView::New( image );
373 mWidgetImageView.SetParentOrigin( ParentOrigin::CENTER );
374 mWidgetImageView.SetAnchorPoint( AnchorPoint::CENTER );
375 mWidgetImageView.SetSize( mWidth, mHeight );
377 Self().Add( mWidgetImageView );
379 // Disable preview and text
380 if( mPreviewVisible )
382 mPreviewImage.SetVisible( false );
385 if( mStateTextVisible )
387 mStateText.SetVisible( false );
391 Dali::WidgetView::WidgetView handle( GetOwner() );
392 mWidgetAddedSignal.Emit( handle );
394 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::AddObjectView: ObjectView is added.\n" );
397 void WidgetView::RemoveObjectView()
399 // Enable preview and text
400 if( mPreviewVisible )
402 mPreviewImage.SetVisible( true );
405 if( mStateTextVisible )
407 mStateText.SetVisible( true );
411 Dali::WidgetView::WidgetView handle( GetOwner() );
412 mWidgetDeletedSignal.Emit( handle );
414 mWidgetImageView.Reset();
416 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::RemoveObjectView: ObjectView is removed.\n" );
419 void WidgetView::SendWidgetEvent( int event )
421 Dali::WidgetView::WidgetView handle( GetOwner() );
423 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::SendWidgetEvent: event = %d widget = %s\n", event, mWidgetId.c_str() );
428 case WIDGET_INSTANCE_EVENT_UPDATE:
430 mWidgetContentUpdatedSignal.Emit( handle );
433 case WIDGET_INSTANCE_EVENT_PERIOD_CHANGED:
435 mWidgetUpdatePeriodChangedSignal.Emit( handle );
438 case WIDGET_INSTANCE_EVENT_FAULT:
440 mWidgetFaultedSignal.Emit( handle );
450 bool WidgetView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
452 Dali::BaseHandle handle( object );
454 bool connected( true );
455 Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( handle );
457 if( strcmp( signalName.c_str(), SIGNAL_WIDGET_ADDED ) == 0 )
459 widgetView.WidgetAddedSignal().Connect( tracker, functor );
461 else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_DELETED ) == 0 )
463 widgetView.WidgetDeletedSignal().Connect( tracker, functor );
465 else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_CREATION_ABORTED ) == 0 )
467 widgetView.WidgetCreationAbortedSignal().Connect( tracker, functor );
469 else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_CONTENT_UPDATED ) == 0 )
471 widgetView.WidgetContentUpdatedSignal().Connect( tracker, functor );
473 else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_UPDATE_PERIOD_CHANGED ) == 0 )
475 widgetView.WidgetUpdatePeriodChangedSignal().Connect( tracker, functor );
477 else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_FAULTED ) == 0 )
479 widgetView.WidgetFaultedSignal().Connect( tracker, functor );
483 // signalName does not match any signal
490 bool WidgetView::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
494 Dali::BaseHandle handle( object );
495 Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( handle );
502 WidgetView& impl = GetImplementation( widgetView );
504 if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_PAUSE_WIDGET ) == 0 )
508 else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_RESUME_WIDGET ) == 0 )
512 else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_CANCEL_TOUCH_EVENT ) == 0 )
514 impl.CancelTouchEvent();
516 else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_ACTIVATE_FAULTED_WIDGET ) == 0 )
518 impl.ActivateFaultedWidget();
528 void WidgetView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
530 Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( Dali::BaseHandle( object ) );
534 WidgetView& impl = GetImplementation( widgetView );
538 case Dali::WidgetView::WidgetView::Property::PREVIEW:
541 if( value.Get( previewEnabled ) )
543 impl.ShowPreview( previewEnabled );
547 case Dali::WidgetView::WidgetView::Property::LOADING_TEXT:
550 if( value.Get( textEnabled ) )
552 impl.ShowStateText( textEnabled );
556 case Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE:
559 if( value.Get( del ) )
561 impl.SetPermanentDelete( del );
569 Property::Value WidgetView::GetProperty( BaseObject* object, Property::Index index )
571 Property::Value value;
572 Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( Dali::BaseHandle( object ) );
576 WidgetView& impl = GetImplementation( widgetView );
580 case Dali::WidgetView::WidgetView::Property::WIDGET_ID:
582 value = impl.GetWidgetId();
585 case Dali::WidgetView::WidgetView::Property::INSTANCE_ID:
587 value = impl.GetInstanceId();
590 case Dali::WidgetView::WidgetView::Property::CONTENT_INFO:
592 value = impl.GetContentInfo();
595 case Dali::WidgetView::WidgetView::Property::TITLE:
597 value = impl.GetTitle();
600 case Dali::WidgetView::WidgetView::Property::UPDATE_PERIOD:
602 value = impl.GetUpdatePeriod();
605 case Dali::WidgetView::WidgetView::Property::PREVIEW:
607 value = impl.IsPreviewVisible();
610 case Dali::WidgetView::WidgetView::Property::LOADING_TEXT:
612 value = impl.IsStateTextVisible();
615 case Dali::WidgetView::WidgetView::Property::WIDGET_STATE_FAULTED:
617 value = impl.IsWidgetFaulted();
620 case Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE:
622 value = impl.IsPermanentDelete();
631 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetAddedSignal()
633 return mWidgetAddedSignal;
636 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetDeletedSignal()
638 return mWidgetDeletedSignal;
641 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetCreationAbortedSignal()
643 return mWidgetCreationAbortedSignal;
646 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetContentUpdatedSignal()
648 return mWidgetContentUpdatedSignal;
651 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetUpdatePeriodChangedSignal()
653 return mWidgetUpdatePeriodChangedSignal;
656 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetFaultedSignal()
658 return mWidgetFaultedSignal;
661 void WidgetView::OnInitialize()
663 char* instanceId = NULL;
664 char* previewPath = NULL;
665 std::string previewImage;
666 widget_size_type_e sizeType;
668 int ret = widget_instance_create( mWidgetId.c_str(), &instanceId );
669 if( ret < 0 || !instanceId )
671 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_create is failed [%s].\n", mWidgetId.c_str() );
675 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_create is called. [widget id = %s, instance id = %s]\n",
676 mWidgetId.c_str(), instanceId );
678 mInstanceId = instanceId;
681 widget_service_get_size_type( mWidth, mHeight, &sizeType );
683 previewPath = widget_service_get_preview_image_path( mWidgetId.c_str(), sizeType );
686 previewImage = previewPath;
691 previewImage = tzplatform_getenv( TZ_SYS_SHARE );
692 previewImage.append( WIDGET_VIEW_RESOURCE_DEFAULT_IMG );
695 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: preview image path = %s\n", previewImage.c_str() );
697 mPreviewImage = Toolkit::ImageView::New( previewImage );
699 mPreviewImage.SetParentOrigin( ParentOrigin::CENTER );
700 mPreviewImage.SetAnchorPoint( AnchorPoint::CENTER );
704 mPreviewImage.SetSize( mWidth, mHeight );
707 Self().SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
708 Self().SetSize( mWidth, mHeight );
710 Self().Add( mPreviewImage );
713 // TODO: use po files
714 mStateText = Toolkit::TextLabel::New( "Loading..." );
716 mStateText.SetParentOrigin( ParentOrigin::CENTER );
717 mStateText.SetAnchorPoint( AnchorPoint::CENTER );
718 mStateText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
719 mStateText.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
721 mPreviewImage.Add( mStateText );
724 mPid = widget_instance_launch( instanceId, (char *)mContentInfo.c_str(), mWidth, mHeight );
727 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is failed. [%s]\n", mWidgetId.c_str() );
730 Dali::WidgetView::WidgetView handle( GetOwner() );
731 mWidgetCreationAbortedSignal.Emit( handle );
736 aul_rsm_viewer_set_surface_handler( mInstanceId.c_str(), &remoteSurfaceHandler, this );
738 DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is called. [%s, mPid = %d]\n", mWidgetId.c_str(), mPid );
742 void WidgetView::OnStageConnection( int depth )
744 Control::OnStageConnection( depth );
747 void WidgetView::OnStageDisconnection()
749 Control::OnStageDisconnection();
752 void WidgetView::OnSizeSet( const Vector3& targetSize )
754 if( mWidgetImageView )
756 mWidgetImageView.SetSize( targetSize );
760 bool WidgetView::IsWidgetImageView()
762 return ( mWidgetImageView )? true: false;
765 void WidgetView::UpdateImageSource( tbm_surface_h source )
767 mImageSource->SetSource( source );
768 Dali::Stage::GetCurrent().KeepRendering( 0.0f );
771 void WidgetView::ConnectSignal( tizen_remote_surface* surface )
773 if( mWidgetImageView && surface )
775 mRemoteSurface = surface;
777 Self().TouchSignal().Connect( this, &WidgetView::OnTouch );
778 Self().WheelEventSignal().Connect( this, &WidgetView::OnWheelEvent );
783 bool WidgetView::OnTouch( Dali::Actor actor, const Dali::TouchData& event )
785 tizen_remote_surface_event_type type = TIZEN_REMOTE_SURFACE_EVENT_TYPE_NONE;
787 if( event.GetPointCount() == 0 || mRemoteSurface == NULL )
792 switch( event.GetState( 0 ) )
794 case Dali::PointState::UP:
796 type = TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP;
799 case Dali::PointState::DOWN:
801 type = TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_DOWN;
804 case Dali::PointState::MOTION:
806 type = TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE;
817 if( type == TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE )
822 Vector2 localPos = event.GetLocalPosition( 0 );
824 tizen_remote_surface_transfer_mouse_event( mRemoteSurface,
830 wl_fixed_from_double( event.GetEllipseRadius( 0 ).x ),
831 wl_fixed_from_double( event.GetEllipseRadius( 0 ).y ),
832 wl_fixed_from_double( event.GetPressure( 0 ) ),
833 wl_fixed_from_double( event.GetAngle( 0 ).degree ),
834 TIZEN_INPUT_DEVICE_CLAS_TOUCHSCREEN,
835 TIZEN_INPUT_DEVICE_SUBCLAS_NONE,
842 bool WidgetView::OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event )
844 if( mRemoteSurface == NULL )
848 //ToDo: We should check TIZEN_INPUT_DEVICE_CLAS_MOUSE
849 tizen_remote_surface_transfer_mouse_wheel( mRemoteSurface,
852 TIZEN_INPUT_DEVICE_CLAS_MOUSE,
853 TIZEN_INPUT_DEVICE_SUBCLAS_NONE,
860 Vector3 WidgetView::GetNaturalSize()
866 if( size.x > 0 && size.y > 0 )
868 size.z = std::min( size.x, size.y );
873 return Control::GetNaturalSize();
877 float WidgetView::GetHeightForWidth( float width )
879 if( mWidth > 0 && mHeight > 0 )
881 return GetHeightForWidthBase( width );
885 return Control::GetHeightForWidthBase( width );
889 float WidgetView::GetWidthForHeight( float height )
891 if( mWidth > 0 && mHeight > 0 )
893 return GetWidthForHeightBase( height );
897 return Control::GetWidthForHeightBase( height );
901 void WidgetView::CloseRemoteSurface()
903 aul_rsm_viewer_unset_surface_handler( mInstanceId.c_str() );
904 mRemoteSurface = NULL;
907 } // namespace Internal
909 } // namespace WidgetView