/*
* 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;
using System.ComponentModel;
using Tizen.NUI.Binding;
namespace Tizen.NUI
{
///
/// Extents class describing the a collection of uint16_t.
///
/// 4
[Binding.TypeConverter(typeof(ExtentsTypeConverter))]
public class Extents : Disposable, ICloneable
{
///
/// Constructor.
///
/// 4
public Extents() : this(Interop.Extents.NewExtents(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Constructor.
///
/// A reference to the copied Extents.
/// 4
public Extents(Extents copy) : this(Interop.Extents.NewExtents(Extents.getCPtr(copy)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// The type cast operator, ushort to Extents.
///
/// A value of ushort type.
/// return a Extents instance
[EditorBrowsable(EditorBrowsableState.Never)]
public static implicit operator Extents(ushort value)
{
return new Extents(value, value, value, value);
}
///
/// Constructor.
/// Start extent.
/// End extent.
/// Top extent.
/// Bottom extent.
///
/// 4
public Extents(ushort start, ushort end, ushort top, ushort bottom) : this(Interop.Extents.NewExtents(start, end, top, bottom), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Extents(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
}
///
/// Constructor
///
///
///
///
///
///
/// Only used by Tizen.NUI.Components, will not be opened
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public Extents(ExtentsChangedCallback cb, ushort start, ushort end, ushort top, ushort bottom) : this(Interop.Extents.NewExtents(start, end, top, bottom), true)
{
callback = cb;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Copy other extents
///
///
/// Thrown when that is null.
/// Only used by Tizen.NUI.Components, will not be opened
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public void CopyFrom(Extents that)
{
if (null == that)
{
throw new ArgumentNullException(nameof(that));
}
Interop.Extents.StartSet(SwigCPtr, that.Start);
Interop.Extents.EndSet(SwigCPtr, that.End);
Interop.Extents.TopSet(SwigCPtr, that.Top);
Interop.Extents.BottomSet(SwigCPtr, that.Bottom);
}
///
/// Constructor
///
///
///
///
///
/// Only used by Tizen.NUI.Components, will not be opened
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public delegate void ExtentsChangedCallback(ushort start, ushort end, ushort top, ushort bottom);
private ExtentsChangedCallback callback = null;
///
/// The Start extent.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Ue new Extents(...) constructor.
///
///
/// // DO NOT use like the followings!
/// Extents extents = new Extents();
/// extents.Start = 1;
/// // USE like this
/// ushort start = 1, end = 2, top = 3, bottom = 4;
/// Extents extents = new Extents(start, end, top, bottom);
///
/// 4
public ushort Start
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new Extents(...) constructor")]
set
{
Interop.Extents.StartSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(Start, End, Top, Bottom);
}
get
{
ushort ret = Interop.Extents.StartGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// The End extend.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Use new Extents(...) constructor.
///
///
/// // DO NOT use like the followings!
/// Extents extents = new Extents();
/// extents.End = 2;
/// // USE like this
/// ushort start = 1, end = 2, top = 3, bottom = 4;
/// Extents extents = new Extents(start, end, top, bottom);
///
/// 4
public ushort End
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new Extents(...) constructor")]
set
{
Interop.Extents.EndSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(Start, End, Top, Bottom);
}
get
{
ushort ret = Interop.Extents.EndGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// The Top extend.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Use new Extents(...) constructor.
///
///
/// // DO NOT use like the followings!
/// Extents extents = new Extents();
/// extents.Top = 3;
/// // USE like this
/// ushort start = 1, end = 2, top = 3, bottom = 4;
/// Extents extents = new Extents(start, end, top, bottom);
///
/// 4
public ushort Top
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new Extents(...) constructor")]
set
{
Interop.Extents.TopSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(Start, End, Top, Bottom);
}
get
{
ushort ret = Interop.Extents.TopGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// The Bottom Extend.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Use new Extents(...) constructor.
///
///
/// // DO NOT use like the followings!
/// Extents extents = new Extents();
/// extents.Bottom = 4;
/// // USE like this
/// ushort start = 1, end = 2, top = 3, bottom = 4;
/// Extents extents = new Extents(start, end, top, bottom);
///
/// 4
public ushort Bottom
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new Extents(...) constructor")]
set
{
Interop.Extents.BottomSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(Start, End, Top, Bottom);
}
get
{
ushort ret = Interop.Extents.BottomGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// Equality operator.
///
/// The Extents to test against.
/// True if the extents are not equal.
/// 4
public bool EqualTo(Extents rhs)
{
bool ret = Interop.Extents.EqualTo(SwigCPtr, Extents.getCPtr(rhs));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Inequality operator.
///
/// The Extents to test against.
/// True if the extents are not equal.
/// 4
public bool NotEqualTo(Extents rhs)
{
bool ret = Interop.Extents.NotEqualTo(SwigCPtr, Extents.getCPtr(rhs));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
[EditorBrowsable(EditorBrowsableState.Never)]
public object Clone() => new Extents(this);
internal Extents Assign(SWIGTYPE_p_uint16_t array)
{
Extents ret = new Extents(Interop.Extents.AssignUint16(SwigCPtr, SWIGTYPE_p_uint16_t.getCPtr(array)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal Extents Assign(Extents copy)
{
Extents ret = new Extents(Interop.Extents.Assign(SwigCPtr, Extents.getCPtr(copy)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.Extents.DeleteExtents(swigCPtr);
}
}
}