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); }
/* 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; }
/* 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 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; }
void MatrixCbModeTest(void) { Ihandle* dlg, *box; box = IupVbox(create_matrix(), NULL); IupSetAttribute(box, "MARGIN", "10x10"); dlg = IupDialog(box); IupSetAttribute(dlg, "TITLE", "IupMatrix Simple Test"); IupShowXY(dlg, IUP_CENTER, IUP_CENTER); }
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); }
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 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); }
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 *dlg; Ihandle *text; Ihandle *menu, *menu_file; Ihandle *submenu_file; Ihandle *item_save, *item_autosave, *item_exit; IupOpen(&argc, &argv); text = IupText(NULL); IupSetAttribute(text, "VALUE", "This is an empty text"); item_save = IupItem("Save\tCtrl+S", NULL); /* this is NOT related with the Ctrl+S key callback, it will just align the text at right */ item_autosave = IupItem("&Auto Save", NULL); item_exit = IupItem("Exit", "item_exit_act"); IupSetAttribute(item_exit, "KEY", "x"); /* this is NOT related with the K_X key callback, it will just underline the letter */ IupSetCallback(item_exit, "ACTION", (Icallback) item_exit_cb); IupSetCallback(item_autosave, "ACTION", (Icallback) item_autosave_cb); IupSetAttribute(item_autosave, "VALUE", "ON"); IupSetHandle("item_autosave", item_autosave); /* giving a name to a iup handle */ menu_file = IupMenu(item_save, item_autosave, item_exit, NULL); submenu_file = IupSubmenu("File", menu_file); menu = IupMenu(submenu_file, NULL); IupSetHandle("menu", menu); dlg = IupDialog(IupVbox(text, IupButton("Test", NULL), NULL)); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetAttribute(dlg, "GAP", "10"); IupSetAttribute(dlg, "TITLE", "IupItem"); IupSetAttribute(dlg, "MENU", "menu"); IupSetCallback(dlg, "K_cX", (Icallback) item_exit_cb); /* this will also affect the IupText if at focus, since it is used for clipboard cut */ IupSetCallback(dlg, "K_cA", (Icallback) item_autosave_cb); /* this will also affect the IupText if at focus, since it is used for select all */ IupSetCallback(dlg, "K_cS", (Icallback) item_save_cb); IupShowXY(dlg, IUP_CENTER, IUP_CENTER); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
int button_cb() { Ihandle *dlg, *cv = IupCanvas(""); IupSetAttribute(cv, IUP_SIZE, "100x100"); IupSetAttribute(cv, IUP_MOTION_CB, "mm"); IupSetAttribute(cv, IUP_TIP, "SEGUNDO ELEMENT"); dlg = IupDialog(IupVbox(IupText(""), cv, NULL)); IupSetAttribute(dlg, IUP_SHOW_CB, "showcb"); IupSetAttribute(dlg, IUP_GETFOCUS_CB, "getfocus_cb"); IupPopup(dlg, IUP_CENTER, IUP_CENTER); IupSetAttribute(dlg, IUP_SHOW_CB, NULL); printf("saiu do popup\n"); return IUP_DEFAULT; }
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; }
void SpinTest(void) { Ihandle *dlg, *spinbox, *text; spinbox = IupSpinbox(IupSetAttributes(text = IupText(NULL), "SIZE=50x, EXPAND=HORIZONTAL, FONT=\"Times, 24\"")); // IupSetAttribute(text, "MASK", "/d+|AUTO"); IupSetCallback(spinbox, "SPIN_CB", (Icallback)spin_cb); dlg = IupDialog(IupVbox(spinbox, NULL)); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetAttribute(dlg, "TITLE", "IupSpin Test"); IupShow(dlg); }
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; }
Ihandle* InitDialog(void) { Ihandle* dialog; /* dialog containing the canvas */ Ihandle* content; /* dialog content */ Ihandle* toolbar=InitToolbar(); /* buttons tool bar */ gc.canvas = IupSGLCanvas(640,480,(Icallback) repaint_cb, (Icallback) resize_cb); /* canvas to paint with OpenGL */ gc.msgbar = IupSMessageBar("Message...",20); /* a msg bar */ content = IupVbox(toolbar,gc.canvas,gc.msgbar,NULL); /* create the dialog and set its attributes */ dialog = IupSDialog("Trabalho 1 - Nino",content, (Icallback) exit_cb, "NO"); return dialog; }
void MatrixTest(void) { Ihandle* dlg, *box, *mat; box = IupVbox(mat = create_matrix(), NULL); IupSetAttribute(box, "MARGIN", "10x10"); // IupSetAttribute(box, "FONT", "Arial, 7"); dlg = IupDialog(box); IupSetAttribute(dlg, "TITLE", "IupMatrix Simple Test"); IupShowXY(dlg, IUP_CENTER, IUP_CENTER); // IupSetAttribute(mat, "ADDLIN", "1"); // IupSetAttribute(mat,"4:0","Teste"); // IupSetAttribute(mat, "REDRAW", "ALL"); }
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; }
int main(int argc, char **argv) { Ihandle *dlg, *multitext, *vbox; Ihandle *file_menu, *item_exit, *item_open, *item_saveas; Ihandle *sub1_menu, *menu; IupOpen(&argc, &argv); multitext = IupText(NULL); IupSetAttribute(multitext, "MULTILINE", "YES"); IupSetAttribute(multitext, "EXPAND", "YES"); item_open = IupItem("Open", NULL); item_saveas = IupItem("Save As", NULL); item_exit = IupItem("Exit", NULL); IupSetCallback(item_exit, "ACTION", (Icallback)exit_cb); file_menu = IupMenu( item_open, item_saveas, IupSeparator(), item_exit, NULL); sub1_menu = IupSubmenu("File", file_menu); menu = IupMenu(sub1_menu, NULL); vbox = IupVbox( multitext, NULL); dlg = IupDialog(vbox); IupSetAttributeHandle(dlg, "MENU", menu); IupSetAttribute(dlg, "TITLE", "Simple Notepad"); IupSetAttribute(dlg, "SIZE", "QUARTERxQUARTER"); IupShowXY(dlg, IUP_CENTER, IUP_CENTER); IupSetAttribute(dlg, "USERSIZE", NULL); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
int main(int argc, char **argv) { Ihandle* txt, *bt; IupOpen(&argc, &argv); IupOleControlOpen(); // Creates an instance of the WebBrowser control Ihandle* control = IupOleControl("Shell.Explorer.2"); // Sets production mode IupSetAttribute(control, "DESIGNMODE", "NO"); // Creates a dialog containing the OLE control Ihandle* dlg = IupDialog(IupVbox(IupHbox(txt = IupText(""), bt = IupButton("Load", NULL), NULL), control, NULL)); IupSetAttribute(dlg, "TITLE", "IupOle"); IupSetAttribute(dlg, "MY_TEXT", (char*)txt); IupSetAttribute(txt, "EXPAND", "HORIZONTAL"); IupSetCallback(bt, "ACTION", (Icallback)load_cb); // Maps the dialog to force the creation of the control IupMap(dlg); // Gathers the IUnknown pointer to access the control's interface IUnknown* punk = (IUnknown*) IupGetAttribute(control, "IUNKNOWN"); IWebBrowser2 *pweb = NULL; punk->QueryInterface(IID_IWebBrowser2, (void **)&pweb); punk->Release(); IupSetAttribute(dlg, "MY_WEB", (char*)pweb); // Shows dialog IupShow(dlg); IupMainLoop(); // Releases the control interface pweb->Release(); IupClose(); return EXIT_SUCCESS; }
static Ihandle * createdialog(void) { Ihandle* txt, *bt; Ihandle * browser = IupOleCreateBrowser(); // Creates a dialog containing the OLE control Ihandle* dlg = IupDialog(IupVbox(IupHbox(txt = IupText(""), bt = IupButton("Load", NULL), NULL), browser, NULL)); IupSetAttribute(dlg, "TITLE", "IupOle"); IupSetAttribute(dlg, "MY_TEXT", (char*)txt); IupSetAttribute(dlg, "MY_BROWSER", (char*)browser); IupSetAttribute(txt, "EXPAND", "HORIZONTAL"); IupSetAttribute(txt, "VALUE", "d:/EditalUniversal.doc"); IupSetCallback(bt, "ACTION", (Icallback)load_cb); // Shows dialog IupShow(dlg); return dlg; }
Ihandle *IupQuakeMouseLayout() { Ihandle *tab; tab = IupSetAttributes( IupHbox( IupVbox( IupQuakeSetToggle("Reverse mouse", "m_pitch", "-0.022", "0.022", 0), IupQuakeSetToggle("Use automatic sensitivity scaling", "m_autosens", "1", "0", 1), IupQuakeScale("Mouse sensitivity", 1.00, 20.00, 0.1, "sensitivity", 3.00), NULL ), IupFill(), NULL ), "HOMOGENEOUS=YES" ); IupSetAttributes(tab, "GAP=5"); return tab; }
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); }
/* Main program */ int main(int argc, char **argv) { Ihandle* dlg, *cells, *box; IupOpen(&argc, &argv); IupControlsOpen(); cells = create(); box = IupVbox(cells, NULL); IupSetAttribute(box,"MARGIN","10x10"); dlg = IupDialog(box); IupSetAttribute(dlg,"TITLE","IupCells"); IupSetAttribute(dlg, "RASTERSIZE","350x250"); IupShowXY(dlg,IUP_CENTER,IUP_CENTER); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
int main(int argc, char* argv[]) { int i, count = sizeof(test_list)/sizeof(TestItems); char str[50]; Ihandle *dlg, *list; IupOpen(&argc, &argv); IupControlsOpen(); // IupSetGlobal("UTF8MODE", "Yes"); // IupSetGlobal("LANGUAGE", "PORTUGUESE"); // IupSetGlobal("DEFAULTDECIMALSYMBOL", "."); // setlocale(LC_NUMERIC, "C"); dlg = IupDialog(IupVbox(list = IupList(NULL), NULL)); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetAttribute(dlg, "TITLE", "IupTests"); IupSetCallback(dlg, "CLOSE_CB", close_cb); // IupSetAttribute(dlg, "ICON", "SIZE_ICON"); IupSetHandle("BIGTEST", dlg); IupSetAttribute(list, "VISIBLELINES", "15"); IupSetAttribute(list, "EXPAND", "YES"); IupSetCallback(list, "DBLCLICK_CB", (Icallback)dblclick_cb); IupSetCallback(list, "K_CR", k_enter_cb); for (i=0; i<count; i++) { sprintf(str, "%d", i+1); IupSetAttribute(list, str, test_list[i].title); } IupShowXY(dlg, 100, IUP_CENTER); IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
int main(int argc, char **argv) { Ihandle *dg, *A, *B; IupOpen(&argc, &argv); IupControlsOpen(); IupSetFunction("showcb", (Icallback) show_cb); IupSetFunction("buttoncb", (Icallback) button_cb); IupSetFunction("getfocus_cb", (Icallback) getfocus_cb); IupSetFunction("mm", (Icallback) mm); A = IupButton("Open Popup", "buttoncb"); B = IupButton("Dummy", ""); IupSetAttribute(A, IUP_TIP, "TIP DO PRIMEIRO ELEMENTO"); dg = IupDialog(IupVbox(A, B, NULL)); IupPopup(dg, IUP_CENTER, IUP_CENTER); IupMainLoop(); IupClose(); return 1; }
static int mdi_new(Ihandle* ih) { static int id = 0; Ihandle *box, *cnv, *dlg; cnv = IupCanvas(NULL); IupSetAttribute(cnv,"BGCOLOR","128 255 0"); box = IupVbox(cnv, NULL); IupSetAttribute(box,"MARGIN","5x5"); dlg = IupDialog(box); IupSetfAttribute(dlg,"TITLE","MDI Child (%d)", id); id++; IupSetAttribute(dlg,"MDICHILD","YES"); IupSetAttribute(dlg,"PARENTDIALOG","mdiFrame"); IupSetCallback(dlg,"MDIACTIVATE_CB",(Icallback)mdi_activate); IupSetAttribute(dlg,"RASTERSIZE","300x300"); // IupSetAttribute(dlg, "PLACEMENT", "MAXIMIZED"); IupShow(dlg); return IUP_DEFAULT; }
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; }
/* Initializes the dlg */ static void init_dlg(void) { Ihandle* butactv, *butnext, *butprev, *butmenu; Ihandle* tree = IupGetHandle("tree"); Ihandle* box = IupHbox(tree, IupVbox(butactv = IupButton("Active", NULL), butnext = IupButton("Next", NULL), butprev = IupButton("Prev", NULL), butmenu = IupButton("Menu", NULL), NULL), NULL); Ihandle* dlg = IupDialog(box) ; IupSetAttribute(dlg, "TITLE", "IupTree"); IupSetAttribute(box, "MARGIN", "10x10"); IupSetAttribute(box, "GAP", "10"); // IupSetAttribute(box, "BGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "BGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "BACKGROUND", "200 10 80"); // IupSetAttribute(dlg, "BGCOLOR", "173 177 194"); // Motif BGCOLOR for documentation IupSetCallback(butactv, "ACTION", active); IupSetCallback(butnext, "ACTION", next); IupSetCallback(butprev, "ACTION", prev); IupSetCallback(butmenu, "ACTION", (Icallback)rightclick_cb); IupSetHandle("dlg", dlg); }
void CanvasScrollbarTest(void) { Ihandle *dlg, *cnv; cnv = IupCanvas(NULL); IupSetAttribute(cnv, "RASTERSIZE", "300x200"); /* initial size */ IupSetAttribute(cnv, "SCROLLBAR", "YES"); IupSetCallback(cnv, "RESIZE_CB", (Icallback)resize_cb); IupSetCallback(cnv, "ACTION", (Icallback)action); IupSetCallback(cnv, "MAP_CB", (Icallback)map_cb); IupSetCallback(cnv, "UNMAP_CB", (Icallback)unmap_cb); IupSetCallback(cnv, "WHEEL_CB", (Icallback)wheel_cb); IupSetCallback(cnv, "SCROLL_CB", (Icallback)scroll_cb); dlg = IupDialog(IupVbox(cnv, NULL)); IupSetAttribute(dlg, "TITLE", "Scrollbar Test"); IupSetAttribute(dlg, "MARGIN", "10x10"); IupMap(dlg); IupSetAttribute(cnv, "RASTERSIZE", NULL); /* release the minimum limitation */ IupShowXY(dlg,IUP_CENTER,IUP_CENTER); }