+static void macctrl_listbox(struct macctrls *mcs, WindowPtr window,
+ struct mac_layoutstate *curstate,
+ union control *ctrl)
+{
+ union macctrl *mc = snew(union macctrl);
+ Rect bounds;
+ ListHandle list;
+ Size olen;
+
+ if (mac_gestalts.apprvers < 0x100)
+ return;
+ if (ctrl->listbox.label != NULL)
+ fprintf(stderr, " label = %s\n", ctrl->listbox.label);
+ fprintf(stderr, " height = %d\n", ctrl->listbox.height);
+ if (ctrl->listbox.draglist)
+ fprintf(stderr, " draglist\n");
+ if (ctrl->listbox.multisel)
+ fprintf(stderr, " multisel\n");
+ fprintf(stderr, " ncols = %d\n", ctrl->listbox.ncols);
+ assert(ctrl->listbox.percentwidth == 100);
+ mc->generic.type = MACCTRL_LISTBOX;
+ mc->generic.ctrl = ctrl;
+ mc->generic.privdata = NULL;
+ /* The list starts off empty */
+ mc->listbox.nids = 0;
+ mc->listbox.ids = NULL;
+ bounds.left = curstate->pos.h;
+ bounds.right = bounds.left + curstate->width;
+ bounds.top = curstate->pos.v;
+ bounds.bottom = bounds.top + 20 * ctrl->listbox.height;
+
+ mc->button.tbctrl = NewControl(window, &bounds, NULL, TRUE,
+ ldes_Default, 0, 0,
+ kControlListBoxProc, (long)mc);
+ if (!ctrl->listbox.multisel) {
+ if (GetControlData(mc->listbox.tbctrl, kControlEntireControl,
+ kControlListBoxListHandleTag, sizeof(list), &list,
+ &olen) != noErr)
+ return;
+#if TARGET_API_MAC_CARBON
+ SetListSelectionFlags(list, lOnlyOne);
+#else
+ (*list)->selFlags = lOnlyOne;
+#endif
+ }
+ add234(mcs->byctrl, mc);
+ curstate->pos.v += 6 + 20 * ctrl->listbox.height;
+ mc->generic.next = mcs->panels[curstate->panelnum];
+ mcs->panels[curstate->panelnum] = mc;
+ ctrlevent(mcs, mc, EVENT_REFRESH);
+}
+
+