From 9e17b6e979301cad6cde927ba4468be2d222c68b Mon Sep 17 00:00:00 2001 From: taeyoon Date: Tue, 20 Dec 2016 20:31:48 +0900 Subject: [PATCH] Added property map for loading text and changed default color and style Added property map for changing loading text size, font style and color Changed text color, and font style Change-Id: Ib7bbb2890daf0c931f91e8a8441fd3382eec5c5c --- .../internal/widget_view/widget_view_impl.cpp | 43 +++++++++++++++++++ .../internal/widget_view/widget_view_impl.h | 2 + 2 files changed, 45 insertions(+) diff --git a/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp b/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp index 346e7ee7..9be9ba39 100644 --- a/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp +++ b/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp @@ -89,6 +89,10 @@ DALI_TYPE_REGISTRATION_END() struct wl_buffer* preBuffer; +const char* const FONT_STYLE( "fontStyle" ); +const char* const TEXT_POINT_SIZE( "textPointSize" ); +const char* const TEXT_COLOR( "textColor" ); + 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, const char *appid, const char *instance_id, const int pid, void *data) @@ -553,6 +557,7 @@ void WidgetView::SetProperty( BaseObject* object, Property::Index index, const P case Dali::WidgetView::WidgetView::Property::PREVIEW: { bool previewEnabled; + if( value.Get( previewEnabled ) ) { impl.ShowPreview( previewEnabled ); @@ -562,10 +567,16 @@ void WidgetView::SetProperty( BaseObject* object, Property::Index index, const P case Dali::WidgetView::WidgetView::Property::LOADING_TEXT: { bool textEnabled; + Property::Map map; + if( value.Get( textEnabled ) ) { impl.ShowStateText( textEnabled ); } + else if( value.Get( map ) ) + { + impl.SetLoadingTextPropertyMap( map ); + } break; } case Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE: @@ -738,6 +749,8 @@ void WidgetView::OnInitialize() mStateText.SetAnchorPoint( AnchorPoint::CENTER ); mStateText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); mStateText.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); + mStateText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Dali::Color::WHITE ); + mStateText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, "Bold" ); mPreviewActor.Add( mStateTextActor ); mStateTextActor.Add( mStateText ); @@ -928,6 +941,36 @@ void WidgetView::CloseRemoteSurface() mRemoteSurface = NULL; } +void WidgetView::SetLoadingTextPropertyMap( Property::Map map ) +{ + if( mStateText ) + { + Property::Value* fontStyle = map.Find( FONT_STYLE ); + std::string style; + + if( fontStyle && fontStyle->Get( style ) ) + { + mStateText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, style ); + } + + Property::Value* textPointSize = map.Find( TEXT_POINT_SIZE ); + float size = 0.f; + + if( textPointSize && textPointSize->Get( size ) ) + { + mStateText.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, size ); + } + + Property::Value* textColor = map.Find( TEXT_COLOR ); + Vector4 color; + + if( textColor && textColor->Get( color ) ) + { + mStateText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, color ); + } + } +} + } // namespace Internal } // namespace WidgetView diff --git a/widget_viewer_dali/internal/widget_view/widget_view_impl.h b/widget_viewer_dali/internal/widget_view/widget_view_impl.h index 3d3079d1..9c5cef6c 100644 --- a/widget_viewer_dali/internal/widget_view/widget_view_impl.h +++ b/widget_viewer_dali/internal/widget_view/widget_view_impl.h @@ -143,6 +143,8 @@ public: // Internal API void CloseRemoteSurface(); + void SetLoadingTextPropertyMap( Dali::Property::Map map ); + public: //Signals /** -- 2.34.1