コード例 #1
0
    private void SetGeometry()
    {
        textarea.geometry.depth = textarea.structure.tabParent.tab.geometry.depth - 1;


        Size ContentSize = TextareaGeometry.getContentSize(this);

        textarea.geometry.textareaContent.rect = new Rect(0, 0, ContentSize.w, ContentSize.h);

        GenericGeometry.ofElement Body = new GenericGeometry.ofElement(this);
        textarea.geometry.textareaBody.rect = Body.rect;// new Rect(bodyPosition.x, bodyPosition.y, bodySize.w, bodySize.h);



        // Body = new GenericGeometry.ofElement(this);
        //  textarea.geometry.textareaBody.rect = Body.rect;// new Rect(bodyPosition.x, bodyPosition.y, bodySize.w, bodySize.h);
        //    textarea.geometry.textareaBody.rect.height = textarea.geometry.textareaContent.rect.height;

        //  textarea.geometry.textareaBody.rect = new GenericGeometry.ofElement(this).rect;


        textarea.style.bodySkin = GenericGeometry.getSkin(textarea.style.bodySkin, textarea.style.bodySkinFollowBranch, textarea.structure.tabParent.tab.data.branchValues.textarea.style.bodySkin, textarea.structure.tabParent.tab.data.branchValues.textarea.style.bodySkinFollowBranch);

        textarea.geometry.scroll.elementScrollModeStyles = GenericGeometry.getScrollStyles(textarea.style.bodySkin, textarea.geometry.scroll, textarea.structure.tabParent.tab.data.branchValues.textarea.geometry.scroll);
        textarea.style.contentSkin = GenericGeometry.getSkin(textarea.style.contentSkin, textarea.style.contentSkinFollowBranch, textarea.structure.tabParent.tab.data.branchValues.textarea.style.contentSkin, textarea.structure.tabParent.tab.data.branchValues.textarea.style.contentSkinFollowBranch);



        textarea.structure.tabParent.UpdateBodyContentSize();
    }
    private void SetGeometry()
    {
        button.geometry.depth = button.structure.tabParent.tab.geometry.depth - 1;


        button.style.bodySkin = GenericGeometry.getSkin(button.style.bodySkin, button.style.bodySkinFollowBranch, button.structure.tabParent.tab.data.branchValues.tabButton.style.bodySkin, button.structure.tabParent.tab.data.branchValues.tabButton.style.bodySkinFollowBranch);
        GenericGeometry.ofElement Body = new GenericGeometry.ofElement(this);



        button.geometry.buttonBody.rect = Body.rect;
    }
    private void SetTabButtonsGeometry()
    {
        //Create Buttons
        // tab.tabButtons.Clear();

        //Set buttons style
        for (int i = 0; i < tab.structure.childrenTabs.Count; i++)
        {
            ///////   if (tab.structure.childrenTabs[i].transform.parent != transform) { continue; }


            tab.structure.childrenTabs[i].tab.tabButton.style.bodySkin = GenericGeometry.getSkin(tab.structure.childrenTabs[i].tab.tabButton.style.bodySkin,
                                                                                                 tab.structure.childrenTabs[i].tab.tabButton.style.bodySkinFollowBranch,
                                                                                                 tab.data.branchValues.tabButton.style.bodySkin,
                                                                                                 tab.data.branchValues.tabButton.style.bodySkinFollowBranch);
        }



        Size headerSize = new Size(tab.geometry.tabHeader.rect.width, tab.geometry.tabHeader.rect.height);

        tab.geometry.tabHeaderContent.rect = Rect.zero;



        if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Top)
        {
            float offset = 0;
            for (int i = 0; i < tab.structure.childrenTabs.Count; i++)
            {
                TabGeometry.TabButton tabButton = new TabGeometry.TabButton(new Vector2(offset, 0), headerSize, tab.structure.childrenTabs[i].tab.tabButton, tab.data.branchValues.tabButton);


                // tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect = tabButton.rect;  //   geo.ConvertHeaderButtonSize(new Vector2(m.geometryData.Header.Rect.width, m.geometryData.Header.Rect.height), m.tabButtons[i], new Vector2(0,0))
                tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect = tabButton.rect; //   geo.ConvertHeaderButtonSize(new Vector2(m.geometryData.Header.Rect.width, m.geometryData.Header.Rect.height), m.tabButtons[i], new Vector2(0,0))
                offset += tabButton.size.w;
                tab.geometry.tabHeaderContent.rect = AddToRect(tab.geometry.tabHeaderContent.rect, tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect);
            }
        }
        else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Bottom)
        {
            float offset = 0;
            for (int i = 0; i < tab.structure.childrenTabs.Count; i++)
            {
                TabGeometry.TabButton tabButton = new TabGeometry.TabButton(new Vector2(offset, 0), headerSize, tab.structure.childrenTabs[i].tab.tabButton, tab.data.branchValues.tabButton);

                //      Vector2 buttonSize = ButtonGeometry.getContainerSize(headerSize, tab.structure.childrenTabs[i].tab.tabButton, tab.data.branchValues.tabButton);
                //  Vector2 buttonPosition = new Vector2(offset, tab.geometry.tabContainer.rect.height - tab.geometry.tabHeader.rect.height);
                //    Vector2 buttonPosition = new Vector2(offset, 0);
                tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect = tabButton.rect;// new Rect(buttonPosition, buttonSize);  //   geo.ConvertHeaderButtonSize(new Vector2(m.geometryData.Header.Rect.width, m.geometryData.Header.Rect.height), m.tabButtons[i], new Vector2(0,0))
                offset += tabButton.size.w;
                tab.geometry.tabHeaderContent.rect = AddToRect(tab.geometry.tabHeaderContent.rect, tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect);
            }
        }
        else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Left)
        {
            float offset = 0;
            for (int i = 0; i < tab.structure.childrenTabs.Count; i++)
            {
                TabGeometry.TabButton tabButton = new TabGeometry.TabButton(new Vector2(0, offset), headerSize, tab.structure.childrenTabs[i].tab.tabButton, tab.data.branchValues.tabButton);

                tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect = tabButton.rect;
                offset += tabButton.size.h;
                tab.geometry.tabHeaderContent.rect = AddToRect(tab.geometry.tabHeaderContent.rect, tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect);
            }
        }
        else if (tab.geometry.tabHeader.position == SubType.THPSR.Position.Right)
        {
            float offset = 0;
            for (int i = 0; i < tab.structure.childrenTabs.Count; i++)
            {
                TabGeometry.TabButton tabButton = new TabGeometry.TabButton(new Vector2(0, offset), headerSize, tab.structure.childrenTabs[i].tab.tabButton, tab.data.branchValues.tabButton);

                tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect = tabButton.rect;// new Rect(buttonPosition, buttonSize);  //   geo.ConvertHeaderButtonSize(new Vector2(m.geometryData.Header.Rect.width, m.geometryData.Header.Rect.height), m.tabButtons[i], new Vector2(0,0))
                offset += tabButton.size.h;
                tab.geometry.tabHeaderContent.rect = AddToRect(tab.geometry.tabHeaderContent.rect, tab.structure.childrenTabs[i].tab.tabButton.geometry.buttonBody.rect);
            }
        }
    }
    private void SetGeometry()
    {
        //Content First
        //   UpdateBodyContentSize();


        // Container
        GenericGeometry.ofElement Container = new GenericGeometry.ofElement(this);


        if (tab.data.dropdown)
        {
            //Position set by button
            tab.geometry.tabContainer.rect.width  = Container.rect.width;
            tab.geometry.tabContainer.rect.height = Container.rect.height;
        }
        else
        {
            tab.geometry.tabContainer.rect = Container.rect;
        }

        tab.style.containerSkin = GenericGeometry.getSkin(tab.style.containerSkin, tab.style.containerSkinFollowBranch, tab.data.branchValues.tab.style.containerSkin, tab.data.branchValues.tab.style.containerSkin);



        // Header
        if (tab.data.type == SubType.TabType.Tab)
        {
            tab.geometry.tabHeader.rect = new TabGeometry.Header(tab).rect;

            SetTabButtonsGeometry();



            //Recalculate header if it fits children

            //Get Branch geometries or component geometries

            //SubType.SizeGeneric headerSizeValues = new SubType.SizeGeneric() ;

            bool wFitChildren = false;
            bool hFitChildren = false;

            if ((tab.geometry.tabHeader.Size.wFollowBranch || tab.data.branchValues.tab.geometry.tabHeader.Size.wFollowBranch))
            {
                wFitChildren = tab.data.branchValues.tab.geometry.tabHeader.Size.wFitChildren;
            }
            else
            {
                wFitChildren = tab.geometry.tabHeader.Size.wFitChildren;
            }
            if ((tab.geometry.tabHeader.Size.hFollowBranch || tab.data.branchValues.tab.geometry.tabHeader.Size.hFollowBranch))
            {
                hFitChildren = tab.data.branchValues.tab.geometry.tabHeader.Size.hFitChildren;
            }
            else
            {
                hFitChildren = tab.geometry.tabHeader.Size.hFitChildren;
            }


            //Resuze header
            if (wFitChildren)
            {
                tab.geometry.tabHeader.rect.width = new TabGeometry.Header(tab).rect.width;
            }
            if (hFitChildren)
            {
                tab.geometry.tabHeader.rect.height = new TabGeometry.Header(tab).rect.height;
            }


            tab.style.headerSkin = GenericGeometry.getSkin(tab.style.headerSkin, tab.style.headerSkinFollowBranch, tab.data.branchValues.tab.style.headerSkin, tab.data.branchValues.tab.style.headerSkin);
            tab.geometry.tabHeader.scroll.elementScrollModeStyles = GenericGeometry.getScrollStyles(tab.style.headerSkin, tab.geometry.tabHeader.scroll, tab.data.branchValues.tab.geometry.tabHeader.scroll);
        }



        // Body
        TabGeometry.Body Body = new TabGeometry.Body(tab);



        tab.geometry.tabBody.rect = Body.rect;// new Rect(Body.position, new Vector2(Body.size.w, Body.size.h));


        tab.style.bodySkin = GenericGeometry.getSkin(tab.style.bodySkin, tab.style.bodySkinFollowBranch, tab.data.branchValues.tab.style.bodySkin, tab.data.branchValues.tab.style.bodySkin);
        tab.geometry.tabBody.scroll.elementScrollModeStyles = GenericGeometry.getScrollStyles(tab.style.bodySkin, tab.geometry.tabBody.scroll, tab.data.branchValues.tab.geometry.tabBody.scroll);



        if (!tab.data.isRoot)
        {
            tab.structure.tabParent.UpdateBodyContentSize();
        }
    }