| 1353 | } |
| 1354 | |
| 1355 | void NWidgetStacked::SetupSmallestSize(Window *w) |
| 1356 | { |
| 1357 | /* Zero size plane selected */ |
| 1358 | if (this->shown_plane >= SZSP_BEGIN) { |
| 1359 | Dimension size = {0, 0}; |
| 1360 | Dimension padding = {0, 0}; |
| 1361 | Dimension fill = {(this->shown_plane == SZSP_HORIZONTAL), (this->shown_plane == SZSP_VERTICAL)}; |
| 1362 | Dimension resize = {(this->shown_plane == SZSP_HORIZONTAL), (this->shown_plane == SZSP_VERTICAL)}; |
| 1363 | /* Here we're primarily interested in the value of resize */ |
| 1364 | if (this->index >= 0) w->UpdateWidgetSize(this->index, size, padding, fill, resize); |
| 1365 | |
| 1366 | this->smallest_x = size.width; |
| 1367 | this->smallest_y = size.height; |
| 1368 | this->fill_x = fill.width; |
| 1369 | this->fill_y = fill.height; |
| 1370 | this->resize_x = resize.width; |
| 1371 | this->resize_y = resize.height; |
| 1372 | this->ApplyAspectRatio(); |
| 1373 | return; |
| 1374 | } |
| 1375 | |
| 1376 | /* First sweep, recurse down and compute minimal size and filling. */ |
| 1377 | this->smallest_x = 0; |
| 1378 | this->smallest_y = 0; |
| 1379 | this->fill_x = this->IsEmpty() ? 0 : 1; |
| 1380 | this->fill_y = this->IsEmpty() ? 0 : 1; |
| 1381 | this->resize_x = this->IsEmpty() ? 0 : 1; |
| 1382 | this->resize_y = this->IsEmpty() ? 0 : 1; |
| 1383 | for (const auto &child_wid : this->children) { |
| 1384 | child_wid->SetupSmallestSize(w); |
| 1385 | |
| 1386 | this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding.Horizontal()); |
| 1387 | this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding.Vertical()); |
| 1388 | this->fill_x = std::lcm(this->fill_x, child_wid->fill_x); |
| 1389 | this->fill_y = std::lcm(this->fill_y, child_wid->fill_y); |
| 1390 | this->resize_x = std::lcm(this->resize_x, child_wid->resize_x); |
| 1391 | this->resize_y = std::lcm(this->resize_y, child_wid->resize_y); |
| 1392 | this->ApplyAspectRatio(); |
| 1393 | } |
| 1394 | } |
| 1395 | |
| 1396 | void NWidgetStacked::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) |
| 1397 | { |
no test coverage detected