Modified creation aborted and faulted signal
[platform/core/uifw/widget-viewer-dali.git] / internal / widget_view / widget_view_impl.h
index 0e40578..e27786f 100644 (file)
@@ -2,31 +2,33 @@
 #define __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_H__
 
 /*
+ * Samsung API
  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://floralicense.org/license/
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 // INTERNAL INCLUDES
 #include <public_api/widget_view/widget_view.h>
 
 // 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 <pepper-dali/public-api/object-view/object-view.h>
-#include <bundle.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 <screen_connector_toolkit.h>
 
 namespace Dali
 {
@@ -44,80 +46,143 @@ public:
   /**
    * @copydoc Dali::WidgetView::WidgetView::New
    */
-  static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+  static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, float updatePeriod );
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetWidgetId
+   * @copydoc Dali::WidgetView::WidgetView::PauseWidget
    */
-  const std::string& GetWidgetId() const;
+  bool PauseWidget();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetInstanceId
+   * @copydoc Dali::WidgetView::WidgetView::ResumeWidget
    */
-  const std::string& GetInstanceId() const;
+  bool ResumeWidget();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetContentInfo
+   * @copydoc Dali::WidgetView::WidgetView::CancelTouchEvent
    */
-  const std::string& GetContentInfo();
+  bool CancelTouchEvent();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetTitle
+   * @copydoc Dali::WidgetView::WidgetView::ActivateFaultedWidget
    */
-  const std::string& GetTitle();
+  void ActivateFaultedWidget();
+
+  void SendWidgetEvent( int event );
+
+public: // Internal API
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetPeriod
+   * @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 GetPeriod() const;
+  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::CancelTouchEvent
+   * @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.
    */
-  bool CancelTouchEvent();
+  static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::SetPreviewEnabled
+   * @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 SetPreviewEnabled( bool enabled );
+  static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
+
+  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+  const std::string& GetWidgetId() const;
+
+  const std::string& GetInstanceId() const;
+
+  const std::string& GetContentInfo();
+
+  const std::string& GetTitle();
+
+  float GetUpdatePeriod() const;
+
+  void SetPreviewVisible( bool visible );
+
+  bool IsPreviewVisible();
+
+  void SetLoadingTextVisible( bool visible );
+
+  bool IsLoadingTextVisible();
+
+  bool IsWidgetFaulted();
+
+  void SetPermanentDelete( bool permanentDelete );
+
+  void RemoveWidgetImage();
+
+  bool IsPermanentDelete();
+
+  bool IsWidgetImageView();
+
+  void UpdateImageSource( tbm_surface_h source );
+
+  void CreateWidgetImageView();
+
+  void ConnectSignal( tizen_remote_surface* surface );
+
+  bool OnTouch( Dali::Actor actor, const Dali::TouchData& event );
+
+  bool OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event );
+
+  void CloseRemoteSurface();
+
+  void SetLoadingTextPropertyMap( Dali::Property::Map map );
+
+  void ShowLoadingState( bool show );
+
+  void ShowRetryState( bool show );
+
+  void TerminateWidget();
+
+public: //Signals
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetPreviewEnabled
+   * @copydoc Dali::WidgetView::WidgetView::WidgetAddedSignal
    */
-  bool GetPreviewEnabled() const;
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetAddedSignal();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::SetStateTextEnabled
+   * @copydoc Dali::WidgetView::WidgetView::WidgetDeletedSignal
    */
-  void SetStateTextEnabled( bool enabled );
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetDeletedSignal();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::GetStateTextEnabled
+   * @copydoc Dali::WidgetView::WidgetView::WidgetCreationAbortedSignal
    */
-  bool GetStateTextEnabled() const;
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetCreationAbortedSignal();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::ActivateFaultedWidget
+   * @copydoc Dali::WidgetView::WidgetView::WidgetContentUpdatedSignal
    */
-  void ActivateFaultedWidget();
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetContentUpdatedSignal();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::IsWidgetFaulted
+   * @copydoc Dali::WidgetView::WidgetView::WidgetUpdatePeriodChangedSignal
    */
-  bool IsWidgetFaulted();
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetUpdatePeriodChangedSignal();
 
   /**
-   * @copydoc Dali::WidgetView::WidgetView::SetPermanentDelete
+   * @copydoc Dali::WidgetView::WidgetView::WidgetFaultedSignal
    */
-  void SetPermanentDelete( bool permanentDelete );
-
-  void AddObjectView( Pepper::ObjectView objectView );
-  void RemoveObjectView();
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetFaultedSignal();
 
-public: //Signals
-
-  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetAddedSignal();
-  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetDeletedSignal();
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetTerminatedSignal();
 
 protected:
 
@@ -129,13 +194,15 @@ protected:
   /**
    * Construct a new WidgetView.
    */
-  WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+  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()
    */
   virtual ~WidgetView();
 
+  float TextPixelToPointSize( int pixelSize );
+
 private: // From Control
 
   /**
@@ -143,6 +210,36 @@ private: // From Control
    */
   virtual void OnInitialize();
 
+  /**
+   * @copydoc Toolkit::Control::OnStageConnect()
+   */
+  virtual void OnStageConnection( int depth );
+
+  /**
+   * @copydoc Toolkit::Control::OnStageDisconnection()
+   */
+  virtual void OnStageDisconnection();
+
+  /**
+   * @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
@@ -153,29 +250,42 @@ private:
 
 private:
 
-  Pepper::ObjectView mObjectView;     ///< Widget content
+  Toolkit::ImageView mWidgetImageView;     ///< Widget content
   Toolkit::ImageView mPreviewImage;   ///< Preview image
-  Toolkit::TextLabel mStateText;      ///< State text
+  Toolkit::TextLabel mLoadingText;      ///< Loading text
+  Toolkit::TextLabel mRetryText;      ///< Retry text
+  Dali::Actor mPreviewActor;
+  Dali::Actor mStateTextActor;
+  Dali::NativeImageSourcePtr mImageSource;
 
   std::string mWidgetId;
   std::string mInstanceId;
   std::string mContentInfo;
   std::string mTitle;
 
-  bundle* mBundle;
-
   int mWidth;
   int mHeight;
   int mPid;
-  double mPeriod;
+  float mUpdatePeriod;
 
-  bool mPreviewEnabled;
-  bool mStateTextEnabled;
+  bool mPreviewVisible;
+  bool mLoadingTextVisible;
+  bool mRetryTextVisible;
+  bool mRetryState;
   bool mPermanentDelete;
+  screen_connector_toolkit_h mWatcherHandle;
+  tizen_remote_surface* mRemoteSurface;
 
   // Signals
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetAddedSignal;
   Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetDeletedSignal;
+  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetCreationAbortedSignal;
+  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetContentUpdatedSignal;
+  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetUpdatePeriodChangedSignal;
+  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetFaultedSignal;
+
+  // Internal signal
+  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetTerminatedSignal;
 };
 
 } // namespace Internal