+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::RemoveWidgetImage: Widget image is removed.\n" );
+}
+
+void WidgetView::TerminateWidget()
+{
+ if( !mWidgetId.empty() && !mInstanceId.empty() )
+ {
+ widget_instance_terminate( mInstanceId.c_str() );
+
+ if( mPermanentDelete )
+ {
+ widget_instance_destroy( mInstanceId.c_str() );
+ }
+
+ Dali::WidgetView::WidgetView handle( GetOwner() );
+ mWidgetTerminatedSignal.Emit( handle );
+ mWidgetDeletedSignal.Emit( handle );
+
+ mWidgetId.clear();
+ mInstanceId.clear();
+
+ CloseRemoteSurface();
+ }
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::TerminateWidget: Widget is terminated/destroyed and deleted signal is emitted.\n" );
+
+}
+
+void WidgetView::SendWidgetEvent( int event )
+{
+ Dali::WidgetView::WidgetView handle( GetOwner() );
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::SendWidgetEvent: event = %d widget = %s\n", event, mWidgetId.c_str() );
+
+ // Emit signal
+ switch( event )
+ {
+ case WIDGET_INSTANCE_EVENT_UPDATE:
+ case WIDGET_INSTANCE_EVENT_EXTRA_UPDATED:
+ {
+ mWidgetContentUpdatedSignal.Emit( handle );
+ break;
+ }
+ case WIDGET_INSTANCE_EVENT_PERIOD_CHANGED:
+ {
+ mWidgetUpdatePeriodChangedSignal.Emit( handle );
+ break;
+ }
+ case WIDGET_INSTANCE_EVENT_FAULT:
+ {
+ mPid = -1;
+ ShowRetryState( true );
+ mWidgetFaultedSignal.Emit( handle );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+}
+
+bool WidgetView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected( true );
+ Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( handle );
+
+ if( strcmp( signalName.c_str(), SIGNAL_WIDGET_ADDED ) == 0 )
+ {
+ widgetView.WidgetAddedSignal().Connect( tracker, functor );
+ }
+ else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_DELETED ) == 0 )
+ {
+ widgetView.WidgetDeletedSignal().Connect( tracker, functor );
+ }
+ else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_CREATION_ABORTED ) == 0 )
+ {
+ widgetView.WidgetCreationAbortedSignal().Connect( tracker, functor );
+ }
+ else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_CONTENT_UPDATED ) == 0 )
+ {
+ widgetView.WidgetContentUpdatedSignal().Connect( tracker, functor );
+ }
+ else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_UPDATE_PERIOD_CHANGED ) == 0 )
+ {
+ widgetView.WidgetUpdatePeriodChangedSignal().Connect( tracker, functor );
+ }
+ else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_FAULTED ) == 0 )
+ {
+ widgetView.WidgetFaultedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+bool WidgetView::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+{
+ bool ret = true;
+
+ Dali::BaseHandle handle( object );
+ Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( handle );
+
+ if( !widgetView )
+ {
+ return false;
+ }
+
+ WidgetView& impl = GetImplementation( widgetView );
+
+ if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_PAUSE_WIDGET ) == 0 )
+ {
+ impl.PauseWidget();
+ }
+ else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_RESUME_WIDGET ) == 0 )
+ {
+ impl.ResumeWidget();
+ }
+ else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_CANCEL_TOUCH_EVENT ) == 0 )
+ {
+ impl.CancelTouchEvent();
+ }
+ else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_ACTIVATE_FAULTED_WIDGET ) == 0 )
+ {
+ impl.ActivateFaultedWidget();
+ }
+ else
+ {
+ ret = false;
+ }
+
+ return ret;
+}
+
+void WidgetView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( Dali::BaseHandle( object ) );
+
+ if( widgetView )
+ {
+ WidgetView& impl = GetImplementation( widgetView );
+
+ switch( index )
+ {
+ case Dali::WidgetView::WidgetView::Property::PREVIEW:
+ {
+ bool previewEnabled;
+
+ if( value.Get( previewEnabled ) )
+ {
+ impl.SetPreviewVisible( previewEnabled );
+ }
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::LOADING_TEXT:
+ {
+ bool textEnabled;
+ Property::Map map;
+
+ if( value.Get( textEnabled ) )
+ {
+ impl.SetLoadingTextVisible( textEnabled );
+ }
+ else if( value.Get( map ) )
+ {
+ impl.SetLoadingTextPropertyMap( map );
+ }
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE:
+ {
+ bool permanent;
+ if( value.Get( permanent ) )
+ {
+ impl.SetPermanentDelete( permanent );
+ }
+ break;
+ }
+ }
+ }
+}
+
+Property::Value WidgetView::GetProperty( BaseObject* object, Property::Index index )
+{
+ Property::Value value;
+ Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( Dali::BaseHandle( object ) );
+
+ if( widgetView )
+ {
+ WidgetView& impl = GetImplementation( widgetView );
+
+ switch( index )
+ {
+ case Dali::WidgetView::WidgetView::Property::WIDGET_ID:
+ {
+ value = impl.GetWidgetId();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::INSTANCE_ID:
+ {
+ value = impl.GetInstanceId();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::CONTENT_INFO:
+ {
+ value = impl.GetContentInfo();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::TITLE:
+ {
+ value = impl.GetTitle();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::UPDATE_PERIOD:
+ {
+ value = impl.GetUpdatePeriod();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::PREVIEW:
+ {
+ value = impl.IsPreviewVisible();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::LOADING_TEXT:
+ {
+ value = impl.IsLoadingTextVisible();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::WIDGET_STATE_FAULTED:
+ {
+ value = impl.IsWidgetFaulted();
+ break;
+ }
+ case Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE:
+ {
+ value = impl.IsPermanentDelete();
+ break;
+ }
+ }
+ }
+
+ return value;