}
/*
- * A static line, followed by a full-width drop-down list (ie a
- * non-editing combo box).
+ * A static line, followed by a full-width combo box.
*/
-void dropdownlist(struct ctlpos *cp, char *text, int staticid, int listid)
+void combobox(struct ctlpos *cp, char *text, int staticid, int listid)
{
RECT r;
- va_list ap;
r.left = GAPBETWEEN;
r.right = cp->width;
r.bottom = COMBOHEIGHT * 10;
doctl(cp, r, "COMBOBOX",
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL |
- CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_CLIENTEDGE, "", listid);
+ CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_CLIENTEDGE, "", listid);
cp->ypos += STATICHEIGHT + GAPWITHIN + COMBOHEIGHT + GAPBETWEEN;
}
/*
* A single standalone static text control.
*/
-void statictext(struct ctlpos *cp, char *text, int id)
+void statictext(struct ctlpos *cp, char *text, int lines, int id)
{
RECT r;
r.left = GAPBETWEEN;
r.top = cp->ypos;
r.right = cp->width;
- r.bottom = STATICHEIGHT;
+ r.bottom = STATICHEIGHT * lines;
cp->ypos += r.bottom + GAPBETWEEN;
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0, text, id);
}
cp->ypos += height + GAPBETWEEN;
}
+/*
+ * Like staticbtn, but two buttons.
+ */
+void static2btn(struct ctlpos *cp, char *stext, int sid,
+ char *btext1, int bid1, char *btext2, int bid2)
+{
+ const int height = (PUSHBTNHEIGHT > STATICHEIGHT ?
+ PUSHBTNHEIGHT : STATICHEIGHT);
+ RECT r;
+ int lwid, rwid1, rwid2, rpos1, rpos2;
+
+ rpos1 = GAPBETWEEN + (cp->width + GAPBETWEEN) / 2;
+ rpos2 = GAPBETWEEN + 3 * (cp->width + GAPBETWEEN) / 4;
+ lwid = rpos1 - 2 * GAPBETWEEN;
+ rwid1 = rpos2 - rpos1 - GAPBETWEEN;
+ rwid2 = cp->width + GAPBETWEEN - rpos2;
+
+ 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 = rpos1;
+ r.top = cp->ypos + (height - PUSHBTNHEIGHT) / 2;
+ r.right = rwid1;
+ r.bottom = PUSHBTNHEIGHT;
+ doctl(cp, r, "BUTTON",
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON,
+ 0, btext1, bid1);
+
+ r.left = rpos2;
+ r.top = cp->ypos + (height - PUSHBTNHEIGHT) / 2;
+ r.right = rwid2;
+ r.bottom = PUSHBTNHEIGHT;
+ doctl(cp, r, "BUTTON",
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON,
+ 0, btext2, bid2);
+
+ cp->ypos += height + GAPBETWEEN;
+}
+
/*
* An edit control on the right hand side, with a static to its left.
*/
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;
if (is_dlmsg) {
- if (wParam == hdl->listid) {
+ if ((int)wParam == hdl->listid) {
DRAGLISTINFO *dlm = (DRAGLISTINFO *)lParam;
int dest;
switch (dlm->uNotification) {
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;
}