From 22add8fcbb8cb09c776f048ce091f3b856f7a902 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 13 Oct 2016 09:40:45 +0300 Subject: [PATCH] add colWidth and rowHeight getters back --- src/dlangui/widgets/grid.d | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/dlangui/widgets/grid.d b/src/dlangui/widgets/grid.d index 089b295a..d099e512 100644 --- a/src/dlangui/widgets/grid.d +++ b/src/dlangui/widgets/grid.d @@ -584,6 +584,20 @@ class GridWidgetBase : ScrollWidgetBase, GridModelAdapter, MenuItemActionHandler updateCumulativeSizes(); } + /// get column width, 0 is header column + int colWidth(int col) { + if (col < 0 || col >= _colWidths.length) + return 0; + return _colWidths[col]; + } + + /// get row height, 0 is header row + int rowHeight(int row) { + if (row < 0 || row >= _rowHeights.length) + return 0; + return _rowHeights[row]; + } + /// returns cell rectangle relative to client area; row 0 is col headers row; col 0 is row headers column Rect cellRect(int x, int y) { return cellRectScroll(x, y); @@ -1278,7 +1292,7 @@ class GridWidgetBase : ScrollWidgetBase, GridModelAdapter, MenuItemActionHandler } void autoFitColumnWidth(int i) { - _colWidths[i] = (i < _headerCols && !_showRowHeaders) ? 0 : measureColWidth(i) + (BACKEND_CONSOLE ? 1 : 5); + _colWidths[i] = (i < _headerCols && !_showRowHeaders) ? 0 : measureColWidth(i) + (BACKEND_CONSOLE ? 1 : 3.pointsToPixels); } /// extend specified column width to fit client area if grid width