{
}
+void WidgetView::InitializeWidgets()
+{
+ auto self = Self();
+ char* instanceId = NULL;
+
+ int ret = widget_instance_create( mWidgetId.c_str(), &instanceId );
+ if( ret < 0 || !instanceId )
+ {
+ DALI_LOG_ERROR("WidgetView::InitializeWidgets: widget_instance_create is failed [%s].\n", mWidgetId.c_str() );
+ return;
+ }
+
+ DALI_LOG_RELEASE_INFO("WidgetView::InitializeWidgets: widget_instance_create is called. [widget id = %s, instance id = %s] [%p]\n",
+ mWidgetId.c_str(), instanceId, this );
+
+ mInstanceId = instanceId;
+
+ SetUpdatePeriod();
+ SetPreviewImage();
+}
+
+void WidgetView::SetUpdatePeriod()
+{
+ // Set UpdatePeriod
+ if( mUpdatePeriod > 0.0f)
+ {
+ widget_instance_h instance = widget_instance_get_instance( mWidgetId.c_str(), mInstanceId.c_str() );
+ if( !instance )
+ {
+ DALI_LOG_ERROR("WidgetView::SetUpdatePeriod: widget_instance_get_instance is failed. [%s]\n", mInstanceId.c_str() );
+ return;
+ }
+
+ int ret = widget_instance_set_period( instance, mUpdatePeriod );
+ widget_instance_unref(instance);
+ if( ret < 0 )
+ {
+ DALI_LOG_ERROR("WidgetView::SetUpdatePeriod: widget_instance_set_period is failed [%s].\n", mWidgetId.c_str() );
+ return;
+ }
+ }
+}
+
+void WidgetView::SetPreviewImage()
+{
+ auto self = Self();
+ char* previewPath = NULL;
+ std::string previewImage;
+ widget_size_type_e sizeType;
+
+ // Preview image
+ widget_service_get_size_type( mWidgetWidth, mWidgetHeight, &sizeType );
+
+ previewPath = widget_service_get_preview_image_path( mWidgetId.c_str(), sizeType );
+ if( previewPath )
+ {
+ previewImage = previewPath;
+ free( previewPath );
+ }
+ else
+ {
+ previewImage = WIDGET_VIEW_RESOURCE_DEFAULT_IMG;
+ }
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::SetPreviewImage: preview image path = %s [%p]\n", previewImage.c_str(), this );
+
+ mPreviewActor = Dali::Actor::New();
+ mPreviewActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mPreviewActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mPreviewActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+ mPreviewImage = Toolkit::ImageView::New( previewImage );
+ mPreviewImage.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mPreviewImage.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mPreviewImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+ self.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
+ self.SetProperty( Actor::Property::SIZE, Vector2(mWidgetWidth, mWidgetHeight));
+
+ self.Add( mPreviewActor );
+ mPreviewActor.Add( mPreviewImage );
+}
+
+void WidgetView::InitializeLayout()
+{
+ mStateTextActor = Dali::Actor::New();
+ mStateTextActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mStateTextActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mStateTextActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+ // Loading text
+ mLoadingText = Toolkit::TextLabel::New( ( mLoadingTextString.empty() )? GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) : mLoadingTextString );
+ mLoadingText.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mLoadingText.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Dali::Color::WHITE );
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, "Bold" );
+ mLoadingText.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, TextPixelToPointSize( DEFAULT_FONT_PIXEL_SIZE ) );
+
+ mPreviewActor.Add( mStateTextActor );
+ mStateTextActor.Add( mLoadingText );
+
+ // Retry text
+ mRetryText = Toolkit::TextLabel::New( ( mRetryTextString.empty() )? GET_LOCALE_TEXT( "IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY" ) : mRetryTextString );
+ mRetryText.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mRetryText.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Dali::Color::WHITE );
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, "Bold" );
+ mRetryText.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, TextPixelToPointSize( DEFAULT_FONT_PIXEL_SIZE ) );
+
+ mStateTextActor.Add( mRetryText );
+ mRetryText.SetProperty( Actor::Property::VISIBLE, false );
+
+}
+
+void WidgetView::InitializeEvents()
+{
+ auto self = Self();
+ self.TouchedSignal().Connect( this, &WidgetView::OnTouch );
+ self.WheelEventSignal().Connect( this, &WidgetView::OnWheelEvent );
+
+ // Accessibility
+ self.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::FILLER);
+ self.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, false);
+}
+
bool WidgetView::PauseWidget()
{
mPausedManually = true;
void WidgetView::OnInitialize()
{
- auto self = Self();
- char* instanceId = NULL;
- char* previewPath = NULL;
- std::string previewImage;
- widget_size_type_e sizeType;
-
- int ret = widget_instance_create( mWidgetId.c_str(), &instanceId );
- if( ret < 0 || !instanceId )
- {
- DALI_LOG_ERROR("WidgetView::OnInitialize: widget_instance_create is failed [%s].\n", mWidgetId.c_str() );
- return;
- }
-
- DALI_LOG_RELEASE_INFO("WidgetView::OnInitialize: widget_instance_create is called. [widget id = %s, instance id = %s] [%p]\n",
- mWidgetId.c_str(), instanceId, this );
-
- mInstanceId = instanceId;
-
- // Set UpdatePeriod
- if( mUpdatePeriod > 0.0f)
- {
- widget_instance_h instance = widget_instance_get_instance( mWidgetId.c_str(), mInstanceId.c_str() );
- if( !instance )
- {
- DALI_LOG_ERROR("WidgetView::OnInitialize: widget_instance_get_instance is failed. [%s]\n", mInstanceId.c_str() );
- return;
- }
- ret = widget_instance_set_period( instance, mUpdatePeriod );
- widget_instance_unref(instance);
- if( ret < 0 )
- {
- DALI_LOG_ERROR("WidgetView::OnInitialize: widget_instance_set_period is failed [%s].\n", mWidgetId.c_str() );
- return;
- }
- }
-
- // Preview image
- widget_service_get_size_type( mWidgetWidth, mWidgetHeight, &sizeType );
-
- previewPath = widget_service_get_preview_image_path( mWidgetId.c_str(), sizeType );
- if( previewPath )
- {
- previewImage = previewPath;
- free( previewPath );
- }
- else
- {
- previewImage = WIDGET_VIEW_RESOURCE_DEFAULT_IMG;
- }
-
- DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: preview image path = %s [%p]\n", previewImage.c_str(), this );
-
-
- mPreviewActor = Dali::Actor::New();
- mPreviewActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mPreviewActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mPreviewActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- mPreviewImage = Toolkit::ImageView::New( previewImage );
- mPreviewImage.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mPreviewImage.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mPreviewImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- self.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- self.SetProperty( Actor::Property::SIZE, Vector2(mWidgetWidth, mWidgetHeight));
-
- self.Add( mPreviewActor );
- mPreviewActor.Add( mPreviewImage );
-
- mStateTextActor = Dali::Actor::New();
- mStateTextActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mStateTextActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mStateTextActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- // Loading text
- mLoadingText = Toolkit::TextLabel::New( ( mLoadingTextString.empty() )? GET_LOCALE_TEXT( "IDS_ST_POP_LOADING_ING" ) : mLoadingTextString );
- mLoadingText.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mLoadingText.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mLoadingText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- mLoadingText.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
- mLoadingText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Dali::Color::WHITE );
- mLoadingText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, "Bold" );
- mLoadingText.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, TextPixelToPointSize( DEFAULT_FONT_PIXEL_SIZE ) );
-
- mPreviewActor.Add( mStateTextActor );
- mStateTextActor.Add( mLoadingText );
-
- // Retry text
- mRetryText = Toolkit::TextLabel::New( ( mRetryTextString.empty() )? GET_LOCALE_TEXT( "IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY" ) : mRetryTextString );
- mRetryText.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mRetryText.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mRetryText.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- mRetryText.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
- mRetryText.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Dali::Color::WHITE );
- mRetryText.SetProperty( Toolkit::TextLabel::Property::FONT_STYLE, "Bold" );
- mRetryText.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, TextPixelToPointSize( DEFAULT_FONT_PIXEL_SIZE ) );
-
- mStateTextActor.Add( mRetryText );
- mRetryText.SetProperty( Actor::Property::VISIBLE, false );
-
- // launch widget
+ InitializeWidgets();
+ InitializeLayout();
LaunchWidget();
- self.TouchedSignal().Connect( this, &WidgetView::OnTouch );
- self.WheelEventSignal().Connect( this, &WidgetView::OnWheelEvent );
-
- // Accessibility
- self.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::FILLER);
- self.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, false);
+ InitializeEvents();
}
Dali::Toolkit::DevelControl::ControlAccessible* WidgetView::CreateAccessibleObject()