static status deleteCellTable(Table tab, TableCell cell, BoolObj keep) { if ( cell->layout_manager == (LayoutManager)tab ) { int tx = valInt(cell->column) + valInt(cell->col_span); int ty = valInt(cell->row) + valInt(cell->row_span); int x, y; removeCellImageTable(tab, cell, keep); for(y=valInt(cell->row); y<ty; y++) { TableRow row = getRowTable(tab, toInt(y), OFF); if ( row ) { for(x=valInt(cell->column); x<tx; x++) elementVector((Vector)row, toInt(x), NIL); } } assign(cell, layout_manager, NIL); changedTable(tab); requestComputeLayoutManager((LayoutManager)tab, DEFAULT); } succeed; }
static status appendTable(Table tab, TableCell cell, Int x, Int y) { int cspan = valInt(cell->col_span); int rspan = valInt(cell->row_span); int dy; if ( isDefault(x) ) x = tab->current->x; if ( isDefault(y) ) y = tab->current->y; if ( notNil(tab->device) && notNil(cell->image) ) send(tab->device, NAME_display, cell->image, EAV); assign(cell, layout_manager, tab); assign(cell, column, x); assign(cell, row, y); for(dy=0; dy<rspan; dy++) { Int cy = toInt(valInt(y)+dy); TableRow row = getRowTable(tab, cy, ON); int dx; for(dx=0; dx<cspan; dx++) { Int cx = toInt(valInt(x)+dx); cellTableRow(row, cx, cell); } } advance_table(tab); requestComputeLayoutManager((LayoutManager)tab, DEFAULT); return changedTable(tab); }
status changedAreaLayoutInterface(LayoutInterface itf) { if ( notNil(itf->layout_manager) && itf->layout_manager->request_compute != NAME_computing ) return requestComputeLayoutManager(itf->layout_manager, DEFAULT); succeed; }
static status vrubberTableCell(TableCell c, Rubber r) { if ( c->vrubber != r ) { assign(c, vrubber, r); requestComputeLayoutManager(c->layout_manager, DEFAULT); } succeed; }
static status valignTableCell(TableCell c, Name align) { if ( c->valign != align ) { assign(c, valign, align); requestComputeLayoutManager(c->layout_manager, DEFAULT); } succeed; }
static status halignTableCell(TableCell c, Name align) { if ( c->halign != align ) { assign(c, halign, align); /* or placeImageTableCell()? */ requestComputeLayoutManager(c->layout_manager, DEFAULT); } succeed; }
static status cellPaddingTableCell(TableCell c, Size padding) { if ( !(c->cell_padding == padding || (classOfObject(c->cell_padding) == classOfObject(padding) && equalSize(c->cell_padding, padding))) ) { assign(c, cell_padding, padding); requestComputeLayoutManager(c->layout_manager, DEFAULT); } succeed; }
static status imageTableCell(TableCell c, Graphical gr) { if ( c->image != gr ) { Graphical old = c->image; Table tab = table_of_cell(c); if ( notNil(old) && !onFlag(old, F_FREEING|F_FREED) ) { Any nil = NIL; qadSendv(old, NAME_layoutInterface, 1, &nil); send(old, NAME_destroy, EAV); } assign(c, image, gr); qadSendv(gr, NAME_layoutInterface, 1, (Any *)&c); if ( tab && notNil(tab->device) ) send(tab->device, NAME_display, gr, EAV); requestComputeLayoutManager(c->layout_manager, DEFAULT); } succeed; }
static status rowSpanTableCell(TableCell cell, Int span) { if ( cell->row_span != span ) { Table tab = table_of_cell(cell); if ( tab ) { int x,y; int fy = valInt(cell->row); int h = valInt(span); int oh = valInt(cell->row_span); int ty = max(h,oh)+fy; for(y=fy+1; y<ty; y++) { TableRow row = getRowTable(tab, toInt(y), ON); for(x=valInt(cell->column); x<valInt(cell->column)+valInt(cell->col_span); x++) { Any e; if ( y-fy < h ) e = cell; else e = NIL; cellTableRow(row, toInt(x), e); } } assign(cell, row_span, span); changedTable(tab); /* changed line-pattern */ requestComputeLayoutManager((LayoutManager)tab, DEFAULT); } else { assign(cell, row_span, span); } } succeed; }
static status colSpanTableCell(TableCell cell, Int span) { if ( cell->col_span != span ) { Table tab = table_of_cell(cell); if ( tab ) { int x,y; int fx = valInt(cell->column); int w = valInt(span); int ow = valInt(cell->col_span); int tx = max(w,ow)+fx; for(y=valInt(cell->row); y<valInt(cell->row)+valInt(cell->row_span); y++) { TableRow row = getRowTable(tab, toInt(y), ON); for(x=fx+1; x<tx; x++) { Any e; if ( x-fx < w ) e = cell; else e = NIL; cellTableRow(row, toInt(x), e); } } assign(cell, col_span, span); changedTable(tab); /* changed line-pattern */ requestComputeLayoutManager((LayoutManager)tab, DEFAULT); } else { assign(cell, col_span, span); } } succeed; }