mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-21 13:05:04 -05:00
Retire winctrls.c:multiedit() in favour of a new simpler function for a
single full-width edit box. multiedit()'s extra functionality has been superseded by the "columns" mechanism, and it didn't allow an edit box to be created with no label. Also add no-label capability to a couple of other controls. [originally from svn r5626]
This commit is contained in:
parent
798f924906
commit
f481acb479
@ -148,44 +148,29 @@ void endbox(struct ctlpos *cp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some edit boxes. Each one has a static above it. The percentages
|
* A static line, followed by a full-width edit box.
|
||||||
* of the horizontal space are provided.
|
|
||||||
*/
|
*/
|
||||||
void multiedit(struct ctlpos *cp, int password, ...)
|
void editboxfw(struct ctlpos *cp, int password, char *text,
|
||||||
|
int staticid, int editid)
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
va_list ap;
|
|
||||||
int percent, xpos;
|
|
||||||
|
|
||||||
percent = xpos = 0;
|
r.left = GAPBETWEEN;
|
||||||
va_start(ap, password);
|
r.right = cp->width;
|
||||||
while (1) {
|
|
||||||
char *text;
|
|
||||||
int staticid, editid, pcwidth;
|
|
||||||
text = va_arg(ap, char *);
|
|
||||||
if (!text)
|
|
||||||
break;
|
|
||||||
staticid = va_arg(ap, int);
|
|
||||||
editid = va_arg(ap, int);
|
|
||||||
pcwidth = va_arg(ap, int);
|
|
||||||
|
|
||||||
r.left = xpos + GAPBETWEEN;
|
|
||||||
percent += pcwidth;
|
|
||||||
xpos = (cp->width + GAPBETWEEN) * percent / 100;
|
|
||||||
r.right = xpos - r.left;
|
|
||||||
|
|
||||||
|
if (text) {
|
||||||
r.top = cp->ypos;
|
r.top = cp->ypos;
|
||||||
r.bottom = STATICHEIGHT;
|
r.bottom = STATICHEIGHT;
|
||||||
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, text, staticid);
|
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, text, staticid);
|
||||||
r.top = cp->ypos + 8 + GAPWITHIN;
|
cp->ypos += STATICHEIGHT + GAPWITHIN;
|
||||||
r.bottom = EDITHEIGHT;
|
|
||||||
doctl(cp, r, "EDIT",
|
|
||||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL |
|
|
||||||
(password ? ES_PASSWORD : 0),
|
|
||||||
WS_EX_CLIENTEDGE, "", editid);
|
|
||||||
}
|
}
|
||||||
va_end(ap);
|
r.top = cp->ypos;
|
||||||
cp->ypos += STATICHEIGHT + GAPWITHIN + EDITHEIGHT + GAPBETWEEN;
|
r.bottom = EDITHEIGHT;
|
||||||
|
doctl(cp, r, "EDIT",
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL |
|
||||||
|
(password ? ES_PASSWORD : 0),
|
||||||
|
WS_EX_CLIENTEDGE, "", editid);
|
||||||
|
cp->ypos += EDITHEIGHT + GAPBETWEEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -198,16 +183,18 @@ void combobox(struct ctlpos *cp, char *text, int staticid, int listid)
|
|||||||
r.left = GAPBETWEEN;
|
r.left = GAPBETWEEN;
|
||||||
r.right = cp->width;
|
r.right = cp->width;
|
||||||
|
|
||||||
|
if (text) {
|
||||||
|
r.top = cp->ypos;
|
||||||
|
r.bottom = STATICHEIGHT;
|
||||||
|
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, text, staticid);
|
||||||
|
cp->ypos += STATICHEIGHT + GAPWITHIN;
|
||||||
|
}
|
||||||
r.top = cp->ypos;
|
r.top = cp->ypos;
|
||||||
r.bottom = STATICHEIGHT;
|
|
||||||
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, text, staticid);
|
|
||||||
r.top = cp->ypos + 8 + GAPWITHIN;
|
|
||||||
r.bottom = COMBOHEIGHT * 10;
|
r.bottom = COMBOHEIGHT * 10;
|
||||||
doctl(cp, r, "COMBOBOX",
|
doctl(cp, r, "COMBOBOX",
|
||||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL |
|
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL |
|
||||||
CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_CLIENTEDGE, "", listid);
|
CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_CLIENTEDGE, "", listid);
|
||||||
|
cp->ypos += COMBOHEIGHT + GAPBETWEEN;
|
||||||
cp->ypos += STATICHEIGHT + GAPWITHIN + COMBOHEIGHT + GAPBETWEEN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct radio { char *text; int id; };
|
struct radio { char *text; int id; };
|
||||||
@ -717,12 +704,14 @@ void staticddlbig(struct ctlpos *cp, char *stext,
|
|||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
r.left = GAPBETWEEN;
|
if (stext) {
|
||||||
r.top = cp->ypos;
|
r.left = GAPBETWEEN;
|
||||||
r.right = cp->width;
|
r.top = cp->ypos;
|
||||||
r.bottom = STATICHEIGHT;
|
r.right = cp->width;
|
||||||
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, stext, sid);
|
r.bottom = STATICHEIGHT;
|
||||||
cp->ypos += STATICHEIGHT;
|
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, stext, sid);
|
||||||
|
cp->ypos += STATICHEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
r.left = GAPBETWEEN;
|
r.left = GAPBETWEEN;
|
||||||
r.top = cp->ypos;
|
r.top = cp->ypos;
|
||||||
@ -742,12 +731,14 @@ void bigeditctrl(struct ctlpos *cp, char *stext,
|
|||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
r.left = GAPBETWEEN;
|
if (stext) {
|
||||||
r.top = cp->ypos;
|
r.left = GAPBETWEEN;
|
||||||
r.right = cp->width;
|
r.top = cp->ypos;
|
||||||
r.bottom = STATICHEIGHT;
|
r.right = cp->width;
|
||||||
cp->ypos += r.bottom + GAPWITHIN;
|
r.bottom = STATICHEIGHT;
|
||||||
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, stext, sid);
|
cp->ypos += r.bottom + GAPWITHIN;
|
||||||
|
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, stext, sid);
|
||||||
|
}
|
||||||
|
|
||||||
r.left = GAPBETWEEN;
|
r.left = GAPBETWEEN;
|
||||||
r.top = cp->ypos;
|
r.top = cp->ypos;
|
||||||
@ -1508,8 +1499,8 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
combobox(&pos, escaped,
|
combobox(&pos, escaped,
|
||||||
base_id, base_id+1);
|
base_id, base_id+1);
|
||||||
else
|
else
|
||||||
multiedit(&pos, ctrl->editbox.password, escaped,
|
editboxfw(&pos, ctrl->editbox.password, escaped,
|
||||||
base_id, base_id+1, 100, NULL);
|
base_id, base_id+1);
|
||||||
} else {
|
} else {
|
||||||
if (ctrl->editbox.has_list) {
|
if (ctrl->editbox.has_list) {
|
||||||
staticcombo(&pos, escaped, base_id, base_id+1,
|
staticcombo(&pos, escaped, base_id, base_id+1,
|
||||||
|
@ -231,7 +231,8 @@ HWND doctl(struct ctlpos *cp, RECT r,
|
|||||||
void bartitle(struct ctlpos *cp, char *name, int id);
|
void bartitle(struct ctlpos *cp, char *name, int id);
|
||||||
void beginbox(struct ctlpos *cp, char *name, int idbox);
|
void beginbox(struct ctlpos *cp, char *name, int idbox);
|
||||||
void endbox(struct ctlpos *cp);
|
void endbox(struct ctlpos *cp);
|
||||||
void multiedit(struct ctlpos *cp, int password, ...);
|
void editboxfw(struct ctlpos *cp, int password, char *text,
|
||||||
|
int staticid, int editid);
|
||||||
void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...);
|
void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...);
|
||||||
void bareradioline(struct ctlpos *cp, int nacross, ...);
|
void bareradioline(struct ctlpos *cp, int nacross, ...);
|
||||||
void radiobig(struct ctlpos *cp, char *text, int id, ...);
|
void radiobig(struct ctlpos *cp, char *text, int id, ...);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user