static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp) { #if 0 uiDrawTextFontDescriptor desc; uiDrawTextFont *font; char *s; char *family; // make compiler happy uiDrawTextLayout *layout; uiDrawTextFontMetrics metrics; double ypos; double width; double height; memset(&desc, 0, sizeof (uiDrawTextFontDescriptor)); family = uiEntryText(textFont); desc.Family = family; desc.Size = entryDouble(textSize); desc.Weight = uiComboboxSelected(textWeight); desc.Italic = uiComboboxSelected(textItalic); desc.SmallCaps = uiCheckboxChecked(textSmallCaps); desc.Stretch = uiComboboxSelected(textStretch); desc.Gravity = uiComboboxSelected(textGravity); font = uiDrawLoadClosestFont(&desc); uiFreeText(family); uiDrawTextFontGetMetrics(font, &metrics); width = entryDouble(textWidth); drawGuides(dp->Context, &metrics); s = uiEntryText(textString); layout = uiDrawNewTextLayout(s, font, width); uiFreeText(s); ypos = 10; uiDrawText(dp->Context, 10, ypos, layout); // TODO make these optional? uiDrawTextLayoutExtents(layout, &width, &height); uiDrawFreeTextLayout(layout); layout = uiDrawNewTextLayout("This is a second line", font, -1); if (/*TODO reuse width*/entryDouble(textWidth) < 0) { double ad; ad = metrics.Ascent + metrics.Descent; printf("ad:%g extent:%g\n", ad, height); } ypos += height; if (uiCheckboxChecked(addLeading)) ypos += metrics.Leading; uiDrawText(dp->Context, 10, ypos, layout); uiDrawFreeTextLayout(layout); uiDrawFreeTextFont(font); #endif }
static void callback_uiComboboxOnSelected( uiCombobox* c, void* d ) { lua_State* L = (lua_State*) d; if( L ) { lua_pushinteger( L, uiComboboxSelected( c ) ); invoke_callback( L, c, callback_OnSelected, 1 ); } }
static Janet janet_ui_combobox_selected(int32_t argc, Janet *argv) { janet_arity(argc, 1, 2); uiCombobox *cbox = janet_getuitype(argv, 0, &combobox_td); if (argc == 2) { int selected = janet_getboolean(argv, 1); uiComboboxSetSelected(cbox, selected); return argv[0]; } return janet_wrap_integer(uiComboboxSelected(cbox)); }
static void onCBChanged(uiCombobox *c, void *data) { printf("%s combobox changed to %d\n", (char *) data, (int) uiComboboxSelected(c)); }