static void new_color(void) { Ihandle* dlg = IupColorDlg(); IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_"); IupSetAttribute(dlg, "VALUE", "128 0 255"); IupSetAttribute(dlg, "ALPHA", "142"); //IupSetAttribute(dlg, "COLORTABLE", ";;177 29 234;;;0 0 23;253 20 119"); IupSetAttribute(dlg, "SHOWHEX", "YES"); IupSetAttribute(dlg, "SHOWCOLORTABLE", "YES"); //IupSetAttribute(dlg, "SHOWALPHA", "YES"); IupSetAttribute(dlg, "TITLE", "IupColorDlg 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(" COLORTABLE(%s)\n", IupGetAttribute(dlg, "COLORTABLE")); } else printf("CANCEL\n"); IupDestroy(dlg); }
static int ColorDlg(lua_State *L) { Ihandle *ih = IupColorDlg(); iuplua_plugstate(L, ih); iuplua_pushihandle_raw(L, ih); return 1; }
int IupGetColor(int x, int y, unsigned char *r, unsigned char *g, unsigned char *b) { int ret; Ihandle* dlg = IupColorDlg(); IupSetAttribute(dlg, "TITLE", iupStrMessageGet("IUP_GETCOLOR")); IupSetfAttribute(dlg, "VALUE", "%d %d %d", *r, *g, *b); IupSetAttribute(dlg, "PARENTDIALOG", IupGetGlobal("PARENTDIALOG")); IupSetAttribute(dlg, "ICON", IupGetGlobal("ICON")); IupPopup(dlg, x, y); ret = IupGetInt(dlg, "STATUS"); if (ret) iupStrToRGB(IupGetAttribute(dlg, "VALUE"), r, g, b); IupDestroy(dlg); return ret; }
int item_background_action_cb(Ihandle* item_background) { Ihandle* canvas = IupGetDialogChild(item_background, "CANVAS"); Ihandle* config = (Ihandle*)IupGetAttribute(canvas, "CONFIG"); Ihandle* colordlg = IupColorDlg(); const char* background = IupConfigGetVariableStrDef(config, "MainWindow", "Background", "255 255 255"); IupSetStrAttribute(colordlg, "VALUE", background); IupSetAttributeHandle(colordlg, "PARENTDIALOG", IupGetDialog(item_background)); IupPopup(colordlg, IUP_CENTERPARENT, IUP_CENTERPARENT); if (IupGetInt(colordlg, "STATUS") == 1) { background = IupGetAttribute(colordlg, "VALUE"); IupConfigSetVariableStr(config, "MainWindow", "Background", background); IupUpdate(canvas); } IupDestroy(colordlg); return IUP_DEFAULT; }
static void CreateColorDlg(void) { lua_pushusertag(IupColorDlg(), iuplua_tag); }