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) { Ihandle *canvas, *finale, *dg; IupOpen(&argc, &argv); IupGLCanvasOpen(); canvas = IupGLCanvas(NULL); IupSetCallback(canvas, "ACTION", (Icallback) redraw); IupSetAttribute(canvas, IUP_BUFFER, IUP_DOUBLE); IupSetAttribute(canvas, "RASTERSIZE", "123x200"); finale = IupHbox(IupFill(), canvas, IupFill(), NULL); dg = IupDialog(finale); IupSetAttribute(dg, "TITLE", "IupGLCanvas"); IupShow(dg); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
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; }
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 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 int Hbox(lua_State *L) { Ihandle *ih = IupHbox(NULL); iuplua_plugstate(L, ih); iuplua_pushihandle_raw(L, ih); return 1; }
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; }
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 ); }
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; }
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; }
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 IupGetText(const char* title, char* text) { Ihandle *ok, *cancel, *multi_text, *button_box, *dlg_box, *dialog; int bt; multi_text = IupMultiLine("do_nothing"); IupSetAttribute(multi_text,IUP_EXPAND, IUP_YES); IupSetAttribute(multi_text, IUP_SIZE, "200x80"); IupSetAttribute(multi_text,IUP_VALUE, text); IupSetAttribute(multi_text,IUP_FONT, IUP_COURIER_NORMAL_12); ok = IupButton(strok, NULL); IupSetAttribute (ok ,IUP_SIZE ,"50x"); IupSetCallback(ok, "ACTION", (Icallback)CB_button_OK); IupSetHandle( "IupGetTextOkButton", ok ); cancel = IupButton(strcancel, NULL); IupSetAttribute (cancel,IUP_SIZE ,"50x"); IupSetCallback(cancel, "ACTION", (Icallback)CB_button_CANCEL); IupSetHandle( "IupGetTextCancelButton", cancel ); button_box = IupHbox( IupSetAttributes(IupFill(), "EXPAND=HORIZONTAL"), ok, IupSetAttributes(IupFill(), "SIZE=1x"), cancel, NULL); IupSetAttribute(button_box,IUP_MARGIN,"0x0"); dlg_box = IupVbox( multi_text, IupSetAttributes(IupFill(), "SIZE=1x"), button_box, NULL); IupSetAttribute(dlg_box,IUP_MARGIN,"10x10"); IupSetAttribute(dlg_box,IUP_GAP,"5"); dialog = IupDialog (dlg_box); IupSetAttribute (dialog,IUP_TITLE,title); IupSetAttribute (dialog,IUP_MINBOX,IUP_NO); IupSetAttribute (dialog,IUP_MAXBOX,IUP_NO); IupSetAttribute (dialog,IUP_DEFAULTENTER,"IupGetTextOkButton"); IupSetAttribute (dialog,IUP_DEFAULTESC,"IupGetTextCancelButton"); IupSetAttribute (dialog,IUP_PARENTDIALOG, IupGetGlobal(IUP_PARENTDIALOG)); IupSetAttribute (dialog, IUP_ICON, IupGetGlobal(IUP_ICON)); IupPopup(dialog, IUP_CENTER, IUP_CENTER); bt = IupGetInt(dialog, IUP_STATUS); if (bt==1) strcpy(text, IupGetAttribute(multi_text, IUP_VALUE)); else bt = 0; /* return 0 instead of -1 */ IupDestroy(dialog); return bt; }
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) { /* 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; }
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 TabsTest(void) { Ihandle *box, *frm1, *frm2, *dlg, *tabs; tabs = CreateTabs(1); box = IupHbox(tabs, frm1 = IupFrame(IupRadio(IupVbox(IupToggle("TOP", "cbType"), IupToggle("LEFT", "cbType"), IupToggle("BOTTOM", "cbType"), IupToggle("RIGHT", "cbType"), NULL))), frm2 = IupFrame(IupRadio(IupVbox(IupToggle("HORIZONTAL", "cbOrientation"), IupToggle("VERTICAL", "cbOrientation"), NULL))), IupVbox(IupSetAttributes(IupButton("Add Tab", "cbAddTab"), "TIP=\"Button Tip\""), IupButton("Insert Tab", "cbInsertTab"), IupButton("Remove Tab", "cbRemoveTab"), IupToggle("Inactive", "cbInactive"), IupButton("VALUEPOS=0", "cbValuePos"), NULL), NULL); IupSetAttribute(frm1, "MARGIN", "5x5"); IupSetAttribute(frm2, "MARGIN", "5x5"); IupSetAttribute(frm1, "GAP", "0"); IupSetAttribute(frm2, "GAP", "0"); IupSetAttribute(frm1, "TITLE", "Type"); IupSetAttribute(frm2, "TITLE", "Orientation"); IupSetAttribute(box, "MARGIN", "10x10"); IupSetAttribute(box, "GAP", "10"); dlg = IupDialog(box); IupSetAttribute(dlg, "TITLE", "IupTabs Test"); IupSetAttribute(dlg, "APP_TABS", (char*)tabs); // IupSetAttribute(box, "BGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "BGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "BACKGROUND", "200 10 80"); // IupSetAttributeHandle(dlg, "BACKGROUND", load_image_LogoTecgraf()); // IupSetAttribute(dlg, "FGCOLOR", "10 200 80"); // IupSetAttribute(dlg, "BGCOLOR", "173 177 194"); // Motif BGCOLOR for documentation // IupSetAttribute(dlg,"COMPOSITED","NO"); IupMap(dlg); IupSetAttribute(dlg, "SIZE", NULL); IupShowXY(dlg, IUP_CENTER, IUP_CENTER); IupSetFunction("cbOrientation", (Icallback)cbOrientation); IupSetFunction("cbType", (Icallback)cbType); IupSetFunction("cbAddTab", (Icallback)cbAddTab); IupSetFunction("cbInsertTab", (Icallback)cbInsertTab); IupSetFunction("cbRemoveTab", (Icallback)cbRemoveTab); IupSetFunction("cbInactive", (Icallback)cbInactive); IupSetFunction("cbChildButton", (Icallback)cbChildButton); IupSetFunction("cbValuePos", (Icallback)cbValuePos); }
//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); }
void WebBrowserTest(void) { Ihandle *txt, *dlg, *web; Ihandle *btLoad, *btReload, *btBack, *btForward, *btStop; #ifndef WIN32 Ihandle *history; #endif IupWebBrowserOpen(); // Creates an instance of the WebBrowser control web = IupWebBrowser(); // Creates a dialog containing the control dlg = IupDialog(IupVbox(IupHbox(btBack = IupButton("Back", NULL), btForward = IupButton("Forward", NULL), txt = IupText(""), btLoad = IupButton("Load", NULL), btReload = IupButton("Reload", NULL), btStop = IupButton("Stop", NULL), #ifndef WIN32 history = IupButton("History", NULL), #endif NULL), web, NULL)); IupSetAttribute(dlg, "TITLE", "IupWebBrowser"); IupSetAttribute(dlg, "MY_TEXT", (char*)txt); IupSetAttribute(dlg, "MY_WEB", (char*)web); IupSetAttribute(dlg, "RASTERSIZE", "800x600"); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetAttribute(dlg, "GAP", "10"); //IupSetAttribute(web, "HTML", "<html><body><b>Hello</b>World!</body></html>"); // IupSetAttribute(txt, "VALUE", "My HTML"); IupSetAttribute(txt, "VALUE", "http://www.tecgraf.puc-rio.br/iup"); // IupSetAttribute(txt, "VALUE", "file:///D:/tecgraf/iup/html/index.html"); IupSetAttribute(web, "VALUE", IupGetAttribute(txt, "VALUE")); IupSetAttributeHandle(dlg, "DEFAULTENTER", btLoad); IupSetAttribute(txt, "EXPAND", "HORIZONTAL"); IupSetCallback(btLoad, "ACTION", (Icallback)load_cb); IupSetCallback(btReload, "ACTION", (Icallback)reload_cb); IupSetCallback(btBack, "ACTION", (Icallback)back_cb); IupSetCallback(btForward, "ACTION", (Icallback)forward_cb); IupSetCallback(btStop, "ACTION", (Icallback)stop_cb); #ifndef WIN32 IupSetCallback(history, "ACTION", (Icallback)history_cb); #endif IupSetCallback(web, "NEWWINDOW_CB", (Icallback)newwindow_cb); IupSetCallback(web, "NAVIGATE_CB", (Icallback)navigate_cb); IupSetCallback(web, "ERROR_CB", (Icallback)error_cb); IupSetCallback(web, "COMPLETED_CB", (Icallback)completed_cb); // Shows dialog IupShow(dlg); }
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); }
/* Initializes the dialog */ void init_dlg(void) { Ihandle* tree1 = IupGetHandle("tree1"); Ihandle* tree2 = IupGetHandle("tree2"); Ihandle* box = IupVbox(IupHbox(tree1, tree2, NULL), NULL); Ihandle* dlg = IupDialog(box); IupSetAttribute(dlg, "TITLE", "IupTree Example"); IupSetAttribute(box, "MARGIN", "20x20"); IupSetHandle("dlg", dlg); }
int main(int argc, char **argv) { Ihandle *dlg; Ihandle *list, *list_multiple, *list_dropdown; Ihandle *frm_medal, *frm_sport, *frm_prize; IupOpen(&argc, &argv); list = IupList ("list_act"); IupSetAttributes (list, "1=Gold, 2=Silver, 3=Bronze, 4=Tecgraf, 5=None," "SHOWIMAGE=YES, SHOWDRAGDROP=YES, XXX_SPACING=4, VALUE=4"); load_medal_images(); IupSetAttribute(list, "IMAGE1", "IMGGOLD"); IupSetAttribute(list, "IMAGE2", "IMGSILVER"); IupSetAttribute(list, "IMAGE3", "IMGBRONZE"); IupSetAttributeHandle(list, "IMAGE4", load_image_Tecgraf()); IupSetCallback(list, "DRAGDROP_CB", (Icallback)dragdrop_cb); // IupSetAttribute(list, "FONT", "Helvetica, Bold 40"); // IupSetAttribute(list, "AUTOHIDE", "NO"); frm_medal = IupFrame (list); IupSetAttribute (frm_medal, "TITLE", "Best medal"); list_multiple = IupList(NULL); IupSetAttributes (list_multiple, "1=\"100m dash\", 2=\"Long jump\", 3=\"Javelin throw\", 4=\"110m hurdlers\", 5=\"Hammer throw\",6=\"High jump\"," "MULTIPLE=YES, VALUE=\"+--+--\", SIZE=EIGHTHxEIGHTH"); IupSetCallback(list_multiple, "ACTION", (Icallback)list_multiple_cb); frm_sport = IupFrame (list_multiple); IupSetAttribute (frm_sport, "TITLE", "Competed in"); list_dropdown = IupList (NULL); IupSetAttributes (list_dropdown, "1=\"Less than US$ 1000\", 2=\"US$ 2000\", 3=\"US$ 5000\", 4=\"US$ 10000\", 5=\"US$ 20000\", 6=\"US$ 50000\", 7=\"More than US$ 100000\"," "SHOWIMAGE=YES, DROPDOWN=YES, VISIBLE_ITEMS=3"); IupSetAttributeHandle(list_dropdown, "IMAGE1", IupImageRGB(20, 20, image_data_24)); IupSetAttributeHandle(list_dropdown, "IMAGE2", IupImageRGB(20, 20, image_data_24)); IupSetAttributeHandle(list_dropdown, "IMAGE3", load_image_Tecgraf()); frm_prize = IupFrame (list_dropdown); IupSetAttribute (frm_prize, "TITLE", "Prizes won"); dlg = IupDialog (IupHbox (frm_medal, frm_sport, frm_prize, NULL)); IupSetAttribute (dlg, "TITLE", "IupList Example"); IupShowXY (dlg, IUP_CENTER, IUP_CENTER); // IupSetAttribute(IupGetChild(dlg, 0), "BGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "BACKGROUND", "200 10 80"); // IupSetAttribute(dlg, "BGCOLOR", "92 92 255"); IupMainLoop (); IupClose (); return EXIT_SUCCESS; }
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; }
/* Main program */ int main(int argc, char **argv) { Ihandle *dlg, *cb; /* Initializes IUP */ IupOpen(&argc, &argv); IupControlsOpen(); /* Creates a canvas associated with the redraw action */ cnvs = IupCanvas(NULL); IupSetCallback(cnvs, "ACTION", (Icallback)redraw_cb); /* Sets size, minimum and maximum values, position and size of the thumb */ /* of the horizontal scrollbar of the canvas */ IupSetAttributes(cnvs, "RASTERSIZE=200x300"); cb = IupColorbar(); IupSetAttribute(cb, "RASTERSIZE", "70x"); IupSetAttribute(cb, "EXPAND", "VERTICAL"); IupSetAttribute(cb, "NUM_PARTS", "2"); IupSetAttribute(cb, "SHOW_SECONDARY", "YES"); IupSetCallback(cb, "SELECT_CB", (Icallback)select_cb); IupSetCallback(cb, "CELL_CB", (Icallback)cell_cb); IupSetCallback(cb, "SWITCH_CB", (Icallback)switch_cb); // IupSetAttribute(cb, "SQUARED", "NO"); IupSetAttribute(cb, "PREVIEW_SIZE", "60"); /* Creates a dialog with a vbox containing the canvas and the colorbar. */ dlg = IupDialog(IupHbox(cnvs, cb, NULL)); /* Sets the dialog's title, so that it is mapped properly */ IupSetAttribute(dlg, "TITLE", "IupColorbar"); /* Maps the dialog. This must be done before the creation of the CD canvas */ IupMap(dlg); /* Creates a CD canvas of type CD_IUP */ cdcanvas = cdCreateCanvas(CD_IUP, cnvs); /* Shows dialog on the center of the screen */ IupShow(dlg); /* Initializes IUP main loop */ IupMainLoop(); /* Finishes IUP */ IupClose(); /* Program finished successfully */ return EXIT_SUCCESS; }
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; }
int main(int argc, char **argv) { Ihandle *male, *female, *exclusive, *frame, *dialog; IupOpen(&argc, &argv); male = IupToggle ("Male", ""); female = IupToggle ("Female", ""); exclusive = IupRadio ( IupVbox ( male, female, NULL ) ); IupSetHandle("male", male); IupSetHandle("female", female); IupSetAttribute(exclusive, IUP_VALUE, "female"); IupSetAttribute(exclusive, IUP_TIP, "Two state button - Exclusive - RADIO"); frame = IupFrame ( exclusive ); IupSetAttribute (frame, IUP_TITLE, "Gender"); dialog = IupDialog ( IupHbox ( IupFill(), frame, IupFill(), NULL ) ); IupSetAttributes(dialog, "SIZE=140, TITLE=IupRadio, RESIZE=NO, MINBOX=NO, MAXBOX=NO"); IupShow(dialog); IupMainLoop(); IupDestroy(dialog); IupClose(); return 0; }
// List method changes static int _list_method_cb(/*@unused@*/ Ihandle *ih, /*@unused@*/ char *text, int pos, int state) { if( state == 0 ) return IUP_DEFAULT; if( !run_task ) run_task = IupSetAtt(NULL,IupTimer(),"TIME","100",NULL); switch(pos) { case 1: LOG(LOGVERBOSE,_("Running geocode with hostip")); IupSetAttribute(lbl_status,"VALUE",""); IupSetfAttribute(lbl_status,"APPEND", _("Downloading info, this may be slow...")); (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geocode); IupSetAttribute(run_task,"RUN","YES"); IupSetAttribute(list_method,"VISIBLE","NO"); break; case 2: LOG(LOGVERBOSE,_("Running geocode with geobytes")); IupSetAttribute(lbl_status,"VALUE",""); IupSetfAttribute(lbl_status,"APPEND", _("Downloading info, this may be slow...")); (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geobytes); IupSetAttribute(run_task,"RUN","YES"); IupSetAttribute(list_method,"VISIBLE","NO"); break; case 3: { edt_address = IupSetAtt(NULL,IupText(NULL), "VALUE","Enter Address...", "EXPAND","HORIZONTAL",NULL); (void)IupSetCallback(edt_address,"GETFOCUS_CB",(Icallback)_address_clear); btn_address = IupSetAtt(NULL,IupButton(_("Lookup"),NULL),NULL); (void)IupSetCallback(btn_address,"ACTION",(Icallback)_address_lookup); hbox_address = IupHbox(edt_address,btn_address,NULL); if( (vbox_method!=NULL) && (hbox_address!=NULL) && (lbl_status!=NULL) ) (void)IupInsert(vbox_method,lbl_status,hbox_address); else { LOG(LOGERR,_("Location search controls not created!")); return IUP_DEFAULT; } IupSetAttribute(list_method,"VISIBLE","NO"); (void)IupMap(hbox_address); IupRefresh(hbox_address); break; } }; return IUP_DEFAULT; }
void guiMenu_OnInit ( void ) { guiHacks_OnInit(); guiMenu = IupHList ( NULL ); guiData = IupHList ( NULL ); guiActionVB = IupHbox ( guiMenu, guiData, NULL ); IupInsert ( guiDlg.vb, guiOrg.main.fset, guiActionVB ); IupMap ( guiActionVB ); IupSetAttribute ( guiActionVB, IUP_EXPAND, IUP_HORIZONTAL ); IupSetAttribute ( guiMenu, IUP_EXPAND, IUP_HORIZONTAL ); IupSetAttribute ( guiData, IUP_EXPAND, IUP_HORIZONTAL ); IupSetCallback ( guiMenu, "VALUECHANGED_CB", guiMenu_OnValueChanged ); IupSetCallback ( guiData, "VALUECHANGED_CB", guiData_OnValueChanged ); guiMenu_OnLang(); }
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 Ihandle *boxcreate (Iclass *box_class, void **params) { Ihandle *self = IupCanvas(NULL); Ihandle *box = IupHbox(NULL); Ihandle *elem; while ((elem = *((Ihandle **) params)) != NULL) { IupAppend(box, elem); params = ((void **) params) + 1; } IupAppend(self, box); iupSetEnv(self, "__cbox_box", (char *)box); return self; }