// Generic helper - use this when creating a layout group. It will make sure everything is wired up correctly.
internal static GUILayoutGroup BeginLayoutArea(GUIStyle style, Type layoutType)
{
GUILayoutGroup g;
switch (Event.current.type)
{
case EventType.Used:
case EventType.Layout:
g = CreateGUILayoutGroupInstanceOfType(layoutType);
g.style = style;
current.windows.Add(g);
break;
default:
g = current.windows.GetNext() as GUILayoutGroup;
if (g == null)
{
throw new ArgumentException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
}
g.ResetCursor();
GUIDebugger.LogLayoutGroupEntry(g.rect, g.marginLeft, g.marginRight, g.marginTop, g.marginBottom, g.style, g.isVertical);
break;
}
current.layoutGroups.Push(g);
current.topLevel = g;
return(g);
}