X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/66ee282adab99e6ef6ab7e09700611c89d87c97c..c5e438ecf3f6d7b8caab10e43a452f3555149309:/winctrls.c diff --git a/winctrls.c b/winctrls.c index eb082f3a..f44a0be5 100644 --- a/winctrls.c +++ b/winctrls.c @@ -448,6 +448,40 @@ void staticpassedit(struct ctlpos *cp, char *stext, } /* + * A drop-down list box on the right hand side, with a static to + * its left. + */ +void staticddl(struct ctlpos *cp, char *stext, + int sid, int lid, int percentlist) +{ + const int height = (COMBOHEIGHT > STATICHEIGHT ? + COMBOHEIGHT : STATICHEIGHT); + RECT r; + int lwid, rwid, rpos; + + rpos = + GAPBETWEEN + (100 - percentlist) * (cp->width + GAPBETWEEN) / 100; + lwid = rpos - 2 * GAPBETWEEN; + rwid = cp->width + GAPBETWEEN - rpos; + + r.left = GAPBETWEEN; + r.top = cp->ypos + (height - STATICHEIGHT) / 2; + r.right = lwid; + r.bottom = STATICHEIGHT; + doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, stext, sid); + + r.left = rpos; + r.top = cp->ypos + (height - EDITHEIGHT) / 2; + r.right = rwid; + r.bottom = COMBOHEIGHT*4; + doctl(cp, r, "COMBOBOX", + WS_CHILD | WS_VISIBLE | WS_TABSTOP | + CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_CLIENTEDGE, "", lid); + + cp->ypos += height + GAPBETWEEN; +} + +/* * A big multiline edit control with a static labelling it. */ void bigeditctrl(struct ctlpos *cp, char *stext, @@ -712,7 +746,7 @@ void charclass(struct ctlpos *cp, char *stext, int sid, int listid, PUSHBTNHEIGHT ? EDITHEIGHT : PUSHBTNHEIGHT); const static int percents[] = { 30, 40, 30 }; int i, xpos, percent; - const int LISTHEIGHT = 66; + const int LISTHEIGHT = 52; /* The static control. */ r.left = GAPBETWEEN; @@ -1024,20 +1058,20 @@ int handle_prefslist(struct prefslist *hdl, SetWindowLong(hwnd, DWL_MSGRESULT, DL_STOPCURSOR); ret = 1; break; case DL_DROPPED: - ret = 1; - if (!hdl->dragging) break; - dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE); - if (dest > hdl->dummyitem) dest = hdl->dummyitem; - DrawInsert (hwnd, dlm->hWnd, -1); + if (hdl->dragging) { + dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE); + if (dest > hdl->dummyitem) dest = hdl->dummyitem; + DrawInsert (hwnd, dlm->hWnd, -1); + } SendDlgItemMessage(hwnd, hdl->listid, LB_DELETESTRING, hdl->dummyitem, 0); - hdl->dragging = 0; - if (dest >= 0) { - /* Correct for "missing" item. This means you can't drag - * an item to the end, but that seems to be the way this - * control is used. */ - if (dest > hdl->srcitem) dest--; - pl_moveitem(hwnd, hdl->listid, hdl->srcitem, dest); + if (hdl->dragging) { + hdl->dragging = 0; + if (dest >= 0) { + /* Correct for "missing" item. */ + if (dest > hdl->srcitem) dest--; + pl_moveitem(hwnd, hdl->listid, hdl->srcitem, dest); + } } ret = 1; break; }