Exemple #1
0
        public static Vector2 getHeaderPosition(TabType.Component tab, Size tabHeaderSize)
        {
            Size tabContainerSize; if (tab.data.isRoot)

            {
                tabContainerSize = new Size(Screen.width, Screen.height);
            }
            else
            {
                tabContainerSize = new Size(tab.structure.tabParent.tab.geometry.tabContainer.rect);
            }

            //Horizontal Display
            if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Top)
            {
                return(new Vector2(0, 0));
            }
            else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Bottom)
            {
                return(new Vector2(0, tabContainerSize.h - tabHeaderSize.h));
            }
            else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Left)
            {
                return(new Vector2(0, 0));
            }
            else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Right)
            {
                return(new Vector2(tabContainerSize.w - tabHeaderSize.w, 0));
            }

            return(new Vector2(0, 0));
        }
Exemple #2
0
        public Body(TabType.Component tab)
        {
            if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Top)
            {
                position = new Vector2(0, tab.geometry.tabHeader.rect.height);
                size     = new Size(tab.geometry.tabContainer.rect.width, tab.geometry.tabContainer.rect.height - tab.geometry.tabHeader.rect.height);
            }
            else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Bottom)
            {
                position = new Vector2(0, 0);
                size     = new Size(tab.geometry.tabContainer.rect.width, tab.geometry.tabContainer.rect.height - tab.geometry.tabHeader.rect.height);
            }
            else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Left)
            {
                position = new Vector2(tab.geometry.tabHeader.rect.width, 0);
                size     = new Size(tab.geometry.tabContainer.rect.width - tab.geometry.tabHeader.rect.width, tab.geometry.tabContainer.rect.height);
            }
            else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Right)
            {
                position = new Vector2(0, 0);
                size     = new Size(tab.geometry.tabContainer.rect.width - tab.geometry.tabHeader.rect.width, tab.geometry.tabContainer.rect.height);
            }

            rect = new Rect(position, new Vector2(size.w, size.h));
            rect = GenericGeometry.getRectWithScrollEdges(tab.style.bodySkin, rect, tab.geometry.tabBody.scroll, tab.data.branchValues.tab.geometry.tabBody.scroll);
        }
Exemple #3
0
        public Header(TabType.Component tab)
        {
            size     = getHeaderSize(tab);
            position = getHeaderPosition(tab, size);

            rect = new Rect(position, new Vector2(size.w, size.h));



            rect = GenericGeometry.getRectWithScrollEdges(tab.style.headerSkin, rect, tab.geometry.tabHeader.scroll, tab.data.branchValues.tab.geometry.tabHeader.scroll);
        }
        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 GenericPosition(Component _e, Size eSize)
        {
            _ele = _e;
            GenericValues val = new GenericValues(_ele);

            componentValues = val.componentPosition;
            branchValues    = val.branchPosition;
            parent          = val.parent;
            ele             = val.ele;

            index        = _ele.transform.GetSiblingIndex();
            brotherCount = _ele.transform.parent.childCount;

            SetX(eSize);
            SetY(eSize);
            SetPivot(eSize);
            setXStick(eSize);
        }
Exemple #7
0
        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);
        }
    //Get Generic
    public static GenericType.Component Generic(TabType.Component tab)
    {
        if (tab == null)
        {
            return(null);
        }
        GenericType.Component gen       = new GenericType.Component();
        GenericType.Data      data      = new GenericType.Data();
        GenericType.Geometry  geometry  = new GenericType.Geometry();
        GenericType.Structure structure = new GenericType.Structure();
        GenericType.Style     style     = new GenericType.Style();

        gen.data      = data;
        gen.geometry  = geometry;
        gen.structure = structure;
        gen.style     = style;

        //generic type
        gen.type = "Tab";

        //Data
        gen.data.name   = tab.data.name;
        gen.data.active = tab.data.active;
        gen.data.type   = tab.data.type;
        //gen.data.globalParams = tab.data.globalParams;

        // Full Geometries

        gen.geometry.tabHeader        = tab.geometry.tabHeader;
        gen.geometry.tabHeaderContent = tab.geometry.tabHeaderContent;
        gen.geometry.tabContainer     = tab.geometry.tabContainer;
        gen.geometry.tabBody          = tab.geometry.tabBody;
        gen.geometry.tabContent       = tab.geometry.tabContent;

        // Generic geometry
        gen.geometry.depth              = tab.geometry.depth;
        gen.geometry.header.rect        = tab.geometry.tabHeader.rect;
        gen.geometry.headerContent.rect = tab.geometry.tabHeaderContent.rect;
        gen.geometry.container.rect     = tab.geometry.tabContainer.rect;
        gen.geometry.body.rect          = tab.geometry.tabBody.rect;
        gen.geometry.content.rect       = tab.geometry.tabContent.rect;



        // Structure
        gen.structure.tabParent    = tab.structure.tabParent;
        gen.structure.childrenTabs = tab.structure.childrenTabs;
        //    gen.structure.childrenButtons = tab.structure.childrenButtons;
        //     gen.structure.childrenTextAreas = tab.structure.childrenTextAreas;
        gen.structure.children = tab.structure.children;

        // Style
        gen.style.headerSkinFollowBranch    = tab.style.headerSkinFollowBranch;
        gen.style.headerSkin                = tab.style.headerSkin;
        gen.style.headerContentSkin         = tab.style.headerContentSkin;
        gen.style.containerSkinFollowBranch = tab.style.containerSkinFollowBranch;
        gen.style.containerSkin             = tab.style.containerSkin;
        gen.style.bodySkinFollowBranch      = tab.style.bodySkinFollowBranch;
        gen.style.bodySkin    = tab.style.bodySkin;
        gen.style.contentSkin = tab.style.contentSkin;      //debug only



        return(gen);
    }