Change default permanent delete flag and add CloseRemoteSurface
[platform/core/uifw/widget-viewer-dali.git] / internal / widget_view / widget_view_impl.cpp
index 16006a7..a98d16b 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,73 +56,78 @@ namespace
 Integration::Log::Filter* gWidgetViewLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_WIDGET_VIEW" );
 #endif
 
-static Eina_Bool OnKeyDown( void* data, int type, void* eventInfo )
+BaseHandle Create()
 {
-  Ecore_Event_Key *event = static_cast< Ecore_Event_Key* >( eventInfo );
-  tizen_remote_surface* surface = static_cast< tizen_remote_surface* >( data );
+  return Dali::BaseHandle();
+}
 
-  tizen_remote_surface_transfer_key_event( surface,
-                                           TIZEN_REMOTE_SURFACE_EVENT_TYPE_KEY_DOWN,
-                                           event->keycode,
-                                           ecore_device_class_get(event->dev),
-                                           ecore_device_subclass_get(event->dev),
-                                           ecore_device_identifier_get(event->dev),
-                                           event->timestamp
-                                         );
+// 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 )
 
-  return EINA_TRUE;
-}
+// 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 )
 
-static Eina_Bool OnKeyUp(void* data, int type, void* eventInfo)
-{
-  Ecore_Event_Key *event = static_cast< Ecore_Event_Key* >( eventInfo );
-  tizen_remote_surface* surface = static_cast< tizen_remote_surface* >( data );
+// 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 );
 
-  tizen_remote_surface_transfer_key_event( surface,
-                                           TIZEN_REMOTE_SURFACE_EVENT_TYPE_KEY_UP,
-                                           event->keycode,
-                                           ecore_device_class_get(event->dev),
-                                           ecore_device_subclass_get(event->dev),
-                                           ecore_device_identifier_get(event->dev),
-                                           event->timestamp
-                                         );
-  return EINA_TRUE;
-}
+DALI_TYPE_REGISTRATION_END()
 
-static void OnSurfaceUpdate( struct tizen_remote_surface* surface, wl_buffer* buffer, uint32_t time, void* data )
+static void OnBufferUpdate( struct tizen_remote_surface* surface, wl_buffer* buffer, uint32_t time, void* data )
 {
   Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
 
-  if( widgetView && !widgetView->IsWidgetImageView() )
+  if( widgetView )
   {
-    tizen_remote_surface_transfer_visibility( surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
+    if( !widgetView->IsWidgetImageView() )
+    {
+      tizen_remote_surface_transfer_visibility( surface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
 
-    widgetView->CreateWidgetImageView();
-    widgetView->ConnectSignal( surface );
-    ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, OnKeyDown, surface );
-    ecore_event_handler_add( ECORE_EVENT_KEY_UP, OnKeyUp, surface );
+      widgetView->CreateWidgetImageView();
+      widgetView->ConnectSignal( surface );
+    }
 
+    //get tbm surface from buffer
+    tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
+    widgetView->UpdateImageSource( tbmSurface );
   }
-
-  //get tbm surface from buffer
-  tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
-  widgetView->UpdateImageSource( tbmSurface );
 }
 
 static void OnSurfaceMissing( struct tizen_remote_surface* surface, void* data )
 {
-  //ToDo: WidgetDeletedSignal
+  Dali::WidgetView::Internal::WidgetView* widgetView = static_cast< Dali::WidgetView::Internal::WidgetView* >( data );
+
+  if( widgetView )
+  {
+    widgetView->CloseRemoteSurface();
+  }
 }
 
 
 static struct aul_rsm_handler_s remoteSurfaceHandler = {
-  OnSurfaceUpdate,
+  OnBufferUpdate,
   OnSurfaceMissing,
 };
 
 } // 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 );
@@ -139,31 +148,31 @@ WidgetView::WidgetView()
   mInstanceId(),
   mContentInfo(),
   mTitle(),
-  mBundle( NULL ),
   mWidth( 0 ),
   mHeight( 0 ),
   mPid( 0 ),
   mUpdatePeriod( 0.0 ),
-  mPreviewEnabled( true ),
-  mStateTextEnabled( true ),
-  mPermanentDelete( true )
+  mPreviewVisible( true ),
+  mStateTextVisible( true ),
+  mPermanentDelete( false ),
+  mRemoteSurface( NULL )
 {
 }
 
-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(),
   mContentInfo( contentInfo ),
   mTitle(),
-  mBundle( NULL ),
   mWidth( width ),
   mHeight( height ),
   mPid( 0 ),
   mUpdatePeriod( updatePeriod ),
-  mPreviewEnabled( true ),
-  mStateTextEnabled( true ),
-  mPermanentDelete( true )
+  mPreviewVisible( true ),
+  mStateTextVisible( true ),
+  mPermanentDelete( false ),
+  mRemoteSurface( NULL )
 {
 }
 
