23 #include "../lout/msg.h" 24 #include "../lout/misc.hh" 25 #include "../lout/debug.hh" 31 int Table::CLASS_ID = -1;
33 Table::Table(
bool limitTextWidth)
36 registerName (
"dw::Table", &CLASS_ID);
37 setFlags (BLOCK_LEVEL);
38 setFlags (USES_HINTS);
39 setButtonSensitive(
false);
41 this->limitTextWidth = limitTextWidth;
74 for (
int i = 0; i < children->size (); i++) {
75 if (children->get(i)) {
76 switch (children->get(i)->type) {
78 delete children->get(i)->cell.widget;
80 case Child::SPAN_SPACE:
84 delete children->get(i);
88 for (
int i = 0; i < rowStyle->size (); i++)
89 if (rowStyle->get (i))
90 rowStyle->get(i)->unref ();
107 forceCalcCellSizes ();
112 requisition->
width = getStyle()->boxDiffWidth ()
113 + (numCols + 1) * getStyle()->hBorderSpacing;
114 for (
int col = 0; col < numCols; col++)
115 requisition->
width += colWidths->get (col);
118 getStyle()->boxDiffHeight () + cumHeight->get (numRows)
119 + getStyle()->vBorderSpacing;
131 forceCalcColumnExtremes ();
134 (numCols + 1) * getStyle()->hBorderSpacing
135 + getStyle()->boxDiffWidth ();
136 for (
int col = 0; col < numCols; col++) {
137 extremes->
minWidth += colExtremes->getRef(col)->minWidth;
138 extremes->
maxWidth += colExtremes->getRef(col)->maxWidth;
149 _MSG(
" Table::getExtremesImpl, {%d, %d} numCols=%d\n",
162 allocation->
y + getStyle()->boxOffsetY () + getStyle()->vBorderSpacing;
164 allocation->
x + getStyle()->boxOffsetX () + getStyle()->hBorderSpacing;
166 for (
int col = 0; col < numCols; col++) {
167 for (
int row = 0; row < numRows; row++) {
168 int n = row * numCols + col;
169 if (childDefined (n)) {
171 (children->get(n)->cell.colspanEff - 1)
172 * getStyle()->hBorderSpacing;
173 for (
int i = 0; i < children->get(n)->cell.colspanEff; i++)
174 width += colWidths->get (col + i);
179 children->get(n)->cell.widget->sizeRequest (&childRequisition);
181 childAllocation.
x = x;
182 childAllocation.
y = cumHeight->get (row) + offy;
183 childAllocation.
width = width;
186 cumHeight->get (row + children->get(n)->cell.rowspan)
187 - cumHeight->get (row) - getStyle()->vBorderSpacing
188 - childRequisition.
ascent;
189 children->get(n)->cell.widget->sizeAllocate (&childAllocation);
193 x += colWidths->get (col) + getStyle()->hBorderSpacing;
197 void Table::resizeDrawImpl ()
199 queueDrawArea (redrawX, 0, allocation.width - redrawX, getHeight ());
200 queueDrawArea (0, redrawY, allocation.width, getHeight () - redrawY);
201 redrawX = allocation.width;
202 redrawY = getHeight ();
205 void Table::setWidth (
int width)
208 if (availWidth != width || limitTextWidth) {
209 _MSG(
" Table::setWidth %d\n", width);
211 queueResize (0,
false);
215 void Table::setAscent (
int ascent)
217 if (availAscent != ascent) {
218 availAscent = ascent;
219 queueResize (0,
false);
223 void Table::setDescent (
int descent)
225 if (availDescent != descent) {
226 availDescent = descent;
227 queueResize (0,
false);
234 drawWidgetBox (view, area,
false);
237 int offx = getStyle()->boxOffsetX () + getStyle()->hBorderSpacing;
238 int offy = getStyle()->boxOffsetY () + getStyle()->vBorderSpacing;
239 int width = getContentWidth ();
243 for (
int row = 0; row < numRows; row++) {
244 if (rowStyle->get (row))
245 drawBox (view, rowStyle->get (row), area,
246 offx, offy + cumHeight->get (row),
247 width - 2*getStyle()->hBorderSpacing,
248 cumHeight->get (row + 1) - cumHeight->get (row)
249 - getStyle()->vBorderSpacing,
false);
253 for (
int i = 0; i < children->size (); i++) {
254 if (childDefined (i)) {
255 Widget *child = children->get(i)->cell.widget;
257 if (child->intersects (area, &childArea))
258 child->
draw (view, &childArea);
263 void Table::removeChild (Widget *child)
273 void Table::addCell (Widget *widget,
int colspan,
int rowspan)
275 const int maxspan = 100;
281 if (colspan > maxspan || colspan < 0) {
282 MSG_WARN(
"colspan = %d is set to %d.\n", colspan, maxspan);
285 if (rowspan > maxspan || rowspan <= 0) {
286 MSG_WARN(
"rowspan = %d is set to %d.\n", rowspan, maxspan);
292 MSG(
"addCell: cell without row.\n");
297 MSG_WARN(
"Last cell had colspan=0.\n");
302 colspanEff =
misc::max (numCols - curCol, 1);
305 colspanEff = colspan;
308 while (curCol < numCols &&
309 (child = children->get(curRow * numCols + curCol)) != NULL &&
310 child->
type == Child::SPAN_SPACE)
313 _MSG(
"Table::addCell numCols=%d,curCol=%d,colspan=%d,colspanEff=%d\n",
314 numCols, curCol, colspan, colspanEff);
317 if (curRow + rowspan > numRows)
318 reallocChildren (numCols, curRow + rowspan);
319 if (curCol + colspanEff > numCols)
320 reallocChildren (curCol + colspanEff, numRows);
323 for (
int col = 0; col < colspanEff; col++)
324 for (
int row = 0; row < rowspan; row++)
325 if (!(col == 0 && row == 0)) {
326 int i = (curRow + row) * numCols + curCol + col;
328 child = children->get(i);
330 MSG(
"Overlapping spans in table.\n");
331 assert(child->
type == Child::SPAN_SPACE);
334 child =
new Child ();
335 child->
type = Child::SPAN_SPACE;
338 children->set (i, child);
342 child =
new Child ();
343 child->
type = Child::CELL;
344 child->
cell.widget = widget;
345 child->
cell.colspanOrig = colspan;
346 child->
cell.colspanEff = colspanEff;
347 child->
cell.rowspan = rowspan;
348 children->set (curRow * numCols + curCol, child);
350 curCol += colspanEff;
352 widget->setParent (
this);
353 if (rowStyle->get (curRow))
354 widget->setBgColor (rowStyle->get(curRow)->backgroundColor);
355 queueResize (0,
true);
359 for (
int row = 0; row < numRows; row++) {
360 for (
int col = 0; col < numCols; col++) {
361 int n = row * numCols + col;
362 if (!(child = children->get (n))) {
364 }
else if (children->get(n)->type == Child::CELL) {
365 MSG(
"[CELL rs=%d] ", child->
cell.rowspan);
366 }
else if (children->get(n)->type == Child::SPAN_SPACE) {
367 MSG(
"[SPAN rs=%d] ", child->
cell.rowspan);
382 if (curRow >= numRows)
383 reallocChildren (numCols, curRow + 1);
385 if (rowStyle->get (curRow))
386 rowStyle->get(curRow)->unref ();
388 rowStyle->set (curRow, style);
400 for (
int row = 0; row <= numRows; row++) {
401 int n = curCol + row * numCols;
402 if (childDefined (n)) {
403 child = children->get(n)->cell.widget;
412 void Table::reallocChildren (
int newNumCols,
int newNumRows)
414 assert (newNumCols >= numCols);
415 assert (newNumRows >= numRows);
417 children->setSize (newNumCols * newNumRows);
419 if (newNumCols > numCols) {
421 for (
int row = newNumRows - 1; row >= 0; row--) {
422 int colspan0Col = -1, colspan0Row = -1;
425 for (
int col = numCols - 1; col >= 0; col--) {
426 int n = row * newNumCols + col;
427 children->set (n, children->get (row * numCols + col));
428 if (children->get (n)) {
429 switch (children->get(n)->type) {
431 if (children->get(n)->cell.colspanOrig == 0) {
434 children->get(n)->cell.colspanEff = newNumCols - col;
437 case Child::SPAN_SPACE:
438 if (children->get(children->get(n)->spanSpace.startRow
440 children->get(n)->spanSpace.startCol)
441 ->cell.colspanOrig == 0) {
442 colspan0Col = children->get(n)->spanSpace.startCol;
443 colspan0Row = children->get(n)->spanSpace.startRow;
451 if (colspan0Col == -1) {
452 for (
int col = numCols; col < newNumCols; col++)
453 children->set (row * newNumCols + col, NULL);
455 for (
int col = numCols; col < newNumCols; col++) {
457 child->
type = Child::SPAN_SPACE;
460 children->set (row * newNumCols + col, child);
467 for (
int row = numRows; row < newNumRows; row++)
468 for (
int col = 0; col < newNumCols; col++)
469 children->set (row * newNumCols + col, NULL);
472 rowStyle->setSize (newNumRows);
473 for (
int row = numRows; row < newNumRows; row++)
474 rowStyle->set (row, NULL);
477 numCols = newNumCols;
478 numRows = newNumRows;
483 void Table::calcCellSizes ()
486 forceCalcCellSizes ();
490 void Table::forceCalcCellSizes ()
492 int totalWidth = 0, childHeight, forceTotalWidth = 1;
496 getExtremes (&extremes);
512 totalWidth = availWidth;
516 _MSG(
" availWidth = %d\n", availWidth);
517 _MSG(
" totalWidth1 = %d\n", totalWidth);
521 totalWidth = totalWidth
522 - (numCols + 1) * getStyle()->hBorderSpacing
523 - getStyle()->boxDiffWidth ();
525 _MSG(
" totalWidth2 = %d curCol=%d\n", totalWidth,curCol);
528 colWidths->setSize (numCols, 0);
529 cumHeight->setSize (numRows + 1, 0);
530 rowSpanCells->setSize (0);
531 baseline->setSize (numRows);
534 _MSG(
" getStyle()->boxDiffWidth() = %d\n", getStyle()->boxDiffWidth());
535 _MSG(
" getStyle()->hBorderSpacing = %d\n", getStyle()->hBorderSpacing);
538 apportion_percentages2 (totalWidth, forceTotalWidth);
540 apportion2 (totalWidth, forceTotalWidth);
543 for (
int row = 0; row < numRows; row++) {
549 for (
int col = 0; col < numCols; col++) {
550 int n = row * numCols + col;
551 if (childDefined (n)) {
552 int width = (children->get(n)->cell.colspanEff - 1)
553 * getStyle()->hBorderSpacing;
554 for (
int i = 0; i < children->get(n)->cell.colspanEff; i++)
555 width += colWidths->get (col + i);
558 children->get(n)->cell.widget->setWidth (width);
559 children->get(n)->cell.widget->sizeRequest (&childRequisition);
560 childHeight = childRequisition.
ascent + childRequisition.
descent;
561 if (children->get(n)->cell.rowspan == 1) {
562 rowHeight =
misc::max (rowHeight, childHeight);
564 rowSpanCells->increase();
565 rowSpanCells->set(rowSpanCells->size()-1, n);
570 setCumHeight (row + 1,
571 cumHeight->get (row) + rowHeight + getStyle()->vBorderSpacing);
578 void Table::apportionRowSpan ()
580 int *rowHeight = NULL;
582 for (
int c = 0; c < rowSpanCells->size(); ++c) {
583 int n = rowSpanCells->get(c);
584 int row = n / numCols;
585 int rs = children->get(n)->cell.rowspan;
586 int sumRows = cumHeight->get(row+rs) - cumHeight->get(row);
588 children->get(n)->cell.widget->sizeRequest (&childRequisition);
589 int spanHeight = childRequisition.
ascent + childRequisition.
descent 590 + getStyle()->vBorderSpacing;
591 if (sumRows >= spanHeight)
595 _MSG(
"Short cell %d, sumRows=%d spanHeight=%d\n",
596 n,sumRows,spanHeight);
600 rowHeight =
new int[numRows];
601 for (
int i = 0; i < numRows; i++)
602 rowHeight[i] = cumHeight->get(i+1) - cumHeight->get(i);
605 MSG(
" rowHeight { ");
606 for (
int i = 0; i < numRows; i++)
607 MSG(
"%d ", rowHeight[i]);
612 int cumHnew_i = 0, cumh_i = 0, hnew_i;
613 for (
int i = row; i < row + rs; ++i) {
615 sumRows == 0 ? (int)((
float)(spanHeight-cumHnew_i)/(row+rs-i)) :
616 (sumRows-cumh_i) <= 0 ? 0 :
617 (int)((
float)(spanHeight-cumHnew_i)*rowHeight[i]/(sumRows-cumh_i));
619 _MSG(
" i=%-3d h=%d hnew_i=%d =%d*%d/%d cumh_i=%d cumHnew_i=%d\n",
620 i,rowHeight[i],hnew_i,
621 spanHeight-cumHnew_i,rowHeight[i],sumRows-cumh_i,
625 cumh_i += rowHeight[i];
626 rowHeight[i] = hnew_i;
629 for (
int i = 0; i < numRows; ++i)
630 setCumHeight (i+1, cumHeight->get(i) + rowHeight[i]);
641 void Table::calcColumnExtremes ()
643 if (extremesChanged ())
644 forceCalcColumnExtremes ();
651 void Table::forceCalcColumnExtremes ()
653 _MSG(
" Table::forceCalcColumnExtremes numCols=%d\n", numCols);
658 colExtremes->setSize (numCols);
659 colPercents->setSize (numCols);
660 colSpanCells->setSize (0);
662 for (
int col = 0; col < numCols; col++) {
663 colExtremes->getRef(col)->minWidth = 0;
664 colExtremes->getRef(col)->maxWidth = 0;
667 for (
int row = 0; row < numRows; row++) {
668 int n = row * numCols + col;
669 if (!childDefined (n))
671 if (children->get(n)->cell.colspanEff == 1) {
673 int cellMinW, cellMaxW, pbm;
675 children->get(n)->cell.widget->getStyle()->width;
676 pbm = (numCols + 1) * getStyle()->hBorderSpacing
677 + children->get(n)->cell.widget->getStyle()->boxDiffWidth ();
678 children->get(n)->cell.widget->getExtremes (&cellExtremes);
689 _MSG(
"FCCE, col%d colMin,colMax,cellMin,cellMax = %d,%d,%d,%d\n",
691 colExtremes->getRef(col)->minWidth,
692 colExtremes->getRef(col)->maxWidth,
695 colExtremes->getRef(col)->minWidth =
696 misc::max (colExtremes->getRef(col)->minWidth, cellMinW);
697 colExtremes->getRef(col)->maxWidth =
699 colExtremes->getRef(col)->maxWidth,
706 colPercents->set(col, width);
717 colSpanCells->increase();
718 colSpanCells->set(colSpanCells->size()-1, n);
725 for (
int c = 0; c < colSpanCells->size(); ++c) {
727 int cellMinW, cellMaxW, pbm;
728 int n = colSpanCells->get(c);
729 int col = n % numCols;
730 int cs = children->get(n)->cell.colspanEff;
732 children->get(n)->cell.widget->getStyle()->width;
733 pbm = (numCols + 1) * getStyle()->hBorderSpacing
734 + children->get(n)->cell.widget->getStyle()->boxDiffWidth ();
735 children->get(n)->cell.widget->getExtremes (&cellExtremes);
745 int minSumCols = 0, maxSumCols = 0;
746 for (
int i = 0; i < cs; ++i) {
747 minSumCols += colExtremes->getRef(col+i)->minWidth;
748 maxSumCols += colExtremes->getRef(col+i)->maxWidth;
751 _MSG(
"cs=%d spanWidth=%d,%d sumCols=%d,%d\n",
752 cs,cellMinW,cellMaxW,minSumCols,maxSumCols);
754 if (minSumCols >= cellMinW && maxSumCols >= cellMaxW)
759 cellMinW - (cs-1) * getStyle()->hBorderSpacing),
761 cellMaxW - (cs-1) * getStyle()->hBorderSpacing);
763 if (minSumCols == 0) {
765 minSumCols = spanMinW; maxSumCols = spanMaxW;
766 int minW = spanMinW, maxW = spanMaxW;
767 for (
int i = 0; i < cs; ++i) {
768 colExtremes->getRef(col+i)->minWidth = minW / (cs - i);
769 colExtremes->getRef(col+i)->maxWidth = maxW / (cs - i);
770 minW -= colExtremes->getRef(col+i)->minWidth;
771 maxW -= colExtremes->getRef(col+i)->maxWidth;
776 int spanHasColPercent = 0;
777 int availSpanMinW = spanMinW;
778 float cumSpanPercent = 0.0f;
779 for (
int i = col; i < col + cs; ++i) {
784 availSpanMinW -= colExtremes->getRef(i)->minWidth;
789 int cumMaxWnew = 0, cumMaxWold = 0, goalMaxW = spanMaxW;
790 int curAppW = maxSumCols;
791 int curExtraW = spanMinW - minSumCols;
792 for (
int i = col; i < col + cs; ++i) {
794 if (!spanHasColPercent) {
795 int d_a = colExtremes->getRef(i)->maxWidth;
796 int d_w = curAppW > 0 ? (int)((
float)curExtraW * d_a/curAppW) : 0;
797 if (d_a < 0||d_w < 0) {
798 MSG(
"d_a=%d d_w=%d\n",d_a,d_w);
801 wMin = colExtremes->getRef(i)->minWidth + d_w;
802 colExtremes->getRef(i)->minWidth = wMin;
809 wMin =
misc::max (colExtremes->getRef(i)->minWidth,
810 (int)(availSpanMinW *
812 (colPercents->get (i))
814 colExtremes->getRef(i)->minWidth = wMin;
818 wMax = (goalMaxW-cumMaxWnew <= 0) ? 0 :
819 (
int)((float)(goalMaxW-cumMaxWnew)
820 * colExtremes->getRef(i)->maxWidth
821 / (maxSumCols-cumMaxWold));
824 cumMaxWold += colExtremes->getRef(i)->maxWidth;
825 colExtremes->getRef(i)->maxWidth = wMax;
827 _MSG(
"i=%d, wMin=%d wMax=%d cumMaxWold=%d\n",
828 i,wMin,wMax,cumMaxWold);
832 MSG(
"col min,max: [");
833 for (
int i = 0; i < numCols; i++)
835 colExtremes->getRef(i)->minWidth,
836 colExtremes->getRef(i)->maxWidth);
838 MSG(
"getStyle()->hBorderSpacing = %d\n", getStyle()->hBorderSpacing);
847 void Table::apportion2 (
int totalWidth,
int forceTotalWidth)
849 if (colExtremes->size() == 0)
852 MSG(
"app2, availWidth=%d, totalWidth=%d, forceTotalWidth=%d\n",
853 availWidth, totalWidth, forceTotalWidth);
854 MSG(
"app2, extremes: ( ");
855 for (
int i = 0; i < colExtremes->size (); i++)
857 colExtremes->get(i).minWidth, colExtremes->get(i).maxWidth);
860 int minAutoWidth = 0, maxAutoWidth = 0, availAutoWidth = totalWidth;
861 for (
int col = 0; col < numCols; col++) {
864 setColWidth (col, colExtremes->get(col).minWidth);
867 maxAutoWidth += colExtremes->get(col).maxWidth;
868 minAutoWidth += colExtremes->get(col).minWidth;
870 availAutoWidth -= colWidths->get(col);
876 colWidths->setSize (colExtremes->size (), 0);
878 if (!forceTotalWidth && maxAutoWidth < availAutoWidth) {
880 availAutoWidth = maxAutoWidth;
884 int curTargetWidth =
misc::max (availAutoWidth, minAutoWidth);
885 int curExtraWidth = curTargetWidth - minAutoWidth;
886 int curMaxWidth = maxAutoWidth;
887 int curNewWidth = minAutoWidth;
888 for (
int col = 0; col < numCols; col++) {
889 _MSG(
"app2, col %d, minWidth=%d maxWidth=%d\n",
890 col, colExtremes->getRef(col)->minWidth,
891 colExtremes->get(col).maxWidth);
896 int colMinWidth = colExtremes->getRef(col)->minWidth;
897 int colMaxWidth = colExtremes->getRef(col)->maxWidth;
898 int w = (curMaxWidth <= 0) ? 0 :
899 (
int)((float)curTargetWidth * colMaxWidth/curMaxWidth);
901 _MSG(
"app2, curTargetWidth=%d colMaxWidth=%d curMaxWidth=%d " 903 curTargetWidth, colMaxWidth,curMaxWidth,curNewWidth);
906 if (w <= colMinWidth)
908 else if (curNewWidth - colMinWidth + w > curTargetWidth)
909 w = colMinWidth + curExtraWidth;
913 curNewWidth -= colMinWidth;
914 curMaxWidth -= colMaxWidth;
915 curExtraWidth -= (w - colMinWidth);
917 setColWidth (col, w);
920 MSG(
"app2, result: ( ");
921 for (
int i = 0; i < colWidths->size (); i++)
922 MSG(
"%d ", colWidths->get (i));
927 void Table::apportion_percentages2(
int totalWidth,
int forceTotalWidth)
931 if (colExtremes->size() == 0 || (!hasTablePercent && !hasColPercent))
935 _MSG(
"APP_P, availWidth=%d, totalWidth=%d, forceTotalWidth=%d\n",
936 availWidth, totalWidth, forceTotalWidth);
938 if (!hasColPercent) {
940 MSG(
"APP_P, only a table-wide percentage\n");
941 MSG(
"APP_P, extremes = { ");
942 for (
int col = 0; col < numCols; col++)
943 MSG(
"%d,%d ", colExtremes->getRef(col)->minWidth,
944 colExtremes->getRef(col)->maxWidth);
948 int sumMaxWidth = 0, perAvailWidth = totalWidth;
949 for (
int col = 0; col < numCols; col++) {
951 perAvailWidth -= colExtremes->getRef(col)->maxWidth;
953 sumMaxWidth += colExtremes->getRef(col)->maxWidth;
956 _MSG(
"APP_P, perAvailWidth=%d, sumMaxWidth=%d\n",
957 perAvailWidth, sumMaxWidth);
959 for (
int col = 0; col < numCols; col++) {
960 int max_wi = colExtremes->getRef(col)->maxWidth, new_wi;
963 misc::max (colExtremes->getRef(col)->minWidth,
964 (int)((
float)max_wi * perAvailWidth/sumMaxWidth));
965 setColWidth (col, new_wi);
966 perAvailWidth -= new_wi;
967 sumMaxWidth -= max_wi;
971 MSG(
"APP_P, result = { ");
972 for (
int col = 0; col < numCols; col++)
973 MSG(
"%d ", colWidths->get(col));
979 _MSG(
"APP_P, we'll have to apportion...\n");
982 float cumPercent = 0.0f;
984 int sumMinWidth = 0, sumMaxWidth = 0, sumMinNonPer = 0, sumMaxNonPer = 0;
985 for (
int col = 0; col < numCols; col++) {
989 sumMinNonPer += colExtremes->getRef(col)->minWidth;
990 sumMaxNonPer += colExtremes->getRef(col)->maxWidth;
994 sumMinWidth += colExtremes->getRef(col)->minWidth;
995 sumMaxWidth += colExtremes->getRef(col)->maxWidth;
997 _MSG(
"APP_P, col %d minWidth=%d maxWidth=%d\n", col,
998 colExtremes->getRef(col)->minWidth,
999 colExtremes->getRef(col)->maxWidth);
1001 int oldTotalWidth = totalWidth;
1002 if (!forceTotalWidth) {
1003 if (sumMaxNonPer == 0 || cumPercent < 0.99f) {
1005 int totW = (int)(sumMaxNonPer / (1.0f - cumPercent));
1006 for (
int col = 0; col < numCols; col++) {
1009 (
int)(colExtremes->getRef(col)->maxWidth
1012 totalWidth =
misc::min (totW, totalWidth);
1017 totalWidth =
misc::max (totalWidth, sumMinWidth);
1019 int extraWidth = totalWidth - sumMinWidth;
1020 int sumMinWidthPer = sumMinWidth - sumMinNonPer;
1021 int curPerWidth = sumMinWidthPer;
1023 int workingWidth = totalWidth - sumMinNonPer;
1024 if (cumPercent < 0.99f) {
1026 workingWidth = totalWidth;
1027 curPerWidth = sumMinWidth;
1030 _MSG(
"APP_P, oldTotalWidth=%d totalWidth=%d" 1031 " workingWidth=%d extraWidth=%d sumMinNonPer=%d\n",
1032 oldTotalWidth,totalWidth,workingWidth,extraWidth,sumMinNonPer);
1034 for (
int col = 0; col < numCols; col++) {
1035 int colMinWidth = colExtremes->getRef(col)->minWidth;
1038 colPercents->get(col));
1039 if (w < colMinWidth)
1041 else if (curPerWidth - colMinWidth + w > workingWidth)
1042 w = colMinWidth + extraWidth;
1043 extraWidth -= (w - colMinWidth);
1044 curPerWidth += (w - colMinWidth);
1045 setColWidth (col, w);
1047 setColWidth (col, colMinWidth);
1051 if (cumPercent < 0.99f) {
1054 MSG(
"APP_P, extremes: ( ");
1055 for (
int i = 0; i < colExtremes->size (); i++)
1057 colExtremes->get(i).minWidth, colExtremes->get(i).maxWidth);
1060 curPerWidth -= sumMinNonPer;
1061 int perWidth = (int)(curPerWidth/cumPercent);
1062 totalWidth =
misc::max (totalWidth, perWidth);
1063 totalWidth =
misc::min (totalWidth, oldTotalWidth);
1065 _MSG(
"APP_P, curPerWidth=%d perWidth=%d, totalWidth=%d\n",
1066 curPerWidth, perWidth, totalWidth);
1068 if (hasAutoCol == 0) {
1071 int extraWidth = totalWidth - curPerWidth - sumMinNonPer;
1072 for (
int col = 0; col < numCols; col++) {
1086 setColWidth (col, colWidths->get(col) + d);
1092 MSG(
"APP_P, result ={ ");
1093 for (
int col = 0; col < numCols; col++)
1094 MSG(
"%d ", colWidths->get(col));
1097 apportion2 (totalWidth, 2);
1100 MSG(
"APP_P, percent={");
1101 for (
int col = 0; col < numCols; col++)
1104 MSG(
"APP_P, result ={ ");
1105 for (
int col = 0; col < numCols; col++)
1106 MSG(
"%d ", colWidths->get(col));
1114 Table::TableIterator::TableIterator (
Table *table,
1116 core::Iterator (table, mask, atEnd)
1124 core::Iterator (table, mask, false)
1126 this->index =
index;
1163 if (index >= table->
children->size ()) {
1167 }
while (table->
children->get(index) == NULL ||
1171 content.widget = table->
children->get(index)->cell.widget;
1194 }
while (table->
children->get(index) == NULL ||
1198 content.widget = table->
children->get(index)->cell.widget;