Replace some APIs to property and clean up
authortaeyoon <taeyoon0.lee@samsung.com>
Wed, 26 Oct 2016 08:22:38 +0000 (17:22 +0900)
committertaeyoon <taeyoon0.lee@samsung.com>
Thu, 10 Nov 2016 01:56:10 +0000 (10:56 +0900)
Change-Id: Ie2722c24a59abbd8db42201c6cc2b75c566b0b46

internal/widget_view/widget_view_impl.cpp
internal/widget_view/widget_view_impl.h
internal/widget_view_manager/widget_view_manager_impl.cpp
internal/widget_view_manager/widget_view_manager_impl.h
public_api/widget_view/widget_view.cpp
public_api/widget_view/widget_view.h
public_api/widget_view_manager/widget_view_manager.cpp
public_api/widget_view_manager/widget_view_manager.h

index 16006a7..7c2f44b 100644 (file)
 #include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/events/wheel-event.h>
 #include <dali/public-api/images/native-image.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali/integration-api/debug.h>
 #include <string.h>
 #include <Ecore_Input.h>
@@ -52,6 +56,39 @@ namespace
 Integration::Log::Filter* gWidgetViewLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_WIDGET_VIEW" );
 #endif
 
+BaseHandle Create()
+{
+  return Dali::BaseHandle();
+}
+
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Dali::WidgetView::WidgetView, Toolkit::Control, Create );
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "widgetId", BOOLEAN, WIDGET_ID )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "instanceId", BOOLEAN, INSTANCE_ID )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "contentInfo", BOOLEAN, CONTENT_INFO )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "title", BOOLEAN, TITLE )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "updatePeriod", BOOLEAN, UPDATE_PERIOD )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "preview", MAP, PREVIEW )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "loadingText", MAP, LOADING_TEXT )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "widgetStateFaulted", BOOLEAN, WIDGET_STATE_FAULTED )
+DALI_PROPERTY_REGISTRATION( Dali::WidgetView, WidgetView, "permanentDelete", BOOLEAN, PERMANENT_DELETE )
+
+// Signals
+DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetAdded", SIGNAL_WIDGET_ADDED )
+DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetDeleted", SIGNAL_WIDGET_DELETED )
+DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetCreationAborted", SIGNAL_WIDGET_CREATION_ABORTED )
+DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetContentUpdated", SIGNAL_WIDGET_CONTENT_UPDATED )
+DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetUpdatePeriodChanged", SIGNAL_WIDGET_UPDATE_PERIOD_CHANGED )
+DALI_SIGNAL_REGISTRATION( Dali::WidgetView, WidgetView, "widgetFaulted", SIGNAL_WIDGET_FAULTED )
+
+// Actions
+DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "pauseWidget", ACTION_WIDGETVIEW_PAUSE_WIDGET );
+DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "resumeWidget", ACTION_WIDGETVIEW_RESUME_WIDGET );
+DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "cancelTouchEvent", ACTION_WIDGETVIEW_CANCEL_TOUCH_EVENT );
+DALI_ACTION_REGISTRATION( Dali::WidgetView, WidgetView, "activateFaultedWidget", ACTION_WIDGETVIEW_ACTIVATE_FAULTED_WIDGET );
+
+DALI_TYPE_REGISTRATION_END()
+
 static Eina_Bool OnKeyDown( void* data, int type, void* eventInfo )
 {
   Ecore_Event_Key *event = static_cast< Ecore_Event_Key* >( eventInfo );
@@ -118,7 +155,7 @@ static struct aul_rsm_handler_s remoteSurfaceHandler = {
 
 } // unnamed namespace
 
-Dali::WidgetView::WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
+Dali::WidgetView::WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod )
 {
   // Create the implementation, temporarily owned on stack
   IntrusivePtr< WidgetView > internalWidgetView = new WidgetView( widgetId, contentInfo, width, height, updatePeriod );
@@ -144,13 +181,13 @@ WidgetView::WidgetView()
   mHeight( 0 ),
   mPid( 0 ),
   mUpdatePeriod( 0.0 ),
-  mPreviewEnabled( true ),
-  mStateTextEnabled( true ),
+  mPreviewVisible( true ),
+  mStateTextVisible( true ),
   mPermanentDelete( true )
 {
 }
 
-WidgetView::WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
+WidgetView::WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod )
 : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
   mWidgetId( widgetId ),
   mInstanceId(),
@@ -161,8 +198,8 @@ WidgetView::WidgetView( const std::string& widgetId, const std::string& contentI
   mHeight( height ),
   mPid( 0 ),
   mUpdatePeriod( updatePeriod ),
-  mPreviewEnabled( true ),
-  mStateTextEnabled( true ),
+  mPreviewVisible( true ),
+  mStateTextVisible( true ),
   mPermanentDelete( true )
 {
 }
@@ -267,27 +304,11 @@ const std::string& WidgetView::GetTitle()
   return mTitle;
 }
 
