From b8c40a552195976cd5860b9f82f13fbed127d2f4 Mon Sep 17 00:00:00 2001 From: Ravi Nanjundappa Date: Wed, 14 Sep 2016 10:30:39 +0530 Subject: [PATCH] DALi C# binding - Rename Control class to View Renamed Control class to View class as per dali-halo common interface definition. DALi# Sample application is also changed to make use of View in place of Control class. Change-Id: If3195e1741878ce7d326b4ea3b8ef83b6fd13694 Signed-off-by: Ravi Nanjundappa --- plugins/dali-swig/SWIG/dali-toolkit.i | 5 ++- plugins/dali-swig/SWIG/events/control-event.i | 60 +++++++++++++-------------- plugins/dali-swig/examples/scroll-view.cs | 6 +-- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/plugins/dali-swig/SWIG/dali-toolkit.i b/plugins/dali-swig/SWIG/dali-toolkit.i index 19c1d4e..d172266 100644 --- a/plugins/dali-swig/SWIG/dali-toolkit.i +++ b/plugins/dali-swig/SWIG/dali-toolkit.i @@ -92,7 +92,8 @@ %ignore *::Button::SetTogglableButton(bool); %ignore *::Button::SetUnselectedImage(const std::string &); -%rename(ControlImpl) Dali::Toolkit::Internal::Control; +%rename(View) Dali::Toolkit::Control; +%rename(ViewImpl) Dali::Toolkit::Internal::Control; %rename(VisualBase) Dali::Toolkit::Visual::Base; %rename(ControlOrientationType) Dali::Toolkit::ControlOrientation::Type; %rename(DefaultItemLayoutType) Dali::Toolkit::DefaultItemLayout::Type; @@ -127,7 +128,7 @@ %rename(COLOR_VISUAL_MIX_COLOR) Dali::Toolkit::Color::Visual::Property::MIX_COLOR; %csconstvalue("PropertyRanges.PROPERTY_REGISTRATION_START_INDEX") PROPERTY_START_INDEX; -%csconstvalue("Control.PropertyRange.PROPERTY_START_INDEX+1000") PROPERTY_END_INDEX; +%csconstvalue("View.PropertyRange.PROPERTY_START_INDEX+1000") PROPERTY_END_INDEX; %csconstvalue("PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX") CHILD_PROPERTY_START_INDEX; %csconstvalue("PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX+1000") CHILD_PROPERTY_END_INDEX; %csconstvalue("PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX") ANIMATABLE_PROPERTY_START_INDEX; diff --git a/plugins/dali-swig/SWIG/events/control-event.i b/plugins/dali-swig/SWIG/events/control-event.i index 79b9034..a5418de 100644 --- a/plugins/dali-swig/SWIG/events/control-event.i +++ b/plugins/dali-swig/SWIG/events/control-event.i @@ -34,21 +34,21 @@ using System.Runtime.InteropServices; */ public class KeyInputFocusGainedEventArgs : EventArgs { - private Control _control; + private View _view; /** - * @brief Control - is the control that gets Key Input Focus + * @brief View - is the view that gets Key Input Focus * */ - public Control Control + public View View { get { - return _control; + return _view; } set { - _control = value; + _view = value; } } } @@ -59,21 +59,21 @@ public class KeyInputFocusGainedEventArgs : EventArgs */ public class KeyInputFocusLostEventArgs : EventArgs { - private Control _control; + private View _view; /** - * @brief Control - is the control that loses Key Input Focus + * @brief View - is the view that loses Key Input Focus * */ - public Control Control + public View View { get { - return _control; + return _view; } set { - _control = value; + _view = value; } } } @@ -84,27 +84,27 @@ public class KeyInputFocusLostEventArgs : EventArgs */ public class KeyEventArgs : EventArgs { - private Control _control; + private View _view; private KeyEvent _keyEvent; /** - * @brief Control - is the control that recieves the keyevent. + * @brief View - is the view that recieves the keyevent. * */ - public Control Control + public View View { get { - return _control; + return _view; } set { - _control = value; + _view = value; } } /** - * @brief KeyEvent - is the keyevent sent to the Control. + * @brief KeyEvent - is the keyevent sent to the View. * */ public KeyEvent KeyEvent @@ -130,24 +130,24 @@ public class KeyEventArgs : EventArgs public delegate bool KeyEventHandler(object source, KeyEventArgs e); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control); + private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr view); private KeyInputFocusGainedEventHandler _KeyInputFocusGainedEventHandler; private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control); + private delegate void KeyInputFocusLostCallbackDelegate(IntPtr view); private KeyInputFocusLostEventHandler _KeyInputFocusLostEventHandler; private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr keyEvent); + private delegate bool KeyCallbackDelegate(IntPtr view, IntPtr keyEvent); private KeyEventHandler _KeyEventHandler; private KeyCallbackDelegate _KeyCallbackDelegate; /** * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler * (in the type of KeyInputFocusGainedEventHandler) provided by the user. - * KeyInputFocusGained signal is emitted when the control gets Key Input Focus. + * KeyInputFocusGained signal is emitted when the view gets Key Input Focus. */ public event KeyInputFocusGainedEventHandler KeyInputFocusGained { @@ -180,12 +180,12 @@ public class KeyEventArgs : EventArgs } } - private void OnKeyInputFocusGained(IntPtr control) + private void OnKeyInputFocusGained(IntPtr view) { KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs(); // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data - e.Control = Dali.Control.GetControlFromPtr(control); + e.View = Dali.View.GetViewFromPtr(view); if (_KeyInputFocusGainedEventHandler != null) { @@ -198,7 +198,7 @@ public class KeyEventArgs : EventArgs /** * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler * (in the type of KeyInputFocusLostEventHandler) provided by the user. - * KeyInputFocusLost signal is emitted when the control loses Key Input Focus. + * KeyInputFocusLost signal is emitted when the view loses Key Input Focus. */ public event KeyInputFocusLostEventHandler KeyInputFocusLost { @@ -231,12 +231,12 @@ public class KeyEventArgs : EventArgs } } - private void OnKeyInputFocusLost(IntPtr control) + private void OnKeyInputFocusLost(IntPtr view) { KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs(); // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data - e.Control = Dali.Control.GetControlFromPtr(control); + e.View = Dali.View.GetViewFromPtr(view); if (_KeyInputFocusLostEventHandler != null) { @@ -281,13 +281,13 @@ public class KeyEventArgs : EventArgs } } - private bool OnKeyEvent(IntPtr control, IntPtr keyEvent) + private bool OnKeyEvent(IntPtr view, IntPtr keyEvent) { KeyEventArgs e = new KeyEventArgs(); // Populate all members of "e" (KeyEventArgs) with real data - e.Control = Dali.Control.GetControlFromPtr(control); - e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent); + e.View = Dali.View.GetViewFromPtr(view); + e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent); if (_KeyEventHandler != null) { @@ -298,8 +298,8 @@ public class KeyEventArgs : EventArgs } - public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) { - ClassName ret = new ClassName(cPtr, false); + public static View GetViewFromPtr(global::System.IntPtr cPtr) { + View ret = new View(cPtr, false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } diff --git a/plugins/dali-swig/examples/scroll-view.cs b/plugins/dali-swig/examples/scroll-view.cs index fa9cc55..f8ea8c8 100644 --- a/plugins/dali-swig/examples/scroll-view.cs +++ b/plugins/dali-swig/examples/scroll-view.cs @@ -65,7 +65,7 @@ namespace MyCSharpExample { for(int pageColumn = 0; pageColumn < pageColumns; pageColumn++) { - Control pageActor = new Control(); + View pageActor = new View(); pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS); pageActor.ParentOrigin = NDalic.ParentOriginCenter; pageActor.AnchorPoint = NDalic.AnchorPointCenter; @@ -118,10 +118,10 @@ namespace MyCSharpExample _scrollView.Add(_scrollBar); // Connect to the OnRelayout signal - _scrollView.OnRelayoutEvent += new Dali.Actor.OnRelayoutEventHandler(OnScrollViewRelayout); + _scrollView.OnRelayoutEvent += new Dali.View.OnRelayoutEventHandler(OnScrollViewRelayout); } - private void OnScrollViewRelayout(object source, Actor.OnRelayoutEventArgs e) + private void OnScrollViewRelayout(object source, View.OnRelayoutEventArgs e) { // Set the correct scroll bar size after size negotiation of scroll view is done _scrollBar.Size = new Vector3(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f); -- 2.7.4