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