| 436 GridDef *rows = calloc(nrows, sizeof(GridDef)); |
436 GridDef *rows = calloc(nrows, sizeof(GridDef)); |
| 437 int num_cols_expanding = 0; |
437 int num_cols_expanding = 0; |
| 438 int num_rows_expanding = 0; |
438 int num_rows_expanding = 0; |
| 439 int req_width = w->mywidget.padding_left + w->mywidget.padding_right; |
439 int req_width = w->mywidget.padding_left + w->mywidget.padding_right; |
| 440 int req_height = w->mywidget.padding_top + w->mywidget.padding_bottom; |
440 int req_height = w->mywidget.padding_top + w->mywidget.padding_bottom; |
| |
441 int width = w->core.width; |
| |
442 int height = w->core.height; |
| 441 |
443 |
| 442 //printf("container width: %d\n", (int)w->core.width); |
444 //printf("container width: %d\n", (int)w->core.width); |
| 443 |
445 |
| 444 // calculate the minimum size requirements for all columns and rows |
446 // calculate the minimum size requirements for all columns and rows |
| 445 // we need to run this 2 times: for widgets without colspan/rowspan first |
447 // we need to run this 2 times: for widgets without colspan/rowspan first |
| 598 |
600 |
| 599 } |
601 } |
| 600 |
602 |
| 601 // how much space can we add to each expanding col/row |
603 // how much space can we add to each expanding col/row |
| 602 int hexpand = 0; |
604 int hexpand = 0; |
| 603 int width_diff = (int)w->core.width - req_width; |
605 int width_diff = width - req_width; |
| 604 int hexpand2 = 0; |
606 int hexpand2 = 0; |
| 605 if(width_diff > 0 && num_cols_expanding > 0) { |
607 if(width_diff > 0 && num_cols_expanding > 0) { |
| 606 hexpand = width_diff / num_cols_expanding; |
608 hexpand = width_diff / num_cols_expanding; |
| 607 hexpand2 = width_diff-hexpand*num_cols_expanding; |
609 hexpand2 = width_diff-hexpand*num_cols_expanding; |
| 608 } |
610 } |
| 652 cwidth += cols[constraints->grid.x+j].size + (j > 0 ? w->mywidget.columnspacing : 0); |
654 cwidth += cols[constraints->grid.x+j].size + (j > 0 ? w->mywidget.columnspacing : 0); |
| 653 } |
655 } |
| 654 } |
656 } |
| 655 width = cwidth; |
657 width = cwidth; |
| 656 } else { |
658 } else { |
| 657 width = c.size - w->mywidget.columnspacing; |
659 width = c.size - w->mywidget.columnspacing - constraints->grid.margin_left - constraints->grid.margin_right; |
| 658 } |
660 } |
| 659 } |
661 } |
| 660 if(constraints->grid.vfill) { |
662 if(constraints->grid.vfill) { |
| 661 if(constraints->grid.rowspan > 1) { |
663 if(constraints->grid.rowspan > 1) { |
| 662 Dimension cheight = 0; |
664 Dimension cheight = 0; |
| 665 cheight += rows[constraints->grid.y+j].size + (j > 0 ? w->mywidget.rowspacing : 0); |
667 cheight += rows[constraints->grid.y+j].size + (j > 0 ? w->mywidget.rowspacing : 0); |
| 666 } |
668 } |
| 667 } |
669 } |
| 668 height = cheight; |
670 height = cheight; |
| 669 } else { |
671 } else { |
| 670 height = r.size - w->mywidget.rowspacing; |
672 height = r.size - w->mywidget.rowspacing - constraints->grid.margin_top - constraints->grid.margin_bottom; |
| 671 } |
673 } |
| 672 } |
674 } |
| 673 |
675 |
| 674 if(width > 0 && height > 0) { |
676 if(width > 0 && height > 0) { |
| 675 XtConfigureWidget(child, x, y, width, height, child->core.border_width); |
677 XtConfigureWidget(child, x, y, width, height, child->core.border_width); |