From cedba732c89206dbb8c1f592c23a12b16d7fc3d2 Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Sat, 25 Mar 2017 00:21:59 +0900 Subject: [PATCH] dali-swig in ubuntu crash fix - I got this log msg, so I changed ViewWrapper.cs => Mono: Probing 'CSharp_Dali_delete_ViewWrapper'. Mono: Found as 'CSharp_Dali_delete_ViewWrapper'. *** Error in `mono': free(): corrupted unsorted chunks: 0x00000000019daad0 *** Stacktrace: at <0xffffffff> at (wrapper managed-to-native) Dali.NDalicManualPINVOKE.delete_ViewWrapper (System.Runtime.InteropServices.HandleRef) <0xffffffff> at Dali.ViewWrapper.Dispose () <0x0008f> at Dali.ViewWrapper.Finalize () <0x00018> at (wrapper runtime-invoke) object.runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr) <0xffffffff> Conflicts: plugins/dali-swig/examples/dali-test.cs Change-Id: I4fdbfebf4b1829ab15eee591a7463986972a7b64 Signed-off-by: dongsug.song --- plugins/dali-swig/examples/control-dashboard.cs | 845 ++++++++++++----------- plugins/dali-swig/examples/dali-test.cs | 667 ++++++++++-------- plugins/dali-swig/examples/hello-world.cs | 197 +++--- plugins/dali-swig/examples/image-view.cs | 390 +++++------ plugins/dali-swig/examples/scroll-view.cs | 10 +- plugins/dali-swig/examples/user-alphafunction.cs | 304 ++++---- plugins/dali-swig/manual/csharp/View.cs | 0 plugins/dali-swig/manual/csharp/ViewWrapper.cs | 45 +- plugins/dali-swig/views/spin.cs | 556 +++++++-------- 9 files changed, 1540 insertions(+), 1474 deletions(-) mode change 100644 => 100755 plugins/dali-swig/manual/csharp/View.cs mode change 100644 => 100755 plugins/dali-swig/manual/csharp/ViewWrapper.cs mode change 100644 => 100755 plugins/dali-swig/views/spin.cs diff --git a/plugins/dali-swig/examples/control-dashboard.cs b/plugins/dali-swig/examples/control-dashboard.cs index 3ec656e..39b7641 100755 --- a/plugins/dali-swig/examples/control-dashboard.cs +++ b/plugins/dali-swig/examples/control-dashboard.cs @@ -1,19 +1,18 @@ -/* - * 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. - * - */ +/** 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. +* +*/ using System; using System.Runtime.InteropServices; @@ -21,32 +20,32 @@ using Dali; namespace MyCSharpExample { - class Example - { - // This is simple structure to contain Control name and implement state at once - // name : control name - // isImplemented : the state which the control is implemented in public or not - private struct Item + class Example { - public String name; - public bool isImplemented; - - public Item(String name, bool isImplemented) - { - this.name = name; - this.isImplemented = isImplemented; - } - } + // This is simple structure to contain Control name and implement state at once + // name : control name + // isImplemented : the state which the control is implemented in public or not + private struct Item + { + public String name; + public bool isImplemented; - private Dali.Application _application; - private TableView _contentContainer; - private Timer _timer; - private Stage _stage; - private Popup _popup; - private ProgressBar _progressBar; + public Item(String name, bool isImplemented) + { + this.name = name; + this.isImplemented = isImplemented; + } + } - // List of items - private Item[] mViewList = { + private Dali.Application _application; + private TableView _contentContainer; + private Timer _timer; + private Stage _stage; + private Popup _popup; + private ProgressBar _progressBar; + + // List of items + private Item[] mViewList = { new Item("PushButton", true), new Item("DropDown", false), new Item("Toggle", true), new Item("InputField", false), new Item("AnimateGif", false), new Item("Loading", false), new Item("ProgressBar", true), new Item("CheckBox", false), new Item("RadioButton", true), @@ -54,419 +53,427 @@ namespace MyCSharpExample new Item("ItemView", false), new Item("CheckBox", true) }; - public Example(Dali.Application application) - { - _application = application; - _application.Initialized += OnInitialize; - } - - public void OnInitialize(object source, NUIApplicationInitEventArgs e) - { - Console.WriteLine("Customized Application Initialize event handler"); - _stage = Stage.GetCurrent(); - _stage.BackgroundColor = Color.White; - - // Top label - TextLabel topLabel = new TextLabel(); - topLabel.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - topLabel.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT); - topLabel.AnchorPoint = NDalic.AnchorPointTopCenter; - topLabel.ParentOrigin = NDalic.ParentOriginTopCenter; - topLabel.SetSizeModeFactor(new Vector3( 0.0f, 0.1f, 0.0f ) ); - topLabel.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f); - topLabel.TextColor = NDalic.WHITE; - topLabel.Text = " DALi Views"; - topLabel.HorizontalAlignment = "BEGIN"; - topLabel.VerticalAlignment = "CENTER"; - topLabel.PointSize = 42.0f; - _stage.Add(topLabel); - - // Grid container to contain items. Use tableView because FlexContainer support focus navigation just two direction ( up/down or left/right ) - _contentContainer = new TableView(6, 5); - _contentContainer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - _contentContainer.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT); - _contentContainer.SetSizeModeFactor(new Vector3( 0.0f, 0.9f, 0.0f ) ); - _contentContainer.AnchorPoint = NDalic.AnchorPointBottomCenter; - _contentContainer.ParentOrigin = NDalic.ParentOriginBottomCenter; - _contentContainer.SetRelativeHeight(0, 0.07f); - _contentContainer.SetRelativeHeight(1, 0.26f); - _contentContainer.SetRelativeHeight(2, 0.07f); - _contentContainer.SetRelativeHeight(3, 0.26f); - _contentContainer.SetRelativeHeight(4, 0.07f); - _contentContainer.SetRelativeHeight(5, 0.26f); - _contentContainer.SetKeyboardFocusable(true); - _stage.Add(_contentContainer); - - CreateContent(); - - FocusManager.Instance.PreFocusChange += OnPreFocusChange; - } - - // Callback for KeyboardFocusManager - private Actor OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) - { - if (!e.Proposed && !e.Current) - { - e.Proposed = _contentContainer.GetChildAt(1); - } - return e.Proposed; - } - - private void CreateContent() - { - for (int i = 0; i < mViewList.Length; i++) - { - CreateItem(mViewList[i], i); - } - } - - private void CreateItem(Item item, int idx) - { - // Make label for item - TextLabel itemLabel = new TextLabel(" " + item.name); - itemLabel.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.05f, 0.0f); - itemLabel.HorizontalAlignment = "BEGIN"; - itemLabel.VerticalAlignment = "BOTTOM"; - itemLabel.PointSize = 18.0f; - _contentContainer.AddChild(itemLabel, new TableView.CellPosition(((uint)idx / 5) * 2, (uint)idx % 5)); - - // If item is implemented in public, attach it on stage - if (item.isImplemented) - { - if (item.name.CompareTo("PushButton") == 0) + public Example(Dali.Application application) { - PushButton pushButton = new PushButton(); - pushButton.LabelText = "Push Button"; - pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT); - pushButton.UnselectedColor = new Vector4(1.0f,0.0f,0.0f,1.0f); - pushButton.SelectedColor = new Vector4(0.0f,1.0f,0.0f,1.0f); - pushButton.Clicked += (obj, e) => - { - e.Button.LabelText = "Click Me"; - e.Button.UnselectedColor = new Vector4(0.0f,0.0f,1.0f,1.0f); - return true; - }; - - _contentContainer.AddChild(pushButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + _application = application; + _application.Initialized += OnInitialize; } - if (item.name.CompareTo("DropDown") == 0) - { - } - if (item.name.CompareTo("Toggle") == 0) + public void OnInitialize(object source, NUIApplicationInitEventArgs e) { - ToggleButton toggleButton = new ToggleButton(); - Dali.Property.Array array = new Dali.Property.Array(); - array.Add( new Dali.Property.Value("./images/star-highlight.png") ); - array.Add( new Dali.Property.Value("./images/star-mod.png") ); - array.Add( new Dali.Property.Value("./images/star-dim.png") ); - toggleButton.StateVisuals = array; - - Dali.Property.Array tooltips = new Dali.Property.Array(); - tooltips.Add( new Dali.Property.Value("State A") ); - tooltips.Add( new Dali.Property.Value("State B") ); - tooltips.Add( new Dali.Property.Value("State C") ); - toggleButton.Tooltips = tooltips; - - toggleButton.WidthResizePolicy = "FILL_TO_PARENT"; - toggleButton.HeightResizePolicy = "FILL_TO_PARENT"; - toggleButton.Clicked += (obj, e) => - { - Console.WriteLine("Toggle button state changed."); - return true; - }; - - _contentContainer.AddChild(toggleButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + Console.WriteLine("Customized Application Initialize event handler"); + _stage = Stage.GetCurrent(); + _stage.BackgroundColor = Color.White; + + // Top label + TextLabel topLabel = new TextLabel(); + topLabel.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + topLabel.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT); + topLabel.AnchorPoint = NDalic.AnchorPointTopCenter; + topLabel.Position = new Position(0, 0, 0); + topLabel.SetSizeModeFactor(new Vector3(0.0f, 0.1f, 0.0f)); + topLabel.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f); + topLabel.TextColor = NDalic.WHITE; + topLabel.Text = " DALi Views"; + topLabel.HorizontalAlignment = "BEGIN"; + topLabel.VerticalAlignment = "CENTER"; + topLabel.PointSize = 42.0f; + _stage.Add(topLabel); + + // Grid container to contain items. Use tableView because FlexContainer support focus navigation just two direction ( up/down or left/right ) + _contentContainer = new TableView(6, 5); + _contentContainer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + _contentContainer.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT); + _contentContainer.SetSizeModeFactor(new Vector3(0.0f, 0.9f, 0.0f)); + _contentContainer.AnchorPoint = NDalic.AnchorPointBottomCenter; + _contentContainer.Position = new Position(0, _stage.Size.Height * 0.1f, 0); + _contentContainer.SetRelativeHeight(0, 0.07f); + _contentContainer.SetRelativeHeight(1, 0.26f); + _contentContainer.SetRelativeHeight(2, 0.07f); + _contentContainer.SetRelativeHeight(3, 0.26f); + _contentContainer.SetRelativeHeight(4, 0.07f); + _contentContainer.SetRelativeHeight(5, 0.26f); + _contentContainer.SetKeyboardFocusable(true); + _stage.Add(_contentContainer); + + CreateContent(); + + FocusManager.Instance.PreFocusChange += OnPreFocusChange; } - if (item.name.CompareTo("InputField") == 0) - { - } - if (item.name.CompareTo("AnimateGif") == 0) + // Callback for KeyboardFocusManager + private Actor OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e) { - + if (!e.Proposed && !e.Current) + { + e.Proposed = _contentContainer.GetChildAt(1); + } + return e.Proposed; } - if (item.name.CompareTo("Loading") == 0) - { - } - if (item.name.CompareTo("ProgressBar") == 0) + private void CreateContent() { - _progressBar = new ProgressBar(); - _progressBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - _progressBar.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT); - _progressBar.SetSize( 0, 50 ); - - _progressBar.ValueChanged += OnProgressBarValueChanged; - - _timer = new Timer( 100 ); - _timer.Tick += ( obj, e ) => - { - float progress = (float)Math.Round( _progressBar.ProgressValue , 2 ); + for (int i = 0; i < mViewList.Length; i++) + { + CreateItem(mViewList[i], i); + } + } - if( progress == 1.0f ) + private void CreateItem(Item item, int idx) + { + // Make label for item + TextLabel itemLabel = new TextLabel(" " + item.name); + itemLabel.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.05f, 0.0f); + itemLabel.HorizontalAlignment = "BEGIN"; + itemLabel.VerticalAlignment = "BOTTOM"; + itemLabel.PointSize = 18.0f; + _contentContainer.AddChild(itemLabel, new TableView.CellPosition(((uint)idx / 5) * 2, (uint)idx % 5)); + + // If item is implemented in public, attach it on stage + if (item.isImplemented) { - _progressBar.ProgressValue = 0.0f; - _progressBar.SecondaryProgressValue = 0.01f; + if (item.name.CompareTo("PushButton") == 0) + { + PushButton pushButton = new PushButton(); + pushButton.LabelText = "Push Button"; + pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT); + pushButton.UnselectedColor = new Vector4(1.0f, 0.0f, 0.0f, 1.0f); + pushButton.SelectedColor = new Vector4(0.0f, 1.0f, 0.0f, 1.0f); + pushButton.Clicked += (obj, e) => + { + e.Button.LabelText = "Click Me"; + e.Button.UnselectedColor = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); + return true; + }; + + _contentContainer.AddChild(pushButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("DropDown") == 0) + { + + } + if (item.name.CompareTo("Toggle") == 0) + { + ToggleButton toggleButton = new ToggleButton(); + Dali.Property.Array array = new Dali.Property.Array(); + array.Add(new Dali.Property.Value("./images/star-highlight.png")); + array.Add(new Dali.Property.Value("./images/star-mod.png")); + array.Add(new Dali.Property.Value("./images/star-dim.png")); + toggleButton.StateVisuals = array; + + Dali.Property.Array tooltips = new Dali.Property.Array(); + tooltips.Add(new Dali.Property.Value("State A")); + tooltips.Add(new Dali.Property.Value("State B")); + tooltips.Add(new Dali.Property.Value("State C")); + toggleButton.Tooltips = tooltips; + + toggleButton.WidthResizePolicy = "FILL_TO_PARENT"; + toggleButton.HeightResizePolicy = "FILL_TO_PARENT"; + toggleButton.Clicked += (obj, e) => + { + Console.WriteLine("Toggle button state changed."); + return true; + }; + + _contentContainer.AddChild(toggleButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("InputField") == 0) + { + + } + if (item.name.CompareTo("AnimateGif") == 0) + { + + } + if (item.name.CompareTo("Loading") == 0) + { + + } + if (item.name.CompareTo("ProgressBar") == 0) + { + _progressBar = new ProgressBar(); + _progressBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + _progressBar.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT); + _progressBar.SetSize(0, 50); + + _progressBar.ValueChanged += OnProgressBarValueChanged; + + _timer = new Timer(100); + _timer.Tick += (obj, e) => + { + float progress = (float)Math.Round(_progressBar.ProgressValue, 2); + + if (progress == 1.0f) + { + _progressBar.ProgressValue = 0.0f; + _progressBar.SecondaryProgressValue = 0.01f; + } + else + { + _progressBar.ProgressValue = progress + 0.01f; + _progressBar.SecondaryProgressValue = progress + 0.21f; + } + return true; + }; + _timer.Start(); + + _contentContainer.AddChild(_progressBar, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("ScrollBar") == 0) + { + + } + if (item.name.CompareTo("CheckBox") == 0) + { + CheckBoxButton checkBoxButton = new CheckBoxButton(); + checkBoxButton.LabelText = "Yes"; + + _contentContainer.AddChild(checkBoxButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("RadioButton") == 0) + { + TableView tableView = new TableView(2, 1); + tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT); + + RadioButton rButton = new RadioButton(); + rButton.LabelText = "Yes"; + rButton.Selected = true; + + tableView.AddChild(rButton, new TableView.CellPosition(0, 0)); + + rButton = new RadioButton(); + rButton.LabelText = "No"; + + tableView.AddChild(rButton, new TableView.CellPosition(1, 0)); + + _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("Tooltip") == 0) + { + TableView tableView = new TableView(2, 1); + tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT); + + // Create two push buttons and add them to a table view + PushButton buttonWithSimpleTooltip = new PushButton(); + buttonWithSimpleTooltip.LabelText = "Tooltip with text only"; + buttonWithSimpleTooltip.UnselectedColor = new Vector4(0.5f, 0.5f, 0.7f, 1.0f); + buttonWithSimpleTooltip.SelectedColor = new Vector4(0.7f, 0.5f, 0.7f, 1.0f); + buttonWithSimpleTooltip.WidthResizePolicy = "FILL_TO_PARENT"; + tableView.AddChild(buttonWithSimpleTooltip, new TableView.CellPosition(0, 0)); + + PushButton buttonWithIconTooltip = new PushButton(); + buttonWithIconTooltip.LabelText = "Tooltip with Text and Icon"; + buttonWithIconTooltip.WidthResizePolicy = "FILL_TO_PARENT"; + buttonWithIconTooltip.UnselectedColor = new Vector4(0.5f, 0.5f, 0.7f, 1.0f); + buttonWithIconTooltip.SelectedColor = new Vector4(0.7f, 0.5f, 0.7f, 1.0f); + + tableView.AddChild(buttonWithIconTooltip, new TableView.CellPosition(1, 0)); + + // Add a simple text only tooltip to the first push button + buttonWithSimpleTooltip.TooltipText = "Simple Tooltip"; + + // Create a property map for a tooltip with one icon and one text + Property.Array iconTooltipContent = new Property.Array(); + + Property.Map iconVisual = new Property.Map(); + iconVisual.Add(Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Image)) + .Add(Dali.Constants.ImageVisualProperty.URL, new Property.Value("./images/star-highlight.png")); + iconTooltipContent.Add(new Property.Value(iconVisual)); + + Property.Map textVisual = new Property.Map(); + textVisual.Add(Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text)) + .Add(Dali.Constants.TextVisualProperty.Text, new Property.Value("Tooltip with Icon")); + iconTooltipContent.Add(new Property.Value(textVisual)); + + Property.Map iconTooltip = new Property.Map(); + iconTooltip.Add(Dali.Constants.Tooltip.Property.Content, new Property.Value(iconTooltipContent)) + .Add(Dali.Constants.Tooltip.Property.Tail, new Property.Value(true)); + + // Add the tooltip with icon and text to the second push button + buttonWithIconTooltip.Tooltip = iconTooltip; + + _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("Popup") == 0) + { + PushButton button = new PushButton(); + button.LabelText = "Popup"; + button.ParentOrigin = NDalic.ParentOriginCenter; + button.AnchorPoint = NDalic.AnchorPointCenter; + button.MaximumSize = new Vector2(90.0f, 50.0f); + _popup = CreatePopup(); + _popup.SetTitle(CreateTitle("Popup")); + + TextLabel text = new TextLabel("This will erase the file permanently. Are you sure?"); + text.BackgroundColor = Color.White; + text.MultiLine = true; + text.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + text.SetResizePolicy(ResizePolicyType.DIMENSION_DEPENDENCY, DimensionType.HEIGHT); + text.SetPadding(new PaddingType(10.0f, 10.0f, 20.0f, 0.0f)); + _popup.SetContent(text); + _popup.SetKeyboardFocusable(true); + _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN); + + button.Clicked += (obj, ee) => + { + _stage.Add(_popup); + _popup.SetDisplayState(Popup.DisplayStateType.SHOWN); + FocusManager.Instance.SetCurrentFocusActor((_popup.FindChildByName("Footer")).FindChildByName("OKButton")); + return true; + }; + _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("Toast") == 0) + { + PushButton button = new PushButton(); + button.LabelText = "Toast"; + button.ParentOrigin = NDalic.ParentOriginCenter; + button.AnchorPoint = NDalic.AnchorPointCenter; + button.Clicked += (obj, ee) => + { + TypeInfo typeInfo = new TypeInfo(TypeRegistry.Get().GetTypeInfo("PopupToast")); + if (typeInfo) + { + BaseHandle baseHandle = typeInfo.CreateInstance(); + if (baseHandle) + { + Popup toast = Popup.DownCast(baseHandle); + TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself"); + text.TextColor = Color.White; + text.MultiLine = true; + text.HorizontalAlignment = "center"; + toast.SetTitle(text); + _stage.Add(toast); + toast.SetDisplayState(Popup.DisplayStateType.SHOWN); + } + } + return true; + }; + _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } + if (item.name.CompareTo("ItemView") == 0) + { + + } } else { - _progressBar.ProgressValue = progress + 0.01f; - _progressBar.SecondaryProgressValue = progress + 0.21f; - } - return true; - }; - _timer.Start(); + ImageView notSupportView = new ImageView("images/not_yet_sign.png"); + notSupportView.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.25f, 0.0f); + notSupportView.SetKeyboardFocusable(true); - _contentContainer.AddChild(_progressBar, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + _contentContainer.AddChild(notSupportView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + } } - if (item.name.CompareTo("ScrollBar") == 0) + Popup CreatePopup() { - + Popup confirmationPopup = new Popup(); + + Actor footer = new Actor(); + footer.SetName("Footer"); + footer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); + footer.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT); + footer.SetSize(0.0f, 80.0f); + footer.ParentOrigin = NDalic.ParentOriginCenter; + footer.AnchorPoint = NDalic.AnchorPointCenter; + + PushButton okButton = CreateOKButton(); + okButton.ParentOrigin = NDalic.ParentOriginCenter; + okButton.AnchorPoint = NDalic.AnchorPointCenter; + okButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS); + okButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f)); + + + PushButton cancelButton = CreateCancelButton(); + cancelButton.ParentOrigin = NDalic.ParentOriginCenter; + cancelButton.AnchorPoint = NDalic.AnchorPointCenter; + cancelButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS); + cancelButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f)); + + + TableView controlLayout = new TableView(1, 2); + 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.SetRelativeWidth(0, 0.5f); + controlLayout.SetRelativeWidth(1, 0.5f); + controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER); + controlLayout.SetCellAlignment(new TableView.CellPosition(0, 1), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER); + controlLayout.AddChild(okButton, new TableView.CellPosition(0, 0)); + controlLayout.AddChild(cancelButton, new TableView.CellPosition(0, 1)); + + + footer.Add(controlLayout); + + confirmationPopup.SetFooter(footer); + return confirmationPopup; } - if (item.name.CompareTo("CheckBox") == 0) + Actor CreateTitle(string title) { - CheckBoxButton checkBoxButton = new CheckBoxButton(); - checkBoxButton.LabelText = "Yes"; + TextLabel titleActor = new TextLabel(title); + titleActor.TextColor = Color.White; + titleActor.MultiLine = true; + titleActor.HorizontalAlignment = "center"; - _contentContainer.AddChild(checkBoxButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + return titleActor; } - if (item.name.CompareTo("RadioButton") == 0) - { - TableView tableView = new TableView(2, 1); - tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT); - - RadioButton rButton = new RadioButton(); - rButton.LabelText = "Yes"; - rButton.Selected = true; - tableView.AddChild(rButton, new TableView.CellPosition(0, 0)); - rButton = new RadioButton(); - rButton.LabelText = "No"; - - tableView.AddChild(rButton, new TableView.CellPosition(1, 0)); - - _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); - } - if (item.name.CompareTo("Tooltip") == 0) + PushButton CreateOKButton() { - TableView tableView = new TableView(2, 1); - tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT); - - // Create two push buttons and add them to a table view - PushButton buttonWithSimpleTooltip = new PushButton(); - buttonWithSimpleTooltip.LabelText = "Tooltip with text only"; - buttonWithSimpleTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f); - buttonWithSimpleTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f); - buttonWithSimpleTooltip.WidthResizePolicy = "FILL_TO_PARENT"; - tableView.AddChild(buttonWithSimpleTooltip, new TableView.CellPosition(0, 0)); - - PushButton buttonWithIconTooltip = new PushButton(); - buttonWithIconTooltip.LabelText = "Tooltip with Text and Icon"; - buttonWithIconTooltip.WidthResizePolicy = "FILL_TO_PARENT"; - buttonWithIconTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f); - buttonWithIconTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f); - tableView.AddChild(buttonWithIconTooltip, new TableView.CellPosition(1, 0)); - - // Add a simple text only tooltip to the first push button - buttonWithSimpleTooltip.TooltipText = "Simple Tooltip"; - - // Create a property map for a tooltip with one icon and one text - Property.Array iconTooltipContent = new Property.Array(); - - Property.Map iconVisual = new Property.Map(); - iconVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Image) ) - .Add( Dali.Constants.ImageVisualProperty.URL, new Property.Value("./images/star-highlight.png") ); - iconTooltipContent.Add(new Property.Value(iconVisual)); - - Property.Map textVisual = new Property.Map(); - textVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text) ) - .Add( Dali.Constants.TextVisualProperty.Text, new Property.Value("Tooltip with Icon") ); - iconTooltipContent.Add(new Property.Value(textVisual)); - - Property.Map iconTooltip = new Property.Map(); - iconTooltip.Add( Dali.Constants.Tooltip.Property.Content, new Property.Value(iconTooltipContent) ) - .Add( Dali.Constants.Tooltip.Property.Tail, new Property.Value(true) ); - - // Add the tooltip with icon and text to the second push button - buttonWithIconTooltip.Tooltip = iconTooltip; - - _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); - } - if (item.name.CompareTo("Popup") == 0) - { - PushButton button = new PushButton(); - button.LabelText = "Popup"; - button.ParentOrigin = NDalic.ParentOriginCenter; - button.AnchorPoint = NDalic.AnchorPointCenter; - button.MaximumSize = new Vector2(90.0f,50.0f); - _popup = CreatePopup(); - _popup.SetTitle(CreateTitle("Popup")); - - TextLabel text = new TextLabel("This will erase the file permanently. Are you sure?"); - text.BackgroundColor = Color.White; - text.MultiLine = true; - text.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - text.SetResizePolicy(ResizePolicyType.DIMENSION_DEPENDENCY, DimensionType.HEIGHT); - text.SetPadding(new PaddingType(10.0f, 10.0f, 20.0f, 0.0f)); - _popup.SetContent(text); - _popup.SetKeyboardFocusable(true); - _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN); - - button.Clicked += (obj, ee) => - { - _stage.Add(_popup); - _popup.SetDisplayState(Popup.DisplayStateType.SHOWN); - FocusManager.Instance.SetCurrentFocusActor((_popup.FindChildByName( "Footer" )).FindChildByName("OKButton")); - return true; - }; - _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + PushButton okayButton = new PushButton(); + okayButton.SetName("OKButton"); + okayButton.LabelText = "OK"; + okayButton.SetKeyboardFocusable(true); + okayButton.Clicked += (obj, ee) => + { + _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN); + return true; + }; + return okayButton; } - if (item.name.CompareTo("Toast") == 0) + PushButton CreateCancelButton() { - PushButton button = new PushButton(); - button.LabelText = "Toast"; - button.ParentOrigin = NDalic.ParentOriginCenter; - button.AnchorPoint = NDalic.AnchorPointCenter; - button.Clicked += (obj, ee) => - { - TypeInfo typeInfo = new TypeInfo(TypeRegistry.Get().GetTypeInfo( "PopupToast" )); - if( typeInfo ) + PushButton cancelButton = new PushButton(); + cancelButton.LabelText = "Cancel"; + cancelButton.SetKeyboardFocusable(true); + cancelButton.Clicked += (obj, ee) => { - BaseHandle baseHandle = typeInfo.CreateInstance(); - if( baseHandle ) - { - Popup toast = Popup.DownCast( baseHandle ); - TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself"); - text.TextColor = Color.White; - text.MultiLine = true; - text.HorizontalAlignment = "center"; - toast.SetTitle( text); - _stage.Add(toast); - toast.SetDisplayState( Popup.DisplayStateType.SHOWN); - } - } - return true; - }; - _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); + _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN); + return true; + }; + return cancelButton; } - if (item.name.CompareTo("ItemView") == 0) + + void OnProgressBarValueChanged(object source, ProgressBar.ValueChangedEventArgs e) { + Property.Map labelVisual = new Property.Map(); + labelVisual.Add(Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text)) + .Add(Dali.Constants.TextVisualProperty.Text, new Property.Value(Math.Round(e.ProgressBar.ProgressValue, 2) + " / " + Math.Round(e.ProgressBar.SecondaryProgressValue, 2))); + e.ProgressBar.LabelVisual = labelVisual; + return; + } + public void MainLoop() + { + _application.MainLoop(); } - } - else - { - ImageView notSupportView = new ImageView("images/not_yet_sign.png"); - notSupportView.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.25f, 0.0f); - notSupportView.SetKeyboardFocusable(true); - _contentContainer.AddChild(notSupportView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); - } - } - Popup CreatePopup() - { - Popup confirmationPopup = new Popup(); - - Actor footer = new Actor(); - footer.SetName("Footer"); - footer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH); - footer.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT); - footer.SetSize(0.0f, 80.0f); - footer.ParentOrigin = NDalic.ParentOriginCenter; - footer.AnchorPoint = NDalic.AnchorPointCenter; - - PushButton okButton = CreateOKButton(); - okButton.ParentOrigin = NDalic.ParentOriginCenter; - okButton.AnchorPoint = NDalic.AnchorPointCenter; - okButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS); - okButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f)); - - PushButton cancelButton = CreateCancelButton(); - cancelButton.ParentOrigin = NDalic.ParentOriginCenter; - cancelButton.AnchorPoint = NDalic.AnchorPointCenter; - cancelButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS); - cancelButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f)); - - TableView controlLayout = new TableView(1, 2); - 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.SetRelativeWidth(0, 0.5f); - controlLayout.SetRelativeWidth(1, 0.5f); - controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER); - controlLayout.SetCellAlignment(new TableView.CellPosition(0, 1), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER); - controlLayout.AddChild(okButton, new TableView.CellPosition(0, 0)); - controlLayout.AddChild(cancelButton, new TableView.CellPosition(0, 1)); - - footer.Add(controlLayout); - - confirmationPopup.SetFooter(footer); - return confirmationPopup; - } - Actor CreateTitle(string title) - { - TextLabel titleActor = new TextLabel(title); - titleActor.TextColor = Color.White; - titleActor.MultiLine = true; - titleActor.HorizontalAlignment = "center"; - return titleActor; - } - PushButton CreateOKButton() - { - PushButton okayButton = new PushButton(); - okayButton.SetName("OKButton"); - okayButton.LabelText = "OK"; - okayButton.SetKeyboardFocusable(true); - okayButton.Clicked += (obj, ee) => - { - _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN); - return true; - }; - return okayButton; - } - PushButton CreateCancelButton() - { - PushButton cancelButton = new PushButton(); - cancelButton.LabelText = "Cancel"; - cancelButton.SetKeyboardFocusable(true); - cancelButton.Clicked += (obj, ee) => - { - _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN); - return true; - }; - return cancelButton; - } + /// + /// The main entry point for the application. + /// - void OnProgressBarValueChanged( object source, ProgressBar.ValueChangedEventArgs e ) - { - Property.Map labelVisual = new Property.Map(); - labelVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text) ) - .Add( Dali.Constants.TextVisualProperty.Text, new Property.Value( Math.Round( e.ProgressBar.ProgressValue, 2 ) +" / "+Math.Round( e.ProgressBar.SecondaryProgressValue, 2 )) ); - e.ProgressBar.LabelVisual = labelVisual; - return; - } + [STAThread] + static void Main(string[] args) + { + Console.WriteLine("Hello Mono World"); - public void MainLoop() - { - _application.MainLoop(); + Example example = new Example(Application.NewApplication("json/control-dashboard.json")); + example.MainLoop(); + } } - - /// - /// The main entry point for the application. - /// - - [STAThread] - static void Main(string[] args) - { - Console.WriteLine("Hello Mono World"); - - Example example = new Example(Application.NewApplication("json/control-dashboard.json")); - example.MainLoop(); - } - } } + diff --git a/plugins/dali-swig/examples/dali-test.cs b/plugins/dali-swig/examples/dali-test.cs index a4a3a1e..f85a78a 100755 --- a/plugins/dali-swig/examples/dali-test.cs +++ b/plugins/dali-swig/examples/dali-test.cs @@ -39,7 +39,7 @@ namespace MyCSharpExample } set { - _myOwnName = value; + _myOwnName = value; } } } @@ -62,7 +62,7 @@ namespace MyCSharpExample } set { - _myOwnName = value; + _myOwnName = value; } } } @@ -85,190 +85,54 @@ namespace MyCSharpExample } set { - _myOwnName = value; + _myOwnName = value; } } } class Example { - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate void CallbackDelegate(IntPtr appPtr); // void, void delgate - private Dali.Application _application; public Example(Dali.Application application) { _application = application; - Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() ); + Console.WriteLine("1) InitSignal connection count = " + _application.InitSignal().GetConnectionCount()); _application.Initialized += Initialize; - Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() ); + Console.WriteLine("2) InitSignal connection count = " + _application.InitSignal().GetConnectionCount()); } public void Initialize(object source, NUIApplicationInitEventArgs e) { + //1) NavigationPropertiesTests(); + //2) OperatorTests(); + //3) CustomViewPropertyTest(); - Handle handle = new Handle(); - int myPropertyIndex = handle.RegisterProperty("myProperty", new Property.Value(10.0f), Property.AccessMode.READ_WRITE); - float myProperty = 0.0f; - 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); - handle.GetProperty(myPropertyIndex2).Get(myProperty2); - Console.WriteLine( "myProperty2 value: " + myProperty2.W + ", " + myProperty2.H ); - - Actor actor = new Actor(); - actor.Size = new Position(200.0f, 200.0f, 0.0f); - actor.Name = "MyActor"; - - Console.WriteLine("Actor id: {0}", actor.GetId()); - Console.WriteLine("Actor size: " + actor.Size.X + ", " + actor.Size.Y); - Console.WriteLine("Actor name: " + actor.Name); - - Stage stage = Stage.GetCurrent(); - stage.BackgroundColor = Color.White; - Size stageSize = stage.Size; - Console.WriteLine("Stage size: " + stageSize.W + ", " + stageSize.H); - stage.Add(actor); - - TextLabel text = new TextLabel("Hello Mono World"); - text.ParentOrigin = NDalic.ParentOriginCenter; - text.AnchorPoint = NDalic.AnchorPointCenter; - text.HorizontalAlignment = "CENTER"; - stage.Add(text); - - Console.WriteLine( "Text label text: " + text.Text ); - - Console.WriteLine( "Text label point size: " + text.PointSize ); - text.PointSize = 32.0f; - Console.WriteLine( "Text label new point size: " + text.PointSize ); + //4) + ActorHandleTest(); + //5) RectanglePaddingClassTest(); - Console.WriteLine( " *************************" ); - Size Size = new Size(100, 50); - 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( " *************************" ); - Position Position = new Position(20, 100, 50); - Console.WriteLine( " Created " + Position ); - Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z ); - Position += new Position(20, 20, 20); - Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z ); - Position.X += 10; - 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); - Console.WriteLine( " parentOrigin x = " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z ); - - Console.WriteLine( " *************************" ); - Color color = new Color(20, 100, 50, 200); - Console.WriteLine( " Created " + color ); - Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A ); - color += new Color(20, 20, 20, 20); - Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A ); - color.R += 10; - color.G += 10; - color.B += 10; - color.A += 10; - Console.WriteLine( " Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A ); + //6) + SizePositionTest(); + //7) ViewDownCastTest(); } - public void RectanglePaddingClassTest() - { - using (Rectangle r1 = new Rectangle(2, 5, 20, 30)) - { - Console.WriteLine( " Created " + r1 ); - Console.WriteLine( " IsEmpty() = " + r1.IsEmpty() ); - Console.WriteLine( " Left = " + r1.Left() ); - Console.WriteLine( " Right = " + r1.Right() ); - Console.WriteLine( " Top = " + r1.Top() ); - Console.WriteLine( " Bottom = " + r1.Bottom() ); - Console.WriteLine( " Area = " + r1.Area() ); - } - - Console.WriteLine( " *************************" ); - - using (Rectangle r2 = new Rectangle(2, 5, 20.0f, 30.0f)) - { - Console.WriteLine( " Created " + r2 ); - r2.Set(1,1,40,40); - Console.WriteLine( " IsEmpty() = " + r2.IsEmpty() ); - Console.WriteLine( " Left = " + r2.Left() ); - Console.WriteLine( " Right = " + r2.Right() ); - Console.WriteLine( " Top = " + r2.Top() ); - Console.WriteLine( " Bottom = " + r2.Bottom() ); - Console.WriteLine( " Area = " + r2.Area() ); - } - - Console.WriteLine( " *************************" ); - - Rectangle r3 = new Rectangle(10, 10, 20, 20); - Rectangle r4 = new Rectangle(10, 10, 20, 20); - - if (r3 == r4) - { - Console.WriteLine("r3 == r4"); - } - else - { - Console.WriteLine("r3 != r4"); - } - - r4 = new Rectangle(12, 10, 20, 20); - - if (r3 == r4) - { - Console.WriteLine("r3 == r4"); - } - else - { - Console.WriteLine("r3 != r4"); - } - - PaddingType p1 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f); - PaddingType p2 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f); - - if (p1 == p2) - { - Console.WriteLine("p1 == p2"); - } - else - { - Console.WriteLine("p1 != p2"); - } - - p2 = new PaddingType(12.0f, 10.7f, 20.2f, 20.0f); - - if (p1 == p2) - { - Console.WriteLine("p1 == p2"); - } - else - { - Console.WriteLine("p1 != p2"); - } - } public void NavigationPropertiesTests() { + Console.WriteLine(""); + Console.WriteLine("### [1] NavigationPropertiesTests START"); + View view = new View(); View leftView, rightView, upView, downView, tmpView; @@ -342,367 +206,558 @@ namespace MyCSharpExample { Console.WriteLine("Failed: LeftFocusedView = " + tmpView.Name); } + + Console.WriteLine("### [1] NavigationPropertiesTests END"); } public void OperatorTests() { + Console.WriteLine(""); + Console.WriteLine("### [2] OperatorTests START"); Actor actor = new Actor(); Actor differentActor = new Actor(); Actor actorSame = actor; Actor nullActor = null; // test the true operator - if ( actor ) + if (actor) { - Console.WriteLine ("BaseHandle Operator true (actor) : test passed "); + Console.WriteLine("BaseHandle Operator true (actor) : test passed "); } else { - Console.WriteLine ("BaseHandle Operator true (actor): test failed "); + Console.WriteLine("BaseHandle Operator true (actor): test failed "); } - Actor parent = actor.GetParent (); + Actor parent = actor.GetParent(); - if ( parent ) + if (parent) { - Console.WriteLine ("Handle with Empty body :failed "); + Console.WriteLine("Handle with Empty body :failed "); } else { - Console.WriteLine ("Valid with Empty body :passed "); + Console.WriteLine("Valid with Empty body :passed "); } - actor.Add( differentActor ); + actor.Add(differentActor); // here we test two different C# objects, which on the native side have the same body/ ref-object - if ( actor == differentActor.GetParent() ) + if (actor == differentActor.GetParent()) { - Console.WriteLine ("actor == differentActor.GetParent() :passed "); + Console.WriteLine("actor == differentActor.GetParent() :passed "); } else { - Console.WriteLine ("actor == differentActor.GetParent() :failed "); + Console.WriteLine("actor == differentActor.GetParent() :failed "); } - if ( differentActor == differentActor.GetParent() ) + if (differentActor == differentActor.GetParent()) { - Console.WriteLine ("differentActor == differentActor.GetParent() :failed "); + Console.WriteLine("differentActor == differentActor.GetParent() :failed "); } else { - Console.WriteLine ("differentActor == differentActor.GetParent() :passed "); + Console.WriteLine("differentActor == differentActor.GetParent() :passed "); } - if ( nullActor ) + if (nullActor) { - Console.WriteLine ("BaseHandle Operator true (nullActor) : test failed "); + Console.WriteLine("BaseHandle Operator true (nullActor) : test failed "); } else { - Console.WriteLine ("BaseHandle Operator true (nullActor): test passed "); + Console.WriteLine("BaseHandle Operator true (nullActor): test passed "); } // ! operator - if ( !actor ) + if (!actor) { - Console.WriteLine ("BaseHandle Operator !(actor) : test failed "); + Console.WriteLine("BaseHandle Operator !(actor) : test failed "); } else { - Console.WriteLine ("BaseHandle Operator !(actor): test passed "); + Console.WriteLine("BaseHandle Operator !(actor): test passed "); } - if ( !nullActor ) + if (!nullActor) { - Console.WriteLine ("BaseHandle Operator !(nullActor) : test passed "); + Console.WriteLine("BaseHandle Operator !(nullActor) : test passed "); } else { - Console.WriteLine ("BaseHandle Operator !(nullActor): test failed "); + Console.WriteLine("BaseHandle Operator !(nullActor): test failed "); } // Note: operator false only used inside & operator // test equality operator == - if ( actor == actorSame ) + if (actor == actorSame) { - Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test passed"); + Console.WriteLine("BaseHandle Operator (actor == actorSame) : test passed"); } else { - Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test failed"); + Console.WriteLine("BaseHandle Operator (actor == actorSame) : test failed"); } - if ( actor == differentActor ) + if (actor == differentActor) { - Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test failed"); + Console.WriteLine("BaseHandle Operator (actor == differentActor) : test failed"); } else { - Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test passed"); + Console.WriteLine("BaseHandle Operator (actor == differentActor) : test passed"); } - if ( actor == nullActor ) + if (actor == nullActor) { - Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test failed"); + Console.WriteLine("BaseHandle Operator (actor == nullActor) : test failed"); } else { - Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test passed"); + Console.WriteLine("BaseHandle Operator (actor == nullActor) : test passed"); } - if ( nullActor == nullActor ) + if (nullActor == nullActor) { - Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test passed"); + Console.WriteLine("BaseHandle Operator (nullActor == nullActor) : test passed"); } else { - Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test failed"); + Console.WriteLine("BaseHandle Operator (nullActor == nullActor) : test failed"); } // test || operator - if ( actor || actorSame ) + if (actor || actorSame) { - Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test passed"); + Console.WriteLine("BaseHandle Operator (actor || actorSame) : test passed"); } else { - Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test failed"); + Console.WriteLine("BaseHandle Operator (actor || actorSame) : test failed"); } - if ( actor || nullActor ) + if (actor || nullActor) { - Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test passed"); + Console.WriteLine("BaseHandle Operator (actor || nullActor) : test passed"); } else { - Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test failed"); + Console.WriteLine("BaseHandle Operator (actor || nullActor) : test failed"); } - if ( nullActor || nullActor ) + if (nullActor || nullActor) { - Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test failed"); + Console.WriteLine("BaseHandle Operator (nullActor || nullActor) : test failed"); } else { - Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test passed"); + Console.WriteLine("BaseHandle Operator (nullActor || nullActor) : test passed"); } // test && operator - if ( actor && actorSame ) + if (actor && actorSame) { - Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test passed"); + Console.WriteLine("BaseHandle Operator (actor && actorSame) : test passed"); } else { - Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test failed"); + Console.WriteLine("BaseHandle Operator (actor && actorSame) : test failed"); } - if ( actor && nullActor ) + if (actor && nullActor) { - Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test failed"); + Console.WriteLine("BaseHandle Operator (actor && nullActor) : test failed"); } else { - Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test passed"); + Console.WriteLine("BaseHandle Operator (actor && nullActor) : test passed"); } - if ( nullActor && nullActor ) + if (nullActor && nullActor) { - Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test failed"); + Console.WriteLine("BaseHandle Operator (nullActor && nullActor) : test failed"); } else { - Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test passed"); + Console.WriteLine("BaseHandle Operator (nullActor && nullActor) : test passed"); } + + Console.WriteLine("### [2] OperatorTests END"); + } public void CustomViewPropertyTest() { + Console.WriteLine(""); + Console.WriteLine("### [3] CustomViewPropertyTest START"); + // Create a Spin control Spin spin = new Spin(); // Background property Property.Map background = new Property.Map(); - background.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Color) ) - .Add( Dali.Constants.ColorVisualProperty.MixColor, new Property.Value(Color.Red) ); + background.Add(Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Color)) + .Add(Dali.Constants.ColorVisualProperty.MixColor, new Property.Value(Color.Red)); spin.Background = background; background = spin.Background; Vector4 backgroundColor = new Vector4(); background.Find(Dali.Constants.ColorVisualProperty.MixColor).Get(backgroundColor); - if( backgroundColor == Color.Red ) + if (backgroundColor == Color.Red) { - Console.WriteLine ("Custom View Background property : test passed"); + Console.WriteLine("Custom View Background property : test passed"); } else { - Console.WriteLine ("Custom View Background property : test failed"); + Console.WriteLine("Custom View Background property : test failed"); } // BackgroundColor property spin.BackgroundColor = Color.Yellow; - if(spin.BackgroundColor == Color.Yellow) + if (spin.BackgroundColor == Color.Yellow) { - Console.WriteLine ("Custom View BackgroundColor property : test passed"); + Console.WriteLine("Custom View BackgroundColor property : test passed"); } else { - Console.WriteLine ("Custom View BackgroundColor property : test failed"); + Console.WriteLine("Custom View BackgroundColor property : test failed"); } // BackgroundImage property spin.BackgroundImage = "background-image.jpg"; - if(spin.BackgroundImage == "background-image.jpg") + if (spin.BackgroundImage == "background-image.jpg") { - Console.WriteLine ("Custom View BackgroundImage property : test passed"); + Console.WriteLine("Custom View BackgroundImage property : test passed"); } else { - Console.WriteLine ("Custom View BackgroundImage property : test failed"); + Console.WriteLine("Custom View BackgroundImage property : test failed"); } // StyleName property spin.StyleName = "MyCustomStyle"; - if(spin.StyleName == "MyCustomStyle") + if (spin.StyleName == "MyCustomStyle") { - Console.WriteLine ("Custom View StyleName property : test passed"); + Console.WriteLine("Custom View StyleName property : test passed"); } else { - Console.WriteLine ("Custom View StyleName property : test failed"); + Console.WriteLine("Custom View StyleName property : test failed"); } + + Console.WriteLine("### [3] CustomViewPropertyTest END"); } - public void ViewDownCastTest() + + + public void ActorHandleTest() { - View container = new View(); - container.Position = new Position(-800.0f, -800.0f, 0.0f); - Stage.GetCurrent().Add(container); + Console.WriteLine(""); + Console.WriteLine("### [4] ActorHandleTest START"); + + Handle handle = new Handle(); + int myPropertyIndex = handle.RegisterProperty("myProperty", new Property.Value(10.0f), Property.AccessMode.READ_WRITE); + float myProperty = 0.0f; + 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); + handle.GetProperty(myPropertyIndex2).Get(myProperty2); + Console.WriteLine("myProperty2 value: " + myProperty2.W + ", " + myProperty2.H); + + Actor actor = new Actor(); + actor.Size = new Position(200.0f, 200.0f, 0.0f); + actor.Name = "MyActor"; + Console.WriteLine("Actor id: {0}", actor.GetId()); + Console.WriteLine("Actor size: " + actor.Size.X + ", " + actor.Size.Y); + Console.WriteLine("Actor name: " + actor.Name); + + Stage stage = Stage.GetCurrent(); + stage.BackgroundColor = Color.White; + Size stageSize = stage.Size; + Console.WriteLine("Stage size: " + stageSize.W + ", " + stageSize.H); + stage.Add(actor); - // Test downcast for native control - TextLabel myLabel = new TextLabel(); - myLabel.Name = "MyLabelName"; - myLabel.Text = "MyText"; + TextLabel text = new TextLabel("Hello World"); + text.ParentOrigin = NDalic.ParentOriginCenter; + text.AnchorPoint = NDalic.AnchorPointCenter; + text.HorizontalAlignment = "CENTER"; + stage.Add(text); + + Console.WriteLine("Text label text: " + text.Text); + + Console.WriteLine("Text label point size: " + text.PointSize); + text.PointSize = 32.0f; + Console.WriteLine("Text label new point size: " + text.PointSize); + + Console.WriteLine("### [4] ActorHandleTest END"); + + } - Console.WriteLine("myLabel.Name = " + myLabel.Name + ", Text = " + myLabel.Text); - container.Add(myLabel); - Actor myLabelActor = container.FindChildByName("MyLabelName"); - if(myLabelActor) - { - TextLabel newLabel = View.DownCast(myLabelActor); - if(newLabel) + public void RectanglePaddingClassTest() + { + Console.WriteLine(""); + Console.WriteLine("### [5] RectanglePaddingClassTest START"); + + using (Rectangle r1 = new Rectangle(2, 5, 20, 30)) { - Console.WriteLine("Downcast to TextLabel successful: newLabel Name = " + newLabel.Name + ", Text = " + newLabel.Text); + Console.WriteLine(" Created " + r1); + Console.WriteLine(" IsEmpty() = " + r1.IsEmpty()); + Console.WriteLine(" Left = " + r1.Left()); + Console.WriteLine(" Right = " + r1.Right()); + Console.WriteLine(" Top = " + r1.Top()); + Console.WriteLine(" Bottom = " + r1.Bottom()); + Console.WriteLine(" Area = " + r1.Area()); } - else + + Console.WriteLine(" *************************"); + + using (Rectangle r2 = new Rectangle(2, 5, 20, 30)) { - Console.WriteLine("Downcast to TextLabel failed!"); + Console.WriteLine(" Created " + r2); + r2.Set(1, 1, 40, 40); + Console.WriteLine(" IsEmpty() = " + r2.IsEmpty()); + Console.WriteLine(" Left = " + r2.Left()); + Console.WriteLine(" Right = " + r2.Right()); + Console.WriteLine(" Top = " + r2.Top()); + Console.WriteLine(" Bottom = " + r2.Bottom()); + Console.WriteLine(" Area = " + r2.Area()); } - } - // Test downcast for class directly inherited from View - MyView myView = new MyView(); - myView.Name = "MyViewName"; - myView.MyOwnName = "MyOwnViewName"; - myView._myCurrentValue = 5; + Console.WriteLine(" *************************"); - Console.WriteLine("myView.Name = " + myView.Name + ", MyOwnName = " + myView.MyOwnName + ", myCurrentValue = " + myView._myCurrentValue); + Rectangle r3 = new Rectangle(10, 10, 20, 20); + Rectangle r4 = new Rectangle(10, 10, 20, 20); - container.Add(myView); + if (r3 == r4) + { + Console.WriteLine("r3 == r4"); + } + else + { + Console.WriteLine("r3 != r4"); + } + + r4 = new Rectangle(12, 10, 20, 20); - Actor myViewActor = container.FindChildByName("MyViewName"); - if(myViewActor) - { - MyView newView = View.DownCast(myViewActor); - if(newView) + if (r3 == r4) { - Console.WriteLine("Downcast to MyView successful: newView Name = " + newView.Name + ", MyOwnName = " + newView.MyOwnName + ", myCurrentValue = " + newView._myCurrentValue); + Console.WriteLine("r3 == r4"); } else { - Console.WriteLine("Downcast to MyView failed!"); + Console.WriteLine("r3 != r4"); } - } - // Test downcast for class directly inherited from native control - MyButton myButton = new MyButton(); - myButton.Name = "MyButtonName"; - myButton.MyOwnName = "MyOwnViewName"; - myButton.LabelText = "MyLabelText"; - myButton._myCurrentValue = 5; + PaddingType p1 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f); + PaddingType p2 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f); - Console.WriteLine("myButton.Name = " + myButton.Name + ", MyOwnName = " + myButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + myButton._myCurrentValue); + if (p1 == p2) + { + Console.WriteLine("p1 == p2"); + } + else + { + Console.WriteLine("p1 != p2"); + } - container.Add(myButton); + p2 = new PaddingType(12.0f, 10.7f, 20.2f, 20.0f); - Actor myButtonActor = container.FindChildByName("MyButtonName"); - if(myButtonActor) - { - MyButton newButton = View.DownCast(myButtonActor); - if(newButton) + if (p1 == p2) { - Console.WriteLine("Downcast to MyButton successful: newButton Name = " + newButton.Name + ", MyOwnName = " + newButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + newButton._myCurrentValue); + Console.WriteLine("p1 == p2"); } else { - Console.WriteLine("Downcast to MyButton failed!"); + Console.WriteLine("p1 != p2"); + } + Console.WriteLine("### [5] RectanglePaddingClassTest END"); + + } + + + public void SizePositionTest() + { + Console.WriteLine(""); + Console.WriteLine("### [6] SizePositionTest START"); + + Size Size = new Size(100, 50); + 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(" *************************"); + Position Position = new Position(20, 100, 50); + Console.WriteLine(" Created " + Position); + Console.WriteLine(" Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z); + Position += new Position(20, 20, 20); + Console.WriteLine(" Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z); + Position.X += 10; + 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); + Console.WriteLine(" parentOrigin x = " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z); + + Console.WriteLine(" *************************"); + Color color = new Color(20, 100, 50, 200); + Console.WriteLine(" Created " + color); + Console.WriteLine(" Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A); + color += new Color(20, 20, 20, 20); + Console.WriteLine(" Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A); + color.R += 10; + color.G += 10; + color.B += 10; + color.A += 10; + Console.WriteLine(" Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A); + + Console.WriteLine("### [6] SizePositionTest END"); + } + + + public void ViewDownCastTest() + { + Console.WriteLine(""); + Console.WriteLine("### [7] ViewDownCastTest START"); + + View container = new View(); + container.Position = new Position(-800.0f, -800.0f, 0.0f); + Stage.GetCurrent().Add(container); + + // Test downcast for native control + TextLabel myLabel = new TextLabel(); + myLabel.Name = "MyLabelName"; + myLabel.Text = "MyText"; + + Console.WriteLine("myLabel.Name = " + myLabel.Name + ", Text = " + myLabel.Text); + + container.Add(myLabel); + + Actor myLabelActor = container.FindChildByName("MyLabelName"); + if (myLabelActor) + { + TextLabel newLabel = View.DownCast(myLabelActor); + if (newLabel) + { + Console.WriteLine("Downcast to TextLabel successful: newLabel Name = " + newLabel.Name + ", Text = " + newLabel.Text); + } + else + { + Console.WriteLine("Downcast to TextLabel failed!"); + } } - } - // Test downcast for a CustomView - Spin spin = new Spin(); - spin.Name = "SpinName"; - spin.MaxValue = 8888; + // Test downcast for class directly inherited from View + MyView myView = new MyView(); + myView.Name = "MyViewName"; + myView.MyOwnName = "MyOwnViewName"; + myView._myCurrentValue = 5; - Console.WriteLine("spin.Name = " + spin.Name + ", MaxValue = " + spin.MaxValue); + Console.WriteLine("myView.Name = " + myView.Name + ", MyOwnName = " + myView.MyOwnName + ", myCurrentValue = " + myView._myCurrentValue); - container.Add(spin); + container.Add(myView); - Actor spinActor = container.FindChildByName("SpinName"); - if(spinActor) - { - Spin newSpin = View.DownCast(spinActor); - if(newSpin) + Actor myViewActor = container.FindChildByName("MyViewName"); + if (myViewActor) { - Console.WriteLine("Downcast to Spin successful: newSpin Name = " + newSpin.Name + ", MaxValue = " + newSpin.MaxValue); + MyView newView = View.DownCast(myViewActor); + if (newView) + { + Console.WriteLine("Downcast to MyView successful: newView Name = " + newView.Name + ", MyOwnName = " + newView.MyOwnName + ", myCurrentValue = " + newView._myCurrentValue); + } + else + { + Console.WriteLine("Downcast to MyView failed!"); + } } - else + + // Test downcast for class directly inherited from native control + MyButton myButton = new MyButton(); + myButton.Name = "MyButtonName"; + myButton.MyOwnName = "MyOwnViewName"; + myButton.LabelText = "MyLabelText"; + myButton._myCurrentValue = 5; + + Console.WriteLine("myButton.Name = " + myButton.Name + ", MyOwnName = " + myButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + myButton._myCurrentValue); + + container.Add(myButton); + + Actor myButtonActor = container.FindChildByName("MyButtonName"); + if (myButtonActor) { - Console.WriteLine("Downcast to Spin failed!"); + MyButton newButton = View.DownCast(myButtonActor); + if (newButton) + { + Console.WriteLine("Downcast to MyButton successful: newButton Name = " + newButton.Name + ", MyOwnName = " + newButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + newButton._myCurrentValue); + } + else + { + Console.WriteLine("Downcast to MyButton failed!"); + } } - } - // Test downcast for class inherited from a CustomView - MySpin mySpin = new MySpin(); - mySpin.Name = "MySpinName"; - mySpin.MyOwnName = "MyOwnSpinName"; - mySpin.MaxValue = 8888; - mySpin._myCurrentValue = 5; + // Test downcast for a CustomView + Spin spin = new Spin(); + spin.Name = "SpinName"; + spin.MaxValue = 8888; - Console.WriteLine("mySpin.Name = " + mySpin.Name + ", MyOwnName = " + mySpin.MyOwnName + ", MaxValue = " + mySpin.MaxValue + ", currentValue = " + mySpin._myCurrentValue); + Console.WriteLine("spin.Name = " + spin.Name + ", MaxValue = " + spin.MaxValue); - container.Add(mySpin); + container.Add(spin); - Actor mySpinActor = container.FindChildByName("MySpinName"); - if(mySpinActor) - { - MySpin newSpin = View.DownCast(mySpinActor); - if(newSpin) + Actor spinActor = container.FindChildByName("SpinName"); + if (spinActor) { - Console.WriteLine("Downcast to MySpin successful: newSpin Name = " + newSpin.Name + ", MyOwnName = " + newSpin.MyOwnName + ", MaxValue = " + newSpin.MaxValue + ", currentValue = " + newSpin._myCurrentValue); + Spin newSpin = View.DownCast(spinActor); + if (newSpin) + { + Console.WriteLine("Downcast to Spin successful: newSpin Name = " + newSpin.Name + ", MaxValue = " + newSpin.MaxValue); + } + else + { + Console.WriteLine("Downcast to Spin failed!"); + } } - else + + // Test downcast for class inherited from a CustomView + MySpin mySpin = new MySpin(); + mySpin.Name = "MySpinName"; + mySpin.MyOwnName = "MyOwnSpinName"; + mySpin.MaxValue = 8888; + mySpin._myCurrentValue = 5; + + Console.WriteLine("mySpin.Name = " + mySpin.Name + ", MyOwnName = " + mySpin.MyOwnName + ", MaxValue = " + mySpin.MaxValue + ", currentValue = " + mySpin._myCurrentValue); + + container.Add(mySpin); + + Actor mySpinActor = container.FindChildByName("MySpinName"); + if (mySpinActor) { - Console.WriteLine("Downcast to MySpin failed!"); + MySpin newSpin = View.DownCast(mySpinActor); + if (newSpin) + { + Console.WriteLine("Downcast to MySpin successful: newSpin Name = " + newSpin.Name + ", MyOwnName = " + newSpin.MyOwnName + ", MaxValue = " + newSpin.MaxValue + ", currentValue = " + newSpin._myCurrentValue); + } + else + { + Console.WriteLine("Downcast to MySpin failed!"); + } } - } + + Console.WriteLine("### [7] ViewDownCastTest END"); } public void MainLoop() { - _application.MainLoop (); + _application.MainLoop(); } /// @@ -711,10 +766,12 @@ namespace MyCSharpExample [STAThread] static void Main(string[] args) { - Console.WriteLine ("Hello Mono World"); + Console.WriteLine("Hello World"); Example example = new Example(Application.NewApplication()); - example.MainLoop (); + example.MainLoop(); } } } + + diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs index d775fbe..8687aa0 100755 --- a/plugins/dali-swig/examples/hello-world.cs +++ b/plugins/dali-swig/examples/hello-world.cs @@ -22,114 +22,113 @@ using Dali.Constants; namespace MyCSharpExample { - class Example - { - private Dali.Application _application; - private Animation _animation; - private TextLabel _text; - - public Example(Dali.Application application) - { - _application = application; - _application.Initialized += Initialize; - } - - public void Initialize(object source, NUIApplicationInitEventArgs e) + class Example { - Console.WriteLine("Customized Application Initialize event handler"); - Stage stage = Stage.Instance; - stage.BackgroundColor = Color.White; - stage.Touch += OnStageTouched; - - // Add a _text label to the stage - _text = new TextLabel("Hello Mono World"); - _text.ParentOrigin = ParentOrigin.Center; - _text.AnchorPoint = AnchorPoint.Center; - _text.HorizontalAlignment = "CENTER"; - _text.PointSize = 32.0f; - _text.TextColor = Color.Magenta; - stage.Add(_text); + private Dali.Application _application; + private Animation _animation; + private TextLabel _text; + private Stage _stage; - } + public Example(Dali.Application application) + { + _application = application; + _application.Initialized += Initialize; + } - // Callback for _animation finished signal handling - public void AnimationFinished(object sender, EventArgs e) - { - Console.WriteLine("AnimationFinished()!"); - if(_animation) - { - Console.WriteLine("Duration= " + _animation.Duration); - Console.WriteLine("EndAction= " + _animation.EndAction); - } - } + public void Initialize(object source, NUIApplicationInitEventArgs e) + { + Console.WriteLine("Customized Application Initialize event handler"); + _stage = Stage.Instance; + _stage.BackgroundColor = Color.White; + _stage.Touch += OnStageTouched; + + // Add a _text label to the stage + _text = new TextLabel("Hello Mono World"); + _text.ParentOrigin = ParentOrigin.Center; + _text.AnchorPoint = AnchorPoint.Center; + _text.HorizontalAlignment = "CENTER"; + _text.PointSize = 32.0f; + _text.TextColor = Color.Magenta; + _stage.Add(_text); + + _animation = new Animation + { + StartTime = 0, + EndTime = 500, + TargetProperty = "Orientation", + Destination = new Rotation(new Radian(new Degree(180.0f)), Vect3.Xaxis) + }; + _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.AnimateTo(_text); + + _animation.StartTime = 1000; + _animation.EndTime = 1500; + _animation.TargetProperty = "ScaleX"; + _animation.Destination = 3.0f; + _animation.AnimateBy(_text); + + _animation.StartTime = 1500; + _animation.EndTime = 2000; + _animation.TargetProperty = "ScaleY"; + _animation.Destination = 4.0f; + _animation.AnimateBy(_text); + + _animation.EndAction = Animation.EndActions.Discard; + + // Connect the signal callback for animaiton finished signal + _animation.Finished += AnimationFinished; + } - // Callback for stage touched signal handling - public void OnStageTouched(object sender, Stage.TouchEventArgs e) - { - // Only animate the _text label when touch down happens - if( e.Touch.GetState(0) == PointStateType.DOWN ) - { - Console.WriteLine("Customized Stage Touch event handler"); - // Create a new _animation - if( _animation ) + // Callback for _animation finished signal handling + public void AnimationFinished(object sender, EventArgs e) { - //_animation.Stop(Dali.Constants.Animation.EndAction.Stop); - _animation.Reset(); + Console.WriteLine("AnimationFinished()!"); + if (_animation) + { + Console.WriteLine("Duration= " + _animation.Duration); + Console.WriteLine("EndAction= " + _animation.EndAction); + } } - _animation = new Animation { - Duration = 2000, - StartTime = 0, - EndTime = 500, - TargetProperty = "Orientation", - Destination = new Rotation( new Radian( new Degree( 180.0f ) ), Vect3.Xaxis) - }; - _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.AnimateTo(_text); - - _animation.StartTime = 1000; - _animation.EndTime = 1500; - _animation.TargetProperty = "ScaleX"; - _animation.Destination = 3.0f; - _animation.AnimateBy(_text); - - _animation.StartTime = 1500; - _animation.EndTime = 2000; - _animation.TargetProperty = "ScaleY"; - _animation.Destination = 4.0f; - _animation.AnimateBy(_text); - - _animation.EndAction = Animation.EndActions.Discard; - - // Connect the signal callback for animaiton finished signal - _animation.Finished += AnimationFinished; - - // Play the _animation - _animation.Play(); - - } - } + // Callback for stage touched signal handling + public void OnStageTouched(object sender, Stage.TouchEventArgs e) + { + // Only animate the _text label when touch down happens + if (e.Touch.GetState(0) == PointStateType.DOWN) + { + Console.WriteLine("Customized Stage Touch event handler"); + + // Create a new _animation + if (_animation) + { + _animation.Stop(); + } + // Play the _animation + _animation.Play(); + } + } - public void MainLoop() - { - _application.MainLoop (); - } + public void MainLoop() + { + _application.MainLoop(); + } - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - Console.WriteLine ("Main() called!"); + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + Console.WriteLine("Main() called!"); - Example example = new Example(Application.NewApplication()); - example.MainLoop (); + Example example = new Example(Application.NewApplication()); + example.MainLoop(); + } } - } } + diff --git a/plugins/dali-swig/examples/image-view.cs b/plugins/dali-swig/examples/image-view.cs index 7cd5359..b8215ef 100755 --- a/plugins/dali-swig/examples/image-view.cs +++ b/plugins/dali-swig/examples/image-view.cs @@ -1,5 +1,4 @@ -/* -* Copyright (c) 2016 Samsung Electronics Co., Ltd. +/** 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. @@ -23,217 +22,218 @@ using Dali.Constants; namespace ImageViewExample { - class Example - { - public static void Log(string str) + class Example { - Console.WriteLine("[DALI C# SAMPLE] " + str); - } + public static void Log(string str) + { + Console.WriteLine("[DALI C# SAMPLE] " + str); + } - private Dali.Application _application; - private Animation _animation; - private ImageView _imageView; - private bool _isAniFinised = true; - private Layer layer, _layer1, _layer2; - private PushButton _pushButton1, _pushButton2; - private Stage stage; + private Dali.Application _application; + private Animation _animation; + private ImageView _imageView; + private bool _isAniFinised = true; + private Layer layer, _layer1, _layer2; + private PushButton _pushButton1, _pushButton2; + private Stage stage; - public Example(Dali.Application application) - { - _application = application; - _application.Initialized += Initialize; - } - - public void Initialize(object source, NUIApplicationInitEventArgs e) - { - Log("Customized Application Initialize event handler"); - stage = Stage.Instance; - stage.BackgroundColor = Color.Cyan; - stage.Touch += OnStageTouched; - stage.Wheel += OnStageWheelMoved; - stage.Key += OnStageKeyPressed; - //stage.EventProcessingFinished += OnStageEventProcessingFinished; - - layer = stage.GetDefaultLayer(); - _layer1 = new Layer(); - _layer2 = new Layer(); - stage.AddLayer(_layer1); - stage.AddLayer(_layer2); - Log("_layer1.Behavior =" + _layer1.Behavior ); - if( _layer1.Behavior == Layer.LayerBehavior.LAYER_UI ) - { - _layer1.Behavior = Layer.LayerBehavior.LAYER_2D; - Log("again _layer1.Behavior =" + _layer1.Behavior ); - } - // Add a ImageView to the stage - _imageView = new ImageView(); - _imageView.ResourceUrl = "./images/gallery-3.jpg"; - _imageView.ParentOrigin = ParentOrigin.Center; - _imageView.AnchorPoint = AnchorPoint.Center; - _imageView.PixelArea = new Vector4(0.0f, 0.0f, 0.5f, 0.5f); - //_imageView.SetResizePolicy(ResizePolicyType.USE_NATURAL_SIZE, DimensionType.ALL_DIMENSIONS); - layer.Add(_imageView); - - _pushButton1 = new PushButton(); - _pushButton1.ParentOrigin = ParentOrigin.BottomLeft; - _pushButton1.AnchorPoint = AnchorPoint.BottomLeft; - _pushButton1.LabelText = "start animation"; - _pushButton1.Position = new Vector3(0.0f, stage.Size.Height * 0.1f, 0.0f); - _pushButton1.Clicked += OnPushButtonClicked1; - _layer1.Add(_pushButton1); - - _pushButton2 = new PushButton(); - _pushButton2.ParentOrigin = ParentOrigin.BottomLeft; - _pushButton2.AnchorPoint = AnchorPoint.BottomLeft; - _pushButton2.LabelText = "reload image with same URL"; - _pushButton2.Position = new Vector3(0.0f, stage.Size.Height * 0.2f, 0.0f); - _pushButton2.Clicked += OnPushButtonClicked2; - _layer2.Add(_pushButton2); + public Example(Dali.Application application) + { + _application = application; + _application.Initialized += Initialize; + } - } + public void Initialize(object source, NUIApplicationInitEventArgs e) + { + Log("Customized Application Initialize event handler"); + stage = Stage.Instance; + stage.BackgroundColor = Color.Cyan; + stage.Touch += OnStageTouched; + stage.Wheel += OnStageWheelMoved; + stage.Key += OnStageKeyPressed; + //stage.EventProcessingFinished += OnStageEventProcessingFinished; + + layer = stage.GetDefaultLayer(); + _layer1 = new Layer(); + _layer2 = new Layer(); + stage.AddLayer(_layer1); + stage.AddLayer(_layer2); + Log("_layer1.Behavior =" + _layer1.Behavior); + if (_layer1.Behavior == Layer.LayerBehavior.LAYER_UI) + { + _layer1.Behavior = Layer.LayerBehavior.LAYER_2D; + Log("again _layer1.Behavior =" + _layer1.Behavior); + } + // Add a ImageView to the stage + _imageView = new ImageView(); + _imageView.ResourceUrl = "./images/gallery-3.jpg"; + _imageView.ParentOrigin = ParentOrigin.Center; + _imageView.AnchorPoint = AnchorPoint.Center; + _imageView.PixelArea = new Vector4(0.0f, 0.0f, 0.5f, 0.5f); + //_imageView.SetResizePolicy(ResizePolicyType.USE_NATURAL_SIZE, DimensionType.ALL_DIMENSIONS); + layer.Add(_imageView); + + _pushButton1 = new PushButton(); + _pushButton1.ParentOrigin = ParentOrigin.BottomLeft; + _pushButton1.AnchorPoint = AnchorPoint.BottomLeft; + _pushButton1.LabelText = "start animation"; + _pushButton1.Position = new Vector3(0.0f, stage.Size.Height * 0.1f, 0.0f); + _pushButton1.Clicked += OnPushButtonClicked1; + _layer1.Add(_pushButton1); + + _pushButton2 = new PushButton(); + _pushButton2.ParentOrigin = ParentOrigin.BottomLeft; + _pushButton2.AnchorPoint = AnchorPoint.BottomLeft; + _pushButton2.LabelText = "reload image with same URL"; + _pushButton2.Position = new Vector3(0.0f, stage.Size.Height * 0.2f, 0.0f); + _pushButton2.Clicked += OnPushButtonClicked2; + _layer2.Add(_pushButton2); - public bool OnPushButtonClicked2(object sender, Button.ClickedEventArgs e) - { - if( _imageView ) - { - Log("OnPushButtonClicked2()!"); - layer.Remove(_imageView); - _imageView = new ImageView(); - _imageView.ResourceUrl = "./images/gallery-3.jpg"; - _imageView.ParentOrigin = ParentOrigin.Center; - _imageView.AnchorPoint = AnchorPoint.Center; - _imageView.PixelArea = new Vector4(0.0f, 0.0f, 0.5f, 0.5f); - //_imageView.SetResizePolicy(ResizePolicyType.USE_NATURAL_SIZE, DimensionType.ALL_DIMENSIONS); - layer.Add(_imageView); - } - - return true; - } + } + public bool OnPushButtonClicked2(object sender, Button.ClickedEventArgs e) + { + if (_imageView) + { + Log("OnPushButtonClicked2()!"); + layer.Remove(_imageView); + _imageView = new ImageView(); + _imageView.ResourceUrl = "./images/gallery-3.jpg"; + _imageView.ParentOrigin = ParentOrigin.Center; + _imageView.AnchorPoint = AnchorPoint.Center; + _imageView.PixelArea = new Vector4(0.0f, 0.0f, 0.5f, 0.5f); + //_imageView.SetResizePolicy(ResizePolicyType.USE_NATURAL_SIZE, DimensionType.ALL_DIMENSIONS); + layer.Add(_imageView); + } + + return true; + } - public bool OnPushButtonClicked1(object sender, Button.ClickedEventArgs e) - { - if( _isAniFinised == true ) - { - _isAniFinised = false; - Log("OnPushButtonClicked1()!"); - // Create a new _animation - if( _animation ) + public bool OnPushButtonClicked1(object sender, Button.ClickedEventArgs e) { - //_animation.Stop(Dali.Constants.Animation.EndAction.Stop); - _animation.Reset(); + if (_isAniFinised == true) + { + _isAniFinised = false; + Log("OnPushButtonClicked1()!"); + + // Create a new _animation + if (_animation) + { + //_animation.Stop(Dali.Constants.Animation.EndAction.Stop); + _animation.Reset(); + } + + _animation = new Animation(); + _animation.StartTime = 0; + _animation.EndTime = 1000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.5f, 0.0f, 0.5f, 0.5f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 1000; + _animation.EndTime = 2000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.5f, 0.5f, 0.5f, 0.5f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 2000; + _animation.EndTime = 3000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 3000; + _animation.EndTime = 4000; + _animation.TargetProperty = "PixelArea"; + _animation.Destination = new Vector4(0.5f, 0.5f, 0.5f, 0.5f); + _animation.AnimateTo(_imageView); + + _animation.StartTime = 4000; + _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)); + _animation.AnimateBetween(_imageView, _keyFrames, Animation.Interpolation.Linear); + + _animation.EndAction = Animation.EndActions.Discard; + + // Connect the signal callback for animaiton finished signal + _animation.Finished += AnimationFinished; + _animation.Finished += AnimationFinished2; + + // Play the _animation + _animation.Play(); + } + + return true; } - _animation = new Animation(); - _animation.StartTime = 0; - _animation.EndTime = 1000; - _animation.TargetProperty = "PixelArea"; - _animation.Destination = new Vector4(0.5f, 0.0f, 0.5f, 0.5f); - _animation.AnimateTo(_imageView); - - _animation.StartTime = 1000; - _animation.EndTime = 2000; - _animation.TargetProperty = "PixelArea"; - _animation.Destination = new Vector4(0.5f, 0.5f, 0.5f, 0.5f); - _animation.AnimateTo(_imageView); - - _animation.StartTime = 2000; - _animation.EndTime = 3000; - _animation.TargetProperty = "PixelArea"; - _animation.Destination = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); - _animation.AnimateTo(_imageView); - - _animation.StartTime = 3000; - _animation.EndTime = 4000; - _animation.TargetProperty = "PixelArea"; - _animation.Destination = new Vector4(0.5f, 0.5f, 0.5f, 0.5f); - _animation.AnimateTo(_imageView); - - _animation.StartTime = 4000; - _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 ) ); - _animation.AnimateBetween(_imageView, _keyFrames, Animation.Interpolation.Linear); - - _animation.EndAction = Animation.EndActions.Discard; - - // Connect the signal callback for animaiton finished signal - _animation.Finished += AnimationFinished; - _animation.Finished += AnimationFinished2; - - // Play the _animation - _animation.Play(); - } - - return true; - } - - // Callback for _animation finished signal handling - public void AnimationFinished(object sender, EventArgs e) - { - Log("AnimationFinished()!"); - } + // Callback for _animation finished signal handling + public void AnimationFinished(object sender, EventArgs e) + { + Log("AnimationFinished()!"); + } - // Callback for second _animation finished signal handling - public void AnimationFinished2(object sender, EventArgs e) - { - Log("AnimationFinished2()!"); - if(_animation) - { - Log("Duration= " + _animation.Duration); - Log("EndAction= " + _animation.EndAction); - _isAniFinised = true; - } - } + // Callback for second _animation finished signal handling + public void AnimationFinished2(object sender, EventArgs e) + { + Log("AnimationFinished2()!"); + if (_animation) + { + Log("Duration= " + _animation.Duration); + Log("EndAction= " + _animation.EndAction); + _isAniFinised = true; + } + } - public void OnStageEventProcessingFinished(object sender, EventArgs e) - { - Log("OnStageEventProcessingFinished()!"); - if( e != null) - { - Log("e != null !"); - } - } + public void OnStageEventProcessingFinished(object sender, EventArgs e) + { + Log("OnStageEventProcessingFinished()!"); + if (e != null) + { + Log("e != null !"); + } + } - public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e) - { - Log("OnStageKeyEventOccured()!"); - Log("keyPressedName=" + e.Key.KeyPressedName); - Log("state=" + e.Key.State); - } + public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e) + { + Log("OnStageKeyEventOccured()!"); + Log("keyPressedName=" + e.Key.KeyPressedName); + Log("state=" + e.Key.State); + } - public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e) - { - Log("OnStageWheelEventOccured()!"); - Log("direction=" + e.Wheel.Direction); - Log("type=" + e.Wheel.Type); - } + public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e) + { + Log("OnStageWheelEventOccured()!"); + Log("direction=" + e.Wheel.Direction); + Log("type=" + e.Wheel.Type); + } - // Callback for stage touched signal handling - public void OnStageTouched(object sender, Stage.TouchEventArgs e) - { - Log("OnStageTouched()! e.TouchData.GetState(0)=" + e.Touch.GetState(0)); - } + // Callback for stage touched signal handling + public void OnStageTouched(object sender, Stage.TouchEventArgs e) + { + Log("OnStageTouched()! e.TouchData.GetState(0)=" + e.Touch.GetState(0)); + } - public void MainLoop() - { - _application.MainLoop (); - } + public void MainLoop() + { + _application.MainLoop(); + } - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - Log("Main() called!"); + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + Log("Main() called!"); - Example example = new Example(Application.NewApplication()); - example.MainLoop (); + Example example = new Example(Application.NewApplication()); + example.MainLoop(); + } } - } } + diff --git a/plugins/dali-swig/examples/scroll-view.cs b/plugins/dali-swig/examples/scroll-view.cs index cc42168..c4cf845 100755 --- a/plugins/dali-swig/examples/scroll-view.cs +++ b/plugins/dali-swig/examples/scroll-view.cs @@ -56,8 +56,8 @@ namespace MyCSharpExample _scrollView = new ScrollView(); Size stageSize = stage.Size; _scrollView.Size = new Position(stageSize.W, stageSize.H, 0.0f); - _scrollView.ParentOrigin = NDalic.ParentOriginCenter; - _scrollView.AnchorPoint = NDalic.AnchorPointCenter; + _scrollView.Position = new Position(0,0,0); + _scrollView.AnchorPoint = NDalic.AnchorPointTopLeft; stage.Add(_scrollView); // Add actors to a scroll view with 3 pages @@ -69,8 +69,7 @@ namespace MyCSharpExample { View pageActor = new View(); pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS); - pageActor.ParentOrigin = NDalic.ParentOriginCenter; - pageActor.AnchorPoint = NDalic.AnchorPointCenter; + pageActor.AnchorPoint = NDalic.AnchorPointTopLeft; pageActor.Position = new Position(pageColumn * stageSize.W, pageRow * stageSize.H, 0.0f); // Add images in a 3x4 grid layout for each page @@ -125,8 +124,7 @@ namespace MyCSharpExample _scrollView.WheelMoved += Onwheel; _scrollView.KeyInputFocusGained += OnKey; _text = new TextLabel("View Touch Event Handler Test"); - _text.ParentOrigin = NDalic.ParentOriginCenter; - _text.AnchorPoint = NDalic.AnchorPointCenter; + _text.AnchorPoint = NDalic.AnchorPointTopLeft; _text.HorizontalAlignment = "CENTER"; _text.PointSize = 48.0f; diff --git a/plugins/dali-swig/examples/user-alphafunction.cs b/plugins/dali-swig/examples/user-alphafunction.cs index 5b521b0..40415f9 100755 --- a/plugins/dali-swig/examples/user-alphafunction.cs +++ b/plugins/dali-swig/examples/user-alphafunction.cs @@ -1,5 +1,4 @@ -/* -* Copyright (c) 2016 Samsung Electronics Co., Ltd. +/** 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. @@ -22,176 +21,175 @@ using Dali.Constants; namespace MyCSharpExample { - class Example - { - private Dali.Application _application; - private Animation _animation; - private TextLabel _text; - private View _view1, _view2, _view3; - private UserAlphaFunctionDelegate _user_alpha_func; - private int myCount; - - public static void Log(string str) + class Example { - Console.WriteLine("[DALI C# SAMPLE] " + str); - } + private Dali.Application _application; + private Animation _animation; + private TextLabel _text; + private View _view1, _view2, _view3; + private UserAlphaFunctionDelegate _user_alpha_func; + private int myCount; + + public static void Log(string str) + { + Console.WriteLine("[DALI C# SAMPLE] " + str); + } - public Example(Dali.Application application) - { - _application = application; - _application.Initialized += Initialize; - } + public Example(Dali.Application application) + { + _application = application; + _application.Initialized += Initialize; + } - // Declare user alpha function delegate - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate float UserAlphaFunctionDelegate(float progress); + // Declare user alpha function delegate + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + delegate float UserAlphaFunctionDelegate(float progress); - public void Initialize(object source, NUIApplicationInitEventArgs e) - { - Log("Initialize() is called!"); - Stage stage = Stage.GetCurrent(); - stage.BackgroundColor = Color.White; - stage.Touch += OnStageTouched; - stage.Touch += OnStageTouched2; - //stage.EventProcessingFinished += OnEventProcessingFinished; - stage.Wheel += OnStageWheelEvent; - - // Add a _text label to the stage - _text = new TextLabel("Hello Mono World"); - _text.ParentOrigin = ParentOrigin.BottomCenter; - _text.AnchorPoint = AnchorPoint.BottomCenter; - _text.HorizontalAlignment = "CENTER"; - _text.PointSize = 32.0f; - stage.Add(_text); - - _view1 = new View(); - _view1.Size = new Vector3(200.0f, 200.0f, 0.0f); - _view1.BackgroundColor = Color.Green; - _view1.ParentOrigin = ParentOrigin.Center; - _view1.AnchorPoint = AnchorPoint.Center; - _view1.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); - _view1.OnStageEvent += OnStage; - stage.Add(_view1); - - _view2 = new View(); - _view2.BackgroundColor = Color.Red; - _view2.Size = new Vector3(50.0f, 50.0f, 0.0f); - _view2.ParentOrigin = ParentOrigin.TopLeft; - _view2.AnchorPoint = AnchorPoint.TopLeft; - _view2.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); - _view1.Add(_view2); - - _view3 = new View(); - _view3.BackgroundColor = Color.Blue; - _view3.Size = new Vector3(50.0f, 50.0f, 0.0f); - _view3.ParentOrigin = ParentOrigin.TopLeft; - _view3.AnchorPoint = AnchorPoint.TopLeft; - _view3.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); - _view1.Add(_view3); - - _user_alpha_func = new UserAlphaFunctionDelegate(body); - - MyAnimating(); - } + public void Initialize(object source, NUIApplicationInitEventArgs e) + { + Log("Initialize() is called!"); + Stage stage = Stage.GetCurrent(); + stage.BackgroundColor = Color.White; + stage.Touch += OnStageTouched; + stage.Touch += OnStageTouched2; + stage.Wheel += OnStageWheelEvent; + + // Add a _text label to the stage + _text = new TextLabel("Hello Mono World"); + _text.ParentOrigin = ParentOrigin.BottomCenter; + _text.AnchorPoint = AnchorPoint.BottomCenter; + _text.HorizontalAlignment = "CENTER"; + _text.PointSize = 32.0f; + stage.Add(_text); + + _view1 = new View(); + _view1.Size = new Vector3(200.0f, 200.0f, 0.0f); + _view1.BackgroundColor = Color.Green; + _view1.ParentOrigin = ParentOrigin.Center; + _view1.AnchorPoint = AnchorPoint.Center; + _view1.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); + _view1.OnStageEvent += OnStage; + stage.Add(_view1); + + _view2 = new View(); + _view2.BackgroundColor = Color.Red; + _view2.Size = new Vector3(50.0f, 50.0f, 0.0f); + _view2.ParentOrigin = ParentOrigin.TopLeft; + _view2.AnchorPoint = AnchorPoint.TopLeft; + _view2.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); + _view1.Add(_view2); + + _view3 = new View(); + _view3.BackgroundColor = Color.Blue; + _view3.Size = new Vector3(50.0f, 50.0f, 0.0f); + _view3.ParentOrigin = ParentOrigin.TopLeft; + _view3.AnchorPoint = AnchorPoint.TopLeft; + _view3.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.ALL_DIMENSIONS); + _view1.Add(_view3); + + _user_alpha_func = new UserAlphaFunctionDelegate(body); + + MyAnimating(); + } - // User defines alpha function as custom alpha function - // Important Notification : when this custom alpha-function is implemented, - // the other function call nor other data excess is prevented. - // this method must be implemented to calculate the values of input and output purely. - // unless, this will cause application crash. - float body(float progress) - { - if (progress > 0.2f && progress< 0.7f) - { - return progress + 0.8f; - } - return progress; - } + // User defines alpha function as custom alpha function + // Important Notification : when this custom alpha-function is implemented, + // the other function call nor other data excess is prevented. + // this method must be implemented to calculate the values of input and output purely. + // unless, this will cause application crash. + float body(float progress) + { + if (progress > 0.2f && progress < 0.7f) + { + return progress + 0.8f; + } + return progress; + } - // Callback for _animation finished signal handling - public void AnimationFinished(object sender, EventArgs e) - { - Log("AnimationFinished() is called!"); - myCount = 0; - } + // Callback for _animation finished signal handling + public void AnimationFinished(object sender, EventArgs e) + { + Log("AnimationFinished() is called!"); + myCount = 0; + } - public void MyAnimating() - { - // Create a new _animation - if( _animation ) - { - _animation.Clear(); - _animation.Reset(); - } - - _animation = new Animation(10000); // 10000 milli-second of duration - _animation.StartTime = 5000; - _animation.EndTime = 10000; - _animation.TargetProperty = "Position"; - _animation.AlphaFunction = new AlphaFunction(_user_alpha_func); - _animation.Destination = new Vector3(150.0f, 150.0f, 0.0f); - _animation.AnimateTo(_view2); - // Connect the signal callback for animaiton finished signal - _animation.Finished += AnimationFinished; - _animation.EndAction = Animation.EndActions.Discard; - // Play the _animation - _animation.Play(); - } + public void MyAnimating() + { + // Create a new _animation + if (_animation) + { + _animation.Clear(); + _animation.Reset(); + } + + _animation = new Animation(10000); // 10000 milli-second of duration + _animation.StartTime = 5000; + _animation.EndTime = 10000; + _animation.TargetProperty = "Position"; + _animation.AlphaFunction = new AlphaFunction(_user_alpha_func); + _animation.Destination = new Vector3(150.0f, 150.0f, 0.0f); + _animation.AnimateTo(_view2); + // Connect the signal callback for animaiton finished signal + _animation.Finished += AnimationFinished; + _animation.EndAction = Animation.EndActions.Discard; + // Play the _animation + _animation.Play(); + } - // Callback for stage touched signal handling - public void OnStageTouched(object source, Stage.TouchEventArgs e) - { - // Only animate the _text label when touch down happens - if( e.Touch.GetState(0) == PointStateType.DOWN ) - { - Log("OnStageTouched() is called! PointStateType.DOWN came!"); - myCount++; - if( myCount > 1 ) + // Callback for stage touched signal handling + public void OnStageTouched(object source, Stage.TouchEventArgs e) { - _animation.Stop(); - Log("_animation.Stop() is called!"); + // Only animate the _text label when touch down happens + if (e.Touch.GetState(0) == PointStateType.DOWN) + { + Log("OnStageTouched() is called! PointStateType.DOWN came!"); + myCount++; + if (myCount > 1) + { + _animation.Stop(); + Log("_animation.Stop() is called!"); + } + } } - } - } - // Callback for stage touched signal handling - public void OnStageTouched2(object source, Stage.TouchEventArgs e) - { - Log("OnStageTouched2() is called!state="+ e.Touch.GetState(0) ); - } + // Callback for stage touched signal handling + public void OnStageTouched2(object source, Stage.TouchEventArgs e) + { + Log("OnStageTouched2() is called!state=" + e.Touch.GetState(0)); + } - public void OnEventProcessingFinished(object source) - { - Log("OnEventProcessingFinished() is called!"); - } + public void OnEventProcessingFinished(object source) + { + Log("OnEventProcessingFinished() is called!"); + } - public void OnStageWheelEvent(object source, Stage.WheelEventArgs e) - { - Log("OnStageWheelEvent() is called!"); - //Log("OnStageWheelEvent() is called!direction="+ e.WheelEvent.direction + " timeStamp=" + e.WheelEvent.timeStamp ); - } + public void OnStageWheelEvent(object source, Stage.WheelEventArgs e) + { + Log("OnStageWheelEvent() is called!"); + } - public void OnStage(object source , View.OnStageEventArgs e) - { - Log("OnStage() is called!"); - } + public void OnStage(object source, View.OnStageEventArgs e) + { + Log("OnStage() is called!"); + } - public void MainLoop() - { - _application.MainLoop (); - } + public void MainLoop() + { + _application.MainLoop(); + } - [STAThread] - static void Main(string[] args) - { - Log("Main() is called!"); + [STAThread] + static void Main(string[] args) + { + Log("Main() is called!"); - Example example = new Example(Application.NewApplication()); - example.MainLoop (); + Example example = new Example(Application.NewApplication()); + example.MainLoop(); - Log("After MainLoop()"); + Log("After MainLoop()"); + } } - } } + diff --git a/plugins/dali-swig/manual/csharp/View.cs b/plugins/dali-swig/manual/csharp/View.cs old mode 100644 new mode 100755 diff --git a/plugins/dali-swig/manual/csharp/ViewWrapper.cs b/plugins/dali-swig/manual/csharp/ViewWrapper.cs old mode 100644 new mode 100755 index f0660b1..bcc54ec --- a/plugins/dali-swig/manual/csharp/ViewWrapper.cs +++ b/plugins/dali-swig/manual/csharp/ViewWrapper.cs @@ -1,19 +1,18 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ +/** Copyright (c) 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 { @@ -34,12 +33,18 @@ namespace Dali ~ViewWrapper() { - Dispose(); + DisposeQueue.Instance.Add(this); } public override void Dispose() { - lock(this) + if (!Stage.IsInstalled()) + { + DisposeQueue.Instance.Add(this); + return; + } + + lock (this) { if (swigCPtr.Handle != global::System.IntPtr.Zero) { @@ -55,7 +60,8 @@ namespace Dali } } - public ViewWrapper (string typeName, ViewWrapperImpl implementation) : this (NDalicManualPINVOKE.ViewWrapper_New(typeName, ViewWrapperImpl.getCPtr(implementation)), true) + + public ViewWrapper(string typeName, ViewWrapperImpl implementation) : this(NDalicManualPINVOKE.ViewWrapper_New(typeName, ViewWrapperImpl.getCPtr(implementation)), true) { viewWrapperImpl = implementation; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -81,3 +87,4 @@ namespace Dali } } } + diff --git a/plugins/dali-swig/views/spin.cs b/plugins/dali-swig/views/spin.cs old mode 100644 new mode 100755 index f4d6aec..b1e7e97 --- a/plugins/dali-swig/views/spin.cs +++ b/plugins/dali-swig/views/spin.cs @@ -1,19 +1,18 @@ -/* - * 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. - * - */ +/** 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. +* +*/ using System; using System.Runtime.InteropServices; @@ -23,292 +22,293 @@ using Dali; namespace Dali { -public class Spin : CustomView - { - private VisualBase _arrowVisual; - private TextField _textField; - private int _arrowVisualPropertyIndex; - private string _arrowImage; - private int _currentValue; - private int _minValue; - private int _maxValue; - private int _singleStep; - private bool _wrappingEnabled; - private string _fontFamily; - private string _fontStyle; - private int _pointSize; - private Color _textColor; - private Color _textBackgroundColor; - private int _maxTextLength; - - // Called by DALi Builder if it finds a Spin control in a JSON file - static CustomView CreateInstance() + public class Spin : CustomView { - return new Spin(); - } - - // static constructor registers the control type (only runs once) - static Spin() - { - // ViewRegistry registers control type with DALi type registery - // also uses introspection to find any properties that need to be registered with type registry - ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) ); - } + private VisualBase _arrowVisual; + private TextField _textField; + private int _arrowVisualPropertyIndex; + private string _arrowImage; + private int _currentValue; + private int _minValue; + private int _maxValue; + private int _singleStep; + private bool _wrappingEnabled; + private string _fontFamily; + private string _fontStyle; + private int _pointSize; + private Color _textColor; + private Color _textBackgroundColor; + private int _maxTextLength; + + // Called by DALi Builder if it finds a Spin control in a JSON file + static CustomView CreateInstance() + { + return new Spin(); + } - public Spin() : base(typeof(Spin).Name, ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT) - { + // static constructor registers the control type (only runs once) + static Spin() + { + // ViewRegistry registers control type with DALi type registery + // also uses introspection to find any properties that need to be registered with type registry + ViewRegistry.Instance.Register(CreateInstance, typeof(Spin)); + } - } + public Spin() : base(typeof(Spin).Name, ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT) + { - public override void OnInitialize() - { - // Initialize the propertiesControl - _arrowImage = "./images/arrow.png"; - _textBackgroundColor = new Color(0.6f, 0.6f, 0.6f, 1.0f); - _currentValue = 0; - _minValue = 0; - _maxValue = 0; - _singleStep = 1; - _maxTextLength = 0; - - // Create image visual for the arrow keys - _arrowVisualPropertyIndex = RegisterProperty("ArrowImage", new Dali.Property.Value(_arrowImage), Dali.Property.AccessMode.READ_WRITE); - _arrowVisual = VisualFactory.Get().CreateVisual( _arrowImage, new Uint16Pair(150, 150) ); - RegisterVisual( _arrowVisualPropertyIndex, _arrowVisual ); - - // Create a text field - _textField = new TextField(); - _textField.ParentOrigin = NDalic.ParentOriginCenter; - _textField.AnchorPoint = NDalic.AnchorPointCenter; - _textField.WidthResizePolicy = "SIZE_RELATIVE_TO_PARENT"; - _textField.HeightResizePolicy = "SIZE_RELATIVE_TO_PARENT"; - _textField.SizeModeFactor = new Vector3( 1.0f, 0.45f, 1.0f ); - _textField.PlaceholderText = "----"; - _textField.BackgroundColor = _textBackgroundColor; - _textField.HorizontalAlignment = "Center"; - _textField.VerticalAlignment = "Center"; - _textField.SetKeyboardFocusable(true); - _textField.Name = "_textField"; - - this.Add(_textField); - - _textField.KeyInputFocusGained += TextFieldKeyInputFocusGained; - _textField.KeyInputFocusLost += TextFieldKeyInputFocusLost; - } + } - public override Vector3 GetNaturalSize() - { - return new Vector3(150.0f, 150.0f, 0.0f); - } + public override void OnInitialize() + { + // Initialize the propertiesControl + _arrowImage = "./images/arrow.png"; + _textBackgroundColor = new Color(0.6f, 0.6f, 0.6f, 1.0f); + _currentValue = 0; + _minValue = 0; + _maxValue = 0; + _singleStep = 1; + _maxTextLength = 0; + + // Create image visual for the arrow keys + _arrowVisualPropertyIndex = RegisterProperty("ArrowImage", new Dali.Property.Value(_arrowImage), Dali.Property.AccessMode.READ_WRITE); + _arrowVisual = VisualFactory.Get().CreateVisual(_arrowImage, new Uint16Pair(150, 150)); + RegisterVisual(_arrowVisualPropertyIndex, _arrowVisual); + + // Create a text field + _textField = new TextField(); + _textField.ParentOrigin = NDalic.ParentOriginCenter; + _textField.AnchorPoint = NDalic.AnchorPointCenter; + _textField.WidthResizePolicy = "SIZE_RELATIVE_TO_PARENT"; + _textField.HeightResizePolicy = "SIZE_RELATIVE_TO_PARENT"; + _textField.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f); + _textField.PlaceholderText = "----"; + _textField.BackgroundColor = _textBackgroundColor; + _textField.HorizontalAlignment = "Center"; + _textField.VerticalAlignment = "Center"; + _textField.SetKeyboardFocusable(true); + _textField.Name = "_textField"; + + this.Add(_textField); + + _textField.KeyInputFocusGained += TextFieldKeyInputFocusGained; + _textField.KeyInputFocusLost += TextFieldKeyInputFocusLost; + } - public void TextFieldKeyInputFocusGained(object source, KeyInputFocusGainedEventArgs e) - { - // Make sure when the current spin that takes input focus also takes the keyboard focus - // For example, when you tap the spin directly - FocusManager.Instance.SetCurrentFocusActor(_textField); - } + public override Vector3 GetNaturalSize() + { + return new Vector3(150.0f, 150.0f, 0.0f); + } - public void TextFieldKeyInputFocusLost(object source, KeyInputFocusLostEventArgs e) - { - int previousValue = _currentValue; + public void TextFieldKeyInputFocusGained(object source, KeyInputFocusGainedEventArgs e) + { + // Make sure when the current spin that takes input focus also takes the keyboard focus + // For example, when you tap the spin directly + FocusManager.Instance.SetCurrentFocusActor(_textField); + } - // If the input value is invalid, change it back to the previous valid value - if(int.TryParse(_textField.Text, out _currentValue)) - { - if (_currentValue < _minValue || _currentValue > _maxValue) + public void TextFieldKeyInputFocusLost(object source, KeyInputFocusLostEventArgs e) { - _currentValue = previousValue; + int previousValue = _currentValue; + + // If the input value is invalid, change it back to the previous valid value + if (int.TryParse(_textField.Text, out _currentValue)) + { + if (_currentValue < _minValue || _currentValue > _maxValue) + { + _currentValue = previousValue; + } + } + else + { + _currentValue = previousValue; + } + + // Otherwise take the new value + this.Value = _currentValue; } - } - else - { - _currentValue = previousValue; - } - - // Otherwise take the new value - this.Value = _currentValue; - } - public override Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, View.KeyboardFocus.Direction direction, bool loopEnabled) - { - // Respond to Up/Down keys to change the value while keeping the current spin focused - Actor nextFocusedActor = currentFocusedActor; - if (direction == View.KeyboardFocus.Direction.UP) - { - this.Value += this.Step; - nextFocusedActor = _textField; - } - else if (direction == View.KeyboardFocus.Direction.DOWN) - { - this.Value -= this.Step; - nextFocusedActor = _textField; - } - else - { - // Return a native empty handle as nothing can be focused in the left or right - nextFocusedActor = new Actor(); - nextFocusedActor.Reset(); - } - - return nextFocusedActor; - } + public override Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, View.KeyboardFocus.Direction direction, bool loopEnabled) + { + // Respond to Up/Down keys to change the value while keeping the current spin focused + Actor nextFocusedActor = currentFocusedActor; + if (direction == View.KeyboardFocus.Direction.UP) + { + this.Value += this.Step; + nextFocusedActor = _textField; + } + else if (direction == View.KeyboardFocus.Direction.DOWN) + { + this.Value -= this.Step; + nextFocusedActor = _textField; + } + else + { + // Return a native empty handle as nothing can be focused in the left or right + nextFocusedActor = new Actor(); + nextFocusedActor.Reset(); + } + + return nextFocusedActor; + } - [ScriptableProperty()] - public int Value - { - get - { - return _currentValue; - } - set - { - - Console.WriteLine ("Value set to " + value ); - _currentValue = value; - - // Make sure no invalid value is accepted - if (_currentValue < _minValue) + [ScriptableProperty()] + public int Value { - _currentValue = _minValue; + get + { + return _currentValue; + } + set + { + + Console.WriteLine("Value set to " + value); + _currentValue = value; + + // Make sure no invalid value is accepted + if (_currentValue < _minValue) + { + _currentValue = _minValue; + } + + if (_currentValue > _maxValue) + { + _currentValue = _maxValue; + } + + _textField.Text = _currentValue.ToString(); + } } - - if (_currentValue > _maxValue) + // MinValue property of type int: + [ScriptableProperty()] + public int MinValue { - _currentValue = _maxValue; + get + { + return _minValue; + } + set + { + _minValue = value; + } } - _textField.Text = _currentValue.ToString(); - } - } - // MinValue property of type int: - [ScriptableProperty()] - public int MinValue - { - get - { - return _minValue; - } - set - { - _minValue = value; - } - } + // MaxValue property of type int: + [ScriptableProperty()] + public int MaxValue + { + get + { + return _maxValue; + } + set + { + _maxValue = value; + } + } - // MaxValue property of type int: - [ScriptableProperty()] - public int MaxValue - { - get - { - return _maxValue; - } - set - { - _maxValue = value; - } - } + // Step property of type int: + [ScriptableProperty()] + public int Step + { + get + { + return _singleStep; + } + set + { + _singleStep = value; + } + } - // Step property of type int: - [ScriptableProperty()] - public int Step - { - get - { - return _singleStep; - } - set - { - _singleStep = value; - } - } + // WrappingEnabled property of type bool: + [ScriptableProperty()] + public bool WrappingEnabled + { + get + { + return _wrappingEnabled; + } + set + { + _wrappingEnabled = value; + } + } - // WrappingEnabled property of type bool: - [ScriptableProperty()] - public bool WrappingEnabled - { - get - { - return _wrappingEnabled; - } - set - { - _wrappingEnabled = value; - } - } + // TextPointSize property of type int: + [ScriptableProperty()] + public int TextPointSize + { + get + { + return _pointSize; + } + set + { + _pointSize = value; + _textField.PointSize = _pointSize; + } + } - // TextPointSize property of type int: - [ScriptableProperty()] - public int TextPointSize - { - get - { - return _pointSize; - } - set - { - _pointSize = value; - _textField.PointSize = _pointSize; - } - } + // TextColor property of type Color: + [ScriptableProperty()] + public Color TextColor + { + get + { + return _textColor; + } + set + { + Console.WriteLine("TextColor set to " + value.R + "," + value.G + "," + value.B); + + _textColor = value; + _textField.TextColor = _textColor; + } + } - // TextColor property of type Color: - [ScriptableProperty()] - public Color TextColor - { - get - { - return _textColor; - } - set - { - Console.WriteLine ("TextColor set to " + value.R + "," + value.G + ","+ value.B); - - _textColor = value; - _textField.TextColor = _textColor; - } - } + // MaxTextLength property of type int: + [ScriptableProperty()] + public int MaxTextLength + { + get + { + return _maxTextLength; + } + set + { + _maxTextLength = value; + _textField.MaxLength = _maxTextLength; + } + } - // MaxTextLength property of type int: - [ScriptableProperty()] - public int MaxTextLength - { - get - { - return _maxTextLength; - } - set - { - _maxTextLength = value; - _textField.MaxLength = _maxTextLength; - } - } + public TextField SpinText + { + get + { + return _textField; + } + set + { + _textField = value; + } + } - public TextField SpinText - { - get - { - return _textField; - } - set - { - _textField = value; - } + // Indicator property of type string: + public string IndicatorImage + { + get + { + return _arrowImage; + } + set + { + _arrowImage = value; + _arrowVisual = VisualFactory.Get().CreateVisual(_arrowImage, new Uint16Pair(150, 150)); + RegisterVisual(_arrowVisualPropertyIndex, _arrowVisual); + } + } } - - // Indicator property of type string: - public string IndicatorImage - { - get - { - return _arrowImage; - } - set - { - _arrowImage = value; - _arrowVisual = VisualFactory.Get().CreateVisual( _arrowImage, new Uint16Pair(150, 150) ); - RegisterVisual( _arrowVisualPropertyIndex, _arrowVisual ); - } - } } -} \ No newline at end of file + -- 2.7.4