Ensure up calls are added for all void virtual functions in view wrapper. 94/117094/14
authorUmar <m.umar@partner.samsung.com>
Thu, 2 Mar 2017 16:33:03 +0000 (16:33 +0000)
committerMuhammad Umar <m.umar@partner.samsung.com>
Fri, 3 Mar 2017 17:28:07 +0000 (09:28 -0800)
Change-Id: Idb4daf00cc805e1908a1bdaa85591ebe9f068154

plugins/dali-swig/manual/cpp/view-wrapper-impl-wrap.cpp
plugins/dali-swig/manual/cpp/view-wrapper-impl-wrap.h
plugins/dali-swig/manual/csharp/CustomView.cs
plugins/dali-swig/manual/csharp/ViewWrapperImpl.cs

index 9bf6950..d0d531a 100644 (file)
@@ -35,24 +35,28 @@ SwigDirector_ViewWrapperImpl::~SwigDirector_ViewWrapperImpl() {
 
 
 void SwigDirector_ViewWrapperImpl::OnStageConnection(int depth) {
-    Dali::Toolkit::Internal::Control::OnStageConnection(depth);
     swig_callbackOnStageConnection(depth);
+
+    Dali::Toolkit::Internal::Control::OnStageConnection(depth);
 }
 
 void SwigDirector_ViewWrapperImpl::OnStageDisconnection() {
     swig_callbackOnStageDisconnection();
+
     Dali::Toolkit::Internal::Control::OnStageDisconnection();
 }
 
 void SwigDirector_ViewWrapperImpl::OnChildAdd(Dali::Actor &child) {
-    Dali::Toolkit::Internal::Control::OnChildAdd( child );
     void * jchild = (Dali::Actor *) &child;
     swig_callbackOnChildAdd(jchild);
+
+    Dali::Toolkit::Internal::Control::OnChildAdd( child );
 }
 
 void SwigDirector_ViewWrapperImpl::OnChildRemove(Dali::Actor &child) {
     void * jchild = (Dali::Actor *) &child;
     swig_callbackOnChildRemove(jchild);
+
     Dali::Toolkit::Internal::Control::OnChildRemove( child );
 }
 
@@ -60,24 +64,23 @@ void SwigDirector_ViewWrapperImpl::OnPropertySet(Dali::Property::Index index, Da
   int jindex  ;
   void * jpropertyValue  ;
 
-  if (!swig_callbackOnPropertySet) {
-    Dali::Toolkit::Internal::ControlWrapper::OnPropertySet(index,propertyValue);
-    return;
-  } else {
-    jindex = index;
-    jpropertyValue = (void *)new Dali::Property::Value((const Dali::Property::Value &)propertyValue);
-    swig_callbackOnPropertySet(jindex, jpropertyValue);
-  }
+  jindex = index;
+  jpropertyValue = (void *)new Dali::Property::Value((const Dali::Property::Value &)propertyValue);
+  swig_callbackOnPropertySet(jindex, jpropertyValue);
+
+  Dali::Toolkit::Internal::ControlWrapper::OnPropertySet(index,propertyValue);
 }
 
 void SwigDirector_ViewWrapperImpl::OnSizeSet(Dali::Vector3 const &targetSize) {
-  Dali::Toolkit::Internal::Control::OnSizeSet(targetSize);
   swig_callbackOnSizeSet((Dali::Vector3 *) &targetSize);
+
+  Dali::Toolkit::Internal::Control::OnSizeSet(targetSize);
 }
 
 void SwigDirector_ViewWrapperImpl::OnSizeAnimation(Dali::Animation &animation, Dali::Vector3 const &targetSize) {
-  Dali::Toolkit::Internal::Control::OnSizeAnimation(animation,targetSize);
   swig_callbackOnSizeAnimation(&animation, (Dali::Vector3 *) &targetSize);
+
+  Dali::Toolkit::Internal::Control::OnSizeAnimation(animation,targetSize);
 }
 
 bool SwigDirector_ViewWrapperImpl::OnTouchEvent(Dali::TouchEvent const &event) {
@@ -144,28 +147,22 @@ void SwigDirector_ViewWrapperImpl::OnRelayout(Dali::Vector2 const &size, Dali::R
   void * jsize = 0 ;
   void * jcontainer = 0 ;
 
-  if (!swig_callbackOnRelayout) {
-    Dali::Toolkit::Internal::Control::OnRelayout(size,container);
-    return;
-  } else {
-    jsize = (Dali::Vector2 *) &size;
-    jcontainer = (Dali::RelayoutContainer *) &container;
-    swig_callbackOnRelayout(jsize, jcontainer);
-  }
+  jsize = (Dali::Vector2 *) &size;
+  jcontainer = (Dali::RelayoutContainer *) &container;
+  swig_callbackOnRelayout(jsize, jcontainer);
+
+  Dali::Toolkit::Internal::Control::OnRelayout(size,container);
 }
 
 void SwigDirector_ViewWrapperImpl::OnSetResizePolicy(Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension) {
   int jpolicy  ;
   int jdimension  ;
 
-  if (!swig_callbackOnSetResizePolicy) {
-    Dali::Toolkit::Internal::Control::OnSetResizePolicy(policy,dimension);
-    return;
-  } else {
-    jpolicy = (int)policy;
-    jdimension = (int)dimension;
-    swig_callbackOnSetResizePolicy(jpolicy, jdimension);
-  }
+  jpolicy = (int)policy;
+  jdimension = (int)dimension;
+  swig_callbackOnSetResizePolicy(jpolicy, jdimension);
+
+  Dali::Toolkit::Internal::Control::OnSetResizePolicy(policy,dimension);
 }
 
 Dali::Vector3 SwigDirector_ViewWrapperImpl::GetNaturalSize() {
@@ -250,45 +247,38 @@ bool SwigDirector_ViewWrapperImpl::RelayoutDependentOnChildren(Dali::Dimension::
 void SwigDirector_ViewWrapperImpl::OnCalculateRelayoutSize(Dali::Dimension::Type dimension) {
   int jdimension  ;
 
-  if (!swig_callbackOnCalculateRelayoutSize) {
-    Dali::Toolkit::Internal::Control::OnCalculateRelayoutSize(dimension);
-    return;
-  } else {
-    jdimension = (int)dimension;
-    swig_callbackOnCalculateRelayoutSize(jdimension);
-  }
+  jdimension = (int)dimension;
+  swig_callbackOnCalculateRelayoutSize(jdimension);
+
+  Dali::Toolkit::Internal::Control::OnCalculateRelayoutSize(dimension);
 }
 
 void SwigDirector_ViewWrapperImpl::OnLayoutNegotiated(float size, Dali::Dimension::Type dimension) {
   float jsize  ;
   int jdimension  ;
 
-  if (!swig_callbackOnLayoutNegotiated) {
-    Dali::Toolkit::Internal::Control::OnLayoutNegotiated(size,dimension);
-    return;
-  } else {
-    jsize = size;
-    jdimension = (int)dimension;
-    swig_callbackOnLayoutNegotiated(jsize, jdimension);
-  }
+  jsize = size;
+  jdimension = (int)dimension;
+  swig_callbackOnLayoutNegotiated(jsize, jdimension);
+
+  Dali::Toolkit::Internal::Control::OnLayoutNegotiated(size,dimension);
 }
 
 void SwigDirector_ViewWrapperImpl::OnInitialize() {
-  if (!swig_callbackOnInitialize) {
-    Dali::Toolkit::Internal::Control::OnInitialize();
-    return;
-  } else {
-    swig_callbackOnInitialize();
-  }
+  swig_callbackOnInitialize();
+
+  Dali::Toolkit::Internal::Control::OnInitialize();
 }
 
 void SwigDirector_ViewWrapperImpl::OnControlChildAdd(Dali::Actor &child) {
-  Dali::Toolkit::Internal::Control::OnControlChildAdd(child);
   swig_callbackOnControlChildAdd(&child);
+
+  Dali::Toolkit::Internal::Control::OnControlChildAdd(child);
 }
 
 void SwigDirector_ViewWrapperImpl::OnControlChildRemove(Dali::Actor &child) {
   swig_callbackOnControlChildRemove(&child);
+
   Dali::Toolkit::Internal::Control::OnControlChildRemove(child);
 }
 
@@ -296,14 +286,11 @@ void SwigDirector_ViewWrapperImpl::OnStyleChange(Dali::Toolkit::StyleManager sty
   void * jstyleManager  ;
   int jchange  ;
 
-  if (!swig_callbackOnStyleChange) {
-    Dali::Toolkit::Internal::Control::OnStyleChange(styleManager,change);
-    return;
-  } else {
-    jstyleManager = (void *)new Dali::Toolkit::StyleManager((const Dali::Toolkit::StyleManager &)styleManager);
-    jchange = (int)change;
-    swig_callbackOnStyleChange(jstyleManager, jchange);
-  }
+  jstyleManager = (void *)new Dali::Toolkit::StyleManager((const Dali::Toolkit::StyleManager &)styleManager);
+  jchange = (int)change;
+  swig_callbackOnStyleChange(jstyleManager, jchange);
+
+  Dali::Toolkit::Internal::Control::OnStyleChange(styleManager,change);
 }
 
 bool SwigDirector_ViewWrapperImpl::OnAccessibilityActivated() {
@@ -378,21 +365,15 @@ bool SwigDirector_ViewWrapperImpl::OnAccessibilityZoom() {
 }
 
 void SwigDirector_ViewWrapperImpl::OnKeyInputFocusGained() {
-  if (!swig_callbackOnKeyInputFocusGained) {
-    Dali::Toolkit::Internal::Control::OnKeyInputFocusGained();
-    return;
-  } else {
-    swig_callbackOnKeyInputFocusGained();
-  }
+  swig_callbackOnKeyInputFocusGained();
+
+  Dali::Toolkit::Internal::Control::OnKeyInputFocusGained();
 }
 
 void SwigDirector_ViewWrapperImpl::OnKeyInputFocusLost() {
-  if (!swig_callbackOnKeyInputFocusLost) {
-    Dali::Toolkit::Internal::Control::OnKeyInputFocusLost();
-    return;
-  } else {
-    swig_callbackOnKeyInputFocusLost();
-  }
+  swig_callbackOnKeyInputFocusLost();
+
+  Dali::Toolkit::Internal::Control::OnKeyInputFocusLost();
 }
 
 Dali::Actor SwigDirector_ViewWrapperImpl::GetNextKeyboardFocusableActor(Dali::Actor currentFocusedActor, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) {
@@ -420,14 +401,10 @@ Dali::Actor SwigDirector_ViewWrapperImpl::GetNextKeyboardFocusableActor(Dali::Ac
 
 void SwigDirector_ViewWrapperImpl::OnKeyboardFocusChangeCommitted(Dali::Actor commitedFocusableActor) {
   void * jcommitedFocusableActor  ;
+  jcommitedFocusableActor = (void *)new Dali::Actor((const Dali::Actor &)commitedFocusableActor);
+  swig_callbackOnKeyboardFocusChangeCommitted(jcommitedFocusableActor);
 
-  if (!swig_callbackOnKeyboardFocusChangeCommitted) {
-    Dali::Toolkit::Internal::Control::OnKeyboardFocusChangeCommitted(commitedFocusableActor);
-    return;
-  } else {
-    jcommitedFocusableActor = (void *)new Dali::Actor((const Dali::Actor &)commitedFocusableActor);
-    swig_callbackOnKeyboardFocusChangeCommitted(jcommitedFocusableActor);
-  }
+  Dali::Toolkit::Internal::Control::OnKeyboardFocusChangeCommitted(commitedFocusableActor);
 }
 
 bool SwigDirector_ViewWrapperImpl::OnKeyboardEnter() {
@@ -445,78 +422,35 @@ bool SwigDirector_ViewWrapperImpl::OnKeyboardEnter() {
 
 void SwigDirector_ViewWrapperImpl::OnPinch(Dali::PinchGesture const &pinch) {
   void * jpinch = 0 ;
+  jpinch = (Dali::PinchGesture *) &pinch;
+  swig_callbackOnPinch(jpinch);
 
-  if (!swig_callbackOnPinch) {
-    Dali::Toolkit::Internal::Control::OnPinch(pinch);
-    return;
-  } else {
-    jpinch = (Dali::PinchGesture *) &pinch;
-    swig_callbackOnPinch(jpinch);
-  }
+  Dali::Toolkit::Internal::Control::OnPinch(pinch);
 }
 
 void SwigDirector_ViewWrapperImpl::OnPan(Dali::PanGesture const &pan) {
   void * jpan = 0 ;
+  jpan = (Dali::PanGesture *) &pan;
+  swig_callbackOnPan(jpan);
 
-  if (!swig_callbackOnPan) {
-    Dali::Toolkit::Internal::Control::OnPan(pan);
-    return;
-  } else {
-    jpan = (Dali::PanGesture *) &pan;
-    swig_callbackOnPan(jpan);
-  }
+  Dali::Toolkit::Internal::Control::OnPan(pan);
 }
 
 void SwigDirector_ViewWrapperImpl::OnTap(Dali::TapGesture const &tap) {
   void * jtap = 0 ;
+  jtap = (Dali::TapGesture *) &tap;
+  swig_callbackOnTap(jtap);
 
-  if (!swig_callbackOnTap) {
-    Dali::Toolkit::Internal::Control::OnTap(tap);
-    return;
-  } else {
-    jtap = (Dali::TapGesture *) &tap;
-    swig_callbackOnTap(jtap);
-  }
+  Dali::Toolkit::Internal::Control::OnTap(tap);
 }
 
 void SwigDirector_ViewWrapperImpl::OnLongPress(Dali::LongPressGesture const &longPress) {
   void * jlongPress = 0 ;
 
-  if (!swig_callbackOnLongPress) {
-    Dali::Toolkit::Internal::Control::OnLongPress(longPress);
-    return;
-  } else {
-    jlongPress = (Dali::LongPressGesture *) &longPress;
-    swig_callbackOnLongPress(jlongPress);
-  }
-}
-
-void SwigDirector_ViewWrapperImpl::SignalConnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback) {
-  void * jslotObserver = 0 ;
-  void * jcallback = 0 ;
-
-  if (!swig_callbackSignalConnected) {
-    Dali::Toolkit::Internal::Control::SignalConnected(slotObserver,callback);
-    return;
-  } else {
-    jslotObserver = (void *) slotObserver;
-    jcallback = (void *) callback;
-    swig_callbackSignalConnected(jslotObserver, jcallback);
-  }
-}
-
-void SwigDirector_ViewWrapperImpl::SignalDisconnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback) {
-  void * jslotObserver = 0 ;
-  void * jcallback = 0 ;
+  jlongPress = (Dali::LongPressGesture *) &longPress;
+  swig_callbackOnLongPress(jlongPress);
 
-  if (!swig_callbackSignalDisconnected) {
-    Dali::Toolkit::Internal::Control::SignalDisconnected(slotObserver,callback);
-    return;
-  } else {
-    jslotObserver = (void *) slotObserver;
-    jcallback = (void *) callback;
-    swig_callbackSignalDisconnected(jslotObserver, jcallback);
-  }
+  Dali::Toolkit::Internal::Control::OnLongPress(longPress);
 }
 
 Dali::Toolkit::Internal::Control::Extension *SwigDirector_ViewWrapperImpl::GetControlExtension() {
index f95d74a..9b5a8be 100644 (file)
@@ -140,8 +140,6 @@ public:
     virtual void OnPan(Dali::PanGesture const &pan);
     virtual void OnTap(Dali::TapGesture const &tap);
     virtual void OnLongPress(Dali::LongPressGesture const &longPress);
-    virtual void SignalConnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback);
-    virtual void SignalDisconnected(Dali::SlotObserver *slotObserver, Dali::CallbackBase *callback);
     virtual Dali::Toolkit::Internal::Control::Extension *GetControlExtension();
 
     typedef void (SWIGSTDCALL* SWIG_Callback0_t)(int);
index 9c54cdd..83540d3 100644 (file)
@@ -60,14 +60,14 @@ namespace Dali
             viewWrapperImpl.OnPan = new ViewWrapperImpl.OnPanDelegate(OnPan);
             viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap);
             viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress);
-            viewWrapperImpl.SignalConnected = new ViewWrapperImpl.SignalConnectedDelegate(SignalConnected);
-            viewWrapperImpl.SignalDisconnected = new ViewWrapperImpl.SignalDisconnectedDelegate(SignalDisconnected);
 
             // Make sure CustomView is initialized.
             OnInitialize();
 
-            // Make sure the style of actors/visuals initialized above are applied by the style manager.
-            viewWrapperImpl.ApplyThemeStyle();
+            // Set the StyleName the name of the View
+            // We have to do this because the StyleManager on Native side can't workout it out
+            // This will also ensure that the style of actors/visuals initialized above are applied by the style manager.
+            SetStyleName( this.GetType().Name );
         }
 
         /**
@@ -805,14 +805,6 @@ namespace Dali
         {
         }
 
-        private void SignalConnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback)
-        {
-        }
-
-        private void SignalDisconnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback)
-        {
-        }
-
         private void OnControlChildAdd(Actor child)
         {
         }
index 0f42e4e..68fcef1 100644 (file)
@@ -58,8 +58,6 @@ namespace Dali
         public delegate void OnPanDelegate(PanGesture pan);
         public delegate void OnTapDelegate(TapGesture tap);
         public delegate void OnLongPressDelegate(LongPressGesture longPress);
-        public delegate void SignalConnectedDelegate(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback);
-        public delegate void SignalDisconnectedDelegate(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback);
 
         public OnStageConnectionDelegate OnStageConnection;
         public OnStageDisconnectionDelegate OnStageDisconnection;
@@ -99,8 +97,6 @@ namespace Dali
         public OnPanDelegate OnPan;
         public OnTapDelegate OnTap;
         public OnLongPressDelegate OnLongPress;
-        public SignalConnectedDelegate SignalConnected;
-        public SignalDisconnectedDelegate SignalDisconnected;
 
         internal ViewWrapperImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ViewWrapperImpl_SWIGUpcast(cPtr), cMemoryOwn)
         {
@@ -411,7 +407,10 @@ namespace Dali
 
         private void DirectorOnStyleChange(global::System.IntPtr styleManager, int change)
         {
-            OnStyleChange(new StyleManager(styleManager, false), (StyleChangeType)change);
+            if (OnStyleChange != null)
+            {
+                OnStyleChange(new StyleManager(styleManager, false), (StyleChangeType)change);
+            }
         }
 
         private bool DirectorOnAccessibilityActivated()
@@ -484,16 +483,6 @@ namespace Dali
             OnLongPress(new LongPressGesture(longPress, false));
         }
 
-        private void DirectorSignalConnected(global::System.IntPtr slotObserver, global::System.IntPtr callback)
-        {
-            SignalConnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false));
-        }
-
-        private void DirectorSignalDisconnected(global::System.IntPtr slotObserver, global::System.IntPtr callback)
-        {
-            SignalDisconnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false));
-        }
-
         public delegate void DelegateViewWrapperImpl_0(int depth);
         public delegate void DelegateViewWrapperImpl_1();
         public delegate void DelegateViewWrapperImpl_2(global::System.IntPtr child);