| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.Runtime.CompilerServices;
- using BansheeEngine;
- namespace BansheeEditor
- {
- public sealed class GUIToggleField : GUIElement
- {
- public delegate void OnChangedDelegate(bool newValue);
- public event OnChangedDelegate OnChanged;
- public bool Value
- {
- get
- {
- bool value;
- Internal_GetValue(mCachedPtr, out value);
- return value;
- }
- set { Internal_SetValue(mCachedPtr, value); }
- }
- public GUIToggleField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
- {
- Internal_CreateInstance(this, title, titleWidth, style, options, true);
- }
- public GUIToggleField(string style = "", params GUIOption[] options)
- {
- Internal_CreateInstance(this, null, 0, style, options, false);
- }
- private void DoOnChanged(bool newValue)
- {
- if (OnChanged != null)
- OnChanged(newValue);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_CreateInstance(GUIToggleField instance, GUIContent title, int titleWidth,
- string style, GUIOption[] options, bool withTitle);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_GetValue(IntPtr nativeInstance, out bool value);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetValue(IntPtr nativeInstance, bool value);
- }
- }
|