From 1730389b12a4a189b54c04ce357a7dba026dd7b8 Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Fri, 10 Mar 2017 01:47:14 +0900 Subject: [PATCH] Size, Position, Color high level class added - copied from Vector2, Vertor3 - Size2D has Interger parameter - implicit conversion is possible - removed Property.Value Set()/Get() for Size/Size2D - files are seperated - making Property.Value set()/get() is required because custom property Conflicts: plugins/dali-swig/examples/scroll-view.cs Change-Id: I005b1197fe650436851d98a72f478d0ff3a30cd9 Signed-off-by: dongsug.song --- plugins/dali-swig/SWIG/events/actor-event.i | 38 +- plugins/dali-swig/SWIG/property-value.i | 54 +- plugins/dali-swig/examples/control-dashboard.cs | 2 +- plugins/dali-swig/examples/dali-test.cs | 147 +++- plugins/dali-swig/examples/hello-world.cs | 4 +- plugins/dali-swig/examples/image-view.cs | 6 +- plugins/dali-swig/examples/json-loader.cs | 2 +- plugins/dali-swig/examples/scroll-view.cs | 23 +- plugins/dali-swig/examples/visuals-example.cs | 4 +- .../visuals-using-custom-view.cs | 2 +- plugins/dali-swig/manual/csharp/Color.cs | 632 ++++++++--------- .../dali-swig/manual/csharp/DaliEnumConstants.cs | 48 -- plugins/dali-swig/manual/csharp/Position.cs | 785 ++++++++++++++++----- plugins/dali-swig/manual/csharp/Position2D.cs | 212 ++++++ plugins/dali-swig/manual/csharp/Size.cs | 444 +++++------- plugins/dali-swig/manual/csharp/Size2D.cs | 211 ++++++ plugins/dali-swig/manual/csharp/ViewRegistry.cs | 5 +- 17 files changed, 1771 insertions(+), 848 deletions(-) mode change 100644 => 100755 plugins/dali-swig/SWIG/property-value.i mode change 100644 => 100755 plugins/dali-swig/examples/visuals-example.cs mode change 100644 => 100755 plugins/dali-swig/examples/visuals-using-custom-view/visuals-using-custom-view.cs mode change 100644 => 100755 plugins/dali-swig/manual/csharp/Color.cs mode change 100644 => 100755 plugins/dali-swig/manual/csharp/Position.cs create mode 100755 plugins/dali-swig/manual/csharp/Position2D.cs mode change 100644 => 100755 plugins/dali-swig/manual/csharp/Size.cs create mode 100755 plugins/dali-swig/manual/csharp/Size2D.cs mode change 100644 => 100755 plugins/dali-swig/manual/csharp/ViewRegistry.cs diff --git a/plugins/dali-swig/SWIG/events/actor-event.i b/plugins/dali-swig/SWIG/events/actor-event.i index fbf5a8e..0947698 100755 --- a/plugins/dali-swig/SWIG/events/actor-event.i +++ b/plugins/dali-swig/SWIG/events/actor-event.i @@ -34,7 +34,7 @@ public IntPtr GetPtrfrom ## ClassName () { - return (IntPtr)swigCPtr; + return (IntPtr)swigCPtr; } public Position CurrentPosition @@ -45,7 +45,21 @@ } } - public Size3D CurrentSize + public Size2D Size2D + { + get + { + Size temp = new Size(0.0f,0.0f,0.0f); + GetProperty( Actor.Property.SIZE).Get( temp ); + return new Size2D(temp); + } + set + { + SetProperty( Actor.Property.SIZE, new Dali.Property.Value( new Size(value) ) ); + } + } + + public Size CurrentSize { get { @@ -61,13 +75,13 @@ } } - public bool Visibility - { + public bool Visibility + { get { return IsVisible(); } - } + } public float Opacity { @@ -83,6 +97,20 @@ } } + public Position2D Position2D + { + get + { + Position temp = new Position(0.0f,0.0f,0.0f); + GetProperty( Actor.Property.POSITION).Get( temp ); + return new Position2D(temp); + } + set + { + SetProperty( Actor.Property.POSITION, new Dali.Property.Value( new Position(value) ) ); + } + } + public Vector2 ScreenPosition { get diff --git a/plugins/dali-swig/SWIG/property-value.i b/plugins/dali-swig/SWIG/property-value.i old mode 100644 new mode 100755 index 290b4a1..e5e971e --- a/plugins/dali-swig/SWIG/property-value.i +++ b/plugins/dali-swig/SWIG/property-value.i @@ -92,9 +92,61 @@ } + public Value(Size2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Size2D.getCPtr(vectorValue)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Value(Size vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Size.getCPtr(vectorValue)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Value(Position2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Position2D.getCPtr(vectorValue)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Value(Position vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Position.getCPtr(vectorValue)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Value(Color vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_6(Color.getCPtr(vectorValue)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + public bool Get(Size2D vectorValue) { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Size2D.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Get(Size vectorValue) { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Size.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Get(Position2D vectorValue) { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Position2D.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Get(Position vectorValue) { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Position.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Get(Color vectorValue) { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_7(swigCPtr, Color.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + %} -#endif \ No newline at end of file +#endif diff --git a/plugins/dali-swig/examples/control-dashboard.cs b/plugins/dali-swig/examples/control-dashboard.cs index 39b7641..2b5de66 100755 --- a/plugins/dali-swig/examples/control-dashboard.cs +++ b/plugins/dali-swig/examples/control-dashboard.cs @@ -398,7 +398,7 @@ namespace MyCSharpExample controlLayout.ParentOrigin = NDalic.ParentOriginCenter; controlLayout.AnchorPoint = NDalic.AnchorPointCenter; controlLayout.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS); - controlLayout.SetCellPadding(new Size(10.0f, 10.0f)); + controlLayout.SetCellPadding(new Size2D(10, 10)); controlLayout.SetRelativeWidth(0, 0.5f); controlLayout.SetRelativeWidth(1, 0.5f); controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER); diff --git a/plugins/dali-swig/examples/dali-test.cs b/plugins/dali-swig/examples/dali-test.cs index f85a78a..c2d5917 100755 --- a/plugins/dali-swig/examples/dali-test.cs +++ b/plugins/dali-swig/examples/dali-test.cs @@ -105,6 +105,7 @@ namespace MyCSharpExample public void Initialize(object source, NUIApplicationInitEventArgs e) { + //1) NavigationPropertiesTests(); @@ -125,6 +126,7 @@ namespace MyCSharpExample //7) ViewDownCastTest(); + } @@ -402,8 +404,9 @@ namespace MyCSharpExample spin.Background = background; background = spin.Background; - Vector4 backgroundColor = new Vector4(); + Color backgroundColor = new Color(); background.Find(Dali.Constants.ColorVisualProperty.MixColor).Get(backgroundColor); + if (backgroundColor == Color.Red) { Console.WriteLine("Custom View Background property : test passed"); @@ -415,7 +418,8 @@ namespace MyCSharpExample // BackgroundColor property spin.BackgroundColor = Color.Yellow; - if (spin.BackgroundColor == Color.Yellow) + + if (spin.BackgroundColor.EqualTo(Color.Yellow)) { Console.WriteLine("Custom View BackgroundColor property : test passed"); } @@ -462,10 +466,10 @@ namespace MyCSharpExample handle.GetProperty(myPropertyIndex).Get(ref myProperty); Console.WriteLine("myProperty value: " + myProperty); - int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f)), Property.AccessMode.READ_WRITE); - Size myProperty2 = new Size(0.0f, 0.0f); + int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f, 5.0f)), Property.AccessMode.READ_WRITE); + Size myProperty2 = new Size(0.0f, 0.0f, 0.0f); handle.GetProperty(myPropertyIndex2).Get(myProperty2); - Console.WriteLine("myProperty2 value: " + myProperty2.W + ", " + myProperty2.H); + Console.WriteLine("myProperty2 value: " + myProperty2.Width + ", " + myProperty2.Height); Actor actor = new Actor(); actor.Size = new Position(200.0f, 200.0f, 0.0f); @@ -476,8 +480,8 @@ namespace MyCSharpExample Stage stage = Stage.GetCurrent(); stage.BackgroundColor = Color.White; - Size stageSize = stage.Size; - Console.WriteLine("Stage size: " + stageSize.W + ", " + stageSize.H); + Size2D stageSize = stage.Size; + Console.WriteLine("Stage size: " + stageSize.Width + ", " + stageSize.Height); stage.Add(actor); TextLabel text = new TextLabel("Hello World"); @@ -585,14 +589,15 @@ namespace MyCSharpExample Console.WriteLine(""); Console.WriteLine("### [6] SizePositionTest START"); - Size Size = new Size(100, 50); + Size Size = new Size(100, 50, 25); Console.WriteLine(" Created " + Size); - Console.WriteLine(" Size x = " + Size.W + ", y = " + Size.H); - Size += new Size(20, 20); - Console.WriteLine(" Size x = " + Size.W + ", y = " + Size.H); - Size.W += 10; - Size.H += 10; - Console.WriteLine(" Size width = " + Size.W + ", height = " + Size.H); + Console.WriteLine(" Size w = " + Size.Width + ", h = " + Size.Height + ", d = " + Size.Depth); + Size += new Size(20, 20, 20); + Console.WriteLine(" Size w = " + Size.Width + ", h = " + Size.Height + ", d = " + Size.Depth); + Size.Width += 10; + Size.Height += 10; + Size.Depth += 10; + Console.WriteLine(" Size width = " + Size.Width+ ", height = " + Size.Height + ", depth = " + Size.Depth); Console.WriteLine(" *************************"); Position Position = new Position(20, 100, 50); @@ -604,7 +609,7 @@ namespace MyCSharpExample Position.Y += 10; Position.Z += 10; Console.WriteLine(" Position width = " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z); - Position parentOrigin = new Dali.Position(NDalic.ParentOriginBottomRight); + Position parentOrigin = ParentOrigin.BottomRight; Console.WriteLine(" parentOrigin x = " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z); Console.WriteLine(" *************************"); @@ -771,7 +776,117 @@ namespace MyCSharpExample Example example = new Example(Application.NewApplication()); example.MainLoop(); } + + private void LOG(string str, int result = -1) + { + if (result == 1) Console.WriteLine(str + " : test passed!"); + else if (result == 0) Console.WriteLine(str + " : test failed! TEST FAILED! test failed! TEST FAILED!"); + else Console.WriteLine(str); + } + + private void CustomPropertyHighLevelClassTest() + { + LOG("================================="); + LOG(" high level class test"); + LOG("================================="); + + Handle handle = new Handle(); + int myPropertyIndex1 = handle.RegisterProperty("myProperty1", new Property.Value(new Size(10, 20, 30)), Property.AccessMode.READ_WRITE); + Size myProperty1 = Dali.Size.Zero; + handle.GetProperty(myPropertyIndex1).Get(myProperty1); + if (myProperty1.EqualTo(new Size(10, 20, 30))) LOG( "myProperty1 must be Size(10, 20, 30) get=" + myProperty1, 1); + else LOG( "myProperty1 must be Size(10, 20, 30) get=" + myProperty1, 0); + + int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Position(40, 50, 60)), Property.AccessMode.READ_WRITE); + Position myProperty2 = Dali.Position.Zero; + handle.GetProperty(myPropertyIndex2).Get(myProperty2); + if (myProperty2.EqualTo(new Position(40, 50, 60))) LOG( "myProperty2 must be Position(40, 50, 60) get=" + myProperty2, 1); + else LOG( "myProperty2 must be Position(40, 50, 60) get=" + myProperty2, 0); + + int myPropertyIndex3 = handle.RegisterProperty("myProperty3", new Property.Value(Color.Cyan), Property.AccessMode.READ_WRITE); + Color myProperty3 = Color.Transparent; + handle.GetProperty(myPropertyIndex3).Get(myProperty3); + if (myProperty3.EqualTo(Color.Cyan)) LOG( "myProperty3 must be Color.Cyan get=" + myProperty3, 1); + else LOG( "myProperty3 must be Color.Cyan get=" + myProperty3, 0); + + int myPropertyIndex4 = handle.RegisterProperty("myProperty4", new Property.Value(new Size2D(100, 200)), Property.AccessMode.READ_WRITE); + Size2D myProperty4 = new Size2D(0, 0); + handle.GetProperty(myPropertyIndex4).Get(myProperty4); + if (myProperty4.EqualTo(new Size2D(100, 200))) LOG( "myProperty4 must be new Size2D(100, 200) get=" + myProperty4, 1); + else LOG( "myProperty4 must be new Size2D(100, 200) get=" + myProperty4, 0); + + int myPropertyIndex5 = handle.RegisterProperty("myProperty5", new Property.Value(new Position2D(200, 300)), Property.AccessMode.READ_WRITE); + Position2D myProperty5 = new Position2D(0, 0); + handle.GetProperty(myPropertyIndex5).Get(myProperty5); + if (myProperty5.EqualTo(new Position2D(200, 300))) LOG( "myProperty5 must be new Position2D(200, 300) get=" + myProperty5, 1); + else LOG( "myProperty5 must be new Position2D(200, 300) get=" + myProperty5, 0); + + View view = new View(); + view.Size2D = new Size2D(new Size(200.0f, 200.0f, 0.0f)); + view.Name = "MyView1"; + view.BackgroundColor = new Color(1.0f, 0.0f, 1.0f, 0.8f); + LOG("view id: " + view.GetId()); + LOG("view size: " + view.Size.Width + ", " + view.Size.Height + "," + view.Size.Depth); + LOG("view size2d: " + view.Size2D.Width + ", " + view.Size2D.Height); + LOG("view name: " + view.Name); + + Stage stage = Stage.GetCurrent(); + Size2D stageSize = stage.Size; + LOG("Stage size2d: " + stageSize.Width + ", " + stageSize.Height); + stage.Add(view); + + Size Size = new Size(100, 50, 25); + LOG( Size + "Created. this should be (100, 50, 25)!"); + LOG( "Size width= " + Size.Width + ", height=" + Size.Height + ",depth=" + Size.Depth ); + Size += new Size(20, 20, 20); + if(Size.EqualTo(new Size(120, 70, 45))){ LOG( "plus Size(20,20,20) should be +20 for each! x = " + Size.Width + ", y = " + Size.Height + ", z = " + Size.Depth, 1);} + else { LOG( "plus Size(20,20,20) should be +20 for each! x = " + Size.Width + ", y = " + Size.Height + ", z = " + Size.Depth, 0);} + + Size.Width += 10; + Size.Height += 10; + Size.Depth += 10; + if(Size.EqualTo(new Size(130, 80, 55))){ LOG( "plus 10 for each! width = " + Size.Width + ", height = " + Size.Height + ", depth = " + Size.Depth, 1); } + else { LOG( "plus 10 for each! width = " + Size.Width + ", height = " + Size.Height + ", depth = " + Size.Depth, 0); } + + Position Position = new Position(20, 100, 50); + LOG(Position + "Created "); + LOG( "Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z ); + Position += new Position(20, 20, 20); + if(Position.EqualTo(new Position(40, 120, 70))) LOG( "plus Position(20, 20, 20)! Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z, 1); + else LOG( "plus Position(20, 20, 20)! Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z, 0); + + Position.X += 10; + Position.Y += 10; + Position.Z += 10; + if(Position.EqualTo(new Position(50, 130, 80))) LOG( "plus +10 for each! Position width = " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z, 1 ); + else LOG( "plus +10 for each! Position width = " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z, 0 ); + + Position2D _position2d = new Position2D(new Position(600.0f, 700.0f, 800.0f)); + LOG(_position2d + "Created "); + LOG( "_postion2d x = " + _position2d.X + ", y = " + _position2d.Y); + _position2d += new Position2D(20, 20); + if(_position2d.EqualTo(new Position2D(620, 720))) LOG( "plus Position2D(20, 20)! Position x = " + _position2d.X + ", y = " + _position2d.Y, 1); + else LOG( "plus Position2D(20, 20)! Position x = " + _position2d.X + ", y = " + _position2d.Y, 0); + + Position parentOrigin = ParentOrigin.BottomRight; + LOG( "parentOrigin.BottomRight x=" + parentOrigin.X + ", y=" + parentOrigin.Y + ", z=" + parentOrigin.Z ); + + Color color = new Color(20, 100, 50, 200); + LOG( color + " Created "); + LOG( "Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A ); + color += new Color(20, 20, 20, 20); + if(color.EqualTo(new Color(40, 120, 70, 220))) LOG( "plus Color(20, 20, 20, 20)! Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A, 1 ); + else LOG( "plus Color(20, 20, 20, 20)! Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A, 0 ); + color.R += 10; + color.G += 10; + color.B += 10; + color.A += 10; + if(color.EqualTo(new Color(50, 130, 80, 230))) LOG( "plus +10 for each! Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A, 1 ); + else LOG( "plus +10 for each! Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A, 0 ); + + LOG("================================="); + } + } } - diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs index 8687aa0..60c7791 100755 --- a/plugins/dali-swig/examples/hello-world.cs +++ b/plugins/dali-swig/examples/hello-world.cs @@ -56,14 +56,14 @@ namespace MyCSharpExample StartTime = 0, EndTime = 500, TargetProperty = "Orientation", - Destination = new Rotation(new Radian(new Degree(180.0f)), Vect3.Xaxis) + Destination = new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X) }; _animation.AnimateTo(_text); _animation.StartTime = 500; _animation.EndTime = 1000; _animation.TargetProperty = "Orientation"; - _animation.Destination = new Rotation(new Radian(new Degree(0.0f)), Vect3.Xaxis); + _animation.Destination = new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X); _animation.AnimateTo(_text); _animation.StartTime = 1000; diff --git a/plugins/dali-swig/examples/image-view.cs b/plugins/dali-swig/examples/image-view.cs index b8215ef..6ece63b 100755 --- a/plugins/dali-swig/examples/image-view.cs +++ b/plugins/dali-swig/examples/image-view.cs @@ -153,9 +153,9 @@ namespace ImageViewExample _animation.EndTime = 6000; _animation.TargetProperty = "Size"; KeyFrames _keyFrames = new KeyFrames(); - _keyFrames.Add(0.0f, new Size3D(0.0f, 0.0f, 0.0f)); - _keyFrames.Add(0.3f, new Size3D((stage.Size * 0.7f))); - _keyFrames.Add(1.0f, new Size3D(stage.Size)); + _keyFrames.Add(0.0f, new Size(0.0f, 0.0f, 0.0f)); + _keyFrames.Add(0.3f, new Size((stage.Size * 0.7f))); + _keyFrames.Add(1.0f, new Size(stage.Size)); _animation.AnimateBetween(_imageView, _keyFrames, Animation.Interpolation.Linear); _animation.EndAction = Animation.EndActions.Discard; diff --git a/plugins/dali-swig/examples/json-loader.cs b/plugins/dali-swig/examples/json-loader.cs index 388b077..b4250b3 100644 --- a/plugins/dali-swig/examples/json-loader.cs +++ b/plugins/dali-swig/examples/json-loader.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/plugins/dali-swig/examples/scroll-view.cs b/plugins/dali-swig/examples/scroll-view.cs index c4cf845..2527c3d 100755 --- a/plugins/dali-swig/examples/scroll-view.cs +++ b/plugins/dali-swig/examples/scroll-view.cs @@ -54,10 +54,10 @@ namespace MyCSharpExample // Create a scroll view _scrollView = new ScrollView(); - Size stageSize = stage.Size; - _scrollView.Size = new Position(stageSize.W, stageSize.H, 0.0f); - _scrollView.Position = new Position(0,0,0); - _scrollView.AnchorPoint = NDalic.AnchorPointTopLeft; + Size2D stageSize = stage.Size; + _scrollView.Size = new Position(stageSize.Width, stageSize.Height, 0.0f); + _scrollView.ParentOrigin = NDalic.ParentOriginCenter; + _scrollView.AnchorPoint = NDalic.AnchorPointCenter; stage.Add(_scrollView); // Add actors to a scroll view with 3 pages @@ -69,14 +69,15 @@ namespace MyCSharpExample { View pageActor = new View(); pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS); - pageActor.AnchorPoint = NDalic.AnchorPointTopLeft; - pageActor.Position = new Position(pageColumn * stageSize.W, pageRow * stageSize.H, 0.0f); + pageActor.ParentOrigin = NDalic.ParentOriginCenter; + pageActor.AnchorPoint = NDalic.AnchorPointCenter; + pageActor.Position = new Position(pageColumn * stageSize.Width, pageRow * stageSize.Height, 0.0f); // Add images in a 3x4 grid layout for each page int imageRows = 4; int imageColumns = 3; float margin = 10.0f; - Position imageSize = new Position((stageSize.W / imageColumns) - margin, (stageSize.H / imageRows) - margin, 0.0f); + Position imageSize = new Position((stageSize.Width / imageColumns) - margin, (stageSize.Height/ imageRows) - margin, 0.0f); for(int row = 0; row < imageRows; row++) { @@ -87,8 +88,8 @@ namespace MyCSharpExample imageView.ParentOrigin = NDalic.ParentOriginCenter; imageView.AnchorPoint = NDalic.AnchorPointCenter; imageView.Size = imageSize; - imageView.Position = new Position( margin * 0.5f + (imageSize.X + margin) * column - stageSize.W * 0.5f + imageSize.X * 0.5f, - margin * 0.5f + (imageSize.Y + margin) * row - stageSize.H * 0.5f + imageSize.Y * 0.5f, 0.0f ); + imageView.Position = new Position( margin * 0.5f + (imageSize.X + margin) * column - stageSize.Width * 0.5f + imageSize.X * 0.5f, + margin * 0.5f + (imageSize.Y + margin) * row - stageSize.Height * 0.5f + imageSize.Y * 0.5f, 0.0f ); pageActor.Add(imageView); } } @@ -101,9 +102,9 @@ namespace MyCSharpExample // Set scroll view to have 3 pages in X axis and allow page snapping, // and also disable scrolling in Y axis. - RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.W)); + RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.Width)); RulerPtr scrollRulerY = new RulerPtr(new DefaultRuler()); - scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.W * pageColumns, true)); + scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.Width * pageColumns, true)); scrollRulerY.Disable(); _scrollView.SetRulerX(scrollRulerX); _scrollView.SetRulerY(scrollRulerY); diff --git a/plugins/dali-swig/examples/visuals-example.cs b/plugins/dali-swig/examples/visuals-example.cs old mode 100644 new mode 100755 index 907054e..51c57d9 --- a/plugins/dali-swig/examples/visuals-example.cs +++ b/plugins/dali-swig/examples/visuals-example.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,7 +41,7 @@ namespace MyCSharpExample contentLayout.Name = ("ContentLayout"); contentLayout.WidthResizePolicy = "FILL_TO_PARENT"; contentLayout.HeightResizePolicy = "FILL_TO_PARENT"; - contentLayout.SetCellPadding(new Size(0.0f, 5.0f)); + contentLayout.SetCellPadding(new Size2D(0, 5)); contentLayout.BackgroundColor = new Color(0.949f, 0.949f, 0.949f, 1.0f); stage.GetDefaultLayer().Add(contentLayout); diff --git a/plugins/dali-swig/examples/visuals-using-custom-view/visuals-using-custom-view.cs b/plugins/dali-swig/examples/visuals-using-custom-view/visuals-using-custom-view.cs old mode 100644 new mode 100755 index b98a9ef..8762974 --- a/plugins/dali-swig/examples/visuals-using-custom-view/visuals-using-custom-view.cs +++ b/plugins/dali-swig/examples/visuals-using-custom-view/visuals-using-custom-view.cs @@ -37,7 +37,7 @@ namespace VisualsUsingCustomView contentLayout.Name = "ContentLayout"; contentLayout.WidthResizePolicy = "FILL_TO_PARENT"; contentLayout.HeightResizePolicy = "FILL_TO_PARENT"; - contentLayout.SetCellPadding(new Size(5.0f, 5.0f)); + contentLayout.SetCellPadding(new Size2D(5, 5)); contentLayout.BackgroundColor = new Color(0.949f, 0.949f, 0.949f, 1.0f); stage.GetDefaultLayer().Add(contentLayout); diff --git a/plugins/dali-swig/manual/csharp/Color.cs b/plugins/dali-swig/manual/csharp/Color.cs old mode 100644 new mode 100755 index abcb020..ca0dd01 --- a/plugins/dali-swig/manual/csharp/Color.cs +++ b/plugins/dali-swig/manual/csharp/Color.cs @@ -1,381 +1,357 @@ -namespace Dali -{ - using System; - - public enum Colors - { - Red, - White, - Blue, - Green, - Black, - Yellow, - Magenta, - Cyan +/* + * Copyright (c) 2017 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. + * + */ + +namespace Dali { + +using System; + +public class Color : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Color(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } - public class Color - { + ~Color() { + DisposeQueue.Instance.Add(this); + } - private float r; - private float g; - private float b; - private float a; - - /** - * @brief constructor - * - * @since 1.0.0 - */ - public Color() - { - r = 0.0f; - g = 0.0f; - b = 0.0f; - a = 0.0f; + public virtual void Dispose() { + if (!Stage.IsInstalled()) { + DisposeQueue.Instance.Add(this); + return; } - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] red The Color r. - * @param [in] green The Color g. - * @param [in] blue The Color b. - * @param [in] alpha The Color a. - */ - public Color(float red, float green, float blue, float alpha) - { - r = red; - g = green; - b = blue; - a = alpha; + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector4(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); } + } - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] o The Vector4 having r g b a components - */ - public Color(Vector4 o) - { - r = o.r; - g = o.g; - b = o.b; - a = o.a; - } + public static Color operator+(Color arg1, Color arg2) { + return arg1.Add(arg2); + } - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] color as enum Colors. - */ - public Color(Colors color) - { - switch (color) - { - case Colors.Red: - SetColor(1.0f, 0.0f, 0.0f, 1.0f); - break; - case Colors.White: - SetColor(1.0f, 1.0f, 1.0f, 1.0f); - break; - case Colors.Blue: - SetColor(0.0f, 0.0f, 1.0f, 1.0f); - break; - case Colors.Green: - SetColor(0.0f, 1.0f, 0.0f, 1.0f); - break; - case Colors.Black: - SetColor(0.0f, 0.0f, 0.0f, 1.0f); - break; - case Colors.Yellow: - SetColor(1.0f, 1.0f, 0.0f, 1.0f); - break; - case Colors.Cyan: - SetColor(0.0f, 1.0f, 1.0f, 1.0f); - break; - case Colors.Magenta: - SetColor(1.0f, 0.0f, 1.0f, 1.0f); - break; - } - } + public static Color operator-(Color arg1, Color arg2) { + return arg1.Subtract(arg2); + } + public static Color operator-(Color arg1) { + return arg1.Subtract(); + } - /** - * @brief SetColor - * - * @since 1.0.0 - * @param [in] red The Color r. - * @param [in] green The Color g. - * @param [in] blue The Color b. - * @param [in] alpha The Color a. - */ - public void SetColor(float red, float green, float blue, float alpha) - { - r = red; - g = green; - b = blue; - a = alpha; - } + public static Color operator*(Color arg1, Color arg2) { + return arg1.Multiply(arg2); + } - /** - * @brief name "R", type float (Color's Red component) - * @SINCE_1_0.0 - */ + public static Color operator*(Color arg1, float arg2) { + return arg1.Multiply(arg2); + } - public float R - { - get { return r; } - set { r = value; } - } + public static Color operator/(Color arg1, Color arg2) { + return arg1.Divide(arg2); + } - /** - * @brief name "G", type float (Color's Green component) - * @SINCE_1_0.0 - */ - public float G - { - get { return g; } - set { g = value; } - } + public static Color operator/(Color arg1, float arg2) { + return arg1.Divide(arg2); + } - /** - * @brief name "B", type float (Color's Blue component) - * @SINCE_1_0.0 - */ - public float B - { - get { return b; } - set { b = value; } - } - /** - * @brief name "A", type float (Color's Alpha value) - * @SINCE_1_0.0 - */ - public float A + public float this[uint index] + { + get { - get { return a; } - set { a = value; } + return ValueOfIndex(index); } + } - /** - * @brief operator+ - * - * @since 1.0.0 - * @param [in] l The Color to add. - * @param [in] r The Color to add - * @return A reference to this - */ - public static Color operator +(Color l, Color r) - { - return new Color(l.R + r.R, l.G + r.G, l.B + r.B, l.A + r.A); - } + public static Color GetColorFromPtr(global::System.IntPtr cPtr) { + Color ret = new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - /** - * @brief operator- - * - * @since 1.0.0 - * @param [in] l The Color to substract. - * @param [in] r The Color to substract - * @return A reference to this - */ - public static Color operator -(Color l, Color r) - { - return new Color(l.R - r.R, l.G - r.G, l.B - r.B, l.A - r.A); - } - /** - * @brief operator* - * - * @since 1.0.0 - * @param [in] a The Color to multiply. - * @param [in] b The constant double to multiply. - * @return A reference to this - */ - public static Color operator *(Color a, double b) - { - return new Color((float)(a.R * b), (float)(a.G * b), (float)(a.B * b), (float)(a.A * b)); - } + public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - /** - * @brief operator/ - * - * @since 1.0.0 - * @param [in] a The Color to divide. - * @param [in] b The Color to divide - * @return float value of division operation - */ - public static float operator /(Color a, Color b) - { - return (float)System.Math.Sqrt((a.R / b.R) * (a.G / b.G) * (a.B / b.B) * (a.A / b.A)); - } + public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(r, g, b, a), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - /** - * @brief Operator == - * - * @since 1.0.0 - * @param [in] x The Color object to compare. - * @param [in] y The Color object to compare. - * @return bool, whether colors are equal or not - */ - public static bool operator == (Color x, Color y) - { - return x.R == y.R && x.G == y.G && x.B == y.B && x.A == y.A; - } + public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - /** - * @brief Operator != - * - * @since 1.0.0 - * @param [in] x The Color object to compare. - * @param [in] y The Color object to compare. - * @return bool, whether colors are equal or not - */ - public static bool operator != (Color x, Color y) - { - return x.R != y.R || x.G != y.G || x.B != y.B || x.A != y.A; - } + private Color Add(Color rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - /** - * @brief GetHashCode - * - * @since 1.0.0 - * @return int, hascode of Color - */ - public override int GetHashCode() - { - return base.GetHashCode(); + private Color AddAssign(Vector4 rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Subtract(Color rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color SubtractAssign(Color rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Multiply(Color rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Multiply(float rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color MultiplyAssign(Color rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color MultiplyAssign(float rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Divide(Vector4 rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Divide(float rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color DivideAssign(Color rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color DivideAssign(float rhs) { + Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Subtract() { + Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool EqualTo(Color rhs) { + bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs)); + + if(rhs == null) return false; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool NotEqualTo(Color rhs) { + bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private float ValueOfIndex(uint index) { + float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float R { + set { + NDalicPINVOKE.Vector4_r_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief Clone - * - * @since 1.0.0 - * @return Color object - */ - public Color Clone() - { - Color copy = new Color(R, G, B, A); - return copy; + public float G { + set { + NDalicPINVOKE.Vector4_g_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + get { + float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } - // Create a color for RGBA values ranging from 0..255, useful when dealing with HTML colors - static Color FromRgbaByte( byte red, byte green, byte blue, byte alpha ) - { - return new Color ( red / 255, green / 255, blue / 255, alpha / 255 ); + public float B { + set { + NDalicPINVOKE.Vector4_b_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - // User-defined conversion from Color to Vector4 - public static implicit operator Vector4(Color color) - { - return new Vector4(color.r, color.g, color.b, color.a); + public float A { + set { + NDalicPINVOKE.Vector4_a_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + get { + float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } - public static implicit operator Color(Vector4 vec) - { - return new Color(vec.r, vec.g, vec.b, vec.a); + public static Color Black { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.BLACK_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "White", type Color (White Color object) - * @SINCE_1_0.0 - */ - public static Color White - { - get - { - return new Color(Colors.White); - } + public static Color White { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.WHITE_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "Black", type Color (Black Color object) - * @SINCE_1_0.0 - */ - public static Color Black - { - get - { - return new Color(Colors.Black); - } + public static Color Red { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.RED_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "Red", type Color (Red Color object) - * @SINCE_1_0.0 - */ - public static Color Red - { - get - { - return new Color(Colors.Red); - } + public static Color Green { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.GREEN_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "Green", type Color (Green Color object) - * @SINCE_1_0.0 - */ - public static Color Green - { - get - { - return new Color(Colors.Green); - } + public static Color Blue { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.BLUE_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "Blue", type Color (Blue Color object) - * @SINCE_1_0.0 - */ - public static Color Blue - { - get - { - return new Color(Colors.Blue); - } + public static Color Yellow { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.YELLOW_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "Yellow", type Color (Yellow Color object) - * @SINCE_1_0.0 - */ - public static Color Yellow - { - get - { - return new Color(Colors.Yellow); - } + public static Color Magenta { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.MAGENTA_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "Magenta", type Color (Magenta Color object) - * @SINCE_1_0.0 - */ - public static Color Magenta - { - get - { - return new Color(Colors.Magenta); - } + public static Color Cyan { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.CYAN_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - /** - * @brief name "Cyan", type Color (Cyan Color object) - * @SINCE_1_0.0 - */ - public static Color Cyan - { - get - { - return new Color(Colors.Cyan); - } + public static Color Transparent { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.TRANSPARENT_get(); + Color ret = (cPtr == global::System.IntPtr.Zero) ? null : new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } } + + public static implicit operator Vector4(Color color) + { + return new Vector4(color.R, color.G, color.B, color.A); + } + + public static implicit operator Color(Vector4 vec) + { + return new Color(vec.r, vec.g, vec.b, vec.a); + } + } + +} + + diff --git a/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs b/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs index 885070c..a2565ba 100755 --- a/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs +++ b/plugins/dali-swig/manual/csharp/DaliEnumConstants.cs @@ -46,54 +46,6 @@ namespace Dali OrthographicProjection = Dali.ProjectionMode.ORTHOGRAPHIC_PROJECTION ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0 } - 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; - } - public struct Direction { public enum Type diff --git a/plugins/dali-swig/manual/csharp/Position.cs b/plugins/dali-swig/manual/csharp/Position.cs old mode 100644 new mode 100755 index e7c72a9..b705ac6 --- a/plugins/dali-swig/manual/csharp/Position.cs +++ b/plugins/dali-swig/manual/csharp/Position.cs @@ -1,188 +1,639 @@ -namespace Dali -{ - using System; +/* + * Copyright (c) 2017 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. + * + */ - public class Position - { +namespace Dali { - private float x; - private float y; - private float z; +public class Position : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; - /** - * @brief constructor - * - * @since 1.0.0 - */ - public Position() - { - x = 0.0f; - y = 0.0f; - z = 0.0f; - } - - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] a The Position X. - * @param [in] b The Position Y. - * @param [in] c The Position Z. - */ - public Position(float a, float b, float c) - { - x = a; - y = b; - z = c; - } - - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] o The Vector Position X, Y, Z. - */ - public Position(Vector3 o) - { - x = o.X; - y = o.Y; - z = o.Z; + internal Position(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~Position() { + DisposeQueue.Instance.Add(this); + } + + public virtual void Dispose() { + if (!Stage.IsInstalled()) { + DisposeQueue.Instance.Add(this); + return; } - ///< name "X", type float (Position X value) - //@since 1.0.0 - public float X - { - get { return x; } - set { x = value; } + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector3(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); } + } + + + public static Position operator+(Position arg1, Position arg2) { + return arg1.Add(arg2); + } + + public static Position operator-(Position arg1, Position arg2) { + return arg1.Subtract(arg2); + } + + public static Position operator-(Position arg1) { + return arg1.Subtract(); + } + + public static Position operator*(Position arg1, Position arg2) { + return arg1.Multiply(arg2); + } + + public static Position operator*(Position arg1, float arg2) { + return arg1.Multiply(arg2); + } + + public static Position operator/(Position arg1, Position arg2) { + return arg1.Divide(arg2); + } - ///< name "Y", type float (Position Y value) - //@since 1.0.0 - public float Y + public static Position operator/(Position arg1, float arg2) { + return arg1.Divide(arg2); + } + + + public float this[uint index] + { + get { - get { return y; } - set { y = value; } + return ValueOfIndex(index); } + } - ///< name "Z", type float (Position Z value) - //@since 1.0.0 - public float Z - { - get { return z; } - set { z = value; } - } - - /** - * @brief operator+ - * - * @since 1.0.0 - * @param [in] l The Position to add. - * @param [in] r The Position to add - * @return A reference to this - */ - public static Position operator +(Position l, Position r) - { - return new Position(l.X + r.X, l.Y + r.Y, l.Z + r.Z); - } - - /** - * @brief operator- - * - * @since 1.0.0 - * @param [in] l The Position to substract. - * @param [in] r The Position to substract - * @return A reference to this - */ - public static Position operator -(Position l, Position r) - { - return new Position(l.X - r.X, l.Y - r.Y, l.Z - r.Z); - } - - /** - * @brief operator* - * - * @since 1.0.0 - * @param [in] a The Position to multiply. - * @param [in] b The constant to multiply of type double. - * @return A reference to this - */ - public static Position operator *(Position a, double b) - { - return new Position((int)(a.X * b), (int)(a.Y * b), (int)(a.Z * b)); - } - - /** - * @brief operator/ - * - * @since 1.0.0 - * @param [in] a The Position to divide. - * @param [in] b The Position to divide - * @return float value of division operation - */ - public static float operator /(Position a, Position b) - { - return (float)System.Math.Sqrt((a.X / b.X) * (a.Y / b.Y) * (a.Z / b.Z)); - } - - /** - * @brief Operator == - * - * @since 1.0.0 - * @param [in] a The Position object to compare. - * @param [in] b The Position object to compare. - * @return bool, whether Position are equal or not - */ - public static bool operator == (Position a, Position b) - { - return a.X == b.X && a.Y == b.Y && a.Z == b.Z; - } - - /** - * @brief Operator != - * - * @since 1.0.0 - * @param [in] a The Position object to compare. - * @param [in] b The Position object to compare. - * @return bool, whether Position are equal or not - */ - public static bool operator != (Position a, Position b) - { - return a.X != b.X || a.Y != b.Y || a.Z == b.Z; + public static Position GetPositionFromPtr(global::System.IntPtr cPtr) { + Position ret = new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public Position() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Position(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Position(Position2D position2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Position2D.getCPtr(position2d)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + + private Position Add(Position rhs) { + Position ret = new Position(NDalicPINVOKE.Vector3_Add(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Subtract(Position rhs) { + Position ret = new Position(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Multiply(Position rhs) { + Position ret = new Position(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Multiply(float rhs) { + Position ret = new Position(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Divide(Position rhs) { + Position ret = new Position(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Divide(float rhs) { + Position ret = new Position(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Subtract() { + Position ret = new Position(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) { + float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool EqualTo(Position rhs) { + bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Position.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool NotEqualTo(Position rhs) { + bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Position.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public float X { + set { + NDalicPINVOKE.Vector3_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + get { + float ret = NDalicPINVOKE.Vector3_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } - /** - * @brief GetHashCode - * - * @since 1.0.0 - * @return int, hascode of position - */ - public override int GetHashCode() - { - return base.GetHashCode(); + public float Y { + set { + NDalicPINVOKE.Vector3_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + get { + float ret = NDalicPINVOKE.Vector3_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } - /** - * @brief Clone - * - * @since 1.0.0 - * @return Position object - */ - public Position Clone() - { - Position copy = new Position(X, Y, Z); - return copy; + public float Z { + set { + NDalicPINVOKE.Vector3_Z_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + get { + float ret = NDalicPINVOKE.Vector3_Z_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } - // User-defined conversion from Position to Vector3 - public static implicit operator Vector3(Position pos) - { - return new Vector3(pos.x, pos.y, pos.z); + internal static float ParentOriginTop + { + get + { + float ret = NDalicPINVOKE.ParentOriginTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float ParentOriginBottom + { + get + { + float ret = NDalicPINVOKE.ParentOriginBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float ParentOriginLeft + { + get + { + float ret = NDalicPINVOKE.ParentOriginLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float ParentOriginRight + { + get + { + float ret = NDalicPINVOKE.ParentOriginRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float ParentOriginMiddle + { + get + { + float ret = NDalicPINVOKE.ParentOriginMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginTopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginTopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginTopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginCenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginCenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginBottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginBottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ParentOriginBottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float AnchorPointTop + { + get + { + float ret = NDalicPINVOKE.AnchorPointTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float AnchorPointBottom + { + get + { + float ret = NDalicPINVOKE.AnchorPointBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float AnchorPointLeft + { + get + { + float ret = NDalicPINVOKE.AnchorPointLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float AnchorPointRight + { + get + { + float ret = NDalicPINVOKE.AnchorPointRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float AnchorPointMiddle + { + get + { + float ret = NDalicPINVOKE.AnchorPointMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointTopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointTopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointTopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointCenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointCenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointBottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointBottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position AnchorPointBottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Position One { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ONE_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - public static implicit operator Position(Vector3 vec) - { - return new Position(vec.X, vec.Y, vec.Z); + internal static Position XAxis { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_XAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position YAxis { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_YAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ZAxis { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position NegativeXAxis { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_XAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position NegativeYAxis { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_YAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position NegativeZAxis { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_ZAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Position Zero { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } } + + public static implicit operator Vector3(Position Position) + { + return new Vector3(Position.X, Position.Y, Position.Z); + } + + public static implicit operator Position(Vector3 vec) + { + return new Position(vec.X, vec.Y, vec.Z); + } + +} + + public struct ParentOrigin + { + public static readonly float Top = Position.ParentOriginTop; + public static readonly float Bottom = Position.ParentOriginBottom; + public static readonly float Left = Position.ParentOriginLeft; + public static readonly float Right = Position.ParentOriginRight; + public static readonly float Middle = Position.ParentOriginMiddle; + public static readonly Position TopLeft = Position.ParentOriginTopLeft; + public static readonly Position TopCenter = Position.ParentOriginTopCenter; + public static readonly Position TopRight = Position.ParentOriginTopRight; + public static readonly Position CenterLeft = Position.ParentOriginCenterLeft; + public static readonly Position Center = Position.ParentOriginCenter; + public static readonly Position CenterRight = Position.ParentOriginCenterRight; + public static readonly Position BottomLeft = Position.ParentOriginBottomLeft; + public static readonly Position BottomCenter = Position.ParentOriginBottomCenter; + public static readonly Position BottomRight = Position.ParentOriginBottomRight; + } + public struct AnchorPoint + { + public static readonly float Top = Position.AnchorPointTop; + public static readonly float Bottom = Position.AnchorPointBottom; + public static readonly float Left = Position.AnchorPointLeft; + public static readonly float Right = Position.AnchorPointRight; + public static readonly float Middle = Position.AnchorPointMiddle; + public static readonly Position TopLeft = Position.AnchorPointTopLeft; + public static readonly Position TopCenter = Position.AnchorPointTopCenter; + public static readonly Position TopRight = Position.AnchorPointTopRight; + public static readonly Position CenterLeft = Position.AnchorPointCenterLeft; + public static readonly Position Center = Position.AnchorPointCenter; + public static readonly Position CenterRight = Position.AnchorPointCenterRight; + public static readonly Position BottomLeft = Position.AnchorPointBottomLeft; + public static readonly Position BottomCenter = Position.AnchorPointBottomCenter; + public static readonly Position BottomRight = Position.AnchorPointBottomRight; + } + public struct PositionAxis + { + public static readonly Position X = Position.XAxis; + public static readonly Position Y = Position.YAxis; + public static readonly Position Z = Position.ZAxis; + public static readonly Position NegativeX = Position.NegativeXAxis; + public static readonly Position NegativeY = Position.NegativeYAxis; + public static readonly Position NegativeZ = Position.NegativeZAxis; + } + } + + diff --git a/plugins/dali-swig/manual/csharp/Position2D.cs b/plugins/dali-swig/manual/csharp/Position2D.cs new file mode 100755 index 0000000..668b5b0 --- /dev/null +++ b/plugins/dali-swig/manual/csharp/Position2D.cs @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2017 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. + * + */ + +namespace Dali { + +public class Position2D : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Position2D(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position2D obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~Position2D() { + DisposeQueue.Instance.Add(this); + } + + public virtual void Dispose() { + if (!Stage.IsInstalled()) { + DisposeQueue.Instance.Add(this); + return; + } + + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector2(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + + public static Position2D operator+(Position2D arg1, Position2D arg2) { + return arg1.Add(arg2); + } + + public static Position2D operator-(Position2D arg1, Position2D arg2) { + return arg1.Subtract(arg2); + } + + public static Position2D operator-(Position2D arg1) { + return arg1.Subtract(); + } + + public static Position2D operator*(Position2D arg1, Position2D arg2) { + return arg1.Multiply(arg2); + } + + public static Position2D operator*(Position2D arg1, int arg2) { + return arg1.Multiply(arg2); + } + + public static Position2D operator/(Position2D arg1, Position2D arg2) { + return arg1.Divide(arg2); + } + + public static Position2D operator/(Position2D arg1, int arg2) { + return arg1.Divide(arg2); + } + + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + public static Position2D GetPosition2DFromPtr(global::System.IntPtr cPtr) { + Position2D ret = new Position2D(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public Position2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Position2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Position2D(Position position) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Position.getCPtr(position)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Position2D Add(Position2D rhs) { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Subtract(Position2D rhs) { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Position2D Multiply(Position2D rhs) { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Multiply(int rhs) { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Position2D Divide(Position2D rhs) { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Divide(int rhs) { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Subtract() { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool EqualTo(Position2D rhs) { + bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Position2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool NotEqualTo(Position2D rhs) { + bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Position2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private int ValueOfIndex(uint index) { + int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public int X { + set { + NDalicPINVOKE.Vector2_X_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + public int Y { + set { + NDalicPINVOKE.Vector2_Y_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + public static implicit operator Vector2(Position2D position2d) + { + return new Vector2((float)position2d.X, (float)position2d.Y); + } + + public static implicit operator Position2D(Vector2 vec) + { + return new Position2D((int)vec.X, (int)vec.Y); + } + +} + +} + + diff --git a/plugins/dali-swig/manual/csharp/Size.cs b/plugins/dali-swig/manual/csharp/Size.cs old mode 100644 new mode 100755 index d238d36..930557f --- a/plugins/dali-swig/manual/csharp/Size.cs +++ b/plugins/dali-swig/manual/csharp/Size.cs @@ -1,306 +1,232 @@ -namespace Dali -{ - using System; +/* + * Copyright (c) 2017 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. + * + */ + +namespace Dali { + +public class Size : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Size(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } - public class Size - { - private float width; - private float height; - - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] a Width value . - * @param [in] b Height value. - */ - public Size(float a, float b) - { - width = a; - height = b; - } - /** - * @brief default constructor - * - * @since 1.0.0 - */ - public Size() - { - width = 0.0f; - height = 0.0f; - } + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } - /** - * @brief constructor with base class object - * - * @since 1.0.0 - * @param [in] o The Vector2 with Width, Height values. - */ - public Size(Vector2 o) - { - width = o.X; - height = o.Y; - } + ~Size() { + DisposeQueue.Instance.Add(this); + } - /** - * @brief Copy constructor - * - * @since 1.0.0 - * @param [in] o The Size having Width & Y. - */ - public Size(Size a) - { - width = a.width; - height = a.height; + public virtual void Dispose() { + if (!Stage.IsInstalled()) { + DisposeQueue.Instance.Add(this); + return; } - ///< name "W", type float (Size Width value) - //@since 1.0.0 - public float W - { - get { return width; } - set { width = value; } + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector3(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); } + } - ///< name "H", type float (Size Height value) - //@since 1.0.0 - public float H - { - get { return height; } - set { height = value; } - } - public float Width - { - get { return width; } - set { width = value; } - } + public static Size operator+(Size arg1, Size arg2) { + return arg1.Add(arg2); + } - public float Height - { - get { return height; } - set { height = value; } - } + public static Size operator-(Size arg1, Size arg2) { + return arg1.Subtract(arg2); + } - /** - * @brief operator+ - * - * @since 1.0.0 - * @param [in] l The Size to add. - * @param [in] r The Size to add - * @return A reference to this - */ - public static Size operator +(Size l, Size r) - { - return new Size(l.W + r.W, l.H + r.H); - } + public static Size operator-(Size arg1) { + return arg1.Subtract(); + } - /** - * @brief operator- - * - * @since 1.0.0 - * @param [in] l The Size to substract. - * @param [in] r The Size to substract - * @return A reference to this - */ - public static Size operator -(Size l, Size r) - { - return new Size(l.W - r.W, l.H - r.H); - } + public static Size operator*(Size arg1, Size arg2) { + return arg1.Multiply(arg2); + } - /** - * @brief operator* - * - * @since 1.0.0 - * @param [in] a The Size to multiply - * @param [in] b The constant to multiply of type double. - * @return A reference to this - */ - public static Size operator *(Size a, double b) - { - return new Size((float)(a.W * b), (float)(a.H * b)); - } + public static Size operator*(Size arg1, float arg2) { + return arg1.Multiply(arg2); + } - /** - * @brief operator/ - * - * @since 1.0.0 - * @param [in] a The Size to divide. - * @param [in] b The Size to divide - * @return float of the size division - */ - public static float operator /(Size a, Size b) - { - return (float)System.Math.Sqrt((a.W / b.W) * (a.H / b.H)); - } + public static Size operator/(Size arg1, Size arg2) { + return arg1.Divide(arg2); + } - /** - * @brief Operator == - * - * @since 1.0.0 - * @param [in] a The Size object to compare. - * @param [in] b The Size object to compare. - * @return bool, whether Size are equal or not - */ - public static bool operator == (Size a, Size b) - { - return a.W == b.W && a.H == b.H ; - } + public static Size operator/(Size arg1, float arg2) { + return arg1.Divide(arg2); + } - /** - * @brief Operator != - * - * @since 1.0.0 - * @param [in] a The Size object to compare. - * @param [in] b The Size object to compare. - * @return bool, whether Size are equal or not - */ - public static bool operator != (Size a, Size b) + public float this[uint index] + { + get { - return a.W != b.W || a.H != b.H; + return ValueOfIndex(index); } + } - /** - * @brief GetHashCode - * - * @since 1.0.0 - * @return int, hascode of Size - */ - public override int GetHashCode() - { - return (int)(W + H); - } + public static Size GetSizeFromPtr(global::System.IntPtr cPtr) { + Size ret = new Size(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - /** - * @brief Clone - * - * @since 1.0.0 - * @return returns a copy of Size object - */ - public Size Clone() - { - Size copy = new Size(W, H); - return copy; - } - // User-defined conversion from Position to Vector2 - public static implicit operator Vector2(Size size) - { - return new Vector2(size.width, size.height); - } + public Size() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - public static implicit operator Size(Vector2 vec) - { - return new Size(vec.X, vec.Y); - } + public Size(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public class Size3D - { - private float width; - private float height; - private float depth; + public Size(Size2D size2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Size2D.getCPtr(size2d)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - public Size3D(float a, float b, float c) - { - width = a; - height = b; - depth = c; - } - public Size3D() - { - width = 0.0f; - height = 0.0f; - depth = 0.0f; + public static Size Zero { + get { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get(); + Size ret = (cPtr == global::System.IntPtr.Zero) ? null : new Size(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - public Size3D(Vector3 o) - { - width = o.X; - height = o.Y; - depth = o.Z; - } + private Size Add(Size rhs) { + Size ret = new Size(NDalicPINVOKE.Vector3_Add(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public Size3D(Vector2 o) - { - width = o.X; - height = o.Y; - depth = 0.0f; - } + private Size Subtract(Size rhs) { + Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public Size3D(Size3D a) - { - width = a.width; - height = a.height; - depth = a.depth; - } + private Size Multiply(Size rhs) { + Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float W - { - get { return width; } - set { width = value; } - } + private Size Multiply(float rhs) { + Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float H - { - get { return height; } - set { height = value; } - } + private Size Divide(Size rhs) { + Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float D - { - get { return depth; } - set { depth = value; } - } + private Size Divide(float rhs) { + Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float Width - { - get { return width; } - set { width = value; } - } + private Size Subtract() { + Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float Height - { - get { return height; } - set { height = value; } - } + private float ValueOfIndex(uint index) { + float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float Depth - { - get { return depth; } - set { depth = value; } - } + public bool EqualTo(Size rhs) { + bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Size.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float X - { - get { return width; } - set { width = value; } - } + public bool NotEqualTo(Size rhs) { + bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Size.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - public float Y - { - get { return height; } - set { height = value; } - } - public float Z - { - get { return depth; } - set { depth = value; } + public float Width { + set { + NDalicPINVOKE.Vector3_Width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector3_Width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - // User-defined conversion from Position to Vector3 - public static implicit operator Vector3(Size3D size) - { - return new Vector3(size.width, size.height, size.depth); + public float Height { + set { + NDalicPINVOKE.Vector3_Height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector3_Height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - public static implicit operator Size3D(Vector3 vec) - { - return new Size3D(vec.X, vec.Y, vec.Z); + public float Depth { + set { + NDalicPINVOKE.Vector3_Depth_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector3_Depth_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } + + + public static implicit operator Vector3(Size size) + { + return new Vector3(size.Width, size.Height, size.Depth); + } + public static implicit operator Size(Vector3 vec) + { + return new Size(vec.Width, vec.Height, vec.Depth); } } + +} + diff --git a/plugins/dali-swig/manual/csharp/Size2D.cs b/plugins/dali-swig/manual/csharp/Size2D.cs new file mode 100755 index 0000000..fb37d41 --- /dev/null +++ b/plugins/dali-swig/manual/csharp/Size2D.cs @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2017 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. + * + */ + +namespace Dali { + +public class Size2D : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Size2D(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size2D obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~Size2D() { + DisposeQueue.Instance.Add(this); + } + + public virtual void Dispose() { + if (!Stage.IsInstalled()) { + DisposeQueue.Instance.Add(this); + return; + } + + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector2(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + + public static Size2D operator+(Size2D arg1, Size2D arg2) { + return arg1.Add(arg2); + } + + public static Size2D operator-(Size2D arg1, Size2D arg2) { + return arg1.Subtract(arg2); + } + + public static Size2D operator-(Size2D arg1) { + return arg1.Subtract(); + } + + public static Size2D operator*(Size2D arg1, Size2D arg2) { + return arg1.Multiply(arg2); + } + + public static Size2D operator*(Size2D arg1, int arg2) { + return arg1.Multiply(arg2); + } + + public static Size2D operator/(Size2D arg1, Size2D arg2) { + return arg1.Divide(arg2); + } + + public static Size2D operator/(Size2D arg1, int arg2) { + return arg1.Divide(arg2); + } + + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + public static Size2D GetSize2DFromPtr(global::System.IntPtr cPtr) { + Size2D ret = new Size2D(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public Size2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Size2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Size2D(Size size) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Size.getCPtr(size)), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Size2D Add(Size2D rhs) { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Subtract(Size2D rhs) { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Size2D Multiply(Size2D rhs) { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Multiply(int rhs) { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Size2D Divide(Size2D rhs) { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Divide(int rhs) { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Subtract() { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool EqualTo(Size2D rhs) { + bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Size2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool NotEqualTo(Size2D rhs) { + bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Size2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private int ValueOfIndex(uint index) { + int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public int Width { + set { + NDalicPINVOKE.Vector2_Width_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + public int Height { + set { + NDalicPINVOKE.Vector2_Height_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get { + float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + public static implicit operator Vector2(Size2D size) + { + return new Vector2((float)size.Width, (float)size.Height); + } + + public static implicit operator Size2D(Vector2 vec) + { + return new Size2D((int)vec.X, (int)vec.Y); + } + +} + +} + diff --git a/plugins/dali-swig/manual/csharp/ViewRegistry.cs b/plugins/dali-swig/manual/csharp/ViewRegistry.cs old mode 100644 new mode 100755 index b055a7d..a359297 --- a/plugins/dali-swig/manual/csharp/ViewRegistry.cs +++ b/plugins/dali-swig/manual/csharp/ViewRegistry.cs @@ -492,12 +492,11 @@ namespace Dali } else if ( type.Equals (typeof(Size)) ) { - // DALi sizes are Vector3 - Vector3 value = new Vector3(); + Size value = new Size(); ok = propValue.Get( value ); if ( ok ) { - propertyInfo.SetValue(view, new Size(value.X,value.Y)); + propertyInfo.SetValue(view, new Size(value.Width, value.Height, value.Depth)); }; } else if ( type.Equals (typeof(Color)) ) -- 2.7.4