| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using System;
- using System.Runtime.CompilerServices;
- namespace BansheeEngine
- {
- public sealed class GUIArea : ScriptObject
- {
- private GUILayout _layout;
- private GUIPanel parent;
- private bool isDestroyed;
- public GUILayout layout
- {
- get { return _layout;}
- }
- internal GUIArea()
- { }
- internal void SetParent(GUIPanel parent)
- {
- if (this.parent != null)
- this.parent.childAreas.Remove(this);
- this.parent = parent;
- parent.childAreas.Add(this);
- }
- internal static GUIArea Create(GUIPanel parent, int x, int y, int width, int height, short depth)
- {
- GUIArea newArea = new GUIArea();
- Internal_CreateInstance(newArea, parent, x, y, width, height, depth);
- newArea._layout = new GUILayoutX(newArea);
- return newArea;
- }
- public void SetArea(int x, int y, int width, int height, short depth = 0)
- {
- Internal_SetArea(mCachedPtr, x, y, width, height, depth);
- }
- public void SetVisible(bool visible)
- {
- Internal_SetVisible(mCachedPtr, visible);
- }
- public bool IsDestroyed()
- {
- return isDestroyed;
- }
- public void Destroy()
- {
- SetParent(null);
- _layout.Destroy();
- isDestroyed = true;
- Internal_Destroy(mCachedPtr);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_CreateInstance(GUIArea instance, GUIPanel parent, int x, int y, int width, int height, short depth);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetArea(IntPtr nativeInstance, int x, int y, int width, int height, short depth);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_Destroy(IntPtr nativeInstance);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetVisible(IntPtr nativeInstance, bool visible);
- }
- }
|