// Internal property
// ToDo it should be changed public property.
const int TERMINATE_WIDGET = Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE+1;
+const int RETRY_TEXT = TERMINATE_WIDGET+1;
Dali::PropertyRegistration internalProperty1( typeRegistration, "terminateWidget", TERMINATE_WIDGET, Property::BOOLEAN, Dali::WidgetView::Internal::WidgetView::SetProperty, Dali::WidgetView::Internal::WidgetView::GetProperty );
+Dali::PropertyRegistration internalProperty2( typeRegistration, "retryText", RETRY_TEXT, Property::MAP, Dali::WidgetView::Internal::WidgetView::SetProperty, Dali::WidgetView::Internal::WidgetView::GetProperty );
// Signals
DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetAdded", SIGNAL_WIDGET_ADDED )
struct wl_buffer* preBuffer;
+const char* const STATE_TEXT( "stateText" );
const char* const FONT_STYLE( "fontStyle" );
const char* const TEXT_POINT_SIZE( "textPointSize" );
const char* const TEXT_COLOR( "textColor" );
+const char* const TEXT_VISIBLE( "textVisible" ); //ToDo: it should be removed after retry text property is public one
static void OnBufferUpdated( struct tizen_remote_surface *surface, uint32_t type, struct wl_buffer *buffer,
int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct wl_array *keys,
mUpdatePeriod( 0.0 ),
mPreviewVisible( true ),
mLoadingTextVisible( true ),
+ mLoadingTextString(),
mRetryTextVisible( true ),
+ mRetryTextString(),
mRetryState( false ),
mPermanentDelete( false ),
mWatcherHandle( NULL ),
mUpdatePeriod( updatePeriod ),
mPreviewVisible( true ),
mLoadingTextVisible( true ),
+ mLoadingTextString(),
mRetryTextVisible( true ),
+ mRetryTextString(),
mRetryState( false ),
mPermanentDelete( false ),
mWatcherHandle( NULL ),
if( visible )
{
- mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT, GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) );
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT,
+ ( mLoadingTextString.empty() )? GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) : mLoadingTextString );
}
mLoadingText.SetVisible( visible );
}
}
+void WidgetView::SetRetryTextVisible( bool visible )
+{
+ if( mRetryText && mRetryTextVisible != visible )
+ {
+ mRetryTextVisible = visible;
+
+ if( visible )
+ {
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::TEXT,
+ ( mRetryTextString.empty() )? GET_LOCALE_TEXT( "IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY" ) : mRetryTextString );
+ }
+ mRetryText.SetVisible( visible );
+ }
+}
+
bool WidgetView::IsLoadingTextVisible()
{
return mLoadingTextVisible;
}
+bool WidgetView::IsRetryTextVisible()
+{
+ return mRetryTextVisible;
+}
+
void WidgetView::ActivateFaultedWidget()
{
if( mPid < 0 )
impl.TerminateWidget();
}
}
+ case RETRY_TEXT:
+ {
+ Property::Map map;
+
+ if( value.Get( map ) )
+ {
+ impl.SetRetryTextPropertyMap( map );
+ }
+ break;
+ }
}
}
}
mStateTextActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
// Loading text
- mLoadingText = Toolkit::TextLabel::New( GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) );
+ mLoadingText = Toolkit::TextLabel::New( ( mLoadingTextString.empty() )? GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) : mLoadingTextString );
mLoadingText.SetParentOrigin( ParentOrigin::CENTER );
mLoadingText.SetAnchorPoint( AnchorPoint::CENTER );
mLoadingText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mStateTextActor.Add( mLoadingText );
// Retry text
- mRetryText = Toolkit::TextLabel::New( GET_LOCALE_TEXT( "IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY" ) );
+ mRetryText = Toolkit::TextLabel::New( ( mRetryTextString.empty() )? GET_LOCALE_TEXT( "IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY" ) : mRetryTextString );
mRetryText.SetParentOrigin( ParentOrigin::CENTER );
mRetryText.SetAnchorPoint( AnchorPoint::CENTER );
mRetryText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
if( mLoadingText && mLoadingTextVisible )
{
- mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT, GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) );
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT,
+ ( mLoadingTextString.empty() )? GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) : mLoadingTextString );
mLoadingText.SetVisible( show );
}
}
if( mRetryText && mRetryTextVisible )
{
- mRetryText.SetProperty( Toolkit::TextLabel::Property::TEXT, GET_LOCALE_TEXT( "IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY" ) );
+ 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;
}
{
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;
}
}
+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 );
+ }
+ }
+}
+
float WidgetView::TextPixelToPointSize( int pixelSize )
{
Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi();