/// <summary>
        /// Ends the table.
        /// </summary>
        public void EndTable()
        {
            if (this.ignoreScrollView) GUIHelper.PushEventType(EventType.Ignore);
            GUILayout.EndScrollView();
            if (this.ignoreScrollView) GUIHelper.PopEventType();

            if (Event.current.type == EventType.Repaint)
            {
                this.ScrollPos = this.nextScrollPos;
            }

            EditorGUILayout.EndVertical();
        }
        /// <summary>
        /// Begins the table.
        /// </summary>
        public void BeginTable(int rowCount)
        {
            marginFix         = marginFix ?? new GUIStyle();
            this.currColIndex = 0;
            this.rows         = this.rows ?? new TableRow[0];

            if (this.rowCount != rowCount)
            {
                this.isDirty  = 3;
                this.rowCount = rowCount;
            }

            this.RowIndexFrom = Math.Min(this.rowCount, this.RowIndexFrom);
            this.RowIndexTo   = Math.Min(this.rowCount, this.RowIndexTo);

            if (this.rows.Length != rowCount)
            {
                Array.Resize(ref this.rows, rowCount);
            }

            if (Event.current.type == EventType.Layout)
            {
                for (int i = this.RowIndexFrom; i < this.RowIndexTo; i++)
                {
                    var row = rows[i];
                    if (row.tmpRowHeight > 0)
                    {
                        if (row.rowHeight != row.tmpRowHeight)
                        {
                            this.isDirty  = 3;
                            row.rowHeight = row.tmpRowHeight;
                        }

                        row.tmpRowHeight = 0;
                        this.rows[i]     = row;
                    }
                }

                if (this.isDirty > 0)
                {
                    this.UpdateSpaceAllocation();
                    GUIHelper.RequestRepaint();
                }
            }

            if (Event.current.type == EventType.Repaint)
            {
                var p = GUIUtility.GUIToScreenPoint(this.OuterRect.position);
                if (this.outerVisibleRect != p)
                {
                    this.outerVisibleRect = p;
                    this.isDirty          = 3;
                }
            }

            var outerRect = EditorGUILayout.BeginVertical(this.GetOuterRectLayoutOptions());

            if (Event.current.type != EventType.Layout && outerRect.height > 1 || Event.current.type == EventType.Repaint)
            {
                if (this.OuterRect != outerRect)
                {
                    this.isDirty   = 3;
                    this.OuterRect = outerRect;
                }
            }

            Vector2 newScrollPos;

            if (this.DrawScrollBars())
            {
                newScrollPos = GUILayout.BeginScrollView(this.ScrollPos, false, false, this.GetScrollViewOptions(true));
            }
            else
            {
                this.ignoreScrollView = Event.current.rawType == EventType.ScrollWheel;
                if (this.ignoreScrollView)
                {
                    GUIHelper.PushEventType(EventType.Ignore);
                }
                newScrollPos = GUILayout.BeginScrollView(this.ScrollPos, false, false, GUIStyle.none, GUIStyle.none, this.GetScrollViewOptions(false));
                if (this.ignoreScrollView)
                {
                    GUIHelper.PopEventType();
                    this.isDirty = 3;
                }
            }

            if (newScrollPos != this.ScrollPos)
            {
                this.nextScrollPos = newScrollPos;
                this.isDirty       = 3;
            }

            var rect = GUILayoutUtility.GetRect(0, this.totalHeight);

            if (Event.current.type != EventType.Layout && rect.width > 1)
            {
                this.innerVisibleRect = GUIClipInfo.VisibleRect;

                if (this.DrawScrollView)
                {
                    var scrollDelta = this.nextScrollPos - this.ScrollPos;
                    this.innerVisibleRect.y += scrollDelta.y;

                    if (scrollDelta != Vector2.zero)
                    {
                        this.isDirty = 3;
                    }
                }

                if (rect != this.contentRect)
                {
                    this.isDirty = 3;
                }

                if (this.contentRect != rect)
                {
                    this.isDirty = 3;
                }

                this.contentRect = rect;
            }

            if (this.isDirty > 0)
            {
                GUIHelper.RequestRepaint();

                if (Event.current.type == EventType.Repaint)
                {
                    this.isDirty--;
                }
            }
        }