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