コード例 #1
0
        internal void Init(int fixedPaneIndex, float fixedPaneInitialDimension, TwoPaneSplitViewOrientation orientation)
        {
            this.m_Orientation               = orientation;
            this.m_FixedPaneIndex            = fixedPaneIndex;
            this.m_FixedPaneInitialDimension = fixedPaneInitialDimension;
            this.m_Content.RemoveFromClassList(TwoPaneSplitView.s_HorizontalClassName);
            this.m_Content.RemoveFromClassList(TwoPaneSplitView.s_VerticalClassName);
            bool flag = this.m_Orientation == TwoPaneSplitViewOrientation.Horizontal;

            if (flag)
            {
                this.m_Content.AddToClassList(TwoPaneSplitView.s_HorizontalClassName);
            }
            else
            {
                this.m_Content.AddToClassList(TwoPaneSplitView.s_VerticalClassName);
            }
            this.m_DragLineAnchor.RemoveFromClassList(TwoPaneSplitView.s_HandleDragLineAnchorHorizontalClassName);
            this.m_DragLineAnchor.RemoveFromClassList(TwoPaneSplitView.s_HandleDragLineAnchorVerticalClassName);
            bool flag2 = this.m_Orientation == TwoPaneSplitViewOrientation.Horizontal;

            if (flag2)
            {
                this.m_DragLineAnchor.AddToClassList(TwoPaneSplitView.s_HandleDragLineAnchorHorizontalClassName);
            }
            else
            {
                this.m_DragLineAnchor.AddToClassList(TwoPaneSplitView.s_HandleDragLineAnchorVerticalClassName);
            }
            this.m_DragLine.RemoveFromClassList(TwoPaneSplitView.s_HandleDragLineHorizontalClassName);
            this.m_DragLine.RemoveFromClassList(TwoPaneSplitView.s_HandleDragLineVerticalClassName);
            bool flag3 = this.m_Orientation == TwoPaneSplitViewOrientation.Horizontal;

            if (flag3)
            {
                this.m_DragLine.AddToClassList(TwoPaneSplitView.s_HandleDragLineHorizontalClassName);
            }
            else
            {
                this.m_DragLine.AddToClassList(TwoPaneSplitView.s_HandleDragLineVerticalClassName);
            }
            bool flag4 = this.m_Resizer != null;

            if (flag4)
            {
                this.m_DragLineAnchor.RemoveManipulator(this.m_Resizer);
                this.m_Resizer = null;
            }
            bool flag5 = this.m_Content.childCount != 2;

            if (flag5)
            {
                base.RegisterCallback <GeometryChangedEvent>(new EventCallback <GeometryChangedEvent>(this.OnPostDisplaySetup), TrickleDown.NoTrickleDown);
            }
            else
            {
                this.PostDisplaySetup();
            }
        }
コード例 #2
0
        private void PostDisplaySetup()
        {
            bool flag = this.m_Content.childCount != 2;

            if (flag)
            {
                Debug.LogError("TwoPaneSplitView needs exactly 2 children.");
            }
            else
            {
                this.m_LeftPane = this.m_Content[0];
                bool flag2 = this.m_FixedPaneIndex == 0;
                if (flag2)
                {
                    this.m_FixedPane = this.m_LeftPane;
                }
                else
                {
                    this.m_FlexedPane = this.m_LeftPane;
                }
                this.m_RightPane = this.m_Content[1];
                bool flag3 = this.m_FixedPaneIndex == 1;
                if (flag3)
                {
                    this.m_FixedPane = this.m_RightPane;
                }
                else
                {
                    this.m_FlexedPane = this.m_RightPane;
                }
                this.m_FixedPane.style.flexBasis   = StyleKeyword.Null;
                this.m_FixedPane.style.flexShrink  = StyleKeyword.Null;
                this.m_FixedPane.style.flexGrow    = StyleKeyword.Null;
                this.m_FlexedPane.style.flexGrow   = StyleKeyword.Null;
                this.m_FlexedPane.style.flexShrink = StyleKeyword.Null;
                this.m_FlexedPane.style.flexBasis  = StyleKeyword.Null;
                this.m_FixedPane.style.width       = StyleKeyword.Null;
                this.m_FixedPane.style.height      = StyleKeyword.Null;
                this.m_FlexedPane.style.width      = StyleKeyword.Null;
                this.m_FlexedPane.style.height     = StyleKeyword.Null;
                bool flag4 = this.m_Orientation == TwoPaneSplitViewOrientation.Horizontal;
                if (flag4)
                {
                    this.m_FixedPane.style.width  = this.m_FixedPaneInitialDimension;
                    this.m_FixedPane.style.height = StyleKeyword.Null;
                }
                else
                {
                    this.m_FixedPane.style.width  = StyleKeyword.Null;
                    this.m_FixedPane.style.height = this.m_FixedPaneInitialDimension;
                }
                this.m_FixedPane.style.flexShrink  = 0f;
                this.m_FixedPane.style.flexGrow    = 0f;
                this.m_FlexedPane.style.flexGrow   = 1f;
                this.m_FlexedPane.style.flexShrink = 0f;
                this.m_FlexedPane.style.flexBasis  = 0f;
                bool flag5 = this.m_Orientation == TwoPaneSplitViewOrientation.Horizontal;
                if (flag5)
                {
                    bool flag6 = this.m_FixedPaneIndex == 0;
                    if (flag6)
                    {
                        this.m_DragLineAnchor.style.left = this.m_FixedPaneInitialDimension;
                    }
                    else
                    {
                        this.m_DragLineAnchor.style.left = base.resolvedStyle.width - this.m_FixedPaneInitialDimension;
                    }
                }
                else
                {
                    bool flag7 = this.m_FixedPaneIndex == 0;
                    if (flag7)
                    {
                        this.m_DragLineAnchor.style.top = this.m_FixedPaneInitialDimension;
                    }
                    else
                    {
                        this.m_DragLineAnchor.style.top = base.resolvedStyle.height - this.m_FixedPaneInitialDimension;
                    }
                }
                bool flag8 = this.m_FixedPaneIndex == 0;
                int  dir;
                if (flag8)
                {
                    dir = 1;
                }
                else
                {
                    dir = -1;
                }
                bool flag9 = this.m_FixedPaneIndex == 0;
                if (flag9)
                {
                    this.m_Resizer = new TwoPaneSplitViewResizer(this, dir, this.m_Orientation);
                }
                else
                {
                    this.m_Resizer = new TwoPaneSplitViewResizer(this, dir, this.m_Orientation);
                }
                this.m_DragLineAnchor.AddManipulator(this.m_Resizer);
                base.UnregisterCallback <GeometryChangedEvent>(new EventCallback <GeometryChangedEvent>(this.OnPostDisplaySetup), TrickleDown.NoTrickleDown);
                base.RegisterCallback <GeometryChangedEvent>(new EventCallback <GeometryChangedEvent>(this.OnSizeChange), TrickleDown.NoTrickleDown);
            }
        }