| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //************** Copyright (c) 2016-2019 Marko Pintera ([email protected]). All rights reserved. *******************//
- using System;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using bs;
- namespace bs.Editor
- {
- /** @addtogroup GUIEditor
- * @{
- */
- /// <summary>
- /// 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 input field for a 3D vector distribution.
- /// </summary>
- [ShowInInspector]
- public partial class GUIVector3DistributionField : GUIElement
- {
- private GUIVector3DistributionField(bool __dummy0) { }
- protected GUIVector3DistributionField() { }
- /// <summary>Creates a new GUI editor field with a label.</summary>
- /// <param name="labelContent">Content to display in the editor field label.</param>
- /// <param name="labelWidth">Width of the label in pixels.</param>
- /// <param name="style">
- /// 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.
- /// </param>
- public GUIVector3DistributionField(GUIContent labelContent, int labelWidth, string style = "")
- {
- Internal_create(this, ref labelContent, labelWidth, style);
- }
- /// <summary>Creates a new GUI editor field with a label.</summary>
- /// <param name="labelContent">Content to display in the editor field label.</param>
- /// <param name="style">
- /// 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.
- /// </param>
- public GUIVector3DistributionField(GUIContent labelContent, string style = "")
- {
- Internal_create0(this, ref labelContent, style);
- }
- /// <summary>Creates a new GUI editor field with a label.</summary>
- /// <param name="labelText">String to display in the editor field label.</param>
- /// <param name="labelWidth">Width of the label in pixels.</param>
- /// <param name="style">
- /// 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.
- /// </param>
- public GUIVector3DistributionField(LocString labelText, int labelWidth, string style = "")
- {
- Internal_create1(this, labelText, labelWidth, style);
- }
- /// <summary>Creates a new GUI editor field with a label.</summary>
- /// <param name="labelText">String to display in the editor field label.</param>
- /// <param name="style">
- /// 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.
- /// </param>
- public GUIVector3DistributionField(LocString labelText, string style = "")
- {
- Internal_create2(this, labelText, style);
- }
- /// <summary>Creates a new GUI editor field without a label.</summary>
- /// <param name="style">
- /// 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.
- /// </param>
- public GUIVector3DistributionField(string style = "")
- {
- Internal_create3(this, style);
- }
- /// <summary>Changes the value of the field.</summary>
- [ShowInInspector]
- [NotNull]
- [PassByCopy]
- [NativeWrapper]
- public Vector3Distribution Value
- {
- get { return Internal_getValue(mCachedPtr); }
- set { Internal_setValue(mCachedPtr, value); }
- }
- /// <summary>Returns the type of the currently selected distribution.</summary>
- [NativeWrapper]
- public PropertyDistributionType DistributionType
- {
- get { return Internal_getType(mCachedPtr); }
- }
- /// <summary>
- /// Checks if any of the float input fields currently have input focus. Only relevant for non-curve distributions.
- /// </summary>
- [NativeWrapper]
- public bool HasInputFocus
- {
- get { return Internal_hasInputFocus(mCachedPtr); }
- }
- /// <summary>
- /// Triggered when the user clicks on the curve display. Only relevant if the distribution is a curve distribution.
- /// Provides the index of the clicked curve.
- /// </summary>
- partial void OnClicked(VectorComponent p0);
- /// <summary>
- /// Triggered when the user modifies the value of the non-curve (constant) values of the distribution. Only relevant if
- /// the distribution is not a curve distribution.
- /// </summary>
- public event Action<RangeComponent, VectorComponent> OnConstantModified;
- /// <summary>
- /// Triggered when the user confirms inputs in the non-curve (constant) values of the distribution. Only relevant if the
- /// distribution is not a curve distribution.
- /// </summary>
- public event Action<RangeComponent, VectorComponent> OnConstantConfirmed;
- /// <summary>
- /// Triggered when a GUI field representing an individual component loses or gains focus. This only applies to input
- /// fields representing the non-curve (constant) distribution types.
- /// </summary>
- public event Action<bool, RangeComponent, VectorComponent> OnConstantFocusChanged;
- /// <summary>Sets input focus to a specific component's input box.</summary>
- /// <param name="rangeComponent">
- /// Whether to focus on the minimum or the maximum part of the range. Only relevant if the distribution represents a
- /// constant range.
- /// </param>
- /// <param name="vectorComponent">
- /// Vector component to focus on. Only relevant of the distribution constant is a vector type, and if the current
- /// distribution type is a non-curve (constant) type.
- /// </param>
- /// <param name="focus">True to enable focus, false to disable.</param>
- public void SetInputFocus(RangeComponent rangeComponent, VectorComponent vectorComponent, bool focus)
- {
- Internal_setInputFocus(mCachedPtr, rangeComponent, vectorComponent, focus);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern Vector3Distribution Internal_getValue(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_setValue(IntPtr thisPtr, Vector3Distribution value);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern PropertyDistributionType Internal_getType(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern bool Internal_hasInputFocus(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_setInputFocus(IntPtr thisPtr, RangeComponent rangeComponent, VectorComponent vectorComponent, bool focus);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_create(GUIVector3DistributionField managedInstance, ref GUIContent labelContent, int labelWidth, string style);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_create0(GUIVector3DistributionField managedInstance, ref GUIContent labelContent, string style);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_create1(GUIVector3DistributionField managedInstance, LocString labelText, int labelWidth, string style);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_create2(GUIVector3DistributionField managedInstance, LocString labelText, string style);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_create3(GUIVector3DistributionField managedInstance, string style);
- private void Internal_onClicked(VectorComponent p0)
- {
- OnClicked(p0);
- }
- private void Internal_onConstantModified(RangeComponent p0, VectorComponent p1)
- {
- OnConstantModified?.Invoke(p0, p1);
- }
- private void Internal_onConstantConfirmed(RangeComponent p0, VectorComponent p1)
- {
- OnConstantConfirmed?.Invoke(p0, p1);
- }
- private void Internal_onConstantFocusChanged(bool p0, RangeComponent p1, VectorComponent p2)
- {
- OnConstantFocusChanged?.Invoke(p0, p1, p2);
- }
- }
- /** @} */
- }
|