+static void macctrl_editbox(struct macctrls *mcs, WindowPtr window,
+ struct mac_layoutstate *curstate,
+ union control *ctrl)
+{
+ union macctrl *mc = snew(union macctrl);
+ Rect lbounds, bounds;
+
+ if (ctrl->editbox.label != NULL)
+ fprintf(stderr, " label = %s\n", ctrl->editbox.label);
+ fprintf(stderr, " percentwidth = %d\n", ctrl->editbox.percentwidth);
+ if (ctrl->editbox.password) fprintf(stderr, " password\n");
+ if (ctrl->editbox.has_list) fprintf(stderr, " has list\n");
+ mc->generic.type = MACCTRL_EDITBOX;
+ mc->generic.ctrl = ctrl;
+ mc->generic.privdata = NULL;
+ lbounds.left = curstate->pos.h;
+ lbounds.top = curstate->pos.v;
+ if (ctrl->editbox.percentwidth == 100) {
+ if (ctrl->editbox.label != NULL) {
+ lbounds.right = lbounds.left + curstate->width;
+ lbounds.bottom = lbounds.top + 16;
+ curstate->pos.v += 18;
+ }
+ bounds.left = curstate->pos.h;
+ bounds.right = bounds.left + curstate->width;
+ } else {
+ lbounds.right = lbounds.left +
+ curstate->width * (100 - ctrl->editbox.percentwidth) / 100;
+ lbounds.bottom = lbounds.top + 22;
+ bounds.left = lbounds.right;
+ bounds.right = lbounds.left + curstate->width;
+ }
+ bounds.top = curstate->pos.v;
+ bounds.bottom = bounds.top + 22;
+ if (mac_gestalts.apprvers >= 0x100) {
+ if (ctrl->editbox.label == NULL)
+ mc->editbox.tblabel = NULL;
+ else {
+ mc->editbox.tblabel = NewControl(window, &lbounds, NULL, TRUE,
+ 0, 0, 0, kControlStaticTextProc,
+ (long)mc);
+ SetControlData(mc->editbox.tblabel, kControlEntireControl,
+ kControlStaticTextTextTag,
+ strlen(ctrl->editbox.label), ctrl->editbox.label);
+ }
+ InsetRect(&bounds, 3, 3);
+ mc->editbox.tbctrl = NewControl(window, &bounds, NULL, TRUE, 0, 0, 0,
+ ctrl->editbox.password ?
+ kControlEditTextPasswordProc :
+ kControlEditTextProc, (long)mc);
+ }