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; }
//Downloads und installs the latest supported nw.js version for the specified application. int downloaderGui_download(){ downloaderGui = IupGetHandle("downloaderDlg"); pb = IupGetHandle("pb"); status = IupGetHandle("status"); IupSetCallback(IupGetHandle("cancel"), "ACTION", (Icallback)cancelCb); IupSetCallback(downloaderGui, "CLOSE_CB", (Icallback)cancelCb); IupSetFunction("IDLE_ACTION", downloadCb); IupPopup(downloaderGui, IUP_CENTERPARENT, IUP_CENTERPARENT); return globalResult; }
/* 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 btn_detach_cb(Ihandle *bt) { Ihandle *dbox = IupGetHandle("dbox"); IupSetAttribute(dbox, "DETACH", NULL); IupSetAttribute(bt, "ACTIVE", "NO"); IupSetAttribute(IupGetHandle("restore"), "ACTIVE", "Yes"); return IUP_DEFAULT; }
static int cb_btnClearMorse(Ihandle *btn) { Ihandle *txtMorse, *lblMorse; txtMorse = IupGetHandle (TXTMORSE_4); lblMorse = IupGetHandle (LBLMORSELEN_4); IupSetAttribute(txtMorse, "VALUE", 0); IupSetfAttribute(lblMorse, "TITLE", FRMT_MORSELEN_4, 0); return IUP_DEFAULT; }
static int cb_btnClearAscii(Ihandle *btn) { Ihandle *txtAscii, *lblAscii; txtAscii = IupGetHandle (TXTASCII_2); lblAscii = IupGetHandle (LBLASCIILEN_2); IupSetAttribute(txtAscii, "VALUE", 0); IupSetfAttribute(lblAscii, "TITLE", FRMT_ASCIILEN_2, 0); return IUP_DEFAULT; }
int main(int argc, char **argv){ IupOpen(&argc, &argv); led_load(); //Loads the GUI compiled from LED files. mainDlg = IupGetHandle("mainDlg"); //Get the window named "mainDlg" IupShowXY(mainDlg, IUP_CENTER, IUP_CENTER); //Shows the main window aboutDlg = about_init(); //Get the window named "aboutDlg" IupSetCallback(IupGetHandle("about"), "ACTION", (Icallback)main_about); //Callback: Associates the click action of the button "about" with the "about" function. IupMainLoop(); IupClose(); return EXIT_SUCCESS; }
static int detached_cb(Ihandle *ih, Ihandle* new_parent, int x, int y) { IupSetAttribute(new_parent, "TITLE", "New Dialog"); IupSetAttribute(IupGetHandle("restore"), "ACTIVE", "YES"); IupSetAttribute(IupGetHandle("detach"), "ACTIVE", "NO"); printf("Detached!\n"); (void)ih; (void)x; (void)y; return IUP_DEFAULT; }
static int enter(Ihandle *self, int lin, int col) { printf("enteritem_cb(%d, %d)\n", lin, col); if(lin == 2 && col == 2) { IupSetAttribute(IupGetHandle("mat1"), "REDRAW", "ALL"); IupSetAttribute(IupGetHandle("mat2"), "REDRAW", "ALL"); //IupSetAttribute(IupGetHandle("mat3"), "REDRAW", "ALL"); //IupSetAttribute(IupGetHandle("mat4"), "REDRAW", "ALL"); //IupSetAttribute(IupGetHandle("mat5"), "REDRAW", "ALL"); //IupSetAttribute(IupGetHandle("mat6"), "REDRAW", "ALL"); } return IUP_DEFAULT; }
int main(int argc, char **argv) { IupOpen(&argc, &argv); IupControlsOpen(); func_1(); IupShowXY(IupGetHandle("dlg"),IUP_CENTER,IUP_CENTER); IupMainLoop(); IupDestroy(IupGetHandle("img1")); IupDestroy(IupGetHandle("img2")); IupDestroy(IupGetHandle("dlg")); IupControlsClose(); IupClose(); return 0; }
static int iDialogSetMenuAttrib(Ihandle* ih, const char* value) { if (!ih->handle) { Ihandle* menu = IupGetHandle(value); ih->data->menu = menu; return 1; } if (!value) { if (ih->data->menu && ih->data->menu->handle) { ih->data->ignore_resize = 1; IupUnmap(ih->data->menu); /* this will remove the menu from the dialog */ ih->data->ignore_resize = 0; ih->data->menu = NULL; } } else { Ihandle* menu = IupGetHandle(value); if (!menu || menu->iclass->nativetype != IUP_TYPEMENU || menu->parent) return 0; /* already the current menu and it is mapped */ if (ih->data->menu && ih->data->menu==menu && menu->handle) return 1; /* the current menu is mapped, so unmap it */ if (ih->data->menu && ih->data->menu->handle && ih->data->menu!=menu) { ih->data->ignore_resize = 1; IupUnmap(ih->data->menu); /* this will remove the menu from the dialog */ ih->data->ignore_resize = 0; } ih->data->menu = menu; menu->parent = ih; /* use this to create a menu bar instead of a popup menu */ ih->data->ignore_resize = 1; IupMap(menu); /* this will automatically add the menu to the dialog */ ih->data->ignore_resize = 0; } return 1; }
static int nodeinfo(Ihandle* ih) { char attr[50], *kind; Ihandle* tree = IupGetHandle("tree"); int branch = 0, id = IupGetInt(tree, "VALUE"); printf("\nTree Info:\n"); printf(" TOTALCOUNT=%s\n", IupGetAttribute(tree, "COUNT")); printf("Node Info:\n"); printf(" ID=%d\n", id); printf(" TITLE=%s\n", IupGetAttribute(tree, "TITLE")); printf(" DEPTH=%s\n", IupGetAttribute(tree, "DEPTH")); sprintf(attr, "KIND%d", id); kind = IupGetAttribute(tree, "KIND"); printf(" KIND=%s\n", kind); if (strcmp(kind, "BRANCH")==0) branch = 1; if (branch) printf(" STATE=%s\n", IupGetAttribute(tree, "STATE")); printf(" IMAGE=%s\n", IupGetAttribute(tree, "IMAGE")); if (branch) printf(" IMAGEBRANCHEXPANDED=%s\n", IupGetAttribute(tree, "IMAGEBRANCHEXPANDED")); printf(" MARKED=%s\n", IupGetAttribute(tree, "MARKED")); printf(" COLOR=%s\n", IupGetAttribute(tree, "COLOR")); printf(" PARENT=%s\n", IupGetAttribute(tree, "PARENT")); printf(" COUNT=%s\n", IupGetAttribute(tree, "CHILDCOUNT")); printf(" USERDATA=%p\n", IupGetAttribute(tree, "USERDATA")); return IUP_DEFAULT; }
/****************************************************************************** * Function: * * Button with image button callback * * * * Description: * * Callback called when the exit button is pressed or released. Shows a * * message saying if the button was pressed or released * * * * Parameters received: * * self - identifies the canvas that activated the function’s execution. * * b - identifies the activated mouse button: * * * * IUP_BUTTON1 left mouse button (button 1) * * IUP_BUTTON2 middle mouse button (button 2) * * IUP_BUTTON3 right mouse button (button 3) * * * * e - indicates the state of the button: * * * * 0 mouse button was released * * 1 mouse button was pressed * * * * Value returned: * * IUP_DEFAULT * ******************************************************************************/ int btn_image_button_cb( Ihandle *self,int b, int e ) { /* If the left button changed its state... */ if( b == IUP_BUTTON1 ) { /* IUP handles */ Ihandle* text; /* Recovers "text" handle */ text = IupGetHandle( "text" ); /* If the button was pressed... */ if(e == 1) { /* Sets text's value */ IupSetAttribute( text, "VALUE", "Red button pressed" ); } /* else the button was released */ else { /* Sets text's value */ IupSetAttribute( text, "VALUE", "Red button released" ); } } /* Executed function successfully */ return IUP_DEFAULT; }
static int addleaf(void) { Ihandle* tree = IupGetHandle("tree"); int id = IupGetInt(tree, "VALUE"); IupTreeSetAttribute(tree, "ADDLEAF", id, ""); return IUP_DEFAULT; }
static int iDetachBoxSetRestoreAttrib(Ihandle* ih, const char* value) { Ihandle *dlg = IupGetDialog(ih); Ihandle* new_parent = IupGetHandle(value); Ihandle* new_brother = NULL; if (!new_parent) { new_parent = ih->data->old_parent; new_brother = ih->data->old_brother; if (IupGetChildPos(new_parent, new_brother) == -1) /* not a child of new_parent */ new_brother = NULL; } /* Sets the new parent */ IupReparent(ih, new_parent, new_brother); /* Show handler */ if (ih->data->barsize) IupSetAttribute(ih->firstchild, "VISIBLE", "Yes"); /* Updates/redraws the layout of the dialog */ IupRefresh(new_parent); /* Reset previous parent and brother */ ih->data->old_parent = NULL; ih->data->old_brother = NULL; IupDestroy(dlg); return 0; }
void* iupImageGetCursor(const char* name) { void* cursor; Ihandle *ih; if (!name) return NULL; /* Check first in the system resources. */ cursor = iupdrvImageLoad(name, IUPIMAGE_CURSOR); if (cursor) return cursor; /* get handle from name */ ih = IupGetHandle(name); if (!ih) return NULL; /* Check for an already created cursor */ cursor = iupAttribGetStr(ih, "_IUPIMAGE_CURSOR"); if (cursor) return cursor; /* Not created, tries to create the cursor */ cursor = iupdrvImageCreateCursor(ih); /* save the pixbuf */ iupAttribSetStr(ih, "_IUPIMAGE_CURSOR", (char*)cursor); return cursor; }
void* iupImageGetIcon(const char* name) { void* icon; Ihandle *ih; if (!name) return NULL; /* Check first in the system resources. */ icon = iupdrvImageLoad(name, IUPIMAGE_ICON); if (icon) return icon; /* get handle from name */ ih = IupGetHandle(name); if (!ih) return NULL; /* Check for an already created icon */ icon = iupAttribGetStr(ih, "_IUPIMAGE_ICON"); if (icon) return icon; /* Not created, tries to create the icon */ icon = iupdrvImageCreateIcon(ih); /* save the pixbuf */ iupAttribSetStr(ih, "_IUPIMAGE_ICON", (char*)icon); return icon; }
static int insertbranch(void) { Ihandle* tree = IupGetHandle("tree"); int id = IupGetInt(tree, "VALUE"); IupTreeSetAttribute(tree, "INSERTBRANCH", id, ""); return IUP_DEFAULT; }
static int next(Ihandle *ih) { Ihandle* tree = IupGetHandle("tree"); IupSetAttribute(tree, "VALUE", "NEXT"); //IupSetAttribute(tree, "TOPITEM", "8"); return IUP_DEFAULT; }
int tabs_get_index(void) { Ihandle *curr_tab = IupGetHandle(IupGetAttribute(tabs, "VALUE")); char *ss = IupGetAttribute(curr_tab, "TABTITLE"); ss += 5; // Skip "Plot " return atoi(ss); }
/* main program */ int main(int argc, char **argv) { char *error=NULL; /* IUP initialization */ IupOpen(&argc, &argv); IupControlsOpen () ; /* loads LED */ if((error = IupLoad("vbox.led"))) { IupMessage("LED error", error); return 1 ; } dlg = IupGetHandle("Alinhav"); /* sets callbacks */ // IupSetFunction( "acao_pausa", (Icallback) btn_pause_cb ); /* shows dialog */ // IupShowXY(dlg,IUP_CENTER,IUP_CENTER); IupShow(dlg); /* main loop */ IupMainLoop(); IupDestroy(dlg); /* ends IUP */ IupControlsClose() ; IupClose(); return 0 ; }
static int GetFromC(lua_State *L) { Ihandle *n; const char *a; if (!lua_istable(L, -1)) { lua_pushstring(L, "iup.GetFromC: wrong arguments to function"); lua_error(L); return 0; } lua_pushinteger(L, 1); lua_gettable(L, -2); if (!lua_isstring(L, -1)) { lua_pushstring(L, "iup.GetFromC: wrong arguments to function"); lua_error(L); return 0; } a = lua_tostring(L, -1); n = IupGetHandle((char*)a); if(n) iuplua_pushihandle(L, n); else lua_pushnil(L); return 1; }
static void iMatrixDrawImage(Ihandle* ih, int x1, int x2, int y1, int y2, int alignment, int marked, int active, int lin, int col, const char* name) { long bgcolor; int x, y; Ihandle* image; iMatrixDrawSetCellClipping(ih, x1, x2, y1, y2); /* Create an space between image and cell frame */ x1 += IMAT_PADDING_W/2; x2 -= IMAT_PADDING_W/2; y1 += IMAT_PADDING_H/2; y2 -= IMAT_PADDING_H/2; image = IupGetHandle(name); if (image) { int width = IupGetInt(image, "WIDTH"); int height = IupGetInt(image, "HEIGHT"); unsigned char r = 255, g = 255, b = 255; iupMatrixGetBgRGB(ih, lin, col, &r, &g, &b, marked, active); bgcolor = cdEncodeColor(r, g, b); y = (y2+y1 + height)/2; if (alignment == IMAT_ALIGN_CENTER) x = x1 + (x2-x1)/2 - width/2; else if(alignment == IMAT_ALIGN_LEFT) x = x1; else /* RIGHT */ x = x2 - width; cdIupDrawImage(ih->data->cd_canvas, image, x, iupMATRIX_INVERTYAXIS(ih, y), 0, 0, !active, bgcolor); } iMatrixDrawResetCellClipping(ih); }
Ihandle* IupGetAttributeHandle(Ihandle *ih, const char* name) { char* handle_name = iupAttribGetInherit(ih, name); if (handle_name) return IupGetHandle(handle_name); return NULL; }
static int GetHandle(lua_State *L) { const char *name = luaL_checkstring(L,1); Ihandle *ih = IupGetHandle(name); iuplua_pushihandle(L,ih); return 1; }
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; }
static int addline(Ihandle *self) { IupSetAttribute(IupGetHandle("mat1"),"ADDLIN","0"); // IupSetAttribute(IupGetHandle("mat1"),"ADDLIN","0-5"); // IupSetAttribute(IupGetHandle("mat1"),"NUMCOL_NOSCROLL","2"); // IupSetAttribute(IupGetHandle("mat1"),"NUMLIN_NOSCROLL","2"); return IUP_DEFAULT; }
static int active(Ihandle *ih) { Ihandle* tree = IupGetHandle("tree"); if (IupGetInt(tree, "ACTIVE")) IupSetAttribute(tree, "ACTIVE", "NO"); else IupSetAttribute(tree, "ACTIVE", "YES"); return IUP_DEFAULT; }
static int addbranch(void) { char attr[50]; Ihandle* tree = IupGetHandle("tree"); int id = IupGetInt(tree, "VALUE"); sprintf(attr, "ADDBRANCH%d", id); IupSetAttribute(tree, attr, ""); return IUP_DEFAULT; }
static int insertleaf(void) { char attr[50]; Ihandle* tree = IupGetHandle("tree"); int id = IupGetInt(tree, "VALUE"); sprintf(attr, "INSERTLEAF%d", id); IupSetAttribute(tree, attr, ""); return IUP_DEFAULT; }