tgrid::request_reduce_*: remove misleading code

These functions operate by calling twidget::request_reduce_* functions for
child widgets and not by changing values in column_width_ and row_height_.
Now when they no longer do the latter at all, and I added a comment to
clarify how the code works, hopefully understanding the code will be easier
for future developers.
This commit is contained in:
Jyrki Vesterinen 2016-11-08 22:59:51 +02:00
parent 4457256f2b
commit 53bc8a7f1d

View file

@ -263,7 +263,6 @@ void tgrid::request_reduce_width(const unsigned maximum_width)
<< " pixels for column " << col << ".\n";
size.x -= reduction;
col_width_[col] = width;
reduced += reduction;
}
@ -340,6 +339,12 @@ void tgrid::request_reduce_height(const unsigned maximum_height)
wanted_height = 1;
}
/* Reducing the height of a widget causes the widget to save its new size
in twidget::layout_size_. After that, get_best_size() will return that
size and not the originally calculated optimal size.
Thus, it's perfectly correct that tgrid::calculate_best_size() that we
call later calls get_best_size() for child widgets as if size reduction
had never happened. */
const unsigned height = tgrid_implementation::row_request_reduce_height(
*this, row, wanted_height);
@ -351,7 +356,6 @@ void tgrid::request_reduce_height(const unsigned maximum_height)
<< " reduced " << reduction << " pixels.\n";
size.y -= reduction;
row_height_[row] = height;
reduced += reduction;
}