//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System.Collections.Generic; using bs; namespace bs.Editor { /** @addtogroup Inspector * @{ */ /// /// Helper layout object that wraps a standard , used primarily by /// implementations keep track of their own GUI elements in a layout. /// public class InspectableFieldLayout { private GUILayoutY parentLayout; private List elements = new List(); /// /// Creates a new inspectable field layout object. /// /// GUI layout object to wrap. public InspectableFieldLayout(GUILayoutY parentLayout) { this.parentLayout = parentLayout; } /// /// Number of child elements in the inspectable layout. /// public int NumElements { get { return elements.Count; } } /// /// Adds a GUI element to the field layout. /// /// Index into the GUI layout at which the field layout start at. /// GUI element to insert into the layout. public void AddElement(int index, GUIElement element) { parentLayout.InsertElement(index + elements.Count, element); elements.Add(element); } /// /// Creates a new and adds it to the field layout. /// /// Index into the GUI layout at which the field layout start at. /// Newly created layout. public GUILayoutX AddLayoutX(int index) { GUILayoutX layout = parentLayout.InsertLayoutX(index + elements.Count); elements.Add(layout); return layout; } /// /// Creates a new and adds it to the field layout. /// /// Index into the GUI layout at which the field layout start at. /// Newly created layout. public GUILayoutY AddLayoutY(int index) { GUILayoutY layout = parentLayout.InsertLayoutY(index + elements.Count); elements.Add(layout); return layout; } /// /// Destroys all GUI elements contained in the field layout. Leaves other elements present in GUI layout intact. /// public void DestroyElements() { foreach (var element in elements) { element.Destroy(); } elements.Clear(); } } /** @} */ }