/// <summary> /// 테이블 그리기 /// </summary> void DrawTable(float detailHeight) { ColumnHeader = new MultiColumnHeader(new MultiColumnHeaderState(Columns)); ColumnHeader.height = 25; ColumnHeader.ResizeToFit(); // calculate the window visible rect GUILayout.FlexibleSpace(); var windowVisibleRect = GUILayoutUtility.GetLastRect(); windowVisibleRect.width = TabPosition.width; windowVisibleRect.height = TabPosition.height; // draw the column headers var headerRect = windowVisibleRect; headerRect.height = ColumnHeader.height; float xScroll = 0; ColumnHeader.OnGUI(headerRect, xScroll); GUILayout.Space(25); GUILayout.BeginArea(new Rect(TabPosition.x, TabPosition.y + TopAreaHeight, TabPosition.width, TabPosition.height - PageAreaHeight - detailHeight)); TableScrollPosition = GUILayout.BeginScrollView(TableScrollPosition); { DrawTableProcess(); } GUILayout.EndScrollView(); GUILayout.EndArea(); bool isChangingPage = false; GUILayout.BeginHorizontal(); GUILayout.Space(TabPosition.width * 0.1f); if (TargetDataList != null) { CreatePageButton(CurrentPageIndex == 0, "<", () => { --CurrentPageIndex; isChangingPage = true; }); foreach (var pageIndex in ShowingPageIndexList) { if (SkipPageIndex == pageIndex) { CreatePageButton(true, "...", () => { }); } else { CreatePageButton(pageIndex == CurrentPageIndex, (pageIndex + 1).ToString(), () => { CurrentPageIndex = pageIndex; isChangingPage = true; }); } } CreatePageButton(CurrentPageIndex == MaxPageIndex, ">", () => { ++CurrentPageIndex; isChangingPage = true; }); } GUILayout.Space(TabPosition.width * 0.1f); GUILayout.EndHorizontal(); if (isChangingPage) { RefreshPageList(); } //맨밑 경계 GUILayout.Space(7); Rect tableBottomBarRect = new Rect(TabPosition.x, TabPosition.height - detailHeight - TabPadding, TabPosition.width, 4); GUILayout.Space(3); }
public Rect Draw(Rect drawRect, int decalTop, float scrollX) { if (sNeedInit) { Init(); } if (mFramesBeforeCanModifyAutoresize > 0) { mFramesBeforeCanModifyAutoresize--; } bool canChangeAutoResizeMode = true; if (mPreviousWindowWidth != drawRect.width) { canChangeAutoResizeMode = false; ChangeAutoResize(true); } mPreviousWindowWidth = drawRect.width; float width = drawRect.width; if (!mFirstDraw) { float adaptedWidth = GetHeaderWidth(); if (canChangeAutoResizeMode) { if (adaptedWidth != mPreviousAdaptedWidth) { if (canChangeAutoResizeMode) { ChangeAutoResize(false); } mAdaptedSizeChangedLastFrame = true; mFramesBeforeCanAutoresize = 10; } else { if (mAdaptedSizeChangedLastFrame) { mFramesBeforeCanAutoresize--; } if (mFramesBeforeCanAutoresize < 0 && canChangeAutoResizeMode && mAdaptedSizeChangedLastFrame) { ChangeAutoResize(true); mAdaptedSizeChangedLastFrame = false; } } } mPreviousAdaptedWidth = adaptedWidth; if (adaptedWidth > width) { width = adaptedWidth; } if (IsColumnSizeDifferentFromSettings()) { ColumnSizeChanged(); } } Rect currentDrawPos = new Rect(new Vector2(-scrollX, mPadTop + decalTop), new Vector2(width, CTL_Styles.MAIN_TAB_MCH_HEIGHT)); currentDrawPos.width = currentDrawPos.width; mHeader.OnGUI(currentDrawPos, 0f); mFirstDraw = false; mPreviousWidth = width; return(currentDrawPos); }