public void UpdateBodyContentSize() { tab.geometry.tabContent.rect.width = 0; tab.geometry.tabContent.rect.height = 0; /* * * for (int i= 0;i< tab.structure.childrenTabs.Count;i++) { tab.geometry.tabContent.rect = AddToRect(tab.geometry.tabContent.rect, tab.structure.childrenTabs[i].tab.geometry.tabContainer.rect); } * for (int i= 0;i< tab.structure.childrenTextAreas.Count;i++) { tab.geometry.tabContent.rect = AddToRect(tab.geometry.tabContent.rect, tab.structure.childrenTextAreas[i].textarea.geometry.textareaBody.rect); } * for (int i= 0;i< tab.structure.childrenButtons.Count;i++) { tab.geometry.tabContent.rect = AddToRect(tab.geometry.tabContent.rect, tab.structure.childrenButtons[i].button.geometry.buttonBody.rect); } */ for (int i = 0; i < tab.structure.children.Components.Count; i++) { TabComponent childTab = tab.structure.children.Components[i].GetComponent <TabComponent>(); ButtonComponent childButton = tab.structure.children.Components[i].GetComponent <ButtonComponent>(); TextareaComponent childTextarea = tab.structure.children.Components[i].GetComponent <TextareaComponent>(); if (childTab != null) { tab.geometry.tabContent.rect = AddToRect(tab.geometry.tabContent.rect, childTab.tab.geometry.tabContainer.rect); } else if (childButton != null) { tab.geometry.tabContent.rect = AddToRect(tab.geometry.tabContent.rect, childButton.button.geometry.buttonBody.rect); } else if (childTextarea != null) { tab.geometry.tabContent.rect = AddToRect(tab.geometry.tabContent.rect, childTextarea.textarea.geometry.textareaBody.rect); } } }
public static Size getContentSize(TextareaComponent _textarea) { TextareaType.Component textarea = _textarea.textarea; Size size = new Size(0, 0); Size bodySize = new GenericGeometry.GenericSize(_textarea).size; size.w = bodySize.w; size.h = textarea.style.bodySkin.textArea.CalcHeight(textarea.data.GUIContent, size.w); //size.h = b.textArea.CalcHeight(textarea.data.GUIContent, size.w); // size.w = textarea.style.contentSkin.textArea.CalcSize(textarea.data.GUIContent).x; // size.h = new GenericGeometry.GenericSize(_textarea).size.h; return(size); }
public static void Init(List <Component> children, bool isRoot) { for (int i = 0; i < children.Count; i++) { TabComponent tab = children[i].GetComponent <TabComponent>(); TextareaComponent textarea = children[i].GetComponent <TextareaComponent>(); ButtonComponent button = children[i].GetComponent <ButtonComponent>(); if (tab != null) { tab.tab.data.isRoot = isRoot; tab.Init(); } if (textarea != null) { textarea.Init(); } if (button != null) { button.Init(); } } }
public static void Draw(List <Component> children) { for (int i = 0; i < children.Count; i++) { TabComponent tab = children[i].GetComponent <TabComponent>(); TextareaComponent textarea = children[i].GetComponent <TextareaComponent>(); ButtonComponent button = children[i].GetComponent <ButtonComponent>(); if (tab != null) { tab.Draw(); } if (textarea != null) { textarea.Draw(); } if (button != null) { button.Draw(); } } }
private void SetY(Size eSize) { //Y SubType.PositionGeneric values = componentValues; //SubType.PositionGeneric values; //branch if (componentValues.yFollowBranch || branchValues.yFollowBranch) { componentValues = branchValues; } if (values.XFill) { return; } // Y is set by setX //YStick if (values.yStick != SubType.PositionGeneric.ystick.None) { setYStick(eSize); if (values.yMirror) { position.y = eSize.h - position.y; } return; } //YFill if (values.YFill) { // all children must have same size int pH = (int)parent.geometry.tabBody.rect.height; int eH = (int)eSize.h; int elementCountByCol = pH / eH; position.y = eSize.h * ((index) % elementCountByCol); position.x = eSize.w * ((index) / elementCountByCol); if (values.yMirror) { position.y = parent.geometry.tabBody.rect.height - eSize.h - position.y; } if (values.xMirror) { position.x = parent.geometry.tabBody.rect.width - eSize.w - position.x; } return; } //Ystack if (values.YStack) { int index = _ele.transform.GetSiblingIndex(); int brotherCount = _ele.transform.parent.childCount; int i = 0; if (index > 0) { i = index - 1; } TabComponent brotherTab = _ele.transform.parent.GetChild(i).GetComponent <TabComponent>(); ButtonComponent brotherButton = _ele.transform.parent.GetChild(i).GetComponent <ButtonComponent>(); TextareaComponent brotherTextarea = _ele.transform.parent.GetChild(i).GetComponent <TextareaComponent>(); Rect container = new Rect(0, 0, 0, 0); if (brotherTab != null) { container = brotherTab.tab.geometry.tabContainer.rect; } if (brotherButton != null) { container = brotherButton.button.geometry.buttonBody.rect; } if (brotherTextarea != null) { container = brotherTextarea.textarea.geometry.textareaBody.rect; } if (values.yMirror) { position.y = container.y - eSize.h; return; } if (!values.yMirror) { position.y = container.height + container.y; return; } /* * position.y = parent.geometry.tabContent.rect.height; * if (values.yMirror) { position.y = parent.geometry.tabBody.rect.height - eSize.h - position.y; } * return; * */ } //Yrel if (values.RelY) { position.y = values.y * parent.geometry.tabContainer.rect.height; if (values.yMirror) { position.y = parent.geometry.tabBody.rect.height - eSize.h - position.y; } return; } //YLIteral position.y = values.y; if (values.yMirror) { position.y = parent.geometry.tabBody.rect.height - eSize.h - position.y; } return; }
private void SetX(Size eSize) { //Values from component or branch SubType.PositionGeneric values = componentValues; if (values.xFollowBranch || branchValues.xFollowBranch) { values = branchValues; } // if Yfill X set in SetY if (values.YFill) { return; } //XStick if (values.xStick != SubType.PositionGeneric.xstick.None) { setXStick(eSize); if (values.xMirror) { position.x = parent.geometry.tabBody.rect.width - eSize.w - position.x; } return; } //XFill if (values.XFill) // all children must have same size { int pW = (int)parent.geometry.tabBody.rect.width; //int eW = (int)eSize.w; int eW = (int)eSize.w; int elementCountByRow = pW / eW; position.x = eSize.w * ((index) % elementCountByRow); position.y = eSize.h * ((index) / elementCountByRow); if (values.xMirror) { position.x = parent.geometry.tabBody.rect.width - eSize.w - position.x; } if (values.yMirror) { position.y = parent.geometry.tabBody.rect.height - eSize.h - position.y; } return; } //Xstack if (values.XStack) { int index = _ele.transform.GetSiblingIndex(); int brotherCount = _ele.transform.parent.childCount; int i = 0; if (index > 0) { i = index - 1; } TabComponent brotherTab = _ele.transform.parent.GetChild(i).GetComponent <TabComponent>(); ButtonComponent brotherButton = _ele.transform.parent.GetChild(i).GetComponent <ButtonComponent>(); TextareaComponent brotherTextarea = _ele.transform.parent.GetChild(i).GetComponent <TextareaComponent>(); Rect container = new Rect(0, 0, 0, 0); if (brotherTab != null) { container = brotherTab.tab.geometry.tabContainer.rect; } if (brotherButton != null) { container = brotherButton.button.geometry.buttonBody.rect; } if (brotherTextarea != null) { container = brotherTextarea.textarea.geometry.textareaBody.rect; } if (values.xMirror) { position.x = container.x - eSize.w; return; } if (!values.xMirror) { position.x = container.width + container.x; return; } } //x rel if (values.RelX) { position.x = values.x * parent.geometry.tabContainer.rect.width; if (values.xMirror) { position.x = parent.geometry.tabBody.rect.width - eSize.w - position.x; } return; } //x literal position.x = values.x; if (values.xMirror) { position.x = parent.geometry.tabBody.rect.width - eSize.w - position.x; } return; }