private static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options)
{
GUIUtility.CheckOnGUI();
switch (Event.current.type)
{
case EventType.Layout:
if (style.isHeightDependantOnWidth)
{
current.topLevel.Add(new GUIWordWrapSizer(style, content, options));
}
else
{
Vector2 constraints = new Vector2(0f, 0f);
if (options != null)
{
foreach (GUILayoutOption option in options)
{
switch (option.type)
{
case GUILayoutOption.Type.maxHeight:
constraints.y = (float) option.value;
break;
case GUILayoutOption.Type.maxWidth:
constraints.x = (float) option.value;
break;
}
}
}
Vector2 vector2 = style.CalcSizeWithConstraints(content, constraints);
current.topLevel.Add(new GUILayoutEntry(vector2.x, vector2.x, vector2.y, vector2.y, style, options));
}
return kDummyRect;
case EventType.Used:
return kDummyRect;
}
GUILayoutEntry next = current.topLevel.GetNext();
GUIDebugger.LogLayoutEntry(next.rect, next.margin, next.style);
return next.rect;
}