+ if( mWatcherHandle != NULL )
+ {
+ if( remoteSurface != NULL && preBuffer != NULL && tizen_remote_surface_get_version( remoteSurface ) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION )
+ {
+ tizen_remote_surface_release( remoteSurface, preBuffer );
+ tbm_surface_h preTbmSurface = (tbm_surface_h)wl_buffer_get_user_data( preBuffer );
+ tbm_surface_internal_unref( preTbmSurface );
+ wl_buffer_destroy( preBuffer );
+ preBuffer = NULL;
+ }
+
+ screen_connector_toolkit_remove( mWatcherHandle );
+ mWatcherHandle = NULL;
+ mRemoteSurface = NULL;
+ mPid = -1;
+ }
+}
+
+void WidgetView::ShowLoadingState( bool show )
+{
+ if( mPreviewImage && mPreviewVisible )
+ {
+ mPreviewImage.SetVisible( show );
+ }
+
+ if( mLoadingText && mLoadingTextVisible )
+ {
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT,
+ ( mLoadingTextString.empty() )? GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) : mLoadingTextString );
+ mLoadingText.SetVisible( show );
+ }
+}
+
+void WidgetView::ShowRetryState( bool show )
+{
+ if( mPreviewImage && mPreviewVisible )
+ {
+ mPreviewImage.SetVisible( false );
+ }
+
+ if( mRetryText && mRetryTextVisible )
+ {
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::TEXT,
+ ( mRetryTextString.empty() )? GET_LOCALE_TEXT( "IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY" ) : mRetryTextString );
+ mRetryText.SetVisible( show );
+ mRetryState = show;
+ }
+}
+
+void WidgetView::SetLoadingTextPropertyMap( Property::Map map )
+{
+ if( mLoadingText )
+ {
+ Property::Value* loadingText = map.Find( STATE_TEXT );
+ std::string text;
+ if( loadingText && loadingText->Get( text ) )
+ {
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT, text );
+ mLoadingTextString = text;
+ }
+
+ Property::Value* fontStyle = map.Find( FONT_STYLE );
+ std::string style;
+
+ if( fontStyle && fontStyle->Get( style ) )
+ {
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, style );
+ }
+
+ Property::Value* textPointSize = map.Find( TEXT_POINT_SIZE );
+ float size = 0.f;
+
+ if( textPointSize && textPointSize->Get( size ) )
+ {
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, size );
+ }
+
+ Property::Value* textColor = map.Find( TEXT_COLOR );
+ Vector4 color;
+
+ if( textColor && textColor->Get( color ) )
+ {
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, color );
+ }
+ }
+}
+
+void WidgetView::SetRetryTextPropertyMap( Property::Map map )
+{
+ if( mRetryText )
+ {
+ Property::Value* retryText = map.Find( STATE_TEXT );
+ std::string text;
+ if( retryText && retryText->Get( text ) )
+ {
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::TEXT, text );
+ mRetryTextString = text;
+ }
+
+ Property::Value* fontStyle = map.Find( FONT_STYLE );
+ std::string style;
+
+ if( fontStyle && fontStyle->Get( style ) )
+ {
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, style );
+ }
+
+ Property::Value* textPointSize = map.Find( TEXT_POINT_SIZE );
+ float size = 0.f;
+
+ if( textPointSize && textPointSize->Get( size ) )
+ {
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, size );
+ }
+
+ Property::Value* textColor = map.Find( TEXT_COLOR );
+ Vector4 color;
+
+ if( textColor && textColor->Get( color ) )
+ {
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, color );
+ }
+
+ Property::Value* textVisible = map.Find( TEXT_VISIBLE );
+ bool visible = true;
+ if( textVisible && textVisible->Get( visible ) )
+ {
+ SetRetryTextVisible( visible );
+ }
+ }
+}
+
+void WidgetView::SetWidgetImagePropertyMap( Property::Map map )
+{
+ mWidgetImagePropertyMap = map;
+ if( mWidgetImageView )
+ {
+ mWidgetImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
+ }
+}
+
+float WidgetView::TextPixelToPointSize( int pixelSize )
+{
+ Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi();
+ float meanDpi = (dpi.height + dpi.width) / 2.0f;
+
+ return (pixelSize * 72.0f) / meanDpi;