void iupwinVersion(void) { Ihandle* dial, *ok; dial = IupDialog(IupVbox(IupFrame(IupVbox( IupLabel(IupVersion()), IupLabel(IUP_VERSION_DATE), IupLabel(IUP_COPYRIGHT), NULL)), ok = IupButton("Ok", NULL), NULL)); IupSetCallback(ok, "ACTION", (Icallback)ok_cb); IupSetAttribute(dial,IUP_TITLE,"IUP"); IupSetAttribute(dial,IUP_MENUBOX,IUP_NO); IupSetAttribute(dial,IUP_MINBOX,IUP_NO); IupSetAttribute(dial,IUP_MAXBOX,IUP_NO); IupSetAttribute(dial,IUP_RESIZE,IUP_NO); IupSetAttribute(dial,"GAP","5"); IupSetAttribute(dial,"MARGIN","5"); IupPopup(dial, IUP_CENTER, IUP_CENTER); IupDestroy(dial); }
Ihandle *IupQuakeScale(char *title, float min, float max, float step, char *key, float def) { Ihandle *scale,*label_value,*label_min,*label_max; char buf[128]; scale = IupVal("HORIZONTAL"); snprintf(buf, 128, "EXPAND=HORIZONTAL, MIN=%.1f, MAX=%.1f, VALUE=%.1f, STEP=0.01", min, max, def); IupSetAttributes(scale, buf); IupSetCallback(scale, "VALUECHANGED_CB", (Icallback)IupQuakeScaleUpdate); snprintf(buf, 16, "%.1f", def); label_value = IupLabel(buf); IupStoreAttribute(label_value, "EXPAND", "HORIZONTAL"); IupStoreAttribute(label_value, "ALIGNMENT", "ACENTER:ACENTER"); snprintf(buf, 16, "%.1f", min); label_min = IupLabel(buf); IupStoreAttribute(label_min, "ALIGNMENT", "ACENTER:ACENTER"); snprintf(buf, 16, "%.1f", max); label_max = IupLabel(buf); IupStoreAttribute(label_max, "ALIGNMENT", "ACENTER:ACENTER"); return IupVbox( IupLabel(title), IupHbox( label_min, label_value, label_max, NULL ), scale, NULL ); }
/* Main program */ int main(int argc, char **argv) { /* IUP identifiers */ Ihandle *dlg; Ihandle *img_star; Ihandle *lbl, *lbl_explain, *lbl_star; /* Initializes IUP */ IupOpen(&argc, &argv); /* Program begin */ /* Creates the star image */ img_star = IupImage ( 13, 13, pixmap_star ); /* Sets star image colors */ IupSetAttribute ( img_star, "1", "0 0 0"); IupSetAttribute ( img_star, "2", "0 198 0"); /* Associates "img_star" to image img_star */ IupSetHandle ( "img_star", img_star ); /* Creates a label */ lbl = IupLabel ( "This label has the following attributes set:\nBGCOLOR = 255 255 0\nFGCOLOR = 0 0 255\nFONT = COURIER_NORMAL_14\nTITLE = All text contained here\nALIGNMENT = ACENTER" ); /* Sets all the attributes of label lbl, except for IMAGE */ IupSetAttributes ( lbl, "BGCOLOR = \"255 255 0\", FGCOLOR = \"0 0 255\", FONT = COURIER_NORMAL_14, ALIGNMENT = ACENTER"); /* Creates a label to explain that the label on the right has an image */ lbl_explain = IupLabel ( "The label on the right has the image of a star" ); /* Creates a label whose title is not important, cause it will have an image */ lbl_star = IupLabel (NULL); /* Associates image "img_star" with label lbl_star */ IupSetAttribute ( lbl_star, "IMAGE", "img_star" ); /* Creates dialog with the label */ dlg = IupDialog ( IupVbox ( lbl, IupHbox ( lbl_explain, lbl_star, NULL ), NULL ) ); /* Sets title of the dialog */ IupSetAttribute ( dlg, "TITLE", "IupLabel Example" ); /* Shows dialog in the center of the screen */ IupShowXY ( dlg, IUP_CENTER, IUP_CENTER ); /* Initializes IUP main loop */ IupMainLoop(); /* Finishes IUP */ IupClose(); /* Program finished successfully */ return EXIT_SUCCESS; }
static Ihandle* dropSetupUI() { Ihandle *dropControlsBox = IupHbox( inboundCheckbox = IupToggle("Inbound", NULL), outboundCheckbox = IupToggle("Outbound", NULL), IupLabel("Chance(%):"), chanceInput = IupText(NULL), NULL ); IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4"); IupSetAttribute(chanceInput, "VALUE", "10.0"); IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance); IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance); IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&dropInbound); IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&dropOutbound); // enable by default to avoid confusing IupSetAttribute(inboundCheckbox, "VALUE", "ON"); IupSetAttribute(outboundCheckbox, "VALUE", "ON"); if (parameterized) { setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound"); setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound"); setFromParameter(chanceInput, "VALUE", NAME"-chance"); } return dropControlsBox; }
static Ihandle* tamperSetupUI() { Ihandle *dupControlsBox = IupHbox( checksumCheckbox = IupToggle("Redo Checksum", NULL), inboundCheckbox = IupToggle("Inbound", NULL), outboundCheckbox = IupToggle("Outbound", NULL), IupLabel("Chance(%):"), chanceInput = IupText(NULL), NULL ); IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4"); IupSetAttribute(chanceInput, "VALUE", "10.0"); IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance); IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance); IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&tamperInbound); IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&tamperOutbound); // sync doChecksum IupSetCallback(checksumCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(checksumCheckbox, SYNCED_VALUE, (char*)&doChecksum); // enable by default to avoid confusing IupSetAttribute(inboundCheckbox, "VALUE", "ON"); IupSetAttribute(outboundCheckbox, "VALUE", "ON"); IupSetAttribute(checksumCheckbox, "VALUE", "ON"); return dupControlsBox; }
static void ext_iup_label(script_t* script, vector_t* args) { script_string_t name = script_get_arg(args, 0)->string; Ihandle* label = IupLabel(name.data); script_push_native(script, label, NULL, iup_handle_free); script_return_top(script); }
static void uiSetupModule(Module *module, Ihandle *parent) { Ihandle *groupBox, *toggle, *controls, *icon; groupBox = IupHbox( icon = IupLabel(NULL), toggle = IupToggle(module->displayName, NULL), IupFill(), controls = module->setupUIFunc(), NULL ); IupSetAttribute(groupBox, "EXPAND", "HORIZONTAL"); IupSetAttribute(groupBox, "ALIGNMENT", "ACENTER"); IupSetAttribute(controls, "ALIGNMENT", "ACENTER"); IupAppend(parent, groupBox); // set controls as attribute to toggle and enable toggle callback IupSetCallback(toggle, "ACTION", (Icallback)uiToggleControls); IupSetAttribute(toggle, CONTROLS_HANDLE, (char*)controls); IupSetAttribute(toggle, SYNCED_VALUE, (char*)module->enabledFlag); IupSetAttribute(controls, "ACTIVE", "NO"); // startup as inactive IupSetAttribute(controls, "NCGAP", "4"); // startup as inactive // set default icon IupSetAttribute(icon, "IMAGE", "none_icon"); IupSetAttribute(icon, "PADDING", "4x"); module->iconHandle = icon; // parameterize toggle if (parameterized) { setFromParameter(toggle, "VALUE", module->shortName); } }
static Ihandle* capSetupUI() { Ihandle *capControlsBox = IupHbox( inboundCheckbox = IupToggle("Inbound", NULL), outboundCheckbox = IupToggle("Outbound", NULL), IupLabel("Bandwidth Cap(kb/s):"), kpsInput = IupText(NULL), NULL ); IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&capInbound); IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&capOutbound); IupSetAttribute(kpsInput, "VISIBLECOLUMNS", "4"); IupSetAttribute(kpsInput, "VALUE", "32.0"); IupSetCallback(kpsInput, "VALUECHANGED_CB", (Icallback)uiSyncFixed); IupSetAttribute(kpsInput, SYNCED_VALUE, (char*)&kps); IupSetAttribute(kpsInput, FIXED_MAX, CAP_MAX); IupSetAttribute(kpsInput, FIXED_MIN, CAP_MIN); // enable by default to avoid confusing IupSetAttribute(inboundCheckbox, "VALUE", "ON"); IupSetAttribute(outboundCheckbox, "VALUE", "ON"); if (parameterized) { setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound"); setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound"); setFromParameter(kpsInput, "VALUE", NAME"-kps"); } return capControlsBox; }
int main(int argc, char **argv) { IupOpen(&argc, &argv); IupControlsOpen(); bt = IupButton("Test", ""); IupSetAttribute(bt, "EXPAND", "YES"); box = IupSbox(bt); IupSetAttribute(box, "DIRECTION", "SOUTH"); ml = IupMultiLine(NULL); IupSetAttribute(ml, IUP_EXPAND, "YES"); vbox = IupVbox(box, ml, NULL); lb = IupLabel("Label"); IupSetAttribute(lb, IUP_EXPAND, "YES"); dg = IupDialog(IupHbox(vbox, IupFrame(lb), NULL)); IupSetAttribute(dg, IUP_MARGIN, "10x20"); //IupSetAttribute(dg,"COMPOSITED", "YES"); //IupSetAttribute(dg,"LAYERED", "YES"); //IupSetAttribute(dg,"LAYERALPHA", "192"); IupShow(dg); IupMainLoop(); IupDestroy(dg); IupControlsClose(); IupClose(); return 1; }
int main(int argc, char **argv) { Ihandle *dlg, *bt, *box, *lbl, *ml, *vbox; IupOpen(&argc, &argv); bt = IupButton("Button", NULL); //IupSetAttribute(bt, "EXPAND", "VERTICAL"); /* This is the only necessary EXPAND */ IupSetAttribute(bt, "EXPAND", "YES"); box = IupSbox(bt); IupSetAttribute(box, "DIRECTION", "SOUTH"); /* place at the bottom of the button */ // IupSetAttribute(box, "COLOR", "0 255 0"); ml = IupMultiLine(NULL); IupSetAttribute(ml, "EXPAND", "YES"); IupSetAttribute(ml, "VISIBLELINES", "5"); vbox = IupVbox(box, ml, NULL); lbl = IupLabel("Label"); IupSetAttribute(lbl, "EXPAND", "VERTICAL"); dlg = IupDialog(IupHbox(vbox, lbl, NULL)); IupSetAttribute(dlg, "TITLE", "IupSbox Example"); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetAttribute(dlg, "GAP", "10"); IupShow(dlg); IupMainLoop(); IupDestroy(dlg); IupClose(); return 1; }
static Ihandle* resetSetupUI() { Ihandle *dupControlsBox = IupHbox( rstButton = IupButton("RST next packet", NULL), inboundCheckbox = IupToggle("Inbound", NULL), outboundCheckbox = IupToggle("Outbound", NULL), IupLabel("Chance(%):"), chanceInput = IupText(NULL), NULL ); IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4"); IupSetAttribute(chanceInput, "VALUE", "0"); IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance); IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance); IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&resetInbound); IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&resetOutbound); IupSetCallback(rstButton, "ACTION", resetSetRSTNextButtonCb); IupSetAttribute(rstButton, "PADDING", "4x"); // enable by default to avoid confusing IupSetAttribute(inboundCheckbox, "VALUE", "ON"); IupSetAttribute(outboundCheckbox, "VALUE", "ON"); if (parameterized) { setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound"); setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound"); setFromParameter(chanceInput, "VALUE", NAME"-chance"); } return dupControlsBox; }
int main(int argc, char **argv) { Ihandle *dg, *tree, *sbox, *ml, *cv, *sbox2, *vbox, *lb, *sbox3; IupOpen(&argc, &argv); IupControlsOpen(); tree = createtree(); IupSetAttribute(tree, "EXPAND", "YES"); sbox = IupSbox(tree); IupSetAttribute(sbox, "DIRECTION", "EAST"); cv = IupCanvas(NULL); IupSetAttribute(cv, "EXPAND", "YES"); ml = IupMultiLine(""); IupSetAttribute(ml, "EXPAND", "YES"); sbox2 = IupSbox(ml); IupSetAttribute(sbox2, "DIRECTION", "WEST"); vbox = IupHbox(sbox, cv, sbox2, NULL); lb = IupLabel("This is a label"); IupSetAttribute(lb, "EXPAND", "NO"); sbox3 = IupSbox(lb); IupSetAttribute(sbox3, "DIRECTION", "NORTH"); dg = IupDialog(IupVbox(vbox, sbox3, NULL)); IupSetAttribute(dg, "TITLE", "IupSbox Example"); IupShow(dg); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
//Set up the status bar to display on the main window Ihandle* status_bar_setup() { status_msg = IupLabel("Welcome to Pic2MCMap! Open an image or map to begin."); status_prog = IupProgressBar(); IupSetAttribute(status_prog, "SIZE", "0x7"); return IupHbox(status_prog, status_msg, NULL); }
int main(int argc, char **argv) { Ihandle *win,*tabs,*buttons; IupOpen(&argc, &argv); tabs = IupTabs( IupQuakeBindingLayout(), IupQuakeMouseLayout(), IupFill(), IupFill(), IupFill(), NULL ); IupStoreAttribute(tabs, "TABTITLE0", "Keyboard"); IupStoreAttribute(tabs, "TABTITLE1", "Mouse"); IupStoreAttribute(tabs, "TABTITLE2", "Audio"); IupStoreAttribute(tabs, "TABTITLE3", "Video"); IupStoreAttribute(tabs, "TABTITLE4", "Multiplayer"); IupStoreAttribute(tabs, "MARGIN", "2x2"); buttons = IupHbox( IupSetCallbacks(IupButton("&Quit", "ACTION"), "ACTION", (Icallback)IupExitLoop, NULL), IupFill(), IupButton("&Save", NULL), IupFill(), IupButton("&Launch game", NULL), NULL ); win = IupDialog( IupSetAttributes( IupVbox( IupSetAttributes( IupLabel("Action Quake 2 Configuration"), "EXPAND=YES, ALIGNMENT=ACENTER:ACENTER, FONT=\"sans-serif, Bold 18\"" ), tabs, //buttons, NULL ), "GAP=5, MARGIN=3x3" ) ); IupStoreAttribute(win, "TITLE", "Action Quake 2 Configuration"); IupStoreAttribute(win, "RESIZE", "NO"); IupShow(win); /* bug? */ IupStoreAttribute(win, "SIZE", NULL); IupRefresh(win); IupMainLoop(); }
void iuplua_show_error_message(const char *pname, const char* msg) { Ihandle *multi_text, *lbl, *copy, *button, *box, *dlg, *abort, *buttonbox; char* value = IupGetGlobal("LUA_ERROR_LABEL"); if (!pname) pname = "_@IUP_ERROR"; lbl = IupLabel("_@IUP_LUAERROR"); IupSetAttribute(lbl, "EXPAND", "HORIZONTAL"); if (value) IupSetStrAttribute(lbl, "TITLE", value); copy = IupButton("_@IUP_COPY", NULL); IupSetStrAttribute(copy, "TIP", "_@IUP_COPYTOCLIPBOARD"); IupSetStrAttribute(copy, "PADDING", IupGetGlobal("DEFAULTBUTTONPADDING")); IupSetCallback(copy, "ACTION", show_error_copy_action); button = IupButton("_@IUP_CONTINUE", NULL); IupSetStrAttribute(button, "PADDING", IupGetGlobal("DEFAULTBUTTONPADDING")); IupSetCallback(button, "ACTION", show_error_continue_action); abort = IupButton("_@IUP_EXIT", NULL); IupSetStrAttribute(abort, "PADDING", IupGetGlobal("DEFAULTBUTTONPADDING")); IupSetCallback(abort, "ACTION", show_error_exit_action); multi_text = IupMultiLine(NULL); IupSetAttribute(multi_text, "EXPAND", "YES"); IupSetAttribute(multi_text, "READONLY", "YES"); IupSetAttribute(multi_text, "FONT", "Courier, 12"); IupSetAttribute(multi_text, "VISIBLELINES", "10"); IupSetAttribute(multi_text, "VISIBLECOLUMNS", "50"); IupSetAttribute(multi_text, "NAME", "TEXT"); IupSetStrAttribute(multi_text, "VALUE", msg); buttonbox = IupHbox(copy, button, abort, NULL); IupSetAttribute(buttonbox, "GAP", "50"); IupSetAttribute(IupNormalizer(button, abort, NULL), "NORMALIZE", "HORIZONTAL"); box = IupVbox(lbl, multi_text, buttonbox, NULL); IupSetAttribute(box, "ALIGNMENT", "ACENTER"); IupSetAttribute(box, "NMARGIN", "10x10"); IupSetAttribute(box, "GAP", "10"); dlg = IupDialog(box); IupSetStrAttribute(dlg, "TITLE", pname); IupSetAttribute(dlg, "MINBOX", "NO"); IupSetAttribute(dlg, "MAXBOX", "NO"); IupSetAttribute(dlg, "PARENTDIALOG", IupGetGlobal("PARENTDIALOG")); IupSetAttribute(dlg, "ICON", IupGetGlobal("ICON")); IupSetAttributeHandle(dlg, "DEFAULTESC", button); IupSetAttributeHandle(dlg, "DEFAULTENTER", button); IupSetAttributeHandle(dlg, "STARTFOCUS", button); IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT); IupDestroy(dlg); }
/* Main program */ int main(int argc, char **argv) { Ihandle *dlg; IupOpen(&argc, &argv); IupControlsOpen(); IupSetFunction("removeline", (Icallback)removeline); IupSetFunction("addline", (Icallback)addline); IupSetFunction("removecol", (Icallback)removecol); IupSetFunction("addcol", (Icallback)addcol); IupSetFunction("redraw", (Icallback)redraw); createmenu(); dlg = IupDialog( IupTabs( IupSetAttributes( IupVbox((create_mat()), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"), NULL), "MARGIN=10x10, GAP=10, TABTITLE=Test1"), IupSetAttributes( IupVbox(IupFrame(create_mat()), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"), // NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2,FONT=HELVETICA_ITALIC_14"), NULL), "FONT=HELVETICA_NORMAL_12, BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL)); IupSetAttribute(dlg,IUP_TITLE, "IupMatrix"); IupSetAttribute(dlg,IUP_MENU, "mymenu"); // IupSetAttribute(dlg,"BGCOLOR", "255 0 255"); //IupSetAttribute(dlg,"COMPOSITED", "YES"); //IupSetAttribute(dlg,"LAYERED", "YES"); //IupSetAttribute(dlg,"LAYERALPHA", "192"); IupShowXY(dlg,IUP_CENTER,IUP_CENTER) ; IupMainLoop(); iupmaskMatRemove(IupGetHandle("mat1"), 2, 1) ; iupmaskMatRemove(IupGetHandle("mat2"), 2, 1) ; IupDestroy(dlg); IupControlsClose(); IupClose(); return 0; }
int item_goto_action_cb(Ihandle* item_goto) { Ihandle* multitext = IupGetDialogChild(item_goto, "MULTITEXT"); Ihandle *dlg, *box, *bt_ok, *bt_cancel, *txt, *lbl; int line_count = IupGetInt(multitext, "LINECOUNT"); lbl = IupLabel(NULL); IupSetfAttribute(lbl, "TITLE", "Line Number [1-%d]:", line_count); txt = IupText(NULL); IupSetAttribute(txt, "MASK", IUP_MASK_UINT); /* unsigned integer numbers only */ IupSetAttribute(txt, "NAME", "LINE_TEXT"); IupSetAttribute(txt, "VISIBLECOLUMNS", "20"); bt_ok = IupButton("OK", NULL); IupSetInt(bt_ok, "TEXT_LINECOUNT", line_count); IupSetAttribute(bt_ok, "PADDING", "10x2"); IupSetCallback(bt_ok, "ACTION", (Icallback)goto_ok_action_cb); bt_cancel = IupButton("Cancel", NULL); IupSetCallback(bt_cancel, "ACTION", (Icallback)goto_cancel_action_cb); IupSetAttribute(bt_cancel, "PADDING", "10x2"); box = IupVbox( lbl, txt, IupSetAttributes(IupHbox( IupFill(), bt_ok, bt_cancel, NULL), "NORMALIZESIZE=HORIZONTAL"), NULL); IupSetAttribute(box, "MARGIN", "10x10"); IupSetAttribute(box, "GAP", "5"); dlg = IupDialog(box); IupSetAttribute(dlg, "TITLE", "Go To Line"); IupSetAttribute(dlg, "DIALOGFRAME", "Yes"); IupSetAttributeHandle(dlg, "DEFAULTENTER", bt_ok); IupSetAttributeHandle(dlg, "DEFAULTESC", bt_cancel); IupSetAttributeHandle(dlg, "PARENTDIALOG", IupGetDialog(item_goto)); IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT); if (IupGetInt(dlg, "STATUS") == 1) { int line = IupGetInt(txt, "VALUE"); int pos; IupTextConvertLinColToPos(multitext, line, 0, &pos); IupSetInt(multitext, "CARETPOS", pos); IupSetInt(multitext, "SCROLLTOPOS", pos); } IupDestroy(dlg); return IUP_DEFAULT; }
int item_find_action_cb(Ihandle* item_find) { Ihandle* dlg = (Ihandle*)IupGetAttribute(item_find, "FIND_DIALOG"); if (!dlg) { Ihandle* multitext = IupGetDialogChild(item_find, "MULTITEXT"); Ihandle *box, *bt_next, *bt_close, *txt, *find_case; txt = IupText(NULL); IupSetAttribute(txt, "NAME", "FIND_TEXT"); IupSetAttribute(txt, "VISIBLECOLUMNS", "20"); find_case = IupToggle("Case Sensitive", NULL); IupSetAttribute(find_case, "NAME", "FIND_CASE"); bt_next = IupButton("Find Next", NULL); IupSetAttribute(bt_next, "PADDING", "10x2"); IupSetCallback(bt_next, "ACTION", (Icallback)find_next_action_cb); bt_close = IupButton("Close", NULL); IupSetCallback(bt_close, "ACTION", (Icallback)find_close_action_cb); IupSetAttribute(bt_close, "PADDING", "10x2"); box = IupVbox( IupLabel("Find What:"), txt, find_case, IupSetAttributes(IupHbox( IupFill(), bt_next, bt_close, NULL), "NORMALIZESIZE=HORIZONTAL"), NULL); IupSetAttribute(box, "MARGIN", "10x10"); IupSetAttribute(box, "GAP", "5"); dlg = IupDialog(box); IupSetAttribute(dlg, "TITLE", "Find"); IupSetAttribute(dlg, "DIALOGFRAME", "Yes"); IupSetAttributeHandle(dlg, "DEFAULTENTER", bt_next); IupSetAttributeHandle(dlg, "DEFAULTESC", bt_close); IupSetAttributeHandle(dlg, "PARENTDIALOG", IupGetDialog(item_find)); /* Save the multiline to acess it from the callbacks */ IupSetAttribute(dlg, "MULTITEXT", (char*)multitext); /* Save the dialog to reuse it */ IupSetAttribute(item_find, "FIND_DIALOG", (char*)dlg); } /* centerparent first time, next time reuse the last position */ IupShowXY(dlg, IUP_CURRENT, IUP_CURRENT); return IUP_DEFAULT; }
void iupVersionDlg(void) { Ihandle* dlg; dlg = IupDialog(IupVbox(IupFrame(IupVbox( IupLabel(IupVersion()), IupLabel(IUP_VERSION_DATE), IupLabel(IUP_COPYRIGHT), NULL)), IupButton("OK", NULL), NULL)); IupSetAttribute(dlg,"TITLE","IUP Version"); IupSetAttribute(dlg,"DIALOGFRAME","YES"); IupSetAttribute(dlg,"DIALOGHINT","YES"); IupSetAttribute(dlg,"GAP","10"); IupSetAttribute(dlg,"MARGIN","10x10"); IupPopup(dlg, IUP_CENTER, IUP_CENTER); IupDestroy(dlg); }
void MatrixCbsTest(void) { Ihandle *dlg, *bt; IupMatrixExOpen(); IupSetFunction("removeline", (Icallback)removeline); IupSetFunction("addline", (Icallback)addline); IupSetFunction("removecol", (Icallback)removecol); IupSetFunction("addcol", (Icallback)addcol); IupSetFunction("redraw", (Icallback)redraw); createmenu(); bt = IupButton("Button", NULL); IupSetCallback(bt, "ACTION", bt_cb); IupSetAttribute(bt, "CANFOCUS", "NO"); dlg = IupDialog( // IupZbox( IupTabs( IupSetAttributes( IupVbox((create_mat(1)), bt, IupText(""), IupLabel("Label Text"), IupFrame(IupVal("HORIZONTAL")), NULL), "MARGIN=10x10, GAP=10, TABTITLE=Test1"), IupSetAttributes( IupVbox(IupFrame(create_mat(2)), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"), // NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2,FONT=HELVETICA_ITALIC_14"), // NULL), "FONT=HELVETICA_NORMAL_12, BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL)); IupSetAttribute(dlg,"TITLE", "IupMatrix"); IupSetAttribute(dlg,"MENU", "mymenu"); IupSetAttributeHandle(dlg,"DEFAULTENTER", bt); // IupSetAttribute(dlg,"BGCOLOR", "255 0 255"); //IupSetAttribute(dlg,"COMPOSITED", "YES"); //IupSetAttribute(dlg,"OPACITY", "192"); IupShowXY(dlg,IUP_CENTER,IUP_CENTER); }
static Ihandle* dupSetupUI() { Ihandle *dupControlsBox = IupHbox( IupLabel("Count:"), countInput = IupText(NULL), inboundCheckbox = IupToggle("Inbound", NULL), outboundCheckbox = IupToggle("Outbound", NULL), IupLabel("Chance(%):"), chanceInput = IupText(NULL), NULL ); IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4"); IupSetAttribute(chanceInput, "VALUE", "10.0"); IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance); IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance); IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&dupInbound); IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&dupOutbound); // sync count IupSetAttribute(countInput, "VISIBLECOLUMNS", "3"); IupSetAttribute(countInput, "VALUE", STR(COPIES_COUNT)); IupSetCallback(countInput, "VALUECHANGED_CB", (Icallback)uiSyncInteger); IupSetAttribute(countInput, SYNCED_VALUE, (char*)&count); IupSetAttribute(countInput, INTEGER_MAX, COPIES_MAX); IupSetAttribute(countInput, INTEGER_MIN, COPIES_MIN); // enable by default to avoid confusing IupSetAttribute(inboundCheckbox, "VALUE", "ON"); IupSetAttribute(outboundCheckbox, "VALUE", "ON"); if (parameterized) { setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound"); setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound"); setFromParameter(chanceInput, "VALUE", NAME"-chance"); setFromParameter(countInput, "VALUE", NAME"-count"); } return dupControlsBox; }
Ihandle * createMainWindow(void) { Ihandle *bottomHbox, *mainVbox; Ihandle *lblTitle, *glCanvas; Ihandle *btnRandomLine, *btnClearLines, *btnClose; Ihandle *dialog; lblTitle = IupLabel(labTitle); IupSetAttribute(lblTitle, "EXPAND", "HORIZONTAL"); IupSetAttribute(lblTitle, "ALIGNMENT", "ALEFT:ACENTER"); IupSetAttribute(lblTitle, "FONTSIZE", "10"); glCanvas = IupGLCanvas(0); IupSetAttribute(glCanvas, "EXPAND", "YES"); IupSetAttribute(glCanvas, "BORDER", "NO"); IupSetAttribute(glCanvas, "CANFOCUS", "NO"); IupSetCallback(glCanvas, "ACTION", (Icallback) repaint_cb); btnRandomLine = IupButton("Generate Random Lines", 0); IupSetAttribute(btnRandomLine, "RASTERSIZE", "150x33"); IupSetCallback(btnRandomLine, "ACTION", (Icallback) btnRandLine_cb); btnClearLines = IupButton("Clear All Lines", 0); IupSetAttribute(btnClearLines, "RASTERSIZE", "100x33"); IupSetCallback(btnClearLines, "ACTION", (Icallback) btnClearLines_cb); btnClose = IupButton("Close", 0); IupSetAttribute(btnClose, "RASTERSIZE", "80x33"); IupSetCallback(btnClose, "ACTION", (Icallback) exit_cb); bottomHbox = IupHbox(btnRandomLine, btnClearLines, IupFill(), btnClose, 0); IupSetAttribute(bottomHbox, "EXPAND", "HORIZONTAL"); IupSetAttribute(bottomHbox, "NGAP", "5"); IupSetAttribute(bottomHbox, "NMARGIN", "0x5"); mainVbox = IupVbox(lblTitle, glCanvas, bottomHbox, 0); IupSetAttribute(mainVbox, "NMARGIN", "10x10"); IupSetAttribute(mainVbox, "NGAP", "10"); IupSetHandle(BTN_CLOSE, btnClose); IupSetHandle(GL_CANVAS, glCanvas); dialog = IupDialog(mainVbox); IupSetAttribute(dialog, "TITLE", "GL Labwork"); IupSetAttribute(dialog, "RASTERSIZE", "425x550"); IupSetAttribute(dialog, "SHRINK", "YES"); IupSetAttribute(dialog, "DEFAULTESC", BTN_CLOSE); IupSetHandle(MAIN_WINDOW, dialog); return dialog; }
static Ihandle *BWLimiterSetupUI() { Ihandle *BWLimiterControlsBox = IupHbox( IupLabel("Max BW(Kb):"), BWmaxInput = IupText(NULL), inboundCheckbox = IupToggle("Inbound", NULL), outboundCheckbox = IupToggle("Outbound", NULL), IupLabel("Q Size(Kb):"), BWQueueSize = IupText(NULL), NULL ); // sync BWLimiter packet number IupSetAttribute(BWmaxInput, "VISIBLECOLUMNS", "3"); IupSetAttribute(BWmaxInput, "VALUE", STR(BW_DEFAULT)); IupSetCallback(BWmaxInput, "VALUECHANGED_CB", (Icallback)uiSyncInteger); IupSetAttribute(BWmaxInput, SYNCED_VALUE, (char*)&BWMaxValue); IupSetAttribute(BWmaxInput, INTEGER_MAX, BW_MAX); IupSetAttribute(BWmaxInput, INTEGER_MIN, BW_MIN); IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&BWLimiterInbound); IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle); IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&BWLimiterOutbound); // sync BWLimiter packet number IupSetAttribute(BWQueueSize, "VISIBLECOLUMNS", "3"); IupSetAttribute(BWQueueSize, "VALUE", STR(BW_QUEUESIZE_DEFAULT)); IupSetCallback(BWQueueSize, "VALUECHANGED_CB", (Icallback)uiSyncInteger); IupSetAttribute(BWQueueSize, SYNCED_VALUE, (char*)&BWQueueSizeValue); IupSetAttribute(BWQueueSize, INTEGER_MAX, BW_QUEUESIZE_MAX); IupSetAttribute(BWQueueSize, INTEGER_MIN, BW_QUEUESIZE_MIN); return BWLimiterControlsBox; }
int main(int argc, char **argv) { Ihandle *dlg, *bt, *dbox, *lbl, *ml, *hbox, *bt2, *txt; IupOpen(&argc, &argv); bt = IupButton("Detache Me!", NULL); IupSetCallback(bt, "ACTION", (Icallback)btn_detach_cb); IupSetHandle("detach", bt); ml = IupMultiLine(NULL); IupSetAttribute(ml, "EXPAND", "YES"); IupSetAttribute(ml, "VISIBLELINES", "5"); hbox = IupHbox(bt, ml, NULL); IupSetAttribute(hbox, "MARGIN", "10x0"); dbox = IupDetachBox(hbox); IupSetAttribute(dbox, "ORIENTATION", "VERTICAL"); //IupSetAttribute(dbox, "SHOWGRIP", "NO"); //IupSetAttribute(dbox, "BARSIZE", "0"); //IupSetAttribute(dbox, "COLOR", "255 0 0"); IupSetCallback(dbox, "DETACHED_CB", (Icallback)detached_cb); IupSetHandle("dbox", dbox); lbl = IupLabel("Label"); IupSetAttribute(lbl, "EXPAND", "VERTICAL"); bt2 = IupButton("Restore me!", NULL); IupSetAttribute(bt2, "EXPAND", "YES"); IupSetAttribute(bt2, "ACTIVE", "NO"); IupSetCallback(bt2, "ACTION", (Icallback)btn_restore_cb); IupSetHandle("restore", bt2); txt = IupText(NULL); IupSetAttribute(txt, "EXPAND", "HORIZONTAL"); dlg = IupDialog(IupVbox(dbox, lbl, bt2, txt, NULL)); IupSetAttribute(dlg, "TITLE", "IupDetachBox Example"); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetAttribute(dlg, "GAP", "10"); IupSetAttribute(dlg, "RASTERSIZE", "300x300"); IupShow(dlg); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
static int cbAddTab(Ihandle* ih) { Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS"); Ihandle *vbox; vbox = IupFrame(IupVbox(IupLabel("Label XXX"), IupButton("Button XXX", "cbChildButton"), NULL)); IupSetAttribute(vbox, "TABTITLE", "XXX"); IupSetAttribute(vbox, "TITLE", "TABS XXX"); IupAppend(tabs, vbox); IupMap(vbox); IupRefresh(tabs); /* update children layout */ return IUP_DEFAULT; }
static int cbInsertTab(Ihandle* ih) { Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS"); Ihandle* ref_vbox = IupGetHandle(IupGetAttribute(tabs, "VALUE")); Ihandle *vbox; vbox = IupFrame(IupVbox(IupLabel("Label YYY"), IupButton("Button YYY", "cbChildButton"), NULL)); IupSetAttribute(vbox, "TABTITLE", "YYY"); IupSetAttribute(vbox, "TITLE", "TABS YYY"); IupInsert(tabs, ref_vbox, vbox); IupMap(vbox); IupRefresh(tabs); /* update children layout */ return IUP_DEFAULT; }
void ClassInfo(void) { Ihandle *dialog, *box, *lists, *listClasses, *listAttributes, *listCallbacks, *labelInfo; listClasses = IupList(NULL); /* list of registered classes */ listAttributes = IupList(NULL); /* list of attributes of the selected class */ listCallbacks = IupList(NULL); /* list of callbacks of the selected class */ IupSetAttributes(listClasses, "NAME=listClasses, SIZE= 70x85, EXPAND=VERTICAL"); IupSetAttributes(listAttributes, "NAME=listAttributes, SIZE=120x85, EXPAND=VERTICAL"); IupSetAttributes(listCallbacks, "NAME=listCallbacks, SIZE=120x85, EXPAND=VERTICAL"); IupSetCallback(listClasses, "ACTION", (Icallback) classesList_ActionCB); IupSetCallback(listAttributes, "ACTION", (Icallback) attributesList_ActionCB); IupSetCallback(listCallbacks, "ACTION", (Icallback) callbacksList_ActionCB); labelInfo = IupLabel(NULL); IupSetAttribute(labelInfo, "SIZE", "x50"); IupSetAttribute(labelInfo, "EXPAND", "HORIZONTAL"); IupSetAttribute(labelInfo, "NAME", "labelInfo"); lists = IupVbox( IupHbox( IupSetAttributes(IupFrame(IupVbox(listClasses, NULL)), "TITLE=Classes"), IupSetAttributes(IupFrame(IupVbox(listAttributes, NULL)), "TITLE=Attributes"), IupSetAttributes(IupFrame(IupVbox(listCallbacks, NULL)), "TITLE=Callbacks"), NULL), IupHbox( IupSetAttributes(IupFrame(IupHbox(labelInfo, NULL)), "TITLE=Info, MARGIN=3x3"), NULL), NULL); box = IupHbox(lists, NULL); IupSetAttributes(lists,"MARGIN=10x10, GAP=10"); dialog = IupDialog(box); IupSetAttribute(dialog, "TITLE", "Iup Classes Information"); IupShowXY(dialog, IUP_CENTER, IUP_CENTER); PopulateListOfClasses(dialog); }
void PreDialogsTest(void) { char* msg = "Press a key for a pre-defined dialog:\n" "e = IupMessageDlg(ERROR)\n" "i = IupMessageDlg(INFORMATION)\n" "w = IupMessageDlg(WARNING)\n" "q = IupMessageDlg(QUESTION)\n" "--------------------\n" "o = IupFileDlg(OPEN)\n" "O = IupFileDlg(OPEN+PREVIEW)\n" "G = IupFileDlg(OPEN+PREVIEW+OPENGL)\n" "s = IupFileDlg(SAVE)\n" "d = IupFileDlg(DIR)\n" "--------------------\n" "c = IupColorDlg\n" "f = IupFontDlg\n" "--------------------\n" "m = IupMessage\n" "a = IupAlarm\n" "t = IupGetText\n" "g = IupGetFile\n" "l = IupListDialog\n" "y = IupLayoutDialog\n" "--------------------\n" "Esc = quit"; Ihandle *dlg = IupDialog(IupVbox(IupLabel(msg), NULL)); #ifdef USE_OPENGL IupGLCanvasOpen(); #endif IupSetHandle("_MAIN_DIALOG_TEST_", dlg); IupSetAttribute(dlg, "TITLE", "Pre-defined Dialogs Test"); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetCallback(dlg, "K_ANY", (Icallback)k_any); IupSetCallback(dlg, "CLOSE_CB", (Icallback)close_cb); IupShow(dlg); }
int main(int argc, char **argv) { Ihandle *dialog, *text; IupOpen(&argc, &argv); text = IupLabel("Timer example"); IupSetHandle("quit", text); /* Creating main dialog */ dialog = IupDialog(IupVbox(text, NULL)); IupSetAttribute(dialog, "TITLE", "timer example"); IupSetAttribute(dialog, "SIZE", "200x200"); IupShowXY(dialog, IUP_CENTER, IUP_CENTER); timer1 = IupTimer(); timer2 = IupTimer(); IupSetAttribute(timer1, "TIME", "1000"); IupSetAttribute(timer1, "RUN", "YES"); IupSetCallback(timer1, "ACTION_CB", (Icallback)timer_cb); IupSetAttribute(timer2, "TIME", "4000"); IupSetAttribute(timer2, "RUN", "YES"); IupSetCallback(timer2, "ACTION_CB", (Icallback)timer_cb); IupMainLoop(); /* Timers are NOT automatically destroyed, must be manually done */ IupDestroy(timer1); IupDestroy(timer2); IupClose(); return EXIT_SUCCESS; }
static int _render_image(Ihandle *ih, char *text, int item, int state) { if(state == 1) { LinkedList *ll = LL_get(images, item-1); if(ll == NULL || ll->contents == NULL) return IUP_ERROR; imImage* img = ll->contents; //Display the scaled image char buf[64]; sprintf(buf,"%dx%d",img->width,img->height); IupSetAttribute(preview, "RASTERSIZE", buf); IupSetAttributeHandle(preview, "IMAGE", ll->iContents); IupRefresh(preview); //Recreate the grid where to put all the images Ihandle* child; while((child = IupGetChild(imgmod, 0)) != NULL) IupDestroy(child); IupSetInt(imgmod, "NUMDIV", ll->cols); //Put the images into the grid int i; for(i = 0; i < ll->cols * ll->rows; i++) { Ihandle* tinyimg = IupLabel(NULL); IupSetAttributeHandle(tinyimg, "IMAGE", ll->iGrid[i]); IupAppend(imgmod, tinyimg); IupMap(tinyimg); } IupRefresh(imgmod); } main_window_set_menu_state(); return IUP_DEFAULT; }