static void createMenu(void) { Ihandle* winmenu; Ihandle* mnu = IupMenu( IupSubmenu("MDI",IupMenu( IupItem("New", "mdi_new"), NULL)), IupSubmenu("Window", winmenu = IupMenu( IupItem("Tile Horizontal", "mdi_tilehoriz"), IupItem("Tile Vertical", "mdi_tilevert"), IupItem("Cascade", "mdi_cascade"), IupItem("Icon Arrange", "mdi_icon"), IupItem("Close All", "mdi_closeall"), IupSeparator(), IupItem("Next", "mdi_next"), IupItem("Previous", "mdi_previous"), NULL)), NULL); IupSetHandle("mnu",mnu); IupSetHandle("mdiMenu",winmenu); IupSetFunction("mdi_new", (Icallback)mdi_new); IupSetFunction("mdi_tilehoriz", (Icallback)mdi_tilehoriz); IupSetFunction("mdi_tilevert", (Icallback)mdi_tilevert); IupSetFunction("mdi_cascade", (Icallback)mdi_cascade); IupSetFunction("mdi_icon", (Icallback)mdi_icon); IupSetFunction("mdi_next", (Icallback)mdi_next); IupSetFunction("mdi_previous", (Icallback)mdi_previous); IupSetFunction("mdi_closeall", (Icallback)mdi_closeall); }
static void SetHandle(void) { if (lua_isnil(lua_getparam(2))) IupSetHandle(luaL_check_string(1), NULL); else IupSetHandle(luaL_check_string(1), iuplua_checkihandle(2)); }
static void iSpinLoadImages(void) { Ihandle* img; /* Spin UP image */ unsigned char iupspin_up_img[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* Spin DOWN image */ unsigned char iupspin_down_img[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; img = IupImage(9, 6, iupspin_up_img); IupSetAttribute(img, "0", "0 0 0"); IupSetAttribute(img, "1", "BGCOLOR"); IupSetHandle("IupSpinUpImage", img); img = IupImage(9, 6, iupspin_down_img); IupSetAttribute(img, "0", "0 0 0"); IupSetAttribute(img, "1", "BGCOLOR"); IupSetHandle("IupSpinDownImage", img); }
static void iMatrixCreateCursor(void) { Ihandle *imgcursor; unsigned char matrx_img_cur_excel[15*15] = { 0,0,0,0,1,1,1,1,1,1,0,0,0,0,0, 0,0,0,0,1,2,2,2,2,1,1,0,0,0,0, 0,0,0,0,1,2,2,2,2,1,1,0,0,0,0, 0,0,0,0,1,2,2,2,2,1,1,0,0,0,0, 1,1,1,1,1,2,2,2,2,1,1,1,1,1,0, 1,2,2,2,2,2,2,2,2,2,2,2,2,1,1, 1,2,2,2,2,2,2,2,2,2,2,2,2,1,1, 1,2,2,2,2,2,2,2,2,2,2,2,2,1,1, 1,1,1,1,1,2,2,2,2,1,1,1,1,1,1, 0,1,1,1,1,2,2,2,2,1,1,1,1,1,1, 0,0,0,0,1,2,2,2,2,1,1,0,0,0,0, 0,0,0,0,1,2,2,2,2,1,1,0,0,0,0, 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0, 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; imgcursor = IupImage(15, 15, matrx_img_cur_excel); IupSetAttribute(imgcursor, "0", "BGCOLOR"); IupSetAttribute(imgcursor, "1", "0 0 0"); IupSetAttribute(imgcursor, "2", "255 255 255"); IupSetAttribute(imgcursor, "HOTSPOT", "7:7"); /* Centered Hotspot */ IupSetHandle("IupMatrixCrossCursor", imgcursor); IupSetHandle("matrx_img_cur_excel", imgcursor); /* for backward compatibility */ }
void TransferFunctionsViewer::BuildInterface () { m_iup_canvas = IupGLCanvas ("tfviewer_canvas"); IupSetCallback (m_iup_canvas, "ACTION", (Icallback)TransferFunctionsViewer::Action); IupSetCallback (m_iup_canvas, "BUTTON_CB", (Icallback)TransferFunctionsViewer::Button_CB); IupSetCallback (m_iup_canvas, "MOTION_CB", (Icallback)TransferFunctionsViewer::Motion_CB); IupSetAttribute (m_iup_canvas, IUP_BUFFER, IUP_DOUBLE); IupSetAttribute (m_iup_canvas, IUP_RASTERSIZE, "258x50"); IupSetAttribute (m_iup_canvas, IUP_RESIZE, IUP_NO); IupSetHandle ("tfviewer_canvas", m_iup_canvas); m_iup_sub_menu_file = IupSubmenu ("Arquivo", IupMenu(NULL)); m_iup_menu = IupMenu (m_iup_sub_menu_file, NULL); IupSetHandle ("TransferFunctionMenu", m_iup_menu); m_iup_main_dialog = IupDialog (m_iup_canvas); //IupSetAttribute (m_iup_main_dialog, "MENU", "TransferFunctionMenu"); IupSetAttribute (m_iup_main_dialog, "TITLE", "Transfer Function Visualization"); IupSetAttribute (m_iup_main_dialog, "BORDER", "NO"); IupSetAttribute (m_iup_main_dialog, "RESIZE", "NO"); IupMap (m_iup_main_dialog); IupRefresh (m_iup_main_dialog); if (!m_pixels) m_pixels = new float[258 * 50 * 4]; Redraw (); }
void createimg_s (void) { Ihandle *img_restart, *img_play, *img_forward, *img_rewind, *img_pause; img_restart = IupImage(22,22, pixmap_restart); img_play = IupImage(22,22, pixmap_play); img_forward = IupImage(22,22, pixmap_forward); img_rewind = IupImage(22,22, pixmap_rewind); img_pause = IupImage(22,22, pixmap_pause); IupSetHandle ("img_restart", img_restart); IupSetHandle ("img_play", img_play); IupSetHandle ("img_forward", img_forward); IupSetHandle ("img_rewind", img_rewind); IupSetHandle ("img_pause", img_pause); IupSetAttribute (img_restart, "1", "0 0 0"); IupSetAttribute (img_restart, "2", "BGCOLOR"); IupSetAttribute (img_play, "1", "0 0 0"); IupSetAttribute (img_play, "2", "BGCOLOR"); IupSetAttribute (img_forward, "1", "0 0 0"); IupSetAttribute (img_forward, "2", "BGCOLOR"); IupSetAttribute (img_rewind, "1", "0 0 0"); IupSetAttribute (img_rewind, "2", "BGCOLOR"); IupSetAttribute (img_pause, "1", "0 0 0"); IupSetAttribute (img_pause, "2", "BGCOLOR"); }
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; }
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 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; }
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* load_image_LogoTecgraf(void) { Ihandle* image = IupGetHandle("LogoTecgraf"); if (!image) { unsigned char imgdata[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 120, 143, 125, 132, 148, 178, 173, 133, 149, 178, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 110, 130, 48, 130, 147, 177, 254, 124, 139, 167, 254, 131, 147, 176, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 128, 153, 134, 142, 159, 191, 194, 47, 52, 61, 110, 114, 128, 154, 222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 143, 172, 192, 140, 156, 188, 99, 65, 69, 76, 16, 97, 109, 131, 251, 129, 144, 172, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 147, 175, 232, 140, 157, 188, 43, 0, 0, 0, 0, 100, 112, 134, 211, 126, 141, 169, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 78, 88, 26, 48, 52, 57, 60, 135, 150, 178, 254, 108, 121, 145, 83, 105, 118, 142, 76, 106, 119, 143, 201, 118, 133, 159, 122, 117, 129, 152, 25, 168, 176, 190, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 118, 128, 145, 3, 104, 117, 140, 92, 114, 127, 152, 180, 131, 147, 177, 237, 133, 149, 178, 249, 38, 42, 50, 222, 137, 152, 180, 249, 126, 142, 170, 182, 114, 128, 154, 182, 104, 117, 140, 227, 95, 107, 128, 238, 83, 93, 112, 248, 84, 95, 113, 239, 104, 117, 141, 180, 115, 129, 155, 93, 127, 140, 165, 4, 98, 109, 130, 153, 109, 123, 147, 254, 145, 163, 195, 153, 138, 154, 182, 56, 115, 123, 138, 5, 92, 99, 109, 35, 134, 149, 177, 230, 0, 0, 0, 0, 0, 0, 0, 0, 120, 133, 159, 143, 135, 151, 181, 115, 86, 89, 93, 5, 41, 45, 51, 54, 40, 45, 53, 150, 107, 120, 144, 254, 122, 137, 164, 154, 51, 57, 66, 147, 83, 93, 112, 255, 108, 121, 145, 159, 113, 126, 151, 62, 123, 136, 159, 8, 87, 93, 103, 35, 125, 141, 169, 230, 0, 0, 0, 0, 0, 0, 0, 0, 129, 143, 169, 143, 140, 156, 184, 115, 134, 147, 172, 8, 124, 138, 165, 60, 124, 139, 167, 155, 131, 147, 177, 255, 131, 147, 176, 153, 64, 68, 73, 2, 36, 39, 45, 86, 41, 46, 54, 173, 60, 67, 80, 232, 75, 84, 101, 251, 89, 100, 120, 228, 105, 118, 142, 250, 110, 123, 148, 187, 118, 132, 158, 187, 126, 141, 169, 229, 134, 149, 177, 239, 136, 152, 179, 250, 136, 152, 181, 234, 139, 156, 186, 175, 130, 145, 173, 90, 124, 134, 151, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 74, 79, 19, 60, 64, 73, 50, 92, 103, 124, 254, 86, 95, 111, 84, 90, 100, 117, 76, 126, 141, 168, 201, 113, 126, 150, 119, 99, 105, 117, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 105, 125, 231, 135, 151, 181, 46, 0, 0, 0, 0, 137, 154, 184, 212, 123, 137, 164, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 83, 98, 191, 133, 149, 179, 102, 111, 121, 139, 17, 134, 150, 180, 252, 126, 140, 166, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 48, 57, 132, 121, 136, 164, 197, 121, 135, 161, 115, 130, 146, 175, 221, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 47, 52, 46, 87, 98, 118, 254, 126, 142, 170, 254, 124, 139, 166, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 57, 67, 118, 115, 128, 152, 170, 127, 140, 164, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; image = IupImageRGBA(16, 16, imgdata); IupSetHandle("LogoTecgraf", image); } return image; }
void TrayTest(void) { Ihandle *dlg, *img; img = IupImage(16, 16, pixmap); IupSetAttribute(img, "0", "BGCOLOR"); IupSetAttribute(img, "1", "255 255 0"); IupSetAttribute(img, "2", "255 0 0"); IupSetAttribute(img, "3", "255 255 0"); IupSetHandle ("img", img); dlg = IupDialog(NULL); IupSetAttribute(dlg, "TITLE", "Tray Test"); IupSetAttribute(dlg, "TRAY", "YES"); IupSetAttribute(dlg, "TRAYTIP", "Tip at Tray"); IupSetAttribute(dlg, "TRAYIMAGE", "img"); IupSetAttribute(dlg, "SIZE", "100x100"); IupSetCallback(dlg, "TRAYCLICK_CB", (Icallback)trayclick); IupSetCallback(dlg, "CLOSE_CB", (Icallback)close_cb); IupSetCallback(dlg, "K_ESC", (Icallback)k_esc); IupShowXY(dlg, IUP_CENTER, IUP_CENTER); /* start only the task bar icon */ IupSetAttribute(dlg, "HIDETASKBAR", "YES"); }
Iclass* iupSpinNewClass(void) { Iclass* ic = iupClassNew(iupRegisterFindClass("vbox")); ic->name = "spin"; ic->format = NULL; /* no parameters */ ic->nativetype = IUP_TYPEVOID; ic->childtype = IUP_CHILDNONE; ic->is_interactive = 0; /* Class functions */ ic->New = iupSpinNewClass; ic->Create = iSpinCreateMethod; iupClassRegisterCallback(ic, "SPIN_CB", "i"); if (!IupGetHandle("IupSpinUpImage") || !IupGetHandle("IupSpinDownImage")) { Ihandle* spin_timer = IupTimer(); IupSetCallback(spin_timer, "ACTION_CB", (Icallback) iSpinTimerCB); IupSetHandle("IupSpinTimer", spin_timer); iSpinLoadImages(); } return ic; }
static void iDetachBoxCreateCursor(void) { Ihandle *imgcursor; unsigned char detach_img_cur[16*16] = { 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 0,0,1,4,4,4,4,4,4,4,4,4,4,4,4,1, 0,0,1,4,4,4,4,4,4,4,4,4,4,4,4,1, 0,0,1,3,3,3,3,3,3,3,3,3,3,3,3,1, 0,0,1,3,3,3,2,2,2,3,3,3,3,3,3,1, 1,1,1,1,1,1,2,2,2,1,1,1,1,1,3,1, 1,4,4,4,4,4,2,2,2,4,4,4,4,1,3,1, 1,4,4,4,4,4,2,2,2,4,4,4,4,1,1,1, 1,3,3,3,3,3,2,2,2,3,3,3,3,1,0,0, 1,3,3,3,2,2,2,2,2,2,2,3,3,1,0,0, 1,3,3,3,3,2,2,2,2,2,3,3,3,1,0,0, 1,3,3,3,3,3,2,2,2,3,3,3,3,1,0,0, 1,3,3,3,3,3,3,2,3,3,3,3,3,1,0,0, 1,3,3,3,3,3,3,3,3,3,3,3,3,1,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 }; imgcursor = IupImage(16, 16, detach_img_cur); IupSetAttribute(imgcursor, "0", "BGCOLOR"); IupSetAttribute(imgcursor, "1", "0 0 0"); IupSetAttribute(imgcursor, "2", "110 150 255"); IupSetAttribute(imgcursor, "3", "255 255 255"); IupSetAttribute(imgcursor, "4", "64 92 255"); IupSetHandle("IupDetachBoxCursor", imgcursor); }
/* Initializes IupTree and registers callbacks */ static void init_tree(void) { Ihandle* tree = IupTree(); IupSetCallback(tree, "EXECUTELEAF_CB", (Icallback) executeleaf_cb); IupSetCallback(tree, "RENAME_CB", (Icallback) rename_cb); IupSetCallback(tree, "BRANCHCLOSE_CB", (Icallback) branchclose_cb); IupSetCallback(tree, "BRANCHOPEN_CB", (Icallback) branchopen_cb); IupSetCallback(tree, "DRAGDROP_CB", (Icallback) dragdrop_cb); IupSetCallback(tree, "RIGHTCLICK_CB", (Icallback) rightclick_cb); IupSetCallback(tree, "K_ANY", (Icallback) k_any_cb); IupSetCallback(tree, "SHOWRENAME_CB", (Icallback) showrename_cb); IupSetCallback(tree, "SELECTION_CB", (Icallback) selection_cb); // IupSetCallback(tree, "MULTISELECTION_CB", (Icallback) multiselection_cb); // IupSetCallback(tree, "MULTIUNSELECTION_CB", (Icallback) multiunselection_cb); IupSetCallback(tree, "GETFOCUS_CB", (Icallback) getfocus_cb); IupSetCallback(tree, "KILLFOCUS_CB", (Icallback) killfocus_cb); //IupSetCallback(tree, "ENTERWINDOW_CB", (Icallback) enterwindow_cb); //IupSetCallback(tree, "LEAVEWINDOW_CB", (Icallback)leavewindow_cb); //IupSetCallback(tree, "BUTTON_CB", (Icallback)button_cb); //IupSetCallback(tree, "MOTION_CB", (Icallback)motion_cb); IupSetCallback(tree, "NODEREMOVED_CB", (Icallback)noderemoved_cb); IupSetCallback(tree, "TOGGLEVALUE_CB", (Icallback)togglevalue_cb); IupSetCallback(tree, "TIPS_CB", (Icallback)tips_cb); IupSetCallback(tree, "HELP_CB", (Icallback)help_cb); // IupSetAttribute(tree, "FONT", "COURIER_NORMAL_14"); // IupSetAttribute(tree, "FONTSIZE", "36"); // IupSetAttribute(tree, "FGCOLOR", "255 0 0"); // IupSetAttribute(tree, "SPACING", "10"); // IupSetAttribute(tree, "BGCOLOR", "255 255 255"); // IupSetAttribute(tree, "BGCOLOR", "128 0 255"); // IupSetAttribute(tree, "MARKMODE", "MULTIPLE"); // IupSetAttribute(tree, "SHOWRENAME", "YES"); IupSetAttribute(tree, "SHOWDRAGDROP", "YES"); IupSetAttribute(tree, "SHOWTOGGLE", "YES"); // IupSetAttribute(tree, "SHOWTOGGLE", "3STATE"); // IupSetAttribute(tree, "DROPEQUALDRAG", "YES"); IupSetAttribute(tree, "ADDEXPANDED", "YES"); // IupSetAttribute(tree, "HIDELINES", "YES"); // IupSetAttribute(tree, "HIDEBUTTONS", "YES"); // IupSetAttribute(tree, "INDENTATION", "40"); // IupSetAttribute(tree, "CANFOCUS", "NO"); IupSetAttribute(tree, "TIP", "Tree Tip"); // IupSetAttribute(tree, "INFOTIP", "No"); // IupSetAttribute(tree, "TIPBGCOLOR", "255 128 128"); // IupSetAttribute(tree, "TIPFGCOLOR", "0 92 255"); // Windows Only // IupSetAttribute(tree, "TIPBALLOON", "YES"); // IupSetAttribute(tree, "TIPBALLOONTITLE", "Tip Title"); // IupSetAttribute(tree, "TIPBALLOONTITLEICON", "2"); // IupSetAttribute(tree, "ADDROOT", "NO"); IupSetHandle("tree", tree); }
/* Main program */ int main(int argc, char **argv) { Ihandle* dlg; Ihandle *tree1, *tree2; IupOpen(&argc, &argv); /* IUP initialization */ IupSetGlobal("UTF8MODE", "Yes"); tree1 = IupTree(); IupSetHandle("tree1", tree1); tree2 = IupTree(); IupSetHandle("tree2", tree2); //Generic DND //IupSetAttribute(tree1, "SHOWDRAGDROP", "YES"); //IupSetAttribute(tree1, "DRAGTYPES", "TEXT,STRING"); //Tree2Tree DND IupSetAttribute(tree1, "DRAGDROPTREE", "YES"); //Common DND Attrib IupSetAttribute(tree1, "DRAGSOURCE", "YES"); IupSetAttribute(tree1, "DRAGSOURCEMOVE", "YES"); IupSetAttribute(tree1, "DRAGTYPES", "TREEBRANCH"); //Generic DND //IupSetAttribute(tree2, "SHOWDRAGDROP", "YES"); //IupSetAttribute(tree2, "DROPTYPES", "TEXT,STRING"); //Tree2Tree DND IupSetAttribute(tree2, "DRAGDROPTREE", "YES"); //Common DND Attrib IupSetAttribute(tree2, "DROPTARGET", "YES"); IupSetAttribute(tree2, "DROPTYPES", "TREEBRANCH"); init_dlg(); /* Initializes the dialog */ dlg = IupGetHandle("dlg"); /* Retrieves the dialog handle */ IupShowXY(dlg, IUP_CENTER, IUP_CENTER); /* Displays the dialog */ init_tree1_atributes(); /* Initializes attributes, can be done here or anywhere */ init_tree2_atributes(); /* Initializes attributes, can be done here or anywhere */ IupMainLoop(); /* Main loop */ IupClose(); /* Ends IUP */ return EXIT_SUCCESS; }
static int SetHandle(lua_State *L) { const char *name = luaL_checkstring(L,1); Ihandle *ih = iuplua_checkihandle(L,2); Ihandle *last = IupSetHandle(name, ih); iuplua_pushihandle(L, last); return 1; }
static void create_images(void) { Ihandle *image; image = IupImage(11, 11, pixmap_x); IupSetAttribute(image, "0", "BGCOLOR"); IupSetAttribute(image, "1", "0 1 0"); IupSetAttribute(image, "2", "255 0 0"); IupSetAttribute(image, "3", "255 255 0"); IupSetHandle("DLG_ICON", image); image = IupImage(32, 32, pixmap_cursor); IupSetAttribute(image, "0", "BGCOLOR"); /* always for cursor */ IupSetAttribute(image, "1", "255 0 0"); IupSetAttribute(image, "2", "128 0 0"); IupSetAttribute(image, "HOTSPOT", "21:10"); IupSetHandle("DLG_CURSOR", image); }
/* 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; }
/* 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); }
static int iBaseSetNormalizerGroupAttrib(Ihandle* ih, const char* value) { Ihandle* ih_normalizer = IupGetHandle(value); if (!ih_normalizer) { ih_normalizer = IupNormalizer(NULL); IupSetHandle(value, ih_normalizer); } IupSetAttribute(ih_normalizer, "ADDCONTROL_HANDLE", (char*)ih); return 1; }
static void createmenu(void) { Ihandle* menu = IupMenu( IupSubmenu("submenu", IupMenu(IupItem("item1","x"), IupItem("item2","x"), NULL)), IupItem("remove line","removeline"), IupItem("add line","addline"), IupItem("remove col","removecol"), IupItem("add col","addcol"), IupItem("redraw","redraw"), NULL); IupSetHandle("mymenu", menu); }
void IupSetAttributeHandle(Ihandle *ih, const char* name, Ihandle *ih_named) { char* handle_name = IupGetName(ih_named); if (handle_name) IupStoreAttribute(ih, name, handle_name); else { char str_name[100]; sprintf(str_name, "_IUP_NAME(%p)", ih_named); IupSetHandle(str_name, ih_named); IupStoreAttribute(ih, name, str_name); } }
void iupImageStockLoad(const char *name) { const char* native_name = NULL; Ihandle* ih = NULL; iImageStockGet(name, &ih, &native_name); if (ih) IupSetHandle(name, ih); else if (native_name) { /* dummy image to save the GTK stock name */ void* image = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE); if (image) { int w, h, bpp; iupdrvImageGetInfo(image, &w, &h, &bpp); if (bpp == 32) ih = IupImageRGBA(w,h,NULL); else ih = IupImageRGB(w,h,NULL); IupSetHandle(native_name, ih); } } }
static void create_CircleProgress_animation(void) { Ihandle* animation = IupUser(); int i; char name[30]; for (i = 0; i < 12; i++) { sprintf(name, "IUP_CircleProgress%d", i); IupAppend(animation, IupGetHandle(name)); } IupSetHandle("IUP_CircleProgressAnimation", animation); IupSetAttribute(animation, "FRAMETIME", "83"); /* near 1s for a full turn */ }
static Ihandle* createFrame(void) { Ihandle *dlg, *cnv; cnv = IupCanvas( NULL); IupSetAttribute(cnv,"MDICLIENT","YES"); IupSetAttribute(cnv,"MDIMENU","mdiMenu"); dlg = IupDialog(cnv); IupSetAttribute(dlg,"TITLE","MDI Frame"); IupSetAttribute(dlg,"MDIFRAME","YES"); IupSetAttribute(dlg,"RASTERSIZE","800x600"); IupSetAttribute(dlg,"MENU","mnu"); IupSetHandle("mdiFrame", dlg); return dlg; }
Ihandle* IupSetAtt(const char* handle_name, Ihandle* ih, const char* name, ...) { const char *attr, *val; va_list arg; va_start (arg, name); attr = name; while (attr) { val = va_arg(arg, const char*); IupSetAttribute(ih, attr, val); attr = va_arg(arg, const char*); } va_end(arg); if (handle_name) IupSetHandle(handle_name, ih); return ih; }
static Ihandle* decl( char* name, Ihandle* elem, char* first, ...) { char *attr, *val; va_list arg; va_start (arg, first); attr = first; while ((long int)attr) { val = va_arg(arg,char*); IupSetAttribute( elem, attr, val ); attr = va_arg(arg,char*); } va_end (arg); if(name) IupSetHandle( name, elem ); return elem; }
void mainMenuCreate(void) { Ihandle* file_menu = IupMenu( IupItem( "Open...", "app_open_cb"), IupSeparator(), IupItem( "Exit", "app_exit_cb"), NULL ); Ihandle* menu = IupMenu( IupSubmenu("File", file_menu), NULL ); /* this will be used by the dialog */ IupSetHandle("app_menu", menu); IupSetFunction("app_open_cb", (Icallback)app_open_cb); IupSetFunction("app_exit_cb", (Icallback)app_exit_cb); }