2 * winctrls.c: routines to self-manage the controls in a dialog
16 #define STATICHEIGHT 8
17 #define CHECKBOXHEIGHT 8
20 #define COMBOHEIGHT 12
21 #define PUSHBTNHEIGHT 14
22 #define PROGBARHEIGHT 14
24 void ctlposinit(struct ctlpos
*cp
, HWND hwnd
,
25 int leftborder
, int rightborder
, int topborder
) {
28 cp
->font
= SendMessage(hwnd
, WM_GETFONT
, 0, 0);
30 GetClientRect(hwnd
, &r
);
34 MapDialogRect(hwnd
, &r2
);
35 cp
->dlu4inpix
= r2
.right
;
36 cp
->width
= (r
.right
* 4) / (r2
.right
) - 2*GAPBETWEEN
;
37 cp
->xoff
= leftborder
;
38 cp
->width
-= leftborder
+ rightborder
;
41 void doctl(struct ctlpos
*cp
, RECT r
,
42 char *wclass
, int wstyle
, int exstyle
,
43 char *wtext
, int wid
) {
46 * Note nonstandard use of RECT. This is deliberate: by
47 * transforming the width and height directly we arrange to
48 * have all supposedly same-sized controls really same-sized.
52 MapDialogRect(cp
->hwnd
, &r
);
54 ctl
= CreateWindowEx(exstyle
, wclass
, wtext
, wstyle
,
55 r
.left
, r
.top
, r
.right
, r
.bottom
,
56 cp
->hwnd
, (HMENU
)wid
, hinst
, NULL
);
57 SendMessage(ctl
, WM_SETFONT
, cp
->font
, MAKELPARAM(TRUE
, 0));
61 * A title bar across the top of a sub-dialog.
63 void bartitle(struct ctlpos
*cp
, char *name
, int id
) {
66 r
.left
= GAPBETWEEN
; r
.right
= cp
->width
;
67 r
.top
= cp
->ypos
; r
.bottom
= STATICHEIGHT
;
68 cp
->ypos
+= r
.bottom
+ GAPBETWEEN
;
69 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, name
, id
);
73 * Begin a grouping box, with or without a group title.
75 void beginbox(struct ctlpos
*cp
, char *name
, int idbox
) {
76 cp
->boxystart
= cp
->ypos
;
78 cp
->boxystart
-= STATICHEIGHT
/2;
80 cp
->ypos
+= STATICHEIGHT
;
82 cp
->width
-= 2*GAPXBOX
;
91 void endbox(struct ctlpos
*cp
) {
94 cp
->width
+= 2*GAPXBOX
;
95 cp
->ypos
+= GAPYBOX
- GAPBETWEEN
;
96 r
.left
= GAPBETWEEN
; r
.right
= cp
->width
;
97 r
.top
= cp
->boxystart
; r
.bottom
= cp
->ypos
- cp
->boxystart
;
98 doctl(cp
, r
, "BUTTON", BS_GROUPBOX
| WS_CHILD
| WS_VISIBLE
, 0,
99 cp
->boxtext ? cp
->boxtext
: "", cp
->boxid
);
104 * Some edit boxes. Each one has a static above it. The percentages
105 * of the horizontal space are provided.
107 void multiedit(struct ctlpos
*cp
, ...) {
116 int staticid
, editid
, pcwidth
;
117 text
= va_arg(ap
, char *);
120 staticid
= va_arg(ap
, int);
121 editid
= va_arg(ap
, int);
122 pcwidth
= va_arg(ap
, int);
124 r
.left
= xpos
+ GAPBETWEEN
;
126 xpos
= (cp
->width
+ GAPBETWEEN
) * percent
/ 100;
127 r
.right
= xpos
- r
.left
;
129 r
.top
= cp
->ypos
; r
.bottom
= STATICHEIGHT
;
130 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0,
132 r
.top
= cp
->ypos
+ 8 + GAPWITHIN
; r
.bottom
= EDITHEIGHT
;
134 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| ES_AUTOHSCROLL
,
139 cp
->ypos
+= 8+GAPWITHIN
+12+GAPBETWEEN
;
143 * A set of radio buttons on the same line, with a static above
144 * them. `nacross' dictates how many parts the line is divided into
145 * (you might want this not to equal the number of buttons if you
146 * needed to line up some 2s and some 3s to look good in the same
149 * There's a bit of a hack in here to ensure that if nacross
150 * exceeds the actual number of buttons, the rightmost button
151 * really does get all the space right to the edge of the line, so
152 * you can do things like
154 * (*) Button1 (*) Button2 (*) ButtonWithReallyLongTitle
156 void radioline(struct ctlpos
*cp
,
157 char *text
, int id
, int nacross
, ...) {
164 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
165 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
166 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
167 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, text
, id
);
168 va_start(ap
, nacross
);
171 btext
= va_arg(ap
, char *);
177 bid
= va_arg(ap
, int);
178 nextbtext
= va_arg(ap
, char *);
179 r
.left
= GAPBETWEEN
+ i
* (cp
->width
+GAPBETWEEN
)/nacross
;
181 r
.right
= (i
+1) * (cp
->width
+GAPBETWEEN
)/nacross
- r
.left
;
183 r
.right
= cp
->width
- r
.left
;
184 r
.top
= cp
->ypos
; r
.bottom
= RADIOHEIGHT
;
185 doctl(cp
, r
, "BUTTON",
186 BS_AUTORADIOBUTTON
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| group
,
194 cp
->ypos
+= r
.bottom
+ GAPBETWEEN
;
198 * A set of radio buttons on multiple lines, with a static above
201 void radiobig(struct ctlpos
*cp
, char *text
, int id
, ...) {
206 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
207 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
208 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
209 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, text
, id
);
215 btext
= va_arg(ap
, char *);
218 bid
= va_arg(ap
, int);
219 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
220 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
221 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
222 doctl(cp
, r
, "BUTTON",
223 BS_AUTORADIOBUTTON
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| group
,
229 cp
->ypos
+= GAPBETWEEN
- GAPWITHIN
;
233 * A single standalone checkbox.
235 void checkbox(struct ctlpos
*cp
, char *text
, int id
) {
238 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
239 r
.right
= cp
->width
; r
.bottom
= CHECKBOXHEIGHT
;
240 cp
->ypos
+= r
.bottom
+ GAPBETWEEN
;
241 doctl(cp
, r
, "BUTTON",
242 BS_AUTOCHECKBOX
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
, 0,
247 * A single standalone static text control.
249 void statictext(struct ctlpos
*cp
, char *text
, int id
) {
252 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
253 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
254 cp
->ypos
+= r
.bottom
+ GAPBETWEEN
;
255 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, text
, id
);
259 * A button on the right hand side, with a static to its left.
261 void staticbtn(struct ctlpos
*cp
, char *stext
, int sid
,
262 char *btext
, int bid
) {
263 const int height
= (PUSHBTNHEIGHT
> STATICHEIGHT ?
264 PUSHBTNHEIGHT
: STATICHEIGHT
);
266 int lwid
, rwid
, rpos
;
268 rpos
= GAPBETWEEN
+ 3 * (cp
->width
+ GAPBETWEEN
) / 4;
269 lwid
= rpos
- 2*GAPBETWEEN
;
270 rwid
= cp
->width
+ GAPBETWEEN
- rpos
;
272 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
+ (height
-STATICHEIGHT
)/2;
273 r
.right
= lwid
; r
.bottom
= STATICHEIGHT
;
274 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
276 r
.left
= rpos
; r
.top
= cp
->ypos
+ (height
-PUSHBTNHEIGHT
)/2;
277 r
.right
= rwid
; r
.bottom
= PUSHBTNHEIGHT
;
278 doctl(cp
, r
, "BUTTON",
279 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| BS_PUSHBUTTON
,
283 cp
->ypos
+= height
+ GAPBETWEEN
;
287 * An edit control on the right hand side, with a static to its left.
289 static void staticedit_internal(struct ctlpos
*cp
, char *stext
,
290 int sid
, int eid
, int percentedit
,
292 const int height
= (EDITHEIGHT
> STATICHEIGHT ?
293 EDITHEIGHT
: STATICHEIGHT
);
295 int lwid
, rwid
, rpos
;
297 rpos
= GAPBETWEEN
+ (100-percentedit
) * (cp
->width
+ GAPBETWEEN
) / 100;
298 lwid
= rpos
- 2*GAPBETWEEN
;
299 rwid
= cp
->width
+ GAPBETWEEN
- rpos
;
301 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
+ (height
-STATICHEIGHT
)/2;
302 r
.right
= lwid
; r
.bottom
= STATICHEIGHT
;
303 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
305 r
.left
= rpos
; r
.top
= cp
->ypos
+ (height
-EDITHEIGHT
)/2;
306 r
.right
= rwid
; r
.bottom
= EDITHEIGHT
;
308 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| ES_AUTOHSCROLL
| style
,
312 cp
->ypos
+= height
+ GAPBETWEEN
;
315 void staticedit(struct ctlpos
*cp
, char *stext
,
316 int sid
, int eid
, int percentedit
) {
317 staticedit_internal(cp
, stext
, sid
, eid
, percentedit
, 0);
320 void staticpassedit(struct ctlpos
*cp
, char *stext
,
321 int sid
, int eid
, int percentedit
) {
322 staticedit_internal(cp
, stext
, sid
, eid
, percentedit
, ES_PASSWORD
);
326 * A big multiline edit control with a static labelling it.
328 void bigeditctrl(struct ctlpos
*cp
, char *stext
,
329 int sid
, int eid
, int lines
) {
332 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
333 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
334 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
335 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
337 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
338 r
.right
= cp
->width
; r
.bottom
= EDITHEIGHT
+ (lines
-1) * STATICHEIGHT
;
339 cp
->ypos
+= r
.bottom
+ GAPBETWEEN
;
341 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| WS_VSCROLL
| ES_MULTILINE
,
347 * A tab-control substitute when a real tab control is unavailable.
349 void ersatztab(struct ctlpos
*cp
, char *stext
, int sid
,
351 const int height
= (COMBOHEIGHT
> STATICHEIGHT ?
352 COMBOHEIGHT
: STATICHEIGHT
);
354 int bigwid
, lwid
, rwid
, rpos
;
355 static const int BIGGAP
= 15;
356 static const int MEDGAP
= 3;
358 bigwid
= cp
->width
+ 2*GAPBETWEEN
- 2*BIGGAP
;
360 rpos
= BIGGAP
+ (bigwid
+ BIGGAP
) / 2;
361 lwid
= rpos
- 2*BIGGAP
;
362 rwid
= bigwid
+ BIGGAP
- rpos
;
364 r
.left
= BIGGAP
; r
.top
= cp
->ypos
+ (height
-STATICHEIGHT
)/2;
365 r
.right
= lwid
; r
.bottom
= STATICHEIGHT
;
366 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
368 r
.left
= rpos
; r
.top
= cp
->ypos
+ (height
-COMBOHEIGHT
)/2;
369 r
.right
= rwid
; r
.bottom
= COMBOHEIGHT
*10;
370 doctl(cp
, r
, "COMBOBOX",
371 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
|
372 CBS_DROPDOWNLIST
| CBS_HASSTRINGS
,
376 cp
->ypos
+= height
+ MEDGAP
+ GAPBETWEEN
;
378 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
379 r
.right
= cp
->width
; r
.bottom
= 2;
380 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
| SS_ETCHEDHORZ
,
385 * A static line, followed by an edit control on the left hand side
386 * and a button on the right.
388 void editbutton(struct ctlpos
*cp
, char *stext
, int sid
,
389 int eid
, char *btext
, int bid
) {
390 const int height
= (EDITHEIGHT
> PUSHBTNHEIGHT ?
391 EDITHEIGHT
: PUSHBTNHEIGHT
);
393 int lwid
, rwid
, rpos
;
395 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
396 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
397 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
398 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
400 rpos
= GAPBETWEEN
+ 3 * (cp
->width
+ GAPBETWEEN
) / 4;
401 lwid
= rpos
- 2*GAPBETWEEN
;
402 rwid
= cp
->width
+ GAPBETWEEN
- rpos
;
404 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
+ (height
-EDITHEIGHT
)/2;
405 r
.right
= lwid
; r
.bottom
= EDITHEIGHT
;
407 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| ES_AUTOHSCROLL
,
411 r
.left
= rpos
; r
.top
= cp
->ypos
+ (height
-PUSHBTNHEIGHT
)/2;
412 r
.right
= rwid
; r
.bottom
= PUSHBTNHEIGHT
;
413 doctl(cp
, r
, "BUTTON",
414 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| BS_PUSHBUTTON
,
418 cp
->ypos
+= height
+ GAPBETWEEN
;
422 * Special control which was hard to describe generically: the
423 * session-saver assembly. A static; below that an edit box; below
424 * that a list box. To the right of the list box, a column of
427 void sesssaver(struct ctlpos
*cp
, char *text
,
428 int staticid
, int editid
, int listid
, ...) {
431 int lwid
, rwid
, rpos
;
433 const int LISTDEFHEIGHT
= 66;
435 rpos
= GAPBETWEEN
+ 3 * (cp
->width
+ GAPBETWEEN
) / 4;
436 lwid
= rpos
- 2*GAPBETWEEN
;
437 rwid
= cp
->width
+ GAPBETWEEN
- rpos
;
439 /* The static control. */
440 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
441 r
.right
= lwid
; r
.bottom
= STATICHEIGHT
;
442 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
443 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, text
, staticid
);
445 /* The edit control. */
446 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
447 r
.right
= lwid
; r
.bottom
= EDITHEIGHT
;
448 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
450 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| ES_AUTOHSCROLL
,
455 * The buttons (we should hold off on the list box until we
456 * know how big the buttons are).
458 va_start(ap
, listid
);
461 char *btext
= va_arg(ap
, char *);
464 bid
= va_arg(ap
, int);
465 r
.left
= rpos
; r
.top
= y
;
466 r
.right
= rwid
; r
.bottom
= PUSHBTNHEIGHT
;
467 y
+= r
.bottom
+ GAPWITHIN
;
468 doctl(cp
, r
, "BUTTON",
469 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| BS_PUSHBUTTON
,
474 /* Compute list box height. LISTDEFHEIGHT, or height of buttons. */
477 if (y
< LISTDEFHEIGHT
) y
= LISTDEFHEIGHT
;
478 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
479 r
.right
= lwid
; r
.bottom
= y
;
480 cp
->ypos
+= y
+ GAPBETWEEN
;
481 doctl(cp
, r
, "LISTBOX",
482 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| WS_VSCROLL
|
483 LBS_NOTIFY
| LBS_HASSTRINGS
,
489 * Another special control: the environment-variable setter. A
490 * static line first; then a pair of edit boxes with associated
491 * statics, and two buttons; then a list box.
493 void envsetter(struct ctlpos
*cp
, char *stext
, int sid
,
494 char *e1stext
, int e1sid
, int e1id
,
495 char *e2stext
, int e2sid
, int e2id
,
497 char *b1text
, int b1id
, char *b2text
, int b2id
) {
499 const int height
= (STATICHEIGHT
> EDITHEIGHT
&& STATICHEIGHT
> PUSHBTNHEIGHT ?
501 EDITHEIGHT
> PUSHBTNHEIGHT ?
502 EDITHEIGHT
: PUSHBTNHEIGHT
);
503 const static int percents
[] = { 20, 35, 10, 25 };
504 int i
, j
, xpos
, percent
;
505 const int LISTHEIGHT
= 42;
507 /* The static control. */
508 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
509 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
510 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
511 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
513 /* The statics+edits+buttons. */
514 for (j
= 0; j
< 2; j
++) {
516 for (i
= 0; i
< 4; i
++) {
517 xpos
= (cp
->width
+ GAPBETWEEN
) * percent
/ 100;
518 r
.left
= xpos
+ GAPBETWEEN
;
519 percent
+= percents
[i
];
520 xpos
= (cp
->width
+ GAPBETWEEN
) * percent
/ 100;
521 r
.right
= xpos
- r
.left
;
523 r
.bottom
= (i
==0 ? STATICHEIGHT
:
526 r
.top
+= (height
-r
.bottom
)/2;
528 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0,
529 j
==0 ? e1stext
: e2stext
, j
==0 ? e1sid
: e2sid
);
532 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| ES_AUTOHSCROLL
,
534 "", j
==0 ? e1id
: e2id
);
536 doctl(cp
, r
, "BUTTON",
537 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| BS_PUSHBUTTON
,
539 j
==0 ? b1text
: b2text
, j
==0 ? b1id
: b2id
);
542 cp
->ypos
+= height
+ GAPWITHIN
;
546 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
547 r
.right
= cp
->width
; r
.bottom
= LISTHEIGHT
;
548 cp
->ypos
+= r
.bottom
+ GAPBETWEEN
;
549 doctl(cp
, r
, "LISTBOX",
550 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| WS_VSCROLL
| LBS_HASSTRINGS
|
557 * Yet another special control: the character-class setter. A
558 * static, then a list, then a line containing a
559 * button-and-static-and-edit.
561 void charclass(struct ctlpos
*cp
, char *stext
, int sid
, int listid
,
562 char *btext
, int bid
, int eid
, char *s2text
, int s2id
) {
564 const int height
= (STATICHEIGHT
> EDITHEIGHT
&& STATICHEIGHT
> PUSHBTNHEIGHT ?
566 EDITHEIGHT
> PUSHBTNHEIGHT ?
567 EDITHEIGHT
: PUSHBTNHEIGHT
);
568 const static int percents
[] = { 30, 40, 30 };
569 int i
, xpos
, percent
;
570 const int LISTHEIGHT
= 66;
572 /* The static control. */
573 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
574 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
575 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
576 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
579 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
580 r
.right
= cp
->width
; r
.bottom
= LISTHEIGHT
;
581 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
582 doctl(cp
, r
, "LISTBOX",
583 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| WS_VSCROLL
| LBS_HASSTRINGS
|
588 /* The button+static+edit. */
590 for (i
= 0; i
< 3; i
++) {
591 r
.left
= xpos
+ GAPBETWEEN
;
592 percent
+= percents
[i
];
593 xpos
= (cp
->width
+ GAPBETWEEN
) * percent
/ 100;
594 r
.right
= xpos
- r
.left
;
596 r
.bottom
= (i
==0 ? PUSHBTNHEIGHT
:
597 i
==1 ? STATICHEIGHT
:
599 r
.top
+= (height
-r
.bottom
)/2;
601 doctl(cp
, r
, "BUTTON",
602 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| BS_PUSHBUTTON
,
605 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
| SS_CENTER
,
609 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| ES_AUTOHSCROLL
,
610 WS_EX_CLIENTEDGE
, "", eid
);
613 cp
->ypos
+= height
+ GAPBETWEEN
;
617 * A special control (horrors!). The colour editor. A static line;
618 * then on the left, a list box, and on the right, a sequence of
619 * two-part statics followed by a button.
621 void colouredit(struct ctlpos
*cp
, char *stext
, int sid
, int listid
,
622 char *btext
, int bid
, ...) {
626 int lwid
, rwid
, rpos
;
627 const int LISTHEIGHT
= 66;
629 /* The static control. */
630 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
631 r
.right
= cp
->width
; r
.bottom
= STATICHEIGHT
;
632 cp
->ypos
+= r
.bottom
+ GAPWITHIN
;
633 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, stext
, sid
);
635 rpos
= GAPBETWEEN
+ 2 * (cp
->width
+ GAPBETWEEN
) / 3;
636 lwid
= rpos
- 2*GAPBETWEEN
;
637 rwid
= cp
->width
+ GAPBETWEEN
- rpos
;
640 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
641 r
.right
= lwid
; r
.bottom
= LISTHEIGHT
;
642 doctl(cp
, r
, "LISTBOX",
643 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| WS_VSCROLL
| LBS_HASSTRINGS
|
644 LBS_USETABSTOPS
| LBS_NOTIFY
,
654 ltext
= va_arg(ap
, char *);
656 lid
= va_arg(ap
, int);
657 rid
= va_arg(ap
, int);
658 r
.top
= y
; r
.bottom
= STATICHEIGHT
;
659 y
+= r
.bottom
+ GAPWITHIN
;
660 r
.left
= rpos
; r
.right
= rwid
/2;
661 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
, 0, ltext
, lid
);
662 r
.left
= rpos
+ r
.right
; r
.right
= rwid
- r
.right
;
663 doctl(cp
, r
, "STATIC", WS_CHILD
| WS_VISIBLE
| SS_RIGHT
, 0, "", rid
);
668 r
.top
= y
+ 2*GAPWITHIN
; r
.bottom
= PUSHBTNHEIGHT
;
669 r
.left
= rpos
; r
.right
= rwid
;
670 doctl(cp
, r
, "BUTTON",
671 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
| BS_PUSHBUTTON
,
674 cp
->ypos
+= LISTHEIGHT
+ GAPBETWEEN
;
678 * A progress bar (from Common Controls). We like our progress bars
679 * to be smooth and unbroken, without those ugly divisions; some
680 * older compilers may not support that, but that's life.
682 void progressbar(struct ctlpos
*cp
, int id
) {
685 r
.left
= GAPBETWEEN
; r
.top
= cp
->ypos
;
686 r
.right
= cp
->width
; r
.bottom
= PROGBARHEIGHT
;
687 cp
->ypos
+= r
.bottom
+ GAPBETWEEN
;
689 doctl(cp
, r
, PROGRESS_CLASS
,
690 WS_CHILD
| WS_VISIBLE
694 , WS_EX_CLIENTEDGE
, "", id
);