private void SetHeight() { SubType.SizeGeneric values = componentValues; //branch if (componentValues.hFollowBranch || branchValues.hFollowBranch) { values = branchValues; } //hfit if (values.hFitChildren) { size.h = button.style.bodySkin.button.CalcSize(button.data.GUIcontent).y; return; } //Relative if (values.relHeight) { size.h = values.height * parent.geometry.tabBody.rect.height; return; } //Literal size.h = values.height; return; }
private void SetWidth() { SubType.SizeGeneric values = componentValues; //branch if (values.wFollowBranch || branchValues.wFollowBranch) { values = branchValues; } //wfit if (values.wFitChildren) { size.w = button.style.bodySkin.button.CalcSize(button.data.GUIcontent).x; return; } //Relative if (values.relWidth) { size.w = values.width * parent.geometry.tabBody.rect.width; return; } //Literal size.w = values.width; return; }
public GenericSize(Component _e) { GenericValues val = new GenericValues(_e); _ele = _e; componentValues = val.componentSize; branchValues = val.branchSize; parent = val.parent; ele = val.ele; SetWidth(); SetHeight(); SetLimits(); }
// Get parent public GenericValues(Component _ele) { //Get parent TabComponent _parent = _ele.transform.parent.GetComponent <TabComponent>(); if (_parent != null) { parent = _parent.tab; } else { parent.geometry = new TabType.Geometry(); parent.geometry.tabContainer.rect.width = Screen.width; parent.geometry.tabContainer.rect.height = Screen.height; parent.geometry.tabBody.rect.width = Screen.width; parent.geometry.tabBody.rect.height = Screen.height; parent.data = new TabType.Data(); parent.data.type = SubType.TabType.Panel; } //Get values by component BranchValuesComponent _branchValues = _ele.GetComponentInParent <BranchValuesComponent>(); if (_ele.GetType() == typeof(TabComponent)) { ele = TabType.Generic(_ele.GetComponents <TabComponent>()[0].tab); componentPosition = ele.geometry.tabContainer.position; branchPosition = _branchValues.tab.geometry.tabContainer.position; componentSize = ele.geometry.tabContainer.size; branchSize = _branchValues.tab.geometry.tabContainer.size; } else if (_ele.GetType() == typeof(ButtonComponent)) { ele = ButtonType.Generic(_ele.GetComponents <ButtonComponent>()[0].button); componentPosition = ele.geometry.buttonBody.position; branchPosition = _branchValues.button.geometry.buttonBody.position; componentSize = ele.geometry.buttonBody.size; branchSize = _branchValues.button.geometry.buttonBody.size; } else if (_ele.GetType() == typeof(TextareaComponent)) { ele = TextareaType.Generic(_ele.GetComponents <TextareaComponent>()[0].textarea); componentPosition = ele.geometry.textareaBody.position; branchPosition = _branchValues.textarea.geometry.textareaBody.position; componentSize = ele.geometry.textareaBody.size; branchSize = _branchValues.textarea.geometry.textareaBody.size; } }
public TabButton(Vector2 _position, Size headerSize, ButtonType.Component _button, ButtonType.Component branch) { parent.geometry = new TabType.Geometry(); parent.geometry.tabBody.rect.width = headerSize.w; parent.geometry.tabBody.rect.height = headerSize.h; componentValues = _button.geometry.buttonBody.size; branchValues = branch.geometry.buttonBody.size; button = _button; position = _position; SetWidth(); SetHeight(); rect = new Rect(position, new Vector2(size.w, size.h)); }
private void SetWidth() { SubType.SizeGeneric values = componentValues; //branch if (values.wFollowBranch || branchValues.wFollowBranch) { values = branchValues; } //wfit if (values.wFitChildren) { if (ele.type == "Tab") { if (ele.data.type == SubType.TabType.Tab && (ele.geometry.tabHeader.position == SubType.THPSR.Position.Left || ele.geometry.tabHeader.position == SubType.THPSR.Position.Right)) { size.w = ele.geometry.tabContent.rect.width + ele.geometry.tabHeader.rect.width; return; } else { size.w = ele.geometry.tabContent.rect.width; return; } } // if (ele.type == "Textarea") { size.w = ele.style.bodySkin.textArea.CalcSize(ele.data.GUIcontent).x; return; } if (ele.type == "Button") { size.w = ele.style.bodySkin.button.CalcSize(ele.data.GUIcontent).x; return; } } //Relative if (values.relWidth) { size.w = values.width * parent.geometry.tabBody.rect.width; return; } //Literal size.w = values.width; return; }
private void SetLimits() { SubType.SizeGeneric values = componentValues; //Xbranch if (values.wFollowBranch || branchValues.wFollowBranch) { values = branchValues; } //Xmax if (values.wLimits.max > 0) { if (!values.wLimits.hideAfterMax && (size.w > values.wLimits.max)) { size.w = values.wLimits.max; } if (values.wLimits.hideAfterMax && (size.w > values.wLimits.max)) { size.w = 0; } } //Xmin if (values.wLimits.min > 0) { if (!values.wLimits.hideBeforeMin && (size.w < values.wLimits.min)) { size.w = values.wLimits.min; } if (values.wLimits.hideBeforeMin && (size.w < values.wLimits.min)) { size.w = 0; } } //YBranch if (values.hFollowBranch || branchValues.hFollowBranch) { values = branchValues; } //Ymax if (values.hLimits.max > 0) { if (!values.hLimits.hideAfterMax && (size.h > values.hLimits.max)) { size.h = values.hLimits.max; } if (values.hLimits.hideAfterMax && (size.h > values.hLimits.max)) { size.h = 0; } } //Ymin if (values.hLimits.min > 0) { if (!values.hLimits.hideBeforeMin && (size.h < values.hLimits.min)) { size.h = values.hLimits.min; } if (values.hLimits.hideBeforeMin && (size.h < values.hLimits.min)) { size.h = 0; } } }
private void SetHeight() { SubType.SizeGeneric values = componentValues; //branch if (componentValues.hFollowBranch || branchValues.hFollowBranch) { values = branchValues; } //hfit if (values.hFitChildren) { if (ele.type == "Tab") { if (ele.data.type == SubType.TabType.Tab && (ele.geometry.tabHeader.position == SubType.THPSR.Position.Top || ele.geometry.tabHeader.position == SubType.THPSR.Position.Bottom)) { size.h = ele.geometry.tabContent.rect.height + ele.geometry.tabHeader.rect.height; return; } { size.h = ele.geometry.content.rect.height; return; } } if (ele.type == "Textarea") { size.h = ele.geometry.textareaContent.rect.height; return; // size.h = TextareaGeometry.getContentSize3(_ele).h; return; // size.h = TextareaGeometry.getContentSize2(ele).h; return; } // if (ele.type == "Textarea") { size.h = ele.style.contentSkin.textArea.CalcSize(ele.data.GUIcontent).y; return; } // if (ele.type == "Textarea") { size.h = ele.style.contentSkin.textArea.CalcHeight(ele.data.GUIcontent, size.w); } /* if (ele.type == "Textarea") { * Size ContentSize = TextareaGeometry.getContentSize(ele); * ele.geometry.textareaContent.rect = new Rect(0, 0, ContentSize.w, ContentSize.h); * size.h =; return; * } * if (ele.type == "Textarea") * { * Size ContentSize = TextareaGeometry.getContentSize(ele); * ele.geometry.textareaContent.rect = new Rect(0, 0, ContentSize.w, ContentSize.h); * // size.h = ContentSize.h; * size.h = ele.style.contentSkin.textArea.CalcHeight(ele.data.GUIcontent,size.w); * return; * * } */ if (ele.type == "Button") { size.h = ele.style.bodySkin.button.CalcSize(ele.data.GUIcontent).y; return; } } //Relative if (values.relHeight) { size.h = values.height * parent.geometry.tabBody.rect.height; return; } //Literal size.h = values.height; return; }
public static Size getHeaderSize(TabType.Component tab) { if (tab.data.type == SubType.TabType.Panel) { return(new Size(0, 0)); } SubType.SizeGeneric branchValues = tab.data.branchValues.tab.geometry.tabHeader.Size; SubType.SizeGeneric values = tab.geometry.tabHeader.Size; //branch if (values.wFollowBranch || branchValues.wFollowBranch) { values = branchValues; } //TabGeometry.Body Body = new .width, Size tabBodySize = new Size(new Body(tab).rect); //if (tab.data.isRoot) { tabBodySize = new Size(Screen.width, Screen.height); } else { tabBodySize = new Size(tab.structure.tabParent.tab.geometry.tabContainer.rect); } Size headerContentSize = new Size(tab.geometry.tabHeaderContent.rect); Size size = new Size(0, 0); if (values.wFitChildren) { size.w = headerContentSize.w; } else { if (values.relWidth) { size.w = values.width * tabBodySize.w; } else { size.w = values.width; } } //Height values = tab.geometry.tabHeader.Size; if (values.hFollowBranch || branchValues.hFollowBranch) { values = branchValues; } if (values.hFitChildren) { size.h = headerContentSize.h; } else { if (values.relHeight) { size.h = values.height * tabBodySize.h; } else { size.h = values.height; } } return(size); }