From c1abb9a303c0ee114367accad6cace6f6101c632 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/internal/widget_view/widget_view_impl.cpp b/internal/widget_view/widget_view_impl.cpp index 346e7ee..9be9ba3 100644 --- a/internal/widget_view/widget_view_impl.cpp +++ b/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/internal/widget_view/widget_view_impl.h b/internal/widget_view/widget_view_impl.h index 3d3079d..9c5cef6 100644 --- a/internal/widget_view/widget_view_impl.h +++ b/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