-double WidgetView::GetUpdatePeriod() const
+float WidgetView::GetUpdatePeriod() const
 {
   return mUpdatePeriod;
 }
 
-void WidgetView::Show()
-{
-  if( mWidgetImageView )
-  {
-    mWidgetImageView.SetVisible( true );
-  }
-}
-
-void WidgetView::Hide()
-{
-  if( mWidgetImageView )
-  {
-    mWidgetImageView.SetVisible( false );
-  }
-}
-
 bool WidgetView::CancelTouchEvent()
 {
   if( mRemoteSurface )
@@ -299,34 +320,32 @@ bool WidgetView::CancelTouchEvent()
   return false;
 }
 
-void WidgetView::SetPreviewEnabled( bool enabled )
+void WidgetView::ShowPreview( bool show )
 {
-  mPreviewEnabled = enabled;
-
-  if( mPreviewImage )
+  if( mPreviewImage && show != mPreviewVisible )
   {
-    mPreviewImage.SetVisible( enabled );
+    mPreviewVisible = show;
+    mPreviewImage.SetVisible( show );
   }
 }
 
-bool WidgetView::GetPreviewEnabled() const
+bool WidgetView::IsPreviewVisible()
 {
-  return mPreviewEnabled;
+  return mPreviewVisible;
 }
 
-void WidgetView::SetStateTextEnabled( bool enabled )
+void WidgetView::ShowStateText( bool show )
 {
-  mStateTextEnabled = enabled;
-
-  if( mStateText )
+  if( mStateText && mStateTextVisible != show )
   {
-    mStateText.SetVisible( enabled );
+    mStateTextVisible = show;
+    mStateText.SetVisible( show );
   }
 }
 
-bool WidgetView::GetStateTextEnabled() const
+bool WidgetView::IsStateTextVisible()
 {
-  return mStateTextEnabled;
+  return mStateTextVisible;
 }
 
 void WidgetView::ActivateFaultedWidget()
@@ -334,12 +353,12 @@ void WidgetView::ActivateFaultedWidget()
   if( mPid < 0 )
   {
     // Esable preview and text
-    if( mPreviewEnabled )
+    if( mPreviewVisible )
     {
       mPreviewImage.SetVisible( true );
     }
 
-    if( mStateTextEnabled )
+    if( mStateTextVisible )
     {
       mStateText.SetVisible( true );
     }
@@ -371,6 +390,11 @@ void WidgetView::SetPermanentDelete( bool permanentDelete )
   mPermanentDelete = permanentDelete;
 }
 
+bool WidgetView::IsPermanentDelete()
+{
+  return mPermanentDelete;
+}
+
 void WidgetView::CreateWidgetImageView()
 {
   Any source;
@@ -386,12 +410,12 @@ void WidgetView::CreateWidgetImageView()
   Self().Add( mWidgetImageView );
 
   // Disable preview and text
-  if( mPreviewEnabled )
+  if( mPreviewVisible )
   {
     mPreviewImage.SetVisible( false );
   }
 
-  if( mStateTextEnabled )
+  if( mStateTextVisible )
   {
     mStateText.SetVisible( false );
   }
@@ -406,12 +430,12 @@ void WidgetView::CreateWidgetImageView()
 void WidgetView::RemoveObjectView()
 {
   // Enable preview and text
-  if( mPreviewEnabled )
+  if( mPreviewVisible )
   {
     mPreviewImage.SetVisible( true );
   }
 
-  if( mStateTextEnabled )
+  if( mStateTextVisible )
   {
     mStateText.SetVisible( true );
   }
@@ -444,26 +468,197 @@ void WidgetView::SendWidgetEvent( int event )
       mWidgetUpdatePeriodChangedSignal.Emit( handle );
       break;
     }
-    case WIDGET_INSTANCE_EVENT_SIZE_CHANGED:
+    case WIDGET_INSTANCE_EVENT_FAULT:
     {
-      mWidgetResizedSignal.Emit( handle );
+      mWidgetFaultedSignal.Emit( handle );
       break;
     }
-    case WIDGET_INSTANCE_EVENT_EXTRA_UPDATED:
+    default:
     {
-      mWidgetExtraInfoUpdatedSignal.Emit( handle );
       break;
     }
-    case WIDGET_INSTANCE_EVENT_FAULT:
+  }
+}
+
+bool WidgetView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+  Dali::BaseHandle handle( object );
+
+  bool connected( true );
+  Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( handle );
+
+  if( strcmp( signalName.c_str(), SIGNAL_WIDGET_ADDED ) == 0 )
+  {
+    widgetView.WidgetAddedSignal().Connect( tracker, functor );
+  }
+  else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_DELETED ) == 0 )
+  {
+    widgetView.WidgetDeletedSignal().Connect( tracker, functor );
+  }
+  else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_CREATION_ABORTED ) == 0 )
+  {
+    widgetView.WidgetCreationAbortedSignal().Connect( tracker, functor );
+  }
+  else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_CONTENT_UPDATED ) == 0 )
+  {
+    widgetView.WidgetContentUpdatedSignal().Connect( tracker, functor );
+  }
+  else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_UPDATE_PERIOD_CHANGED ) == 0 )
+  {
+    widgetView.WidgetUpdatePeriodChangedSignal().Connect( tracker, functor );
+  }
+  else if( strcmp( signalName.c_str(), SIGNAL_WIDGET_FAULTED ) == 0 )
+  {
+    widgetView.WidgetFaultedSignal().Connect( tracker, functor );
+  }
+  else
+  {
+    // signalName does not match any signal
+    connected = false;
+  }
+
+  return connected;
+}
+
+bool WidgetView::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+{
+  bool ret = true;
+
+  Dali::BaseHandle handle( object );
+  Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( handle );
+
+  if( !widgetView )
+  {
+    return false;
+  }
+
+  WidgetView& impl = GetImplementation( widgetView );
+
+  if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_PAUSE_WIDGET ) == 0 )
+  {
+    impl.PauseWidget();
+  }
+  else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_RESUME_WIDGET ) == 0 )
+  {
+    impl.ResumeWidget();
+  }
+  else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_CANCEL_TOUCH_EVENT ) == 0 )
+  {
+    impl.CancelTouchEvent();
+  }
+  else if( strcmp( actionName.c_str(), ACTION_WIDGETVIEW_ACTIVATE_FAULTED_WIDGET ) == 0 )
+  {
+    impl.ActivateFaultedWidget();
+  }
+  else
+  {
+    ret = false;
+  }
+
+  return ret;
+}
+
+void WidgetView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+  Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( Dali::BaseHandle( object ) );
+
+  if( widgetView )
+  {
+    WidgetView& impl = GetImplementation( widgetView );
+
+    switch( index )
     {
-      mWidgetFaultedSignal.Emit( handle );
-      break;
+      case Dali::WidgetView::WidgetView::Property::PREVIEW:
+      {
+        bool previewEnabled;
+        if( value.Get( previewEnabled ) )
+        {
+          impl.ShowPreview( previewEnabled );
+        }
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::LOADING_TEXT:
+      {
+        bool textEnabled;
+        if( value.Get( textEnabled ) )
+        {
+          impl.ShowStateText( textEnabled );
+        }
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE:
+      {
+        bool del;
+        if( value.Get( del ) )
+        {
+          impl.SetPermanentDelete( del );
+        }
+        break;
+      }
     }
-    default:
+  }
+}
+
+Property::Value WidgetView::GetProperty( BaseObject* object, Property::Index index )
+{
+  Property::Value value;
+  Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::DownCast( Dali::BaseHandle( object ) );
+
+  if( widgetView )
+  {
+    WidgetView& impl = GetImplementation( widgetView );
+
+    switch( index )
     {
-      break;
+      case Dali::WidgetView::WidgetView::Property::WIDGET_ID:
+      {
+        value = impl.GetWidgetId();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::INSTANCE_ID:
+      {
+        value = impl.GetInstanceId();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::CONTENT_INFO:
+      {
+        value = impl.GetContentInfo();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::TITLE:
+      {
+        value = impl.GetTitle();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::UPDATE_PERIOD:
+      {
+        value = impl.GetUpdatePeriod();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::PREVIEW:
+      {
+        value = impl.IsPreviewVisible();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::LOADING_TEXT:
+      {
+        value = impl.IsStateTextVisible();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::WIDGET_STATE_FAULTED:
+      {
+        value = impl.IsWidgetFaulted();
+        break;
+      }
+      case Dali::WidgetView::WidgetView::Property::PERMANENT_DELETE:
+      {
+        value = impl.IsPermanentDelete();
+        break;
+      }
     }
   }
+
+  return value;
 }
 
 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetAddedSignal()
@@ -481,21 +676,11 @@ Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetCreationAb
   return mWidgetCreationAbortedSignal;
 }
 
-Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetResizedSignal()
-{
-  return mWidgetResizedSignal;
-}
-
 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetContentUpdatedSignal()
 {
   return mWidgetContentUpdatedSignal;
 }
 
-Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetExtraInfoUpdatedSignal()
-{
-  return mWidgetExtraInfoUpdatedSignal;
-}
-
 Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetUpdatePeriodChangedSignal()
 {
   return mWidgetUpdatePeriodChangedSignal;
@@ -585,6 +770,16 @@ void WidgetView::OnInitialize()
 
 }
 
+void WidgetView::OnStageConnection( int depth )
+{
+  Control::OnStageConnection( depth );
+}
+
+void WidgetView::OnStageDisconnection()
+{
+  Control::OnStageDisconnection();
+}
+
 void WidgetView::OnSizeSet( const Vector3& targetSize )
 {
   if( mWidgetImageView )
@@ -673,6 +868,47 @@ bool WidgetView::OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event
   return true;
 }
 
+Vector3 WidgetView::GetNaturalSize()
+{
+  Vector3 size;
+  size.x = mWidth;
+  size.y = mHeight;
+
+  if( size.x > 0 && size.y > 0 )
+  {
+    size.z = std::min( size.x, size.y );
+    return size;
+  }
+  else
+  {
+    return Control::GetNaturalSize();
+  }
+}
+
+float WidgetView::GetHeightForWidth( float width )
+{
+  if( mWidth > 0 && mHeight > 0 )
+  {
+    return GetHeightForWidthBase( width );
+  }
+  else
+  {
+    return Control::GetHeightForWidthBase( width );
+  }
+}
+
+float WidgetView::GetWidthForHeight( float height )
+{
+  if( mWidth > 0 && mHeight > 0 )
+  {
+    return GetWidthForHeightBase( height );
+  }
+  else
+  {
+    return Control::GetWidthForHeightBase( height );
+  }
+}
+
 } // namespace Internal
 
 } // namespace WidgetView
index bba069d..651e6b4 100644 (file)
@@ -24,8 +24,8 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <wayland-extension/tizen-remote-surface-client-protocol.h>
 #include <tbm_surface.h>
 #include <bundle.h>
@@ -46,7 +46,7 @@ public:
   /**
    * @copydoc Dali::WidgetView::WidgetView::New
    */
-  static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
+  static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod );
 
   /**
    * @copydoc Dali::WidgetView::WidgetView::PauseWidget
@@ -59,84 +59,75 @@ public:
   bool ResumeWidget();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetWidgetId
+   * @copydoc Dali::WidgetView::WidgetView::CancelTouchEvent
    */
-  const std::string& GetWidgetId() const;
+  bool CancelTouchEvent();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetInstanceId
+   * @copydoc Dali::WidgetView::WidgetView::ActivateFaultedWidget
    */
-  const std::string& GetInstanceId() const;
+  void ActivateFaultedWidget();
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::GetContentInfo
-   */
-  const std::string& GetContentInfo();
+  void SendWidgetEvent( int event );
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::GetTitle
-   */
-  const std::string& GetTitle();
+public: // Internal API
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetUpdatePeriod
+   * @brief Called when a property of an object of this type is set.
+   * @SINCE_1_1.38
+   * @param[in] object The object whose property is set.
+   * @param[in] index The property index.
+   * @param[in] value The new property value.
    */
-  double GetUpdatePeriod() const;
+  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::Show
+   * @brief Called to retrieve a property of an object of this type.
+   * @SINCE_1_1.38
+   * @param[in] object The object whose property is to be retrieved.
+   * @param[in] index The property index.
+   * @return The current value of the property.
    */
-  void Show();
+  static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::Hide
+   * @brief Performs actions as requested using the action name.
+   * @SINCE_1_1.38
+   * @param[in] object The object on which to perform the action.
+   * @param[in] actionName The action to perform.
+   * @param[in] attributes The attributes with which to perfrom this action.
+   * @return True if action has been accepted by this control
    */
-  void Hide();
+  static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::CancelTouchEvent
-   */
-  bool CancelTouchEvent();
+  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::SetPreviewEnabled
-   */
-  void SetPreviewEnabled( bool enabled );
+  const std::string& GetWidgetId() const;
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::GetPreviewEnabled
-   */
-  bool GetPreviewEnabled() const;
+  const std::string& GetInstanceId() const;
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::SetStateTextEnabled
-   */
-  void SetStateTextEnabled( bool enabled );
+  const std::string& GetContentInfo();
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::GetStateTextEnabled
-   */
-  bool GetStateTextEnabled() const;
+  const std::string& GetTitle();
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::ActivateFaultedWidget
-   */
-  void ActivateFaultedWidget();
+  float GetUpdatePeriod() const;
+
+  void ShowPreview( bool show );
+
+  bool IsPreviewVisible();
+
+  void ShowStateText( bool show );
+
+  bool IsStateTextVisible();
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::IsWidgetFaulted
-   */
   bool IsWidgetFaulted();
 
-  /**
-   * @copydoc Dali::WidgetView::WidgetView::SetPermanentDelete
-   */
   void SetPermanentDelete( bool permanentDelete );
 
 // ToDo: This funstion will be used for widgetDeletedSignal
   void RemoveObjectView();
 
-  void SendWidgetEvent( int event );
+  bool IsPermanentDelete();
 
   bool IsWidgetImageView();
 
@@ -168,21 +159,11 @@ public: //Signals
   Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetCreationAbortedSignal();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::WidgetResizedSignal
-   */
-  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetResizedSignal();
-
-  /**
    * @copydoc Dali::WidgetView::WidgetView::WidgetContentUpdatedSignal
    */
   Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetContentUpdatedSignal();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::WidgetExtraInfoUpdatedSignal
-   */
-  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetExtraInfoUpdatedSignal();
-
-  /**
    * @copydoc Dali::WidgetView::WidgetView::WidgetUpdatePeriodChangedSignal
    */
   Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetUpdatePeriodChangedSignal();
@@ -202,7 +183,7 @@ protected:
   /**
    * Construct a new WidgetView.
    */
-  WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
+  WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod );
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
@@ -216,13 +197,36 @@ private: // From Control
    */
   virtual void OnInitialize();
 
-private: // From CustomActorImpl
+  /**
+   * @copydoc Toolkit::Control::OnStageConnect()
+   */
+  virtual void OnStageConnection( int depth );
+
+  /**
+   * @copydoc Toolkit::Control::OnStageDisconnection()
+   */
+  virtual void OnStageDisconnection();
 
   /**
-   * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
+   * @copydoc Toolkit::Control::OnSizeSet()
    */
   virtual void OnSizeSet( const Vector3& targetSize );
 
+  /**
+   * @copydoc Toolkit::Control::GetNaturalSize
+   */
+  virtual Vector3 GetNaturalSize();
+
+  /**
+   * @copydoc Toolkit::Control::GetHeightForWidth()
+   */
+  virtual float GetHeightForWidth( float width );
+
+  /**
+   * @copydoc Toolkit::Control::GetWidthForHeight()
+   */
+  virtual float GetWidthForHeight( float height );
+
 private:
 
   // Undefined
@@ -248,10 +252,10 @@ private:
   int mWidth;
   int mHeight;
   int mPid;
-  double mUpdatePeriod;
+  float mUpdatePeriod;
 
-  bool mPreviewEnabled;
-  bool mStateTextEnabled;
+  bool mPreviewVisible;
+  bool mStateTextVisible;
   bool mPermanentDelete;
 
   tizen_remote_surface* mRemoteSurface;
@@ -260,9 +264,7 @@ private:
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetAddedSignal;
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetDeletedSignal;
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetCreationAbortedSignal;
-  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetResizedSignal;
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetContentUpdatedSignal;
-  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetExtraInfoUpdatedSignal;
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetUpdatePeriodChangedSignal;
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetFaultedSignal;
 };
index df33581..4d42798 100644 (file)
@@ -22,6 +22,8 @@
 #include <internal/widget_view/widget_view_impl.h>
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
 #include <dali/integration-api/debug.h>
 #include <system_info.h>
 #include <cynara-client.h>
@@ -50,6 +52,13 @@ namespace
 Integration::Log::Filter* gWidgetViewManagerLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_WIDGET_VIEW_MANAGER" );
 #endif
 
+BaseHandle Create()
+{
+  return Dali::BaseHandle();
+}
+
+DALI_TYPE_REGISTRATION_BEGIN( Dali::WidgetView::WidgetViewManager, Dali::BaseHandle, Create );
+
 static bool IsWidgetFeatureEnabled()
 {
   static bool feature = false;
@@ -172,12 +181,14 @@ int WidgetViewManager::Initialize( Application application, const std::string& n
   return WIDGET_ERROR_NONE;
 }
 
-Dali::WidgetView::WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
+Dali::WidgetView::WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod )
 {
   // Add a new widget view
   Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::New( widgetId, contentInfo, width, height, updatePeriod );
 
-  std::string instanceId = widgetView.GetInstanceId();
+  std::string instanceId;
+  Property::Value value = widgetView.GetProperty( Dali::WidgetView::WidgetView::Property::INSTANCE_ID );
+  value.Get( instanceId );
 
   if( !instanceId.empty() )
   {
index e1b8dd0..9489787 100644 (file)
@@ -49,7 +49,7 @@ public:
   /**
    * @copydoc Dali::WidgetView::WidgetViewManager::AddWidget()
    */
-  Dali::WidgetView::WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
+  Dali::WidgetView::WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod );
 
 private:
 
index 741c7ea..ed91fe2 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 namespace WidgetView
 {
 
-WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
+WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod )
 {
   return Internal::WidgetView::New( widgetId, contentInfo, width, height, updatePeriod );
 }
@@ -69,81 +69,16 @@ bool WidgetView::ResumeWidget()
   return Dali::WidgetView::GetImplementation( *this ).ResumeWidget();
 }
 
-const std::string& WidgetView::GetWidgetId() const
-{
-  return Dali::WidgetView::GetImplementation( *this ).GetWidgetId();
-}
-
-const std::string& WidgetView::GetInstanceId() const
-{
-  return Dali::WidgetView::GetImplementation( *this ).GetInstanceId();
-}
-
-const std::string& WidgetView::GetContentInfo()
-{
-  return Dali::WidgetView::GetImplementation( *this ).GetContentInfo();
-}
-
-const std::string& WidgetView::GetTitle()
-{
-  return Dali::WidgetView::GetImplementation( *this ).GetTitle();
-}
-
-double WidgetView::GetUpdatePeriod() const
-{
-  return Dali::WidgetView::GetImplementation( *this ).GetUpdatePeriod();
-}
-
-void WidgetView::Show()
-{
-  Dali::WidgetView::GetImplementation( *this ).Show();
-}
-
-void WidgetView::Hide()
-{
-  Dali::WidgetView::GetImplementation( *this ).Hide();
-}
-
 bool WidgetView::CancelTouchEvent()
 {
   return Dali::WidgetView::GetImplementation( *this ).CancelTouchEvent();
 }
 
-void WidgetView::SetPreviewEnabled( bool enabled )
-{
-  Dali::WidgetView::GetImplementation( *this ).SetPreviewEnabled( enabled );
-}
-
-bool WidgetView::GetPreviewEnabled() const
-{
-  return Dali::WidgetView::GetImplementation( *this ).GetPreviewEnabled();
-}
-
-void WidgetView::SetStateTextEnabled( bool enabled )
-{
-  Dali::WidgetView::GetImplementation( *this ).SetStateTextEnabled( enabled );
-}
-
-bool WidgetView::GetStateTextEnabled() const
-{
-  return Dali::WidgetView::GetImplementation( *this ).GetStateTextEnabled();
-}
-
 void WidgetView::ActivateFaultedWidget()
 {
   return Dali::WidgetView::GetImplementation( *this ).ActivateFaultedWidget();
 }
 
-bool WidgetView::IsWidgetFaulted()
-{
-  return Dali::WidgetView::GetImplementation( *this ).IsWidgetFaulted();
-}
-
-void WidgetView::SetPermanentDelete( bool permanentDelete )
-{
-  return Dali::WidgetView::GetImplementation( *this ).SetPermanentDelete( permanentDelete );
-}
-
 WidgetView::WidgetViewSignalType& WidgetView::WidgetAddedSignal()
 {
   return Dali::WidgetView::GetImplementation(*this).WidgetAddedSignal();
@@ -159,21 +94,11 @@ WidgetView::WidgetViewSignalType& WidgetView::WidgetCreationAbortedSignal()
   return Dali::WidgetView::GetImplementation(*this).WidgetCreationAbortedSignal();
 }
 
-WidgetView::WidgetViewSignalType& WidgetView::WidgetResizedSignal()
-{
-  return Dali::WidgetView::GetImplementation(*this).WidgetResizedSignal();
-}
-
 WidgetView::WidgetViewSignalType& WidgetView::WidgetContentUpdatedSignal()
 {
   return Dali::WidgetView::GetImplementation(*this).WidgetContentUpdatedSignal();
 }
 
-WidgetView::WidgetViewSignalType& WidgetView::WidgetExtraInfoUpdatedSignal()
-{
-  return Dali::WidgetView::GetImplementation(*this).WidgetExtraInfoUpdatedSignal();
-}
-
 WidgetView::WidgetViewSignalType& WidgetView::WidgetUpdatePeriodChangedSignal()
 {
   return Dali::WidgetView::GetImplementation(*this).WidgetUpdatePeriodChangedSignal();
index b6cbc51..c6a58f7 100644 (file)
@@ -41,6 +41,16 @@ class WidgetView;
  * @brief WidgetView is a class for displaying the widget image and controlling the widget.
  * Input events that WidgetView gets are delivered to the widget.
  *
+ * Signals
+ * | %Signal Name                | Method                                 |
+ * |-----------------------------|----------------------------------------|
+ * | widgetAdded                 | @ref WidgetAddedSignal()               |
+ * | widgetDeleted               | @ref WidgetDeletedSignal()             |
+ * | widgetCreationAborted       | @ref WidgetCreationAbortedSignal()     |
+ * | widgetContentUpdated        | @ref WidgetContentUpdatedSignal()      |
+ * | widgetUpdatePeriodChanged   | @ref WidgetUpdatePeriodChangedSignal() |
+ * | widgetFaulted               | @ref WidgetFaultedSignal()             |
+ *
  * @since_tizen 3.0
  */
 class DALI_IMPORT_API WidgetView : public Toolkit::Control
@@ -48,6 +58,86 @@ class DALI_IMPORT_API WidgetView : public Toolkit::Control
 public:
 
   /**
+   * @brief The start and end property ranges for this control.
+   * @SINCE_1_0.0
+   */
+  enum PropertyRange
+  {
+    PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,  ///< @SINCE_1_0.0
+    PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000,              ///< Reserve property indices @SINCE_1_0.0
+  };
+
+  /**
+   * @brief An enumeration of properties belonging to the WidgetView class.
+   * @privlevel public
+   * @privilege %http://tizen.org/privilege/widget.viewer
+   * @SINCE_1_0.0
+   */
+  struct Property
+  {
+    enum
+    {
+      // Event side properties
+
+      /**
+       * @brief name "widgetId", Get the id of the widget, type string, read-only
+       * @SINCE_1_0.0
+       */
+      WIDGET_ID = PROPERTY_START_INDEX,
+
+      /**
+       * @brief name "instanceId", type string, read-only
+       * @SINCE_1_0.0
+       */
+      INSTANCE_ID,
+
+      /**
+       * @brief name "contentInfo", type string, read-only
+       * @SINCE_1_0.0
+       */
+      CONTENT_INFO,
+
+      /**
+       * @brief name "title", type string, read-only
+       * @SINCE_1_0.0
+       */
+      TITLE,
+
+      /**
+       * @brief name "updatePeriod", type float, read-only
+       * @SINCE_1_0.0
+       */
+      UPDATE_PERIOD,
+
+      /**
+       * @brief name "preview", type boolean if it is a show/hide flag, map otherwise
+       * @SINCE_1_0.0
+       */
+      PREVIEW,
+
+      /**
+       * @brief name "loadingText", type boolean if it is a show/hide flag, map otherwise
+       * @SINCE_1_0.0
+       */
+      LOADING_TEXT,
+
+      /**
+       * @brief name "widgetStateFaulted", type boolean
+       * @SINCE_1_0.0
+       */
+      WIDGET_STATE_FAULTED,
+
+      /**
+       * @brief name "permanentDelete", type boolean
+       * @SINCE_1_0.0
+       */
+      PERMANENT_DELETE,
+
+    };
+  };
+
+
+  /**
    * @brief Create widget view.
    *
    * @since_tizen 3.0
@@ -60,7 +150,7 @@ public:
    * @param[in] updatePeriod The period of updating contents of the widget.
    * @return A handle to WidgetView.
    */
-  static WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
+  static WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod );
 
   /**
    * @brief Downcast a handle to WidgetView handle.
@@ -126,78 +216,6 @@ public:
   bool ResumeWidget();
 
   /**
-   * @brief Get the id of the widget.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return The widget id on success, otherwise an empty string.
-   */
-  const std::string& GetWidgetId() const;
-
-  /**
-   * @brief Get the instance id of the widget.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return The instance id on success, otherwise an empty string.
-   */
-  const std::string& GetInstanceId() const;
-
-  /**
-   * @brief Get the content string of the widget.
-   * This string can be used for creating contents of widget again after reboot a device or recovered from crash(abnormal status).
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return The content string to be recognize content of the widget or an empty string if there is no specific content string.
-   */
-  const std::string& GetContentInfo();
-
-  /**
-   * @brief Get the summarized string of the widget content for accessibility.
-   * If the accessibility feature is turned on, a viewer can use this text to describe the widget.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return The title string to be used for summarizing the widget or an empty string if there is no summarized text for content of given widget.
-   */
-  const std::string& GetTitle();
-
-  /**
-   * @brief Get the update period of the widget content.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return The update period of the widget content.
-   */
-  double GetUpdatePeriod() const;
-
-  /**
-   * @brief Shows the widget.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @note Use this function instead of Dali::Actor::SetVisible() to restart updating widget content.
-   */
-  void Show();
-
-  /**
-   * @brief Hides the widget.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @note Use this function instead of Dali::Actor::SetVisible() to stop updating widget content.
-   */
-  void Hide();
-
-  /**
    * @brief Cancels touch event procedure.
    * If you call this function after feed the touch down event, the widget will get ON_HOLD events.
    * If a widget gets ON_HOLD event, it will not do anything even if you feed touch up event.
@@ -210,46 +228,6 @@ public:
   bool CancelTouchEvent();
 
   /**
-   * @brief Sets whether to enable or disable the preview of the widget
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @param[in] enable Whether to enable the preview of the widget or not
-   */
-  void SetPreviewEnabled( bool enabled );
-
-  /**
-   * @brief Checks if the preview of the widget has been enabled or not.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return Whether the preview of the widget is enabled
-   */
-  bool GetPreviewEnabled() const;
-
-  /**
-   * @brief Sets whether to enable or disable the state message of the widget
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @param[in] enable Whether to enable the state message of the widget or not
-   */
-  void SetStateTextEnabled( bool enabled );
-
-  /**
-   * @brief Checks if the state message of the widget has been enabled or not.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return Whether the state message of the widget is enabled
-   */
-  bool GetStateTextEnabled() const;
-
-  /**
    * @brief Activate a widget in faulted state.
    * A widget in faulted state MUST be activated before adding the widget.
    *
@@ -259,26 +237,6 @@ public:
    */
   void ActivateFaultedWidget();
 
-  /**
-   * @brief Check whether the widget is faulted.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return true for faulted state, otherwise false.
-   */
-  bool IsWidgetFaulted();
-
-  /**
-   * @brief Set the deletion mode.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @param[in] permanentDelete Pass true if you want to delete this widget instance permanently, or pass false if you want to keep it and it will be re-created soon.
-   */
-  void SetPermanentDelete( bool permanentDelete );
-
 public: //Signals
 
   typedef Signal< void ( WidgetView ) > WidgetViewSignalType;   ///< WidgetView signal type @since_tizen 3.0
@@ -314,16 +272,6 @@ public: //Signals
   WidgetViewSignalType& WidgetCreationAbortedSignal();
 
   /**
-   * @brief This signal is emitted when the widget is resized.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return The signal to connect to.
-   */
-  WidgetViewSignalType& WidgetResizedSignal();
-
-  /**
    * @brief This signal is emitted when the widget content is updated.
    *
    * @since_tizen 3.0
@@ -334,16 +282,6 @@ public: //Signals
   WidgetViewSignalType& WidgetContentUpdatedSignal();
 
   /**
-   * @brief This signal is emitted when the widget extra info is updated.
-   *
-   * @since_tizen 3.0
-   * @privlevel public
-   * @privilege %http://tizen.org/privilege/widget.viewer
-   * @return The signal to connect to.
-   */
-  WidgetViewSignalType& WidgetExtraInfoUpdatedSignal();
-
-  /**
    * @brief This signal is emitted when the widget update period is changed.
    *
    * @since_tizen 3.0
@@ -366,6 +304,7 @@ public: //Signals
 public: // Not intended for application developers
 
   /**
+   * @internal
    * @brief Creates a handle using the WidgetView::Internal implementation.
    *
    * @since_tizen 3.0
@@ -374,6 +313,7 @@ public: // Not intended for application developers
   DALI_INTERNAL WidgetView( Internal::WidgetView& implementation );
 
   /**
+   * @internal
    * @brief Allows the creation of this control from an Internal::CustomActor pointer.
    *
    * @since_tizen 3.0
index f41f494..a3aaa57 100644 (file)
@@ -29,9 +29,9 @@ namespace Dali
 namespace WidgetView
 {
 
-WidgetViewManager WidgetViewManager::New( Application application, const std::string& name )
+WidgetViewManager WidgetViewManager::New( Application application, const std::string& appId )
 {
-  Internal::WidgetViewManagerPtr internal = Internal::WidgetViewManager::New( application, name );
+  Internal::WidgetViewManagerPtr internal = Internal::WidgetViewManager::New( application, appId );
 
   return WidgetViewManager( internal.Get() );
 }
@@ -65,7 +65,7 @@ WidgetViewManager::WidgetViewManager( Internal::WidgetViewManager* implementatio
 {
 }
 
-WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
+WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod )
 {
   return GetImplementation(*this).AddWidget( widgetId, contentInfo, width, height, updatePeriod );
 }
index 2a8cbb6..5a3ff68 100644 (file)
@@ -59,10 +59,10 @@ public:
    * @privlevel public
    * @privilege %http://tizen.org/privilege/widget.viewer
    * @param[in] application Application class for the widget view manager.
-   * @param[in] name Widget view manager name. It is used for socket name internally.
+   * @param[in] appId App ID of app with widget viewer dali.
    * @return A handle to WidgetViewManager.
    */
-  static WidgetViewManager New( Application application, const std::string& name );
+  static WidgetViewManager New( Application application, const std::string& appId );
 
   /**
    * @brief Downcast a handle to WidgetViewManager handle.
@@ -122,11 +122,12 @@ public:
    * @param[in] updatePeriod The period of updating contents of the widget.
    * @return A handle to WidgetView.
    */
-  WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
+  WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod );
 
 public: // Not intended for application developers
 
   /**
+   * @internal
    * @brief Creates a handle using the WidgetView::Internal implementation.
    *
    * @since_tizen 3.0