int item_font_action_cb(Ihandle* item_font) { Ihandle* multitext = IupGetDialogChild(item_font, "MULTITEXT"); Ihandle* fontdlg = IupFontDlg(); char* font = IupGetAttribute(multitext, "FONT"); IupSetStrAttribute(fontdlg, "VALUE", font); IupSetAttributeHandle(fontdlg, "PARENTDIALOG", IupGetDialog(item_font)); IupPopup(fontdlg, IUP_CENTERPARENT, IUP_CENTERPARENT); if (IupGetInt(fontdlg, "STATUS") == 1) { font = IupGetAttribute(fontdlg, "VALUE"); IupSetStrAttribute(multitext, "FONT", font); } IupDestroy(fontdlg); return IUP_DEFAULT; }
static void new_font(void) { Ihandle* dlg = IupFontDlg(); IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_"); IupSetAttribute(dlg, "COLOR", "128 0 255"); IupSetAttribute(dlg, "VALUE", "Times New Roman, Bold 20"); IupSetAttribute(dlg, "TITLE", "IupFontDlg Test"); IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb); IupPopup(dlg, IUP_CURRENT, IUP_CURRENT); if (IupGetInt(dlg, "STATUS")) { printf("OK\n"); printf(" VALUE(%s)\n", IupGetAttribute(dlg, "VALUE")); printf(" COLOR(%s)\n", IupGetAttribute(dlg, "COLOR")); } else printf("CANCEL\n"); IupDestroy(dlg); }
static void CreateFontDlg(void) { lua_pushusertag(IupFontDlg(), iuplua_tag); }