@@ -178,11 +187,6 @@ WidgetView::~WidgetView()
       widget_instance_destroy( mInstanceId.c_str() );
     }
   }
-
-  if( mBundle )
-  {
-    bundle_free( mBundle );
-  }
 }
 
 bool WidgetView::PauseWidget()
@@ -267,27 +271,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 +287,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 +320,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 +357,11 @@ void WidgetView::SetPermanentDelete( bool permanentDelete )
   mPermanentDelete = permanentDelete;
 }
 
+bool WidgetView::IsPermanentDelete()
+{
+  return mPermanentDelete;
+}
+
 void WidgetView::CreateWidgetImageView()
 {
   Any source;
@@ -386,12 +377,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 +397,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 +435,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 +643,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;
@@ -552,7 +704,9 @@ void WidgetView::OnInitialize()
     mPreviewImage.SetSize( mWidth, mHeight );
   }
 
-  Self().SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+  Self().SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
+  Self().SetSize( mWidth, mHeight );
+
   Self().Add( mPreviewImage );
 
   // State text
@@ -585,6 +739,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 )
@@ -606,11 +770,12 @@ void WidgetView::UpdateImageSource( tbm_surface_h source )
 
 void WidgetView::ConnectSignal( tizen_remote_surface* surface )
 {
-  if( mWidgetImageView )
+  if( mWidgetImageView && surface )
   {
     mRemoteSurface = surface;
-    mWidgetImageView.TouchSignal().Connect( this, &WidgetView::OnTouch );
-    mWidgetImageView.WheelEventSignal().Connect( this, &WidgetView::OnWheelEvent );
+
+    Self().TouchSignal().Connect( this, &WidgetView::OnTouch );
+    Self().WheelEventSignal().Connect( this, &WidgetView::OnWheelEvent );
   }
 
 }
@@ -619,6 +784,11 @@ bool WidgetView::OnTouch( Dali::Actor actor, const Dali::TouchData& event )
 {
   tizen_remote_surface_event_type type = TIZEN_REMOTE_SURFACE_EVENT_TYPE_NONE;
 
+  if( event.GetPointCount() == 0 || mRemoteSurface == NULL )
+  {
+    return false;
+  }
+
   switch( event.GetState( 0 ) )
   {
     case Dali::PointState::UP:
@@ -642,17 +812,26 @@ bool WidgetView::OnTouch( Dali::Actor actor, const Dali::TouchData& event )
     }
   }
 
+  int button = 1;
+
+  if( type == TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE )
+  {
+    button = 0 ;
+  }
+
+  Vector2 localPos = event.GetLocalPosition( 0 );
+
   tizen_remote_surface_transfer_mouse_event( mRemoteSurface,
                                              type,
-                                             event.GetDeviceId( 0 ),
-                                             1,
-                                             event.GetLocalPosition( 0 ).x,
-                                             event.GetLocalPosition( 0 ).y,
-                                             event.GetEllipseRadius( 0 ).x,
-                                             event.GetEllipseRadius( 0 ).y,
-                                             event.GetPressure( 0 ),
-                                             event.GetAngle( 0 ).degree,
-                                             TIZEN_INPUT_DEVICE_CLAS_MOUSE,
+                                             0,
+                                             button,
+                                             (int)localPos.x,
+                                             (int)localPos.y,
+                                             wl_fixed_from_double( event.GetEllipseRadius( 0 ).x ),
+                                             wl_fixed_from_double( event.GetEllipseRadius( 0 ).y ),
+                                             wl_fixed_from_double( event.GetPressure( 0 ) ),
+                                             wl_fixed_from_double( event.GetAngle( 0 ).degree ),
+                                             TIZEN_INPUT_DEVICE_CLAS_TOUCHSCREEN,
                                              TIZEN_INPUT_DEVICE_SUBCLAS_NONE,
                                              "",
                                              event.GetTime()
@@ -662,6 +841,11 @@ bool WidgetView::OnTouch( Dali::Actor actor, const Dali::TouchData& event )
 
 bool WidgetView::OnWheelEvent( Dali::Actor actor, const Dali::WheelEvent& event )
 {
+  if( mRemoteSurface == NULL )
+  {
+    return false;
+  }
+  //ToDo: We should check TIZEN_INPUT_DEVICE_CLAS_MOUSE
   tizen_remote_surface_transfer_mouse_wheel( mRemoteSurface,
                                              event.direction,
                                              event.z,
@@ -673,6 +857,53 @@ 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 );
+  }
+}
+
+void WidgetView::CloseRemoteSurface()
+{
+  aul_rsm_viewer_unset_surface_handler( mInstanceId.c_str() );
+  mRemoteSurface = NULL;
+}
+
 } // namespace Internal
 
 } // namespace WidgetView