public static GUIStyle[] getScrollStyles(GUISkin ScrollSKin, SubType.Scroll componentValue, SubType.Scroll globalParam) { GUIStyle[] res = { null, null }; if (componentValue.ScrollFollowBranch || globalParam.ScrollFollowBranch) { componentValue.Mode = globalParam.Mode; } res[0] = new GUIStyle(ScrollSKin.horizontalScrollbar); res[1] = new GUIStyle(ScrollSKin.verticalScrollbar); switch (componentValue.Mode) { case SubType.Scroll.scrollMode.Vertical: res[0].fixedHeight = 0; res[1].fixedWidth = ScrollSKin.verticalScrollbar.fixedWidth; break; case SubType.Scroll.scrollMode.Horizontal: res[0].fixedHeight = ScrollSKin.horizontalScrollbar.fixedHeight; res[1].fixedWidth = 0; break; case SubType.Scroll.scrollMode.Both: res[0].fixedHeight = ScrollSKin.horizontalScrollbar.fixedHeight; res[1].fixedWidth = ScrollSKin.verticalScrollbar.fixedWidth; break; case SubType.Scroll.scrollMode.None: res[0].fixedHeight = 0; res[1].fixedWidth = 0; break; } return(res); }
public static Rect getRectWithScrollEdges(GUISkin elementSkin, Rect rect, SubType.Scroll componentValue, SubType.Scroll globalParam) { if (componentValue.ScrollFollowBranch || globalParam.ScrollFollowBranch) { componentValue.Edge = globalParam.Edge; componentValue.Mode = globalParam.Mode; } switch (componentValue.Edge) { case SubType.Scroll.scrollEdge.Inner: switch (componentValue.Mode) { case SubType.Scroll.scrollMode.Vertical: rect.width = rect.width - elementSkin.verticalScrollbar.fixedWidth - 1; break; case SubType.Scroll.scrollMode.Horizontal: rect.height = rect.height - elementSkin.horizontalScrollbar.fixedHeight - 1; break; case SubType.Scroll.scrollMode.Both: rect.width = rect.width - elementSkin.verticalScrollbar.fixedWidth - 1; rect.height = rect.height - elementSkin.horizontalScrollbar.fixedHeight - 1; break; } break; case SubType.Scroll.scrollEdge.Normal: rect.width = rect.width; rect.height = rect.height; break; case SubType.Scroll.scrollEdge.Outer: switch (componentValue.Mode) { case SubType.Scroll.scrollMode.Vertical: rect.width = rect.width + elementSkin.verticalScrollbar.fixedWidth; break; case SubType.Scroll.scrollMode.Horizontal: rect.height = rect.height + elementSkin.horizontalScrollbar.fixedHeight; break; case SubType.Scroll.scrollMode.Both: rect.width = rect.width + elementSkin.verticalScrollbar.fixedWidth; rect.height = rect.height + elementSkin.horizontalScrollbar.fixedHeight; break; } break; } return(rect); }