//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//************** Copyright (c) 2016-2019 Marko Pintera (marko.pintera@gmail.com). All rights reserved. *******************//
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using bs;
namespace bs.Editor
{
/** @addtogroup GUIEditor
* @{
*/
///
/// A composite GUI object representing an editor field. Editor fields are a combination of a label and an input field.
/// Label is optional. This specific implementation displays an animation curve or a range between two animation curves.
///
[ShowInInspector]
public partial class GUICurvesField : GUIElement
{
private GUICurvesField(bool __dummy0) { }
protected GUICurvesField() { }
/// Creates a new GUI editor field with a label.
/// Options that control which additional curve elements to draw.
/// Content to display in the editor field label.
/// Width of the label in pixels.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(CurveDrawOptions drawOptions, GUIContent labelContent, int labelWidth, string style = "")
{
Internal_create(this, drawOptions, ref labelContent, labelWidth, style);
}
/// Creates a new GUI editor field with a label.
/// Options that control which additional curve elements to draw.
/// String to display in the editor field label.
/// Width of the label in pixels.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(CurveDrawOptions drawOptions, LocString labelText, int labelWidth, string style = "")
{
Internal_create0(this, drawOptions, labelText, labelWidth, style);
}
/// Creates a new GUI editor field without a label.
/// Options that control which additional curve elements to draw.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(CurveDrawOptions drawOptions, string style = "")
{
Internal_create1(this, drawOptions, style);
}
/// Creates a new GUI editor field with a label.
/// Content to display in the editor field label.
/// Width of the label in pixels.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(GUIContent labelContent, int labelWidth, string style = "")
{
Internal_create2(this, ref labelContent, labelWidth, style);
}
/// Creates a new GUI editor field with a label.
/// Content to display in the editor field label.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(GUIContent labelContent, string style = "")
{
Internal_create3(this, ref labelContent, style);
}
/// Creates a new GUI editor field with a label.
/// String to display in the editor field label.
/// Width of the label in pixels.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(LocString labelText, int labelWidth, string style = "")
{
Internal_create4(this, labelText, labelWidth, style);
}
/// Creates a new GUI editor field with a label.
/// String to display in the editor field label.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(LocString labelText, string style = "")
{
Internal_create5(this, labelText, style);
}
/// Creates a new GUI editor field without a label.
///
/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
/// If not specified default style is used.
///
public GUICurvesField(string style = "")
{
Internal_create6(this, style);
}
///
/// Returns the curve represented by the field. If the field represents a curve range this returns the minimal curve of
/// that range.
///
[NotNull]
[PassByCopy]
[NativeWrapper]
public AnimationCurve Curve
{
get { return Internal_getCurve(mCachedPtr); }
}
///
/// Returns the minimal curve represented by the field containing a curve range. Returns the only available curve if the
/// field doesn't represent a range.
///
[NotNull]
[PassByCopy]
[NativeWrapper]
public AnimationCurve MinCurve
{
get { return Internal_getMinCurve(mCachedPtr); }
}
///
/// Returns the maximal curve represented by the field containing a curve range. Returns the only available curve if the
/// field doesn't represent a range.
///
[NotNull]
[PassByCopy]
[NativeWrapper]
public AnimationCurve MaxCurve
{
get { return Internal_getMaxCurve(mCachedPtr); }
}
/// Sets the size of padding to apply to the left and right sides of the curve drawing, in pixels.
[ShowInInspector]
[NativeWrapper]
public int Padding
{
set { Internal_setPadding(mCachedPtr, value); }
}
/// Triggered when the user clicks on the GUI element.
partial void OnClicked();
/// Sets an animation curve to display on the field.
public void SetCurve(AnimationCurve curve)
{
Internal_setCurve(mCachedPtr, curve);
}
/// Sets a set of animation curves and displays the difference (range) between them.
public void SetCurveRange(AnimationCurve curveA, AnimationCurve curveB)
{
Internal_setCurveRange(mCachedPtr, curveA, curveB);
}
/// Changes the visible range that the GUI element displays.
/// Range of the horizontal area. Displayed area will range from [0, xRange].
/// Range of the vertical area. Displayed area will range from [-yRange * 0.5, yRange * 0.5]
public void SetRange(float xRange, float yRange)
{
Internal_setRange(mCachedPtr, xRange, yRange);
}
/// Returns the offset at which the displayed timeline values start at.
/// Value to start the timeline values at, where x = time, y = value.
public void SetOffset(Vector2 offset)
{
Internal_setOffset(mCachedPtr, ref offset);
}
/// Centers and zooms the view to fully display the provided set of curves.
public void CenterAndZoom()
{
Internal_centerAndZoom(mCachedPtr);
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setCurve(IntPtr thisPtr, AnimationCurve curve);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setCurveRange(IntPtr thisPtr, AnimationCurve curveA, AnimationCurve curveB);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern AnimationCurve Internal_getCurve(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern AnimationCurve Internal_getMinCurve(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern AnimationCurve Internal_getMaxCurve(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setRange(IntPtr thisPtr, float xRange, float yRange);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setOffset(IntPtr thisPtr, ref Vector2 offset);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_centerAndZoom(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_setPadding(IntPtr thisPtr, int padding);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create(GUICurvesField managedInstance, CurveDrawOptions drawOptions, ref GUIContent labelContent, int labelWidth, string style);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create0(GUICurvesField managedInstance, CurveDrawOptions drawOptions, LocString labelText, int labelWidth, string style);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create1(GUICurvesField managedInstance, CurveDrawOptions drawOptions, string style);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create2(GUICurvesField managedInstance, ref GUIContent labelContent, int labelWidth, string style);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create3(GUICurvesField managedInstance, ref GUIContent labelContent, string style);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create4(GUICurvesField managedInstance, LocString labelText, int labelWidth, string style);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create5(GUICurvesField managedInstance, LocString labelText, string style);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_create6(GUICurvesField managedInstance, string style);
private void Internal_onClicked()
{
OnClicked();
}
}
/** @} */
}