--- /dev/null
+/*
+ * Copyright (c) 2019 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.ComponentModel;
+using System;
+using Tizen.NUI.BaseComponents;
+using System.Runtime.InteropServices;
+
+namespace Tizen.NUI
+{
+ /// <summary>
+ /// [Draft] The class that initiates the Measuring and Layouting of the tree,
+ /// It sets a callback that becomes the entry point into the C# Layouting.
+ /// </summary>
+ internal class LayoutController : global::System.IDisposable
+ {
+ private global::System.Runtime.InteropServices.HandleRef unmanagedLayoutController;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate void Callback(int id);
+
+ event Callback mInstance;
+
+ //A Flat to check if it is already disposed.
+ protected bool disposed = false;
+
+
+ /// <summary>
+ /// Constructs a LayoutController which controls the measuring and layouting.<br />
+ /// </summary>
+
+ public LayoutController()
+ {
+ global::System.IntPtr cPtr = LayoutPINVOKE.LayoutController_New();
+
+ // Wrap cPtr in a managed handle.
+ unmanagedLayoutController = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+
+ mInstance = new Callback(Process);
+ LayoutPINVOKE.LayoutController_SetCallback(unmanagedLayoutController, mInstance);
+ }
+
+ /// <summary>
+ /// Get the unique id of the LayoutController
+ /// </summary>
+ public int GetId()
+ {
+ return LayoutPINVOKE.LayoutController_GetId(unmanagedLayoutController);
+ }
+
+ /// <summary>
+ /// Destructor which adds LayoutController to the Dispose queue.
+ /// </summary>
+ ~LayoutController()
+ {
+ Dispose(DisposeTypes.Explicit);
+ }
+
+ /// <summary>
+ /// Explict Dispose.
+ /// </summary>
+
+ public void Dispose()
+ {
+ Dispose(DisposeTypes.Explicit);
+ System.GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Dispose Explict or Implicit
+ /// </summary>
+ protected virtual void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User code
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+
+ if (unmanagedLayoutController.Handle != global::System.IntPtr.Zero)
+ {
+ LayoutPINVOKE.delete_LayoutController(unmanagedLayoutController);
+ unmanagedLayoutController = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+
+ disposed = true;
+ }
+
+ /// <summary>
+ /// Entry point into the C# Layouting that starts the Processing
+ /// </summary>
+ private void Process(int id)
+ {
+ NUILog.Debug("layoutController Process id:" + id );
+ }
+
+ } // class LayoutController
+
+} // namespace Tizen.NUI
\ No newline at end of file
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
[global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GridLayout__GetColumns")]
public static extern int GridLayout_GetColumns(global::System.Runtime.InteropServices.HandleRef jarg1);
- }
+ // LayoutingEX
+
+ // LayoutController
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_new_LayoutController")]
+ public static extern global::System.IntPtr LayoutController_New();
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_delete_LayoutController")]
+ public static extern global::System.IntPtr delete_LayoutController(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_LayoutController_SetCallback")]
+ public static extern void LayoutController_SetCallback(global::System.Runtime.InteropServices.HandleRef jarg1, LayoutController.Callback jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_LayoutController_GetId")]
+ public static extern int LayoutController_GetId(global::System.Runtime.InteropServices.HandleRef jarg1);
+ }
}
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
[global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_GetClosestImageSize__SWIG_4")]
public static extern global::System.IntPtr GetClosestImageSize__SWIG_4(string jarg1);
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_GetOriginalImageSize")]
+ public static extern global::System.IntPtr GetOriginalImageSize(string jarg1);
[global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_DownloadImageSynchronously__SWIG_0")]
public static extern global::System.IntPtr DownloadImageSynchronously__SWIG_0(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, bool jarg5);
var addMethod =
Context.Types[parentElement].GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
- addMethod.Invoke(source, new[] { value });
+ addMethod?.Invoke(source, new[] { value });
return;
}
if (xpe == null && (contentProperty = GetContentPropertyName(Context.Types[parentElement].GetTypeInfo())) != null) {
ci.GetParameters().Length != 0 && ci.IsPublic &&
ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute))));
object[] arguments = CreateArgumentsArray(node, ctorInfo);
- return ctorInfo?.Invoke(arguments);
+
+ if (arguments != null)
+ {
+ return ctorInfo?.Invoke(arguments);
+ }
+ else
+ {
+ return null;
+ }
}
public object CreateFromFactory(Type nodeType, IElementNode node)
public object[] CreateArgumentsArray(IElementNode enode, ConstructorInfo ctorInfo)
{
- var n = ctorInfo.GetParameters().Length;
- var array = new object[n];
- for (var i = 0; i < n; i++)
+ if( ctorInfo != null )
{
- var parameter = ctorInfo.GetParameters()[i];
- var propname =
- parameter?.CustomAttributes?.First(attr => attr.AttributeType == typeof (ParameterAttribute))?
- .ConstructorArguments.First()
- .Value as string;
- var name = new XmlName("", propname);
- INode node;
- if (!enode.Properties.TryGetValue(name, out node))
+ var n = ctorInfo.GetParameters().Length;
+ var array = new object[n];
+ for (var i = 0; i < n; i++)
{
- String msg = "";
- if (propname != null)
- {
- msg = String.Format("The Property {0} is required to create a {1} object.", propname, ctorInfo.DeclaringType.FullName);
- }
- else
+ var parameter = ctorInfo.GetParameters()[i];
+ var propname =
+ parameter?.CustomAttributes?.First(attr => attr.AttributeType == typeof (ParameterAttribute))?
+ .ConstructorArguments.First()
+ .Value as string;
+ var name = new XmlName("", propname);
+ INode node;
+ if (!enode.Properties.TryGetValue(name, out node))
{
- msg = "propname is null.";
+ String msg = "";
+ if (propname != null)
+ {
+ msg = String.Format("The Property {0} is required to create a {1} object.", propname, ctorInfo.DeclaringType.FullName);
+ }
+ else
+ {
+ msg = "propname is null.";
+ }
+ throw new XamlParseException(msg, enode as IXmlLineInfo);
}
- throw new XamlParseException(msg, enode as IXmlLineInfo);
+ if (!enode.SkipProperties.Contains(name))
+ enode.SkipProperties.Add(name);
+ var value = Context.Values[node];
+ var serviceProvider = new XamlServiceProvider(enode, Context);
+ var convertedValue = value.ConvertTo(parameter?.ParameterType, () => parameter, serviceProvider);
+ array[i] = convertedValue;
}
- if (!enode.SkipProperties.Contains(name))
- enode.SkipProperties.Add(name);
- var value = Context.Values[node];
- var serviceProvider = new XamlServiceProvider(enode, Context);
- var convertedValue = value.ConvertTo(parameter.ParameterType, () => parameter, serviceProvider);
- array[i] = convertedValue;
+ return array;
}
- return array;
+ return null;
}
static bool IsXaml2009LanguagePrimitive(IElementNode node)
if (e.NewStartingIndex == -1 || e.NewItems?.Count > 1)
goto case NotifyCollectionChangedAction.Reset;
- var newItem = e.NewItems[0] as TRestrict;
+ var newItem = e.NewItems?[0] as TRestrict;
if (newItem == null || !newItem.Owned)
break;
if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
goto case NotifyCollectionChangedAction.Reset;
- var movedItem = e.NewItems[0] as TRestrict;
+ var movedItem = e.NewItems?[0] as TRestrict;
if (movedItem == null || !movedItem.Owned)
break;
-using System.Collections.Generic;
+using System.Collections.Generic;
using Tizen.NUI.Binding;
namespace Tizen.NUI.StyleSheets
}
/// <summary>
+ /// Get the size of an original image
+ /// </summary>
+ /// <param name="filename">The name of the image.</param>
+ /// <returns>Dimension of the original image.</returns>
+ /// <since_tizen> 5 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5. Therefore, currently this would be used as an in-house API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Size2D GetOriginalImageSize(string filename)
+ {
+ var val = new Uint16Pair(NDalicPINVOKE.GetOriginalImageSize(filename), true);
+ Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
/// Load an image synchronously from a remote resource.
/// </summary>
/// <param name="url">The URL of the image file to load.</param>
/*
- * Copyright(c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2019 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.
private static readonly Window instance = Application.Instance?.GetWindow();
+ private LayoutController localController;
+
internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
if (NDalicPINVOKE.Stage_IsInstalled())
{
stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
+
+ localController = new LayoutController();
+ NUILog.Debug("layoutController id:" + localController.GetId() );
+
// Create a root layout (AbsoluteLayout) that is invisible to the user but enables layouts added to the Window
// Enables layouts added to the Window to have a parent layout. As parent layout is needed to store measure spec properties.
// Currently without these measure specs the new layout added will always be the size of the window.
{
if (depth < LayersChildren?.Count)
{
- Layer ret = LayersChildren[Convert.ToInt32(depth)];
+ Layer ret = LayersChildren?[Convert.ToInt32(depth)];
return ret;
}
else
/// Disconnect all native signals
/// </summary>
/// <since_tizen> 5 </since_tizen>
- internal void DisconnectNativeSignals()
+ internal void DisconnectNativeSignals()
{
if( _windowFocusChangedEventCallback != null )
{