using System; using System.Runtime.CompilerServices; namespace BansheeEngine { public sealed class GUIButton : GUIElement { public delegate void OnClickDelegate(); public delegate void OnHoverDelegate(); public delegate void OnOutDelegate(); public event OnClickDelegate OnClick; public event OnHoverDelegate OnHover; public event OnOutDelegate OnOut; internal GUIButton(GUILayout parentLayout, GUIContent content, GUIElementStyle style, params GUIOption[] options) :base(parentLayout) { Internal_CreateInstance(this, parentLayout, content, style, options); } public void SetContent(GUIContent content) { Internal_SetContent(mCachedPtr, content); } private void DoOnClick() { if (OnClick != null) OnClick(); } private void DoOnHover() { if (OnHover != null) OnHover(); } private void DoOnOut() { if (OnOut != null) OnOut(); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_CreateInstance(GUIButton instance, GUILayout layout, GUIContent content, GUIElementStyle style, GUIOption[] options); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content); } }