1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-27 02:02:26 +00:00

Finally, column spanning.

[originally from svn r3184]
This commit is contained in:
Ben Harris 2003-05-10 20:51:39 +00:00
parent feac9298a0
commit dc2af8af66

View File

@ -1,4 +1,4 @@
/* $Id: macctrls.c,v 1.41 2003/05/10 20:23:23 ben Exp $ */ /* $Id: macctrls.c,v 1.42 2003/05/10 20:51:39 ben Exp $ */
/* /*
* Copyright (c) 2003 Ben Harris * Copyright (c) 2003 Ben Harris
* All rights reserved. * All rights reserved.
@ -291,8 +291,8 @@ static void macctrl_layoutset(struct mac_layoutstate *curstate,
struct controlset *s, struct controlset *s,
WindowPtr window, struct macctrls *mcs) WindowPtr window, struct macctrls *mcs)
{ {
unsigned int i, j, ncols, colstart; unsigned int i, j, ncols, colstart, colspan;
struct mac_layoutstate cols[MAXCOLS]; struct mac_layoutstate cols[MAXCOLS], pos;
cols[0] = *curstate; cols[0] = *curstate;
ncols = 1; ncols = 1;
@ -301,8 +301,8 @@ static void macctrl_layoutset(struct mac_layoutstate *curstate,
union control *ctrl = s->ctrls[i]; union control *ctrl = s->ctrls[i];
colstart = COLUMN_START(ctrl->generic.column); colstart = COLUMN_START(ctrl->generic.column);
switch (ctrl->generic.type) { colspan = COLUMN_SPAN(ctrl->generic.column);
case CTRL_COLUMNS: if (ctrl->generic.type == CTRL_COLUMNS) {
if (ctrl->columns.ncols != 1) { if (ctrl->columns.ncols != 1) {
ncols = ctrl->columns.ncols; ncols = ctrl->columns.ncols;
assert(ncols <= MAXCOLS); assert(ncols <= MAXCOLS);
@ -324,29 +324,41 @@ static void macctrl_layoutset(struct mac_layoutstate *curstate,
cols[0].width = curstate->width; cols[0].width = curstate->width;
ncols = 1; ncols = 1;
} }
break; } else {
pos = cols[colstart];
pos.width = cols[colstart + colspan - 1].width +
(cols[colstart + colspan - 1].pos.h - cols[colstart].pos.h);
for (j = colstart; j < colstart + colspan; j++)
if (pos.pos.v < cols[j].pos.v)
pos.pos.v = cols[j].pos.v;
switch (ctrl->generic.type) {
case CTRL_TEXT: case CTRL_TEXT:
macctrl_text(mcs, window, &cols[colstart], ctrl); macctrl_text(mcs, window, &pos, ctrl);
break; break;
case CTRL_EDITBOX: case CTRL_EDITBOX:
macctrl_editbox(mcs, window, &cols[colstart], ctrl); macctrl_editbox(mcs, window, &pos, ctrl);
break; break;
case CTRL_RADIO: case CTRL_RADIO:
macctrl_radio(mcs, window, &cols[colstart], ctrl); macctrl_radio(mcs, window, &pos, ctrl);
break; break;
case CTRL_CHECKBOX: case CTRL_CHECKBOX:
macctrl_checkbox(mcs, window, &cols[colstart], ctrl); macctrl_checkbox(mcs, window, &pos, ctrl);
break; break;
case CTRL_BUTTON: case CTRL_BUTTON:
macctrl_button(mcs, window, &cols[colstart], ctrl); macctrl_button(mcs, window, &pos, ctrl);
break; break;
case CTRL_LISTBOX: case CTRL_LISTBOX:
if (ctrl->listbox.height == 0) if (ctrl->listbox.height == 0)
macctrl_popup(mcs, window, &cols[colstart], ctrl); macctrl_popup(mcs, window, &pos, ctrl);
else else
macctrl_listbox(mcs, window, &cols[colstart], ctrl); macctrl_listbox(mcs, window, &pos, ctrl);
break; break;
} }
for (j = colstart; j < colstart + colspan; j++)
cols[j].pos.v = pos.pos.v;
}
} }
for (j = 0; j < ncols; j++) for (j = 0; j < ncols; j++)
if (cols[j].pos.v > curstate->pos.v) if (cols[j].pos.v > curstate->pos.v)