From: dongsug.song Date: Mon, 19 Dec 2016 07:41:22 +0000 (+0900) Subject: Dali C#: Common Interface Define related changes X-Git-Tag: dali_1.2.20~8^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=0802b509ef2af3d87444003ab9b66224109447f4 Dali C#: Common Interface Define related changes - OnStage() : changed/added into property of 'IsStageOn{get;}', changed into internal. - View class inherit : changed to inherit from Actor (previously, CustomActor). - BackgroundImage, Background are moved to /internal/view.cs because these return Dali.Property class which needs to be hidden in Common-Interface. - KeyboardFocusManager naming changed : FocusManager, only class name is changed. need to change signal's names also. - KeyInputFocusManager : Instance property added. - Stage : BackgroundColor, Size property return types are changed from Dali.Color, Dali.Size to Vector4, Vector2. - Animation FinishedSignal : Event Handler has been changed to get only one argument. Event chaining enabled. - Animation EndAction : naming is changed as 'Cancel' and 'Stop', Stop(action) argument changed. EndAction property added. - Duration : set as Milli-second unit as default. (DurationMilliSecs: removed) - AnimateTo : Animation API interface changed. - Add user custom alphafunction : enable user defined simple custom alphafunction, add sample app "user-alphafunction.cs" how to define custom alphafunction and delegate - hello-world.cs, user-alphafunction.cs have been changed. - Dali build server error : break in dali-demo build, some rpm package get failed. remove dali csharp spec file. - EventHandler pattern changed : .NET provided EventHandler used. Stage Wheel event is not working. (but EventProcessingFinished works when actual mouse wheel controled.) Stage's event property naming changed. Change-Id: I0b5e1af8817c94f757ff7bf9e87bc850c4cbd50b Signed-off-by: dongsug.song --- diff --git a/packaging/dali-csharp-wrapper.spec b/packaging/dali-csharp-wrapper.spec deleted file mode 100755 index 2583885..0000000 --- a/packaging/dali-csharp-wrapper.spec +++ /dev/null @@ -1,149 +0,0 @@ -Name: NDalic -Summary: dali wrapper -Version: 1.2.19 -Release: 1 -Group: uifw/graphic -License: TO_BE_FILLED_IN -Source0: %{name}-%{version}.tar.gz -BuildRequires: cmake -BuildRequires: swig -#BuildRequires: ruby -#BuildRequires: ruby-devel - -#BuildRequires: mono-core -#BuildRequires: mono-compat -#BuildRequires: mono-data -#BuildRequires: mono-compiler -#BuildRequires: mono-wcf -#BuildRequires: mono-web - -BuildRequires: pkgconfig - -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(dali-core) -BuildRequires: pkgconfig(dali-adaptor) -BuildRequires: pkgconfig(dali-toolkit) - -BuildRequires: dali-devel -BuildRequires: dali-integration-devel -BuildRequires: dali-adaptor-devel -BuildRequires: dali-adaptor-integration-devel -BuildRequires: dali-toolkit-devel - - -%description -dali wrapper - -%package dali-wrapper - -Summary: Development dali-wrapper -Group: Development/Libraries/Other -Requires: %{name} = %{version} - -%description dali-wrapper -Development .so for dali wrapper -%define daliSwigDir %{_builddir}/%{name}-%{version}/build/tizen -%define daliToolkitDir %{_builddir}/dali-toolkit-%{version}/build/tizen -%define daliPluginsDir %{_builddir}/%{name}-%{version}/build/tizen/plugins/csharp - -############################# -# profile setup -############################# - - -%define dali_toolkit_profile MOBILE - -%define dali_style_folder 720x1280 -# dali_style to be provided by build system as with dali_toolkit_profile or by passing --define 'dali_style 470x800' to the rpm build command - -%if "%{?dali_style}" - %define dali_style_folder %{dali_style} -%endif - -# Further resource locations profiles can be provided here otherwise MOBILE will be used -%if "%{tizen_profile_name}" == "mobile" - %define dali_toolkit_profile MOBILE -%endif - -%description -The OpenGLES Canvas Core Library Toolkit - a set of controls that provide -user interface functionality. - -############################## -# Preparation -############################## -%prep -%setup -q - -#Use TZ_PATH when tizen version is 3.x - -%if "%{tizen_version_major}" == "2" -%define ndali_data_rw_dir /opt/usr/share/dali/ -%define ndali_data_ro_dir /usr/share/dali/ -%else -%define ndali_data_rw_dir %TZ_SYS_SHARE/dali/ -%define ndali_data_ro_dir %TZ_SYS_RO_SHARE/dali/ -%endif -############################## -# Build -############################## -%build -echo "----------------" %{_builddir} -echo "----------------" %{daliSwigDir} -echo "----------------" %{_libdir} -echo "----------------" %{daliPluginsDir} - -PREFIX="/usr" -CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections " -LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions " - -%if 0%{?enable_coverage} -CXXFLAGS+=" --coverage " -LDFLAGS+=" --coverage " -%endif - - -############################## -# Build dali-wrap -############################## - -libtoolize --force -cd %{daliSwigDir} -autoreconf --install -NDALI_DATA_RW_DIR="%{ndali_data_rw_dir}" ; export NDALI_DATA_RW_DIR -NDALI_DATA_RO_DIR="%{ndali_data_ro_dir}" ; export NDALI_DATA_RO_DIR -%configure --enable-profile=%{dali_toolkit_profile} \ - --with-style=%{dali_style_folder} \ - --enable-csharp=yes \ -%if 0%{?enable_debug} - --enable-debug \ -%endif - --enable-i18n=yes -cd %{daliPluginsDir} -make gbs-local - -############################## -# Installation -############################## -echo "----------------" %{_buildrootdir} -%install -cd "%{daliPluginsDir}" -make DESTDIR=%{_buildrootdir}/%{name}-%{version}-%{release}.arm/usr/lib/ gbs-install - -#mv %{_builddir}/%{name}-%{version}/plugins/dali-swig/NDali.dll %{_buildrootdir}/%{name}-%{version}-%{release}.arm/usr/lib/ - -############################## -# Post Install -############################## -%post - - -############################## -# Files in Binary Packages -############################## -%files -%manifest dali-csharp-wrapper.manifest -%defattr(-,root,root,-) -%{_libdir}/lib* -%{_libdir}/NDali.dll - diff --git a/plugins/dali-swig/Makefile.am b/plugins/dali-swig/Makefile.am old mode 100644 new mode 100755 index af4f807..1e437ce --- a/plugins/dali-swig/Makefile.am +++ b/plugins/dali-swig/Makefile.am @@ -47,6 +47,7 @@ check-local: examples/dali-test.exe \ examples/custom-control.exe \ examples/spin-control.exe \ examples/control-dashboard.exe \ + examples/user-alphafunction.exe \ examples/libNDalic.so examples/NDali.dll examples/%.exe: examples/%.cs diff --git a/plugins/dali-swig/SWIG/alphafunction.i b/plugins/dali-swig/SWIG/alphafunction.i old mode 100644 new mode 100755 index 26003be..154641c --- a/plugins/dali-swig/SWIG/alphafunction.i +++ b/plugins/dali-swig/SWIG/alphafunction.i @@ -16,7 +16,13 @@ */ %typemap(cscode) Dali::AlphaFunction %{ - public AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_1((int)function), true){ + public AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_1((int)function), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AlphaFunction(System.Delegate func) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_2(SWIGTYPE_p_f_float__float.getCPtr(new SWIGTYPE_p_f_float__float(System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func), true))), true) + { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } %} diff --git a/plugins/dali-swig/SWIG/dali-core.i b/plugins/dali-swig/SWIG/dali-core.i old mode 100644 new mode 100755 index 29edf14..04a1732 --- a/plugins/dali-swig/SWIG/dali-core.i +++ b/plugins/dali-swig/SWIG/dali-core.i @@ -147,6 +147,7 @@ %rename(BlendingEquationType) Dali::BlendingEquation::Type; %rename(CameraType) Dali::Camera::Type; %rename(LayerBehavior) Dali::Layer::Behavior; +%rename(DaliEndAction) Dali::Animation::EndAction; typedef std::pair StringValuePair; typedef std::vector TouchPointContainer; @@ -282,13 +283,13 @@ typedef std::pair< Dali::Radian, Dali::Radian > AngleThresholdPair; %template(ImageSignal) Dali::Signal; %template(RenderTaskSignal) Dali::Signal; %template(LongPressGestureDetectedSignal) Dali::Signal; -%template(ActorTouchEventSignal) Dali::Signal; +//%template(ActorTouchEventSignal) Dali::Signal; %template(ActorTouchDataSignal) Dali::Signal; %template(ActorHoverEventSignal) Dali::Signal; %template(ActorWheelEventSignal) Dali::Signal; %template(ActorSignal) Dali::Signal; %template(KeyEventSignal) Dali::Signal; -%template(TouchEventSignal) Dali::Signal; +//%template(TouchEventSignal) Dali::Signal; %template(TouchSignal) Dali::Signal; %template(StageWheelEventSignal) Dali::Signal; %template(AngleThresholdPair) std::pair; diff --git a/plugins/dali-swig/SWIG/dali-toolkit.i b/plugins/dali-swig/SWIG/dali-toolkit.i old mode 100644 new mode 100755 diff --git a/plugins/dali-swig/SWIG/dali.i b/plugins/dali-swig/SWIG/dali.i index 4a612e9..ee70716 100755 --- a/plugins/dali-swig/SWIG/dali.i +++ b/plugins/dali-swig/SWIG/dali.i @@ -196,7 +196,6 @@ using namespace Dali::Toolkit; %include events/gaussian-blur-view-event.i %include events/image-event.i %include events/itemview-event.i -%include events/keyboardFocusManager-event.i %include events/objectregistry-event.i %include events/popup-event.i %include events/pinchgesture-event.i diff --git a/plugins/dali-swig/SWIG/events/actor-event.i b/plugins/dali-swig/SWIG/events/actor-event.i old mode 100644 new mode 100755 index 1deccbc..f65e658 --- a/plugins/dali-swig/SWIG/events/actor-event.i +++ b/plugins/dali-swig/SWIG/events/actor-event.i @@ -41,8 +41,7 @@ { get { - Actor parent = GetParent(); - return parent; + return GetParent(); } } @@ -50,8 +49,7 @@ { get { - bool visibility = IsVisible(); - return visibility; + return IsVisible(); } } @@ -63,8 +61,7 @@ } get { - float ret = GetCurrentOpacity(); - return ret; + return GetCurrentOpacity(); } } @@ -76,8 +73,15 @@ } get { - bool focusable = IsKeyboardFocusable(); - return focusable; + return IsKeyboardFocusable(); + } + } + + public bool IsOnStage + { + get + { + return OnStage(); } } diff --git a/plugins/dali-swig/SWIG/events/animation-event.i b/plugins/dali-swig/SWIG/events/animation-event.i old mode 100644 new mode 100755 index bb21466..2bbc118 --- a/plugins/dali-swig/SWIG/events/animation-event.i +++ b/plugins/dali-swig/SWIG/events/animation-event.i @@ -26,113 +26,25 @@ using System.Runtime.InteropServices; %define Animation_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName) %typemap(cscode) NameSpace::ClassName %{ - public static readonly int ParentOrigin = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_get(); - public static readonly int ParentOriginX = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_X_get(); - public static readonly int ParentOriginY = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Y_get(); - public static readonly int ParentOriginZ = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Z_get(); - public static readonly int AnchorPoint = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_get(); - public static readonly int AnchorPointX = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_X_get(); - public static readonly int AnchorPointY = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Y_get(); - public static readonly int AnchorPointZ = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Z_get(); - public static readonly int Size = NDalicPINVOKE.Actor_Property_SIZE_get(); - public static readonly int SizeWidth = NDalicPINVOKE.Actor_Property_SIZE_WIDTH_get(); - public static readonly int SizeHeight = NDalicPINVOKE.Actor_Property_SIZE_HEIGHT_get(); - public static readonly int SizeDepth = NDalicPINVOKE.Actor_Property_SIZE_DEPTH_get(); - public static readonly int Position = NDalicPINVOKE.Actor_Property_POSITION_get(); - public static readonly int PositionX = NDalicPINVOKE.Actor_Property_POSITION_X_get(); - public static readonly int PositionY = NDalicPINVOKE.Actor_Property_POSITION_Y_get(); - public static readonly int PositionZ = NDalicPINVOKE.Actor_Property_POSITION_Z_get(); - public static readonly int WorldPosition = NDalicPINVOKE.Actor_Property_WORLD_POSITION_get(); - public static readonly int WorldPositionX = NDalicPINVOKE.Actor_Property_WORLD_POSITION_X_get(); - public static readonly int WorldPositionY = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Y_get(); - public static readonly int WorldPositionZ = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Z_get(); - public static readonly int Orientation = NDalicPINVOKE.Actor_Property_ORIENTATION_get(); - public static readonly int WorldOrientation = NDalicPINVOKE.Actor_Property_WORLD_ORIENTATION_get(); - public static readonly int Scale = NDalicPINVOKE.Actor_Property_SCALE_get(); - public static readonly int ScaleX = NDalicPINVOKE.Actor_Property_SCALE_X_get(); - public static readonly int ScaleY = NDalicPINVOKE.Actor_Property_SCALE_Y_get(); - public static readonly int ScaleZ = NDalicPINVOKE.Actor_Property_SCALE_Z_get(); - public static readonly int WorldScale = NDalicPINVOKE.Actor_Property_WORLD_SCALE_get(); - public static readonly int Visibile = NDalicPINVOKE.Actor_Property_VISIBLE_get(); - public static readonly int Color = NDalicPINVOKE.Actor_Property_COLOR_get(); - public static readonly int ColorRed = NDalicPINVOKE.Actor_Property_COLOR_RED_get(); - public static readonly int ColorGreeb = NDalicPINVOKE.Actor_Property_COLOR_GREEN_get(); - public static readonly int ColorBlue = NDalicPINVOKE.Actor_Property_COLOR_BLUE_get(); - public static readonly int ColorAlpha = NDalicPINVOKE.Actor_Property_COLOR_ALPHA_get(); - public static readonly int WorldColor = NDalicPINVOKE.Actor_Property_WORLD_COLOR_get(); - public static readonly int WorldMatrix = NDalicPINVOKE.Actor_Property_WORLD_MATRIX_get(); - public static readonly int Name = NDalicPINVOKE.Actor_Property_NAME_get(); - public static readonly int Sensitive = NDalicPINVOKE.Actor_Property_SENSITIVE_get(); - public static readonly int LeaveRequired = NDalicPINVOKE.Actor_Property_LEAVE_REQUIRED_get(); - public static readonly int InheritOrientation = NDalicPINVOKE.Actor_Property_INHERIT_ORIENTATION_get(); - public static readonly int InheritScale = NDalicPINVOKE.Actor_Property_INHERIT_SCALE_get(); - public static readonly int ColorMode = NDalicPINVOKE.Actor_Property_COLOR_MODE_get(); - public static readonly int PositionInheritance = NDalicPINVOKE.Actor_Property_POSITION_INHERITANCE_get(); - public static readonly int DrawMode = NDalicPINVOKE.Actor_Property_DRAW_MODE_get(); - public static readonly int SizeModeFactor = NDalicPINVOKE.Actor_Property_SIZE_MODE_FACTOR_get(); - public static readonly int WidthResizePolicy = NDalicPINVOKE.Actor_Property_WIDTH_RESIZE_POLICY_get(); - public static readonly int HeightResizePolicy = NDalicPINVOKE.Actor_Property_HEIGHT_RESIZE_POLICY_get(); - public static readonly int SizeScalePolicy = NDalicPINVOKE.Actor_Property_SIZE_SCALE_POLICY_get(); - public static readonly int WidthForHeight = NDalicPINVOKE.Actor_Property_WIDTH_FOR_HEIGHT_get(); - public static readonly int HeightForWidth = NDalicPINVOKE.Actor_Property_HEIGHT_FOR_WIDTH_get(); - public static readonly int Padding = NDalicPINVOKE.Actor_Property_PADDING_get(); - public static readonly int MinimumSize = NDalicPINVOKE.Actor_Property_MINIMUM_SIZE_get(); - public static readonly int MaximumSize = NDalicPINVOKE.Actor_Property_MAXIMUM_SIZE_get(); - public static readonly int InheritPosition = NDalicPINVOKE.Actor_Property_INHERIT_POSITION_get(); - public static readonly int ClippingMode = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get(); - /** - * @brief Event arguments that passed via Finished signal - * - */ - public class FinishedEventArgs : EventArgs - { - private Animation _animation; - - /** - * @brief Animation - is the Animation which has finished with the animation. - * - */ - public Animation Animation - { - get - { - return _animation; - } - set - { - _animation = value; - } - } - } - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void FinishedEventCallbackDelegate(IntPtr Animation); - private DaliEventHandler _animationFinishedEventHandler; - private FinishedEventCallbackDelegate _animationFinishedEventCallbackDelegate; + private EventCallbackDelegateType1 _animationFinishedEventCallbackDelegate; + private event EventHandler _animationFinishedEventHandler; /** * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler - * (in the type of FinishedEventHandler - DaliEventHandler) provided by the user. * Finished signal is emitted when an Animation's animations have finished. */ - public event DaliEventHandler Finished + public event EventHandler Finished { add { lock(this) { - // Restricted to only one listener - if (_animationFinishedEventHandler == null) - { - _animationFinishedEventHandler += value; - - _animationFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished); - this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate); - } + _animationFinishedEventHandler += value; + _animationFinishedEventCallbackDelegate = OnFinished; + this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate); } } - remove { lock(this) @@ -141,7 +53,6 @@ using System.Runtime.InteropServices; { this.FinishedSignal().Disconnect(_animationFinishedEventCallbackDelegate); } - _animationFinishedEventHandler -= value; } } @@ -150,49 +61,38 @@ using System.Runtime.InteropServices; // Callback for Animation FinishedSignal private void OnFinished(IntPtr data) { - FinishedEventArgs e = new FinishedEventArgs(); - - // Populate all members of "e" (FinishedEventArgs) with real data - e.Animation = Animation.GetAnimationFromPtr(data); - if (_animationFinishedEventHandler != null) { //here we send all data to user event handlers - _animationFinishedEventHandler(this, e); + _animationFinishedEventHandler(this, null); } } - public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) { ClassName ret = new ClassName(cPtr, false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + private float MilliSecondsToSeconds( int millisec ) + { + return (float)millisec / 1000.0f; + } - public float Duration + private int SecondsToMilliSeconds( float sec ) { - set - { - SetDuration(value); - } - get - { - float ret = GetDuration(); - return ret; - } + return (int)( sec * 1000 ); } - public int DurationMilliSecs + public int Duration { set { - SetDuration(value/1000); + SetDuration( MilliSecondsToSeconds( value ) ); } get { - int ret = (int) GetDuration() * 1000; - return ret; + return SecondsToMilliSeconds( GetDuration() ); } } @@ -209,12 +109,11 @@ using System.Runtime.InteropServices; } } - public Animation.State Status + public Dali.Constants.Animation.State Status { get { - Animation.State ret = GetState(); - return ret; + return (Dali.Constants.Animation.State)GetState(); } } @@ -244,114 +143,272 @@ using System.Runtime.InteropServices; } } - public void AnimateBy(Actor target, T propertyIndex, U relativeValue) + public Dali.Constants.Animation.EndAction EndAction { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(relativeValue); - AnimateBy(new Property(target, var), new Property.Value(obj)); + set + { + switch(value) + { + case Dali.Constants.Animation.EndAction.Cancel : + SetEndAction(Dali.Animation.DaliEndAction.Bake); + break; + case Dali.Constants.Animation.EndAction.Discard : + SetEndAction(Dali.Animation.DaliEndAction.Discard); + break; + case Dali.Constants.Animation.EndAction.Stop : + SetEndAction(Dali.Animation.DaliEndAction.BakeFinal); + break; + default : + SetEndAction(Dali.Animation.DaliEndAction.Bake); + break; + } + } + get + { + Dali.Animation.DaliEndAction temp = GetEndAction(); + switch(temp) + { + case Dali.Animation.DaliEndAction.Bake : + return Dali.Constants.Animation.EndAction.Cancel; + case Dali.Animation.DaliEndAction.Discard : + return Dali.Constants.Animation.EndAction.Discard; + case Dali.Animation.DaliEndAction.BakeFinal : + return Dali.Constants.Animation.EndAction.Stop; + default : + return Dali.Constants.Animation.EndAction.Cancel; + } + } } - public void AnimateBy(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha) - { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(relativeValue); - AnimateBy(new Property(target, var), new Property.Value(obj), alpha); + public void Stop(Dali.Constants.Animation.EndAction action) { + switch( action ) + { + case Dali.Constants.Animation.EndAction.Cancel : + SetEndAction(Dali.Animation.DaliEndAction.Bake); + break; + case Dali.Constants.Animation.EndAction.Discard : + SetEndAction(Dali.Animation.DaliEndAction.Discard); + break; + case Dali.Constants.Animation.EndAction.Stop : + SetEndAction(Dali.Animation.DaliEndAction.BakeFinal); + break; + default : + SetEndAction(Dali.Animation.DaliEndAction.Bake); + break; + } + NDalicPINVOKE.Animation_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public void AnimateBy(Actor target, T propertyIndex, U relativeValue, TimePeriod period) - { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(relativeValue); - AnimateBy(new Property(target, var), new Property.Value(obj), period); - } + public int StartTime { set; get; } + public int EndTime { set; get; } + public string TargetPoperty { set; get; } + public object Destination { set; get; } + public Dali.AlphaFunction AlphaFunction { set; get; } - public void AnimateBy(Actor target, T propertyIndex, U relativeValue, AlphaFunction alpha, TimePeriod period) - { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(relativeValue); - AnimateBy(new Property(target, var), new Property.Value(obj), alpha, period); - } - public void AnimateTo(Actor target, T propertyIndex, U destinationValue) + public void AnimateBy(Actor target) { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(destinationValue); - AnimateTo(new Property(target, var), new Property.Value(obj)); - } + string _str1 = TargetPoperty.Substring(0, 1); + string _str2 = TargetPoperty.Substring(1); + string _str = _str1.ToLower() + _str2; - public void AnimateTo(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha) - { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(destinationValue); - AnimateTo(new Property(target, var), new Property.Value(obj), alpha); - } + dynamic obj = (object)Destination; - public void AnimateTo(Actor target, T propertyIndex, U destinationValue, TimePeriod period) - { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(destinationValue); - AnimateTo(new Property(target, var), new Property.Value(obj), period); + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBy(new Property(target, _str), new Property.Value(obj) ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateBy(new Property(target, _str), new Property.Value(obj), time ); + } + } } - public void AnimateTo(Actor target, T propertyIndex, U destinationValue, AlphaFunction alpha, TimePeriod period) + public void AnimateBy(Actor target, string propertyIndex) { - dynamic var = (object)(propertyIndex); - dynamic obj = (object)(destinationValue); - AnimateTo(new Property(target, var), new Property.Value(obj), alpha, period); - } + string _str1 = propertyIndex.Substring(0, 1); + string _str2 = propertyIndex.Substring(1); + string _str = _str1.ToLower() + _str2; - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames) - { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames); - } + dynamic obj = (object)Destination; - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, Animation.Interpolation interpolation) - { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames, interpolation); + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBy(new Property(target, _str), new Property.Value(obj) ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateBy(new Property(target, _str), new Property.Value(obj), time ); + } + } } - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha) + public void AnimateBy(Actor target, string propertyIndex, object relativeValue) { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames, alpha); - } + string _str1 = propertyIndex.Substring(0, 1); + string _str2 = propertyIndex.Substring(1); + string _str = _str1.ToLower() + _str2; - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation) - { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames, alpha, interpolation); - } + dynamic obj = (object)relativeValue; - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period) - { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames, period); + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateBy(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateBy(new Property(target, _str), new Property.Value(obj) ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateBy(new Property(target, _str), new Property.Value(obj), time ); + } + } } - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation) + public void AnimateTo(Actor target) { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames, period, interpolation); + string _str1 = TargetPoperty.Substring(0, 1); + string _str2 = TargetPoperty.Substring(1); + string _str = _str1.ToLower() + _str2; + + dynamic obj = (object)Destination; + + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateTo(new Property(target, _str), new Property.Value(obj) ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateTo(new Property(target, _str), new Property.Value(obj), time ); + } + } } - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period) + public void AnimateTo(Actor target, string propertyIndex) { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames, alpha, period); + string _str1 = propertyIndex.Substring(0, 1); + string _str2 = propertyIndex.Substring(1); + string _str = _str1.ToLower() + _str2; + + dynamic obj = (object)Destination; + + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateTo(new Property(target, _str), new Property.Value(obj) ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateTo(new Property(target, _str), new Property.Value(obj), time ); + } + } } - public void AnimateBetween(Actor target, U propertyIndex, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation) + public void AnimateTo(Actor target, string propertyIndex, object destinationValue) { - dynamic var = (object)(propertyIndex); - AnimateBetween(new Property(target, var), keyFrames, alpha, period, interpolation); - } + string _str1 = propertyIndex.Substring(0, 1); + string _str2 = propertyIndex.Substring(1); + string _str = _str1.ToLower() + _str2; - public void Stop(Animation.EndAction action) { - SetEndAction(action); - NDalicPINVOKE.Animation_Stop(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + dynamic obj = (object)destinationValue; + + if( this.AlphaFunction != null ) + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateTo(new Property(target, _str), new Property.Value(obj), this.AlphaFunction, time ); + } + } + else + { + if( this.StartTime == 0 && this.EndTime == 0 ) + { + AnimateTo(new Property(target, _str), new Property.Value(obj) ); + } + else + { + Dali.TimePeriod time = new Dali.TimePeriod( MilliSecondsToSeconds( this.StartTime ), MilliSecondsToSeconds( this.EndTime ) ); + AnimateTo(new Property(target, _str), new Property.Value(obj), time ); + } + } } /** @@ -368,6 +425,11 @@ using System.Runtime.InteropServices; public Animation (int durationmSeconds) : this (NDalicPINVOKE.Animation_New((float)durationmSeconds/1000.0f), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + + public Animation () : this (NDalicPINVOKE.Animation_New( 0.0f ), true ) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + %} %enddef diff --git a/plugins/dali-swig/SWIG/events/control-event.i b/plugins/dali-swig/SWIG/events/control-event.i old mode 100644 new mode 100755 index 489af5a..9d32da5 --- a/plugins/dali-swig/SWIG/events/control-event.i +++ b/plugins/dali-swig/SWIG/events/control-event.i @@ -779,6 +779,8 @@ // Populate all members of "e" (OnStageEventArgs) with real data e.View = View.GetViewFromPtr(data); + //Console.WriteLine("############# OnStage()! e.View.Name=" + e.View.Name); + if (_viewOnStageEventHandler != null) { //here we send all data to user event handlers diff --git a/plugins/dali-swig/SWIG/events/keyboardFocusManager-event.i b/plugins/dali-swig/SWIG/events/keyboardFocusManager-event.i old mode 100644 new mode 100755 diff --git a/plugins/dali-swig/SWIG/events/stage-event.i b/plugins/dali-swig/SWIG/events/stage-event.i old mode 100644 new mode 100755 index 74693cd..ed2dabc --- a/plugins/dali-swig/SWIG/events/stage-event.i +++ b/plugins/dali-swig/SWIG/events/stage-event.i @@ -26,174 +26,52 @@ using System.Runtime.InteropServices; %define STAGE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName) %typemap(cscode) NameSpace::ClassName %{ -/** - * @brief Event arguments that passed via Touch signal - * - */ -public class TouchEventArgs : EventArgs -{ - private TouchData _touchData; - - /** - * @brief TouchData - contains the information of touch points - * - */ - public TouchData TouchData - { - get - { - return _touchData; - } - set - { - _touchData = value; - } - } -} - - -/** - * @brief Event arguments that passed via Wheel signal - * - */ -public class WheelEventArgs : EventArgs -{ - private WheelEvent _wheelEvent; - - /** - * @brief WheelEvent - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL - * - */ - public WheelEvent WheelEvent - { - get - { - return _wheelEvent; - } - set - { - _wheelEvent = value; - } - } -} - -/** - * @brief Event arguments that passed via KeyEvent signal - * - */ -public class KeyEventArgs : EventArgs -{ - private KeyEvent _keyEvent; - - /** - * @brief KeyEvent - is the keyevent sent to Stage. - * - */ - public KeyEvent KeyEvent - { - get - { - return _keyEvent; - } - set - { - _keyEvent = value; - } - } -} - -/** - * @brief Event arguments that passed via EventProcessingFinished signal - * - */ -public class EventProcessingFinishedEventArgs : EventArgs -{ -} - -/** - * @brief Event arguments that passed via ContextLost signal - * - */ -public class ContextLostEventArgs : EventArgs -{ -} - -/** - * @brief Event arguments that passed via ContextRegained signal - * - */ -public class ContextRegainedEventArgs : EventArgs -{ -} - -/** - * @brief Event arguments that passed via SceneCreated signal - * - */ -public class SceneCreatedEventArgs : EventArgs -{ -} - - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void StageTouchCallbackDelegate(IntPtr data); - private DaliEventHandler _stageTouchEventHandler; - private StageTouchCallbackDelegate _stageTouchCallbackDelegate; - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void WheelCallbackDelegate(IntPtr data); - private DaliEventHandler _stageWheelEventHandler; - private WheelCallbackDelegate _stageWheelCallbackDelegate; - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void KeyCallbackDelegate(IntPtr data); - private DaliEventHandler _stageKeyEventHandler; - private KeyCallbackDelegate _stageKeyCallbackDelegate; - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void EventProcessingFinishedEventCallbackDelegate(); - private DaliEventHandler _stageEventProcessingFinishedEventHandler; - private EventProcessingFinishedEventCallbackDelegate _stageEventProcessingFinishedEventCallbackDelegate; - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void ContextLostEventCallbackDelegate(); - private DaliEventHandler _stageContextLostEventHandler; - private ContextLostEventCallbackDelegate _stageContextLostEventCallbackDelegate; + /** + * @brief Event arguments that passed via Touch signal + * + */ + public class TouchEventArgs : EventArgs + { + private TouchData _touchData; - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void ContextRegainedEventCallbackDelegate(); - private DaliEventHandler _stageContextRegainedEventHandler; - private ContextRegainedEventCallbackDelegate _stageContextRegainedEventCallbackDelegate; + /** + * @brief TouchData - contains the information of touch points + * + */ + public TouchData TouchData + { + get + { + return _touchData; + } + set + { + _touchData = value; + } + } + } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void SceneCreatedEventCallbackDelegate(); - private DaliEventHandler _stageSceneCreatedEventHandler; - private SceneCreatedEventCallbackDelegate _stageSceneCreatedEventCallbackDelegate; + private event EventHandler _stageTouchEventHandler; + private EventCallbackDelegateType1 _stageTouchCallbackDelegate; /** - * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler - * (in the type of TouchEventHandler-DaliEventHandler) provided by the user. - * Touched signal is emitted when the screen is touched and when the touch ends + * @brief Event for TouchEvent signal which can be used to subscribe/unsubscribe the event handler + * TouchEvent signal is emitted when the screen is touched and when the touch ends * (i.e. the down & up touch events only). * */ - public event DaliEventHandler Touched + public event EventHandler TouchEvent { add { lock(this) { - // Restricted to only one listener - if (_stageTouchEventHandler == null) - { - _stageTouchEventHandler += value; - - _stageTouchCallbackDelegate = new StageTouchCallbackDelegate(OnStageTouch); - this.TouchSignal().Connect(_stageTouchCallbackDelegate); - } + _stageTouchEventHandler += value; + _stageTouchCallbackDelegate = OnStageTouch; + this.TouchSignal().Connect(_stageTouchCallbackDelegate); } } - remove { lock(this) @@ -202,50 +80,71 @@ public class SceneCreatedEventArgs : EventArgs { this.TouchSignal().Disconnect(_stageTouchCallbackDelegate); } - _stageTouchEventHandler -= value; } } } - // Callback for Stage Touch signal private void OnStageTouch(IntPtr data) { - TouchEventArgs e = new TouchEventArgs(); + TouchEventArgs e = new TouchEventArgs(); + + if( data != null ) + { + e.TouchData = TouchData.GetTouchDataFromPtr( data ); + } + + if (_stageTouchEventHandler != null) + { + _stageTouchEventHandler(this, e); + } + } + - // Populate all members of "e" (TouchEventArgs) with real data - e.TouchData = TouchData.GetTouchDataFromPtr( data ); + /** + * @brief WheelEvent arguments that passed via Wheel signal + * + */ + public class WheelEventArgs : EventArgs + { + private WheelEvent _wheelEvent; - if (_stageTouchEventHandler != null) + /** + * @brief WheelEvent - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL + * + */ + public WheelEvent WheelEvent { - //here we send all data to user event handlers - _stageTouchEventHandler(this, e); + get + { + return _wheelEvent; + } + set + { + _wheelEvent = value; + } } } + private event EventHandler _stageWheelEventHandler; + private EventCallbackDelegateType1 _stageWheelCallbackDelegate; + /** - * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler - * (in the type of WheelEventHandler-DaliEventHandler) provided by the user. - * WheelMoved signal is emitted is emitted when wheel event is received. + * @brief Event for WheelEvent signal which can be used to subscribe/unsubscribe the event handler + * WheelEvent signal is emitted is emitted when wheel event is received. * */ - public event DaliEventHandler WheelMoved + public event EventHandler WheelEvent { add { lock(this) { - // Restricted to only one listener - if (_stageWheelEventHandler == null) - { - _stageWheelEventHandler += value; - - _stageWheelCallbackDelegate = new WheelCallbackDelegate(OnStageWheel); - this.WheelEventSignal().Connect(_stageWheelCallbackDelegate); - } + _stageWheelEventHandler += value; + _stageWheelCallbackDelegate = OnStageWheel; + this.WheelEventSignal().Connect(_stageWheelCallbackDelegate); } } - remove { lock(this) @@ -254,50 +153,70 @@ public class SceneCreatedEventArgs : EventArgs { this.WheelEventSignal().Disconnect(_stageWheelCallbackDelegate); } - _stageWheelEventHandler -= value; } } } - // Callback for Stage WheelEventsignal private void OnStageWheel(IntPtr data) { - WheelEventArgs e = new WheelEventArgs(); + WheelEventArgs e = new WheelEventArgs(); - // Populate all members of "e" (WheelEventArgs) with real data - e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr( data ); + if( data != null ) + { + e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr( data ); + } + + if (_stageWheelEventHandler != null) + { + _stageWheelEventHandler(this, e); + } + } + + /** + * @brief Event arguments that passed via KeyEvent signal + * + */ + public class KeyEventArgs : EventArgs + { + private KeyEvent _keyEvent; - if (_stageWheelEventHandler != null) + /** + * @brief KeyEvent - is the keyevent sent to Stage. + * + */ + public KeyEvent KeyEvent { - //here we send all data to user event handlers - _stageWheelEventHandler(this, e); + get + { + return _keyEvent; + } + set + { + _keyEvent = value; + } } } + private event EventHandler _stageKeyEventHandler; + private EventCallbackDelegateType1 _stageKeyCallbackDelegate; + /** - * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler - * (in the type of KeyEventHandler-DaliEventHandler) provided by the user. - * KeyPressed signal is emitted is emitted when key event is received. + * @brief Event for KeyEvent signal which can be used to subscribe/unsubscribe the event handler + * KeyEvent signal is emitted is emitted when key event is received. * */ - public event DaliEventHandler KeyPressed + public event EventHandler KeyEvent { add { lock(this) { - // Restricted to only one listener - if (_stageKeyEventHandler == null) - { - _stageKeyEventHandler += value; - - _stageKeyCallbackDelegate = new KeyCallbackDelegate(OnStageKey); - this.KeyEventSignal().Connect(_stageKeyCallbackDelegate); - } + _stageKeyEventHandler += value; + _stageKeyCallbackDelegate = OnStageKey; + this.KeyEventSignal().Connect(_stageKeyCallbackDelegate); } } - remove { lock(this) @@ -306,50 +225,48 @@ public class SceneCreatedEventArgs : EventArgs { this.KeyEventSignal().Disconnect(_stageKeyCallbackDelegate); } - _stageKeyEventHandler -= value; } } } // Callback for Stage KeyEventsignal - private void OnStageKey(IntPtr keyEvent) + private void OnStageKey(IntPtr data) { - KeyEventArgs e = new KeyEventArgs(); + KeyEventArgs e = new KeyEventArgs(); + + if( data != null ) + { + e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr( data ); + } + + if (_stageKeyEventHandler != null) + { + //here we send all data to user event handlers + _stageKeyEventHandler(this, e); + } + } - // Populate all members of "e" (KeyEventArgs) with real data - e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr( keyEvent ); - if (_stageKeyEventHandler != null) - { - //here we send all data to user event handlers - _stageKeyEventHandler(this, e); - } - } + private event EventHandler _stageEventProcessingFinishedEventHandler; + private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate; /** * @brief Event for EventProcessingFinished signal which can be used to subscribe/unsubscribe the event handler - * (in the type of EventProcessingFinishedEventHandler-DaliEventHandler) * provided by the user. EventProcessingFinished signal is emitted just after the event processing is finished. * */ - public event DaliEventHandler EventProcessingFinished + public event EventHandler EventProcessingFinished { add { lock(this) { - // Restricted to only one listener - if (_stageEventProcessingFinishedEventHandler == null) - { - _stageEventProcessingFinishedEventHandler += value; - - _stageEventProcessingFinishedEventCallbackDelegate = new EventProcessingFinishedEventCallbackDelegate(OnEventProcessingFinished); - this.EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate); - } + _stageEventProcessingFinishedEventHandler += value; + _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished; + this.EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate); } } - remove { lock(this) @@ -358,7 +275,6 @@ public class SceneCreatedEventArgs : EventArgs { this.EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate); } - _stageEventProcessingFinishedEventHandler -= value; } } @@ -367,38 +283,32 @@ public class SceneCreatedEventArgs : EventArgs // Callback for Stage EventProcessingFinishedSignal private void OnEventProcessingFinished() { - EventProcessingFinishedEventArgs e = new EventProcessingFinishedEventArgs(); - if (_stageEventProcessingFinishedEventHandler != null) { - //here we send all data to user event handlers - _stageEventProcessingFinishedEventHandler(this, e); + _stageEventProcessingFinishedEventHandler(this, null); } } + + private EventHandler _stageContextLostEventHandler; + private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate; + /** * @brief Event for ContextLost signal which can be used to subscribe/unsubscribe the event handler - * (in the type of ContextLostEventHandler-DaliEventHandler) provided by the user. * ContextLost signal is emitted when the GL context is lost (Platform specific behaviour). * */ - public event DaliEventHandler ContextLost + public event EventHandler ContextLost { add { lock(this) { - // Restricted to only one listener - if (_stageContextLostEventHandler == null) - { - _stageContextLostEventHandler += value; - - _stageContextLostEventCallbackDelegate = new ContextLostEventCallbackDelegate(OnContextLost); - this.ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate); - } + _stageContextLostEventHandler += value; + _stageContextLostEventCallbackDelegate = OnContextLost; + this.ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate); } } - remove { lock(this) @@ -416,39 +326,33 @@ public class SceneCreatedEventArgs : EventArgs // Callback for Stage ContextLostSignal private void OnContextLost() { - ContextLostEventArgs e = new ContextLostEventArgs(); - if (_stageContextLostEventHandler != null) { - //here we send all data to user event handlers - _stageContextLostEventHandler(this, e); + _stageContextLostEventHandler(this, null); } } + + private EventHandler _stageContextRegainedEventHandler; + private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate; + /** * @brief Event for ContextRegained signal which can be used to subscribe/unsubscribe the event handler - * (in the type of ContextRegainedEventHandler-DaliEventHandler) * provided by the user. ContextRegained signal is emitted when the GL context is regained (Platform specific * behaviour). * */ - public event DaliEventHandler ContextRegained + public event EventHandler ContextRegained { add { lock(this) { - // Restricted to only one listener - if (_stageContextRegainedEventHandler == null) - { - _stageContextRegainedEventHandler += value; - - _stageContextRegainedEventCallbackDelegate = new ContextRegainedEventCallbackDelegate(OnContextRegained); - this.ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate); - } + _stageContextRegainedEventHandler += value; + _stageContextRegainedEventCallbackDelegate = OnContextRegained; + this.ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate); } } - remove { lock(this) @@ -466,38 +370,32 @@ public class SceneCreatedEventArgs : EventArgs // Callback for Stage ContextRegainedSignal private void OnContextRegained() { - ContextRegainedEventArgs e = new ContextRegainedEventArgs(); - if (_stageContextRegainedEventHandler != null) { - //here we send all data to user event handlers - _stageContextRegainedEventHandler(this, e); + _stageContextRegainedEventHandler(this, null); } } + + private EventHandler _stageSceneCreatedEventHandler; + private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate; + /** * @brief Event for SceneCreated signal which can be used to subscribe/unsubscribe the event handler - * (in the type of SceneCreatedEventHandler-DaliEventHandler) provided by the user. * SceneCreated signal is emitted after the initial scene is created. * */ - public event DaliEventHandler SceneCreated + public event EventHandler SceneCreated { add { lock(this) { - // Restricted to only one listener - if (_stageSceneCreatedEventHandler == null) - { - _stageSceneCreatedEventHandler += value; - - _stageSceneCreatedEventCallbackDelegate = new SceneCreatedEventCallbackDelegate(OnSceneCreated); - this.SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate); - } + _stageSceneCreatedEventHandler += value; + _stageSceneCreatedEventCallbackDelegate = OnSceneCreated; + this.SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate); } } - remove { lock(this) @@ -515,30 +413,23 @@ public class SceneCreatedEventArgs : EventArgs // Callback for Stage SceneCreatedSignal private void OnSceneCreated() { - SceneCreatedEventArgs e = new SceneCreatedEventArgs(); - if (_stageSceneCreatedEventHandler != null) { - //here we send all data to user event handlers - _stageSceneCreatedEventHandler(this, e); + _stageSceneCreatedEventHandler(this, null); } } - ///< name "Size", type Dali.Size (Stage Size value) - //@since 1.0.0 - public Dali.Size Size + + public Vector2 Size { get { - Vector2 ret1 = GetSize(); - Dali.Size ret= new Size(ret1); + Vector2 ret = GetSize(); return ret; } } - ///< name "BackgroundColor", type Dali.Color (Stage background color value) - //@since 1.0.0 - public Dali.Color BackgroundColor + public Vector4 BackgroundColor { set { @@ -546,8 +437,7 @@ public class SceneCreatedEventArgs : EventArgs } get { - Vector4 ret1 = GetBackgroundColor(); - Dali.Color ret = new Color(ret1); + Vector4 ret = GetBackgroundColor(); return ret; } } diff --git a/plugins/dali-swig/examples/control-dashboard.cs b/plugins/dali-swig/examples/control-dashboard.cs old mode 100644 new mode 100755 index 9a791a9..84e0b75 --- a/plugins/dali-swig/examples/control-dashboard.cs +++ b/plugins/dali-swig/examples/control-dashboard.cs @@ -96,11 +96,11 @@ namespace MyCSharpExample CreateContent(); - KeyboardFocusManager.Get().PreFocusChange += OnPreFocusChange; + FocusManager.Instance.PreFocusChange += OnPreFocusChange; } // Callback for KeyboardFocusManager - private Actor OnPreFocusChange(object source, KeyboardFocusManager.PreFocusChangeEventArgs e) + private Actor OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { if (!e.Proposed && !e.Current) { diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs index be7a11b..8437e3a 100755 --- a/plugins/dali-swig/examples/hello-world.cs +++ b/plugins/dali-swig/examples/hello-world.cs @@ -1,112 +1,167 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (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 - * - * Unless required by applicable law or agreed to in writing, software - * 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. - * - */ +* Copyright (c) 2016 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (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 +* +* Unless required by applicable law or agreed to in writing, software +* 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. +* +*/ using System; using System.Runtime.InteropServices; using Dali; +using Dali.Constants; namespace MyCSharpExample { - class Example - { - private Dali.Application _application; + class Example + { + private Dali.Application _application; + private Animation _animation; + private TextLabel _text; - private Animation _animation; - private TextLabel _text; + public Example(Dali.Application application) + { + _application = application; + _application.Initialized += Initialize; + } - public Example(Dali.Application application) - { - _application = application; - _application.Initialized += Initialize; - } + public void Initialize(object source, AUIApplicationInitEventArgs e) + { + Console.WriteLine("Customized Application Initialize event handler"); + Stage stage = Stage.GetCurrent(); + stage.BackgroundColor = Color.Cyan; + stage.TouchEvent += OnStageTouched; + stage.WheelEvent += OnStageWheelMoved; + stage.KeyEvent += OnStageKeyPressed; + stage.EventProcessingFinished += OnStageEventProcessingFinished; + + // Add a _text label to the stage + _text = new TextLabel("Hello Mono World"); + _text.ParentOrigin = ParentOrigin.Center; + _text.AnchorPoint = AnchorPoint.Center; + _text.HorizontalAlignment = "CENTER"; + _text.PointSize = 32.0f; + _text.TextColor = Color.Magenta; + stage.Add(_text); + } - public void Initialize(object source, AUIApplicationInitEventArgs e) - { - Console.WriteLine("Customized Application Initialize event handler"); - Stage stage = Stage.GetCurrent(); - stage.BackgroundColor = Color.Green; + // Callback for _animation finished signal handling + public void AnimationFinished(object sender, EventArgs e) + { + Console.WriteLine("AnimationFinished()!"); + } - stage.Touched += OnStageTouched; + // Callback for _animation finished signal handling + public void AnimationFinished2(object sender, EventArgs e) + { + Console.WriteLine("AnimationFinished2()!"); + if(_animation) + { + Console.WriteLine("Duration= " + _animation.Duration); + Console.WriteLine("EndAction= " + _animation.EndAction); + } + } - // Add a _text label to the stage - _text = new TextLabel("Hello Mono World"); - _text.ParentOrigin = NDalic.ParentOriginCenter; - _text.AnchorPoint = NDalic.AnchorPointCenter; - _text.HorizontalAlignment = "CENTER"; - _text.PointSize = 32.0f; + public void OnStageEventProcessingFinished(object sender, EventArgs e) + { + Console.WriteLine("OnStageEventProcessingFinished()!"); + if( e != null) + { + Console.WriteLine("e != null !"); + } + } - stage.Add(_text); - } + public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e) + { + Console.WriteLine("OnStageKeyEventOccured()!"); + Console.WriteLine("keyPressedName=" + e.KeyEvent.keyPressedName); + Console.WriteLine("state=" + e.KeyEvent.state); + } - // Callback for _animation finished signal handling - public void AnimationFinished(object source, Animation.FinishedEventArgs e) - { - Console.WriteLine("Customized Animation Finished Event handler"); - Console.WriteLine("Animation finished: duration = " + e.Animation.Duration); - Console.WriteLine("End Action = " + e.Animation.GetEndAction()); - } + public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e) + { + Console.WriteLine("OnStageWheelEventOccured()!"); + Console.WriteLine("direction=" + e.WheelEvent.direction); + Console.WriteLine("type=" + e.WheelEvent.type); + } - // Callback for stage touched signal handling - public void OnStageTouched(object source, Stage.TouchEventArgs e) + // Callback for stage touched signal handling + public void OnStageTouched(object sender, Stage.TouchEventArgs e) + { + // Only animate the _text label when touch down happens + if( e.TouchData.GetState(0) == PointStateType.DOWN ) + { + Console.WriteLine("Customized Stage Touch event handler"); + // Create a new _animation + if( _animation ) { - //TouchData touchData = TouchData.GetTouchDataFromPtr( data ); - - // Only animate the _text label when touch down happens - if( e.TouchData.GetState(0) == PointStateType.DOWN ) - { - Console.WriteLine("Customized Stage Touch event handler"); - // Create a new _animation - if( _animation ) - { - _animation.Reset(); - } - - _animation = new Animation(1.0f); // 1 second of duration - - _animation.AnimateTo(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f)); - - _animation.AnimateTo(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f)); - - // Connect the signal callback for animaiton finished signal - _animation.Finished += AnimationFinished; - - // Play the _animation - _animation.Play(); - - Console.WriteLine("Looping:" + _animation.Looping); - } + //_animation.Stop(Dali.Constants.Animation.EndAction.Stop); + _animation.Reset(); } - public void MainLoop() - { - _application.MainLoop (); - } + _animation = new Animation { + Duration = 2000, + StartTime = 0, + EndTime = 500, + TargetPoperty = "Orientation", + Destination = new Quaternion( new Radian( new Degree( 180.0f ) ), Vect3.Xaxis) + }; + _animation.AnimateTo(_text); + + _animation.StartTime = 500; + _animation.EndTime = 1000; + _animation.TargetPoperty = "Orientation"; + _animation.Destination = new Quaternion( new Radian( new Degree( 0.0f ) ), Vect3.Xaxis ); + _animation.AnimateTo(_text); + + _animation.StartTime = 1000; + _animation.EndTime = 1500; + _animation.TargetPoperty = "ScaleX"; + _animation.Destination = 3.0f; + _animation.AnimateBy(_text); + + _animation.StartTime = 1500; + _animation.EndTime = 2000; + _animation.TargetPoperty = "ScaleY"; + _animation.Destination = 4.0f; + _animation.AnimateBy(_text); + + _animation.EndAction = Dali.Constants.Animation.EndAction.Discard; + + // Connect the signal callback for animaiton finished signal + _animation.Finished += AnimationFinished; + _animation.Finished += AnimationFinished2; + + // Play the _animation + _animation.Play(); + + } + } - /// - /// The main entry point for the application. - /// + public void MainLoop() + { + _application.MainLoop (); + } - [STAThread] - static void Main(string[] args) - { - Console.WriteLine ("Hello Mono World"); + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + Console.WriteLine ("Main() called!"); - Example example = new Example(Application.NewApplication()); - example.MainLoop (); - } + Example example = new Example(Application.NewApplication()); + example.MainLoop (); } + } } diff --git a/plugins/dali-swig/examples/scroll-view.cs b/plugins/dali-swig/examples/scroll-view.cs old mode 100644 new mode 100755 index 4e7c3ac..e922f1f --- a/plugins/dali-swig/examples/scroll-view.cs +++ b/plugins/dali-swig/examples/scroll-view.cs @@ -134,10 +134,9 @@ namespace MyCSharpExample } // Callback for _animation finished signal handling - public void AnimationFinished(object source, Animation.FinishedEventArgs e) + public void AnimationFinished(object sender, EventArgs e) { Console.WriteLine("Customized Animation Finished Event handler"); - Console.WriteLine("Animation finished: duration = " + e.Animation.Duration); } private void OnKey(object source, View.KeyInputFocusGainedEventArgs e) { diff --git a/plugins/dali-swig/examples/spin-control.cs b/plugins/dali-swig/examples/spin-control.cs old mode 100644 new mode 100755 index af74f1e..8e5826b --- a/plugins/dali-swig/examples/spin-control.cs +++ b/plugins/dali-swig/examples/spin-control.cs @@ -89,7 +89,7 @@ namespace MyCSharpExample { // Make sure when the current spin that takes input focus also takes the keyboard focus // For example, when you tap the spin directly - KeyboardFocusManager.Get().SetCurrentFocusActor(_textField); + FocusManager.Instance.SetCurrentFocusActor(_textField); } public void TextFieldKeyInputFocusLost(object source, KeyInputFocusLostEventArgs e) @@ -371,13 +371,13 @@ namespace MyCSharpExample _spinDay.SetKeyboardFocusable(true); _spinDay.Name = "_spinDay"; - KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.Get(); + FocusManager keyboardFocusManager = FocusManager.Instance; keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChange; keyboardFocusManager.FocusedActorEnterKeyPressed += OnFocusedActorEnterKeyPressed; } - private Actor OnKeyboardPreFocusChange(object source, KeyboardFocusManager.PreFocusChangeEventArgs e) + private Actor OnKeyboardPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { Actor nextFocusActor = e.Proposed; @@ -414,7 +414,7 @@ namespace MyCSharpExample return nextFocusActor; } - private void OnFocusedActorEnterKeyPressed(object source, KeyboardFocusManager.FocusedActorEnterKeyEventArgs e) + private void OnFocusedActorEnterKeyPressed(object source, FocusManager.FocusedActorEnterKeyEventArgs e) { // Make the text field in the current focused spin to take the key input KeyInputFocusManager manager = KeyInputFocusManager.Get(); diff --git a/plugins/dali-swig/examples/user-alphafunction.cs b/plugins/dali-swig/examples/user-alphafunction.cs new file mode 100755 index 0000000..0605706 --- /dev/null +++ b/plugins/dali-swig/examples/user-alphafunction.cs @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (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 +* +* Unless required by applicable law or agreed to in writing, software +* 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. +* +*/ + +using System; +using System.Runtime.InteropServices; +using Dali; +using Dali.Constants; + +namespace MyCSharpExample +{ + class Example + { + private Dali.Application _application; + private Animation _animation; + private TextLabel _text; + private View _view1, _view2, _view3; + private UserAlphaFunctionDelegate _user_alpha_func; + private int myCount; + + public static void Log(string str) + { + Console.WriteLine("[DALI C# SAMPLE] " + str); + } + + public Example(Dali.Application application) + { + _application = application; + _application.Initialized += Initialize; + } + + // Declare user alpha function delegate + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + delegate float UserAlphaFunctionDelegate(float progress); + + public void Initialize(object source, AUIApplicationInitEventArgs e) + { + Log("Initialize() is called!"); + Stage stage = Stage.GetCurrent(); + stage.BackgroundColor = Color.White; + stage.TouchEvent += OnStageTouched; + stage.TouchEvent += OnStageTouched2; + //stage.EventProcessingFinished += OnEventProcessingFinished; + stage.WheelEvent += OnStageWheelEvent; + + // Add a _text label to the stage + _text = new TextLabel("Hello Mono World"); + _text.ParentOrigin = ParentOrigin.BottomCenter; + _text.AnchorPoint = AnchorPoint.BottomCenter; + _text.HorizontalAlignment = "CENTER"; + _text.PointSize = 32.0f; + stage.Add(_text); + + _view1 = new View(); + _view1.Size = new Vector3(200.0f, 200.0f, 0.0f); + _view1.BackgroundColor = Color.Green; + _view1.ParentOrigin = ParentOrigin.Center; + _view1.AnchorPoint = AnchorPoint.Center; + _view1.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); + _view1.OnStageEvent += OnStage; + stage.Add(_view1); + + _view2 = new View(); + _view2.BackgroundColor = Color.Red; + _view2.Size = new Vector3(50.0f, 50.0f, 0.0f); + _view2.ParentOrigin = ParentOrigin.TopLeft; + _view2.AnchorPoint = AnchorPoint.TopLeft; + _view2.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); + _view1.Add(_view2); + + _view3 = new View(); + _view3.BackgroundColor = Color.Blue; + _view3.Size = new Vector3(50.0f, 50.0f, 0.0f); + _view3.ParentOrigin = ParentOrigin.TopLeft; + _view3.AnchorPoint = AnchorPoint.TopLeft; + _view3.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); + _view1.Add(_view3); + + _user_alpha_func = new UserAlphaFunctionDelegate(body); + + MyAnimating(); + } + + // User defines alpha function as custom alpha function + // Important Notification : when this custom alpha-function is implemented, + // the other function call nor other data excess is prevented. + // this method must be implemented to calculate the values of input and output purely. + // unless, this will cause application crash. + float body(float progress) + { + if (progress > 0.2f && progress< 0.7f) + { + return progress + 0.8f; + } + return progress; + } + + // Callback for _animation finished signal handling + public void AnimationFinished(object sender, EventArgs e) + { + Log("AnimationFinished() is called!"); + myCount = 0; + } + + public void MyAnimating() + { + // Create a new _animation + if( _animation ) + { + _animation.Clear(); + _animation.Reset(); + } + + _animation = new Animation(10000); // 10000 milli-second of duration + _animation.StartTime = 5000; + _animation.EndTime = 10000; + _animation.TargetPoperty = "Position"; + _animation.AlphaFunction = new AlphaFunction(_user_alpha_func); + _animation.Destination = new Vector3(150.0f, 150.0f, 0.0f); + _animation.AnimateTo(_view2); + // Connect the signal callback for animaiton finished signal + _animation.Finished += AnimationFinished; + _animation.EndAction = Dali.Constants.Animation.EndAction.Discard; + // Play the _animation + _animation.Play(); + } + + // Callback for stage touched signal handling + public void OnStageTouched(object source, Stage.TouchEventArgs e) + { + // Only animate the _text label when touch down happens + if( e.TouchData.GetState(0) == PointStateType.DOWN ) + { + Log("OnStageTouched() is called! PointStateType.DOWN came!"); + myCount++; + if( myCount > 1 ) + { + _animation.Stop(); + Log("_animation.Stop() is called!"); + } + } + } + + // Callback for stage touched signal handling + public void OnStageTouched2(object source, Stage.TouchEventArgs e) + { + Log("OnStageTouched2() is called!state="+ e.TouchData.GetState(0) ); + } + + public void OnEventProcessingFinished(object source) + { + Log("OnEventProcessingFinished() is called!"); + } + + public void OnStageWheelEvent(object source, Stage.WheelEventArgs e) + { + Log("OnStageWheelEvent() is called!"); + //Log("OnStageWheelEvent() is called!direction="+ e.WheelEvent.direction + " timeStamp=" + e.WheelEvent.timeStamp ); + } + + + public void OnStage(object source , View.OnStageEventArgs e) + { + Log("OnStage() is called!"); + } + + public void MainLoop() + { + _application.MainLoop (); + } + + [STAThread] + static void Main(string[] args) + { + Log("Main() is called!"); + + Example example = new Example(Application.NewApplication()); + example.MainLoop (); + + Log("After MainLoop()"); + } + } +} + diff --git a/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs b/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs old mode 100644 new mode 100755 index e159317..71b0ddb --- a/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs +++ b/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs @@ -15,10 +15,14 @@ */ using System; -namespace Dali { - namespace Constants{ - namespace AlphaFunction { - public enum BuiltinFunction { +namespace Dali +{ + namespace Constants + { + namespace AlphaFunction + { + public enum BuiltinFunction + { Default = Dali.AlphaFunction.BuiltinFunction.DEFAULT, Linear = Dali.AlphaFunction.BuiltinFunction.LINEAR, Reverse = Dali.AlphaFunction.BuiltinFunction.REVERSE, @@ -35,60 +39,123 @@ namespace Dali { EaseOutBack = Dali.AlphaFunction.BuiltinFunction.EASE_OUT_BACK, Count = Dali.AlphaFunction.BuiltinFunction.COUNT } - - - public enum Mode { + public enum Mode + { BuiltinFunction = Dali.AlphaFunction.Mode.BUILTIN_FUNCTION, CustomFunction = Dali.AlphaFunction.Mode.CUSTOM_FUNCTION, Bezier = Dali.AlphaFunction.Mode.BEZIER } - } // namespace AlphaFunction - namespace FrameBuffer { - namespace Attachment { - public enum Mask { + namespace FrameBuffer + { + namespace Attachment + { + public enum Mask + { None = Dali.FrameBuffer.Attachment.Mask.NONE, ///< No attachments are created initially @SINCE_1_1.45 Depth = Dali.FrameBuffer.Attachment.Mask.DEPTH, ///< Depth buffer bit-mask value @SINCE_1_1.45 Stencil = Dali.FrameBuffer.Attachment.Mask.STENCIL , ///< Stencil buffer bit-mask value @SINCE_1_1.45 - // Preset bit-mask combinations: DepthStencil = Dali.FrameBuffer.Attachment.Mask.DEPTH_STENCIL ///< The Framebuffer will be created with depth and stencil buffer @SINCE_1_1.45 } - } //namespace FrameBuffer - } // namespace Attachment - + } //namespace Attachment + } // namespace FrameBuffer - public enum TextureType { + public enum TextureType + { Texture2D = Dali.TextureType.TEXTURE_2D, ///< One 2D image @SINCE_1_1.43 TextureCube = Dali.TextureType.TEXTURE_CUBE ///< Six 2D images arranged in a cube-shape @SINCE_1_1.43 } - /** - * @brief Stereoscopic view modes - * @SINCE_1_0.0 - */ - public enum ViewMode { + public enum ViewMode + { Mono = Dali.ViewMode.MONO, ///< Monoscopic (single camera). This is the default @SINCE_1_0.0 StereoHorizontal = Dali.ViewMode.STEREO_HORIZONTAL, ///< Stereoscopic. Frame buffer is split horizontally with the left and right camera views in their respective sides. @SINCE_1_0.0 StereoVertical = Dali.ViewMode.STEREO_VERTICAL, ///< Stereoscopic. Frame buffer is split vertically with the left camera view at the top and the right camera view at the bottom. @SINCE_1_0.0 StereoInterlaced = Dali.ViewMode.STEREO_INTERLACED ///< @DEPRECATED_1_1.19 @brief Stereoscopic. Left/Right camera views are rendered into the framebuffer on alternate frames. @SINCE_1_0.0 } - public enum MeshVisualShadingModeValue { + public enum MeshVisualShadingModeValue + { TexturelessWithDiffuseLighting = Dali.MeshVisualShadingModeValue.TEXTURELESS_WITH_DIFFUSE_LIGHTING, ///< *Simplest*. One color that is lit by ambient and diffuse lighting. @SINCE_1_1.45 TexturedWithSpecularLigting = Dali.MeshVisualShadingModeValue.TEXTURED_WITH_SPECULAR_LIGHTING, ///< Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting. @SINCE_1_1.45 TexturedWithDetailedSpecularLighting = Dali.MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING ///< Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting. @SINCE_1_1.45 } - /** - * @brief Projection modes. - * @SINCE_1_0.0 - */ - public enum ProjectionMode { + public enum ProjectionMode + { PerspectiveProjection = Dali.ProjectionMode.PERSPECTIVE_PROJECTION, ///< Distance causes foreshortening; objects further from the camera appear smaller @SINCE_1_0.0 OrthographicProjection = Dali.ProjectionMode.ORTHOGRAPHIC_PROJECTION ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0 } + namespace Animation + { + public enum EndAction + { + Cancel = Dali.Animation.DaliEndAction.Bake, + Discard = Dali.Animation.DaliEndAction.Discard, + Stop = Dali.Animation.DaliEndAction.BakeFinal + } + public enum Interpolation + { + Linear = Dali.Animation.Interpolation.Linear, + Cubic = Dali.Animation.Interpolation.Cubic + } + public enum State + { + Stopped = Dali.Animation.State.STOPPED, + Playing = Dali.Animation.State.PLAYING, + Paused = Dali.Animation.State.PAUSED + } + } //namespace Animation + + public struct ParentOrigin + { + public static readonly float Top = NDalic.ParentOriginTop; + public static readonly float Bottom = NDalic.ParentOriginBottom; + public static readonly float Left = NDalic.ParentOriginLeft; + public static readonly float Right = NDalic.ParentOriginRight; + public static readonly float Middle = NDalic.ParentOriginMiddle; + public static readonly Dali.Vector3 TopLeft = NDalic.ParentOriginTopLeft; + public static readonly Dali.Vector3 TopCenter = NDalic.ParentOriginTopCenter; + public static readonly Dali.Vector3 TopRight = NDalic.ParentOriginTopRight; + public static readonly Dali.Vector3 CenterLeft = NDalic.ParentOriginCenterLeft; + public static readonly Dali.Vector3 Center = NDalic.ParentOriginCenter; + public static readonly Dali.Vector3 CenterRight = NDalic.ParentOriginCenterRight; + public static readonly Dali.Vector3 BottomLeft = NDalic.ParentOriginBottomLeft; + public static readonly Dali.Vector3 BottomCenter = NDalic.ParentOriginBottomCenter; + public static readonly Dali.Vector3 BottomRight = NDalic.ParentOriginBottomRight; + } + + public struct AnchorPoint + { + public static readonly float Top = NDalic.AnchorPointTop; + public static readonly float Bottom = NDalic.AnchorPointBottom; + public static readonly float Left = NDalic.AnchorPointLeft; + public static readonly float Right = NDalic.AnchorPointRight; + public static readonly float Middle = NDalic.AnchorPointMiddle; + public static readonly Dali.Vector3 TopLeft = NDalic.AnchorPointTopLeft; + public static readonly Dali.Vector3 TopCenter = NDalic.AnchorPointTopCenter; + public static readonly Dali.Vector3 TopRight = NDalic.AnchorPointTopRight; + public static readonly Dali.Vector3 CenterLeft = NDalic.AnchorPointCenterLeft; + public static readonly Dali.Vector3 Center = NDalic.AnchorPointCenter; + public static readonly Dali.Vector3 CenterRight = NDalic.AnchorPointCenterRight; + public static readonly Dali.Vector3 BottomLeft = NDalic.AnchorPointBottomLeft; + public static readonly Dali.Vector3 BottomCenter = NDalic.AnchorPointBottomCenter; + public static readonly Dali.Vector3 BottomRight = NDalic.AnchorPointBottomRight; + } + + public struct Vect3 + { + public static readonly Dali.Vector3 One = Dali.Vector3.ONE; + public static readonly Dali.Vector3 Xaxis = Dali.Vector3.XAXIS; + public static readonly Dali.Vector3 Yaxis = Dali.Vector3.YAXIS; + public static readonly Dali.Vector3 Zaxis = Dali.Vector3.ZAXIS; + public static readonly Dali.Vector3 NegativeXaxis = Dali.Vector3.NEGATIVE_XAXIS; + public static readonly Dali.Vector3 NegativeYaxis = Dali.Vector3.NEGATIVE_YAXIS; + public static readonly Dali.Vector3 NegativeZaxis = Dali.Vector3.NEGATIVE_ZAXIS; + public static readonly Dali.Vector3 Zero = Dali.Vector3.ZERO; + } } // namespace Constants } // namesapce Dali diff --git a/plugins/dali-swig/manual/csharp/DaliEventHandler.cs b/plugins/dali-swig/manual/csharp/DaliEventHandler.cs old mode 100644 new mode 100755 index 80becbf..53e8321 --- a/plugins/dali-swig/manual/csharp/DaliEventHandler.cs +++ b/plugins/dali-swig/manual/csharp/DaliEventHandler.cs @@ -20,9 +20,21 @@ namespace Dali { using System.Runtime.InteropServices; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate void DaliEventHandler(T source, U e); + public delegate R DaliEventHandlerWithReturnType(T source, U e); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate R DaliEventHandlerWithReturnType(T source, U e); + public delegate void EventCallbackDelegateType0(); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void EventCallbackDelegateType1(T arg1); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void EventCallbackDelegateType2(T arg1, U arg2); + + + //this should be removed with EventHandler from .NET + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void DaliEventHandler(T source, U e); + } diff --git a/plugins/dali-swig/manual/csharp/KeyboardFocusManager.cs b/plugins/dali-swig/manual/csharp/FocusManager.cs old mode 100644 new mode 100755 similarity index 96% rename from plugins/dali-swig/manual/csharp/KeyboardFocusManager.cs rename to plugins/dali-swig/manual/csharp/FocusManager.cs index 4051b36..17e7685 --- a/plugins/dali-swig/manual/csharp/KeyboardFocusManager.cs +++ b/plugins/dali-swig/manual/csharp/FocusManager.cs @@ -20,18 +20,18 @@ namespace Dali { using System; using System.Runtime.InteropServices; -public class KeyboardFocusManager : BaseHandle { +public class FocusManager : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - internal KeyboardFocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.KeyboardFocusManager_SWIGUpcast(cPtr), cMemoryOwn) { + internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.KeyboardFocusManager_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyboardFocusManager obj) { + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FocusManager obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - ~KeyboardFocusManager() { + ~FocusManager() { DisposeQueue.Instance.Add(this); } @@ -461,12 +461,12 @@ public class PreFocusChangeEventArgs : EventArgs } } - public KeyboardFocusManager() : this(NDalicManualPINVOKE.new_KeyboardFocusManager(), true) { + public FocusManager() : this(NDalicManualPINVOKE.new_KeyboardFocusManager(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public static KeyboardFocusManager Get() { - KeyboardFocusManager ret = new KeyboardFocusManager(NDalicManualPINVOKE.KeyboardFocusManager_Get(), true); + public static FocusManager Get() { + FocusManager ret = new FocusManager(NDalicManualPINVOKE.KeyboardFocusManager_Get(), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -557,6 +557,17 @@ public class PreFocusChangeEventArgs : EventArgs return ret; } + private static readonly FocusManager instance = FocusManager.Get(); + + public static FocusManager Instance + { + get + { + return instance; + } + } + + } } diff --git a/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs b/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs old mode 100644 new mode 100755 index 949dfb8..bd49666 --- a/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs +++ b/plugins/dali-swig/manual/csharp/KeyboardPreFocusChangeSignal.cs @@ -68,7 +68,7 @@ public class KeyboardPreFocusChangeSignal : global::System.IDisposable { return ret; } - public void Connect(KeyboardFocusManager.PreFocusChangeEventCallbackDelegate func) { + public void Connect(FocusManager.PreFocusChangeEventCallbackDelegate func) { NDalicManualPINVOKE.KeyboardPreFocusChangeSignal_Connect(swigCPtr, func); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs b/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs old mode 100644 new mode 100755 index d39ebcb..77937dc --- a/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs +++ b/plugins/dali-swig/manual/csharp/ManualPINVOKE.cs @@ -80,7 +80,7 @@ namespace Dali public static extern uint KeyboardPreFocusChangeSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Connect")] - public static extern void KeyboardPreFocusChangeSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, KeyboardFocusManager.PreFocusChangeEventCallbackDelegate delegate1); + public static extern void KeyboardPreFocusChangeSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, FocusManager.PreFocusChangeEventCallbackDelegate delegate1); [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Disconnect")] public static extern void KeyboardPreFocusChangeSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);