/* 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); }
static int Tree(lua_State *L) { Ihandle *ih = IupTree(); iuplua_plugstate(L, ih); iuplua_pushihandle_raw(L, ih); return 1; }
/* 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; }
VALUE rb_IupTree(int argc,VALUE *argv,VALUE self) { extern VALUE rb_cIupTree; Ihandle* v; IupControlsOpen(); v = IupTree(); if(argc==1 && TYPE(argv[0])==T_HASH) rb_set_attribute(v,argv[0]); if(v) return rb_funcall(rb_cIupTree,rb_intern("new"),1,ULONG2NUM((unsigned long)v)); return Qnil; }
Ihandle *createtree() { Ihandle *tree = IupTree(); IupSetAttribute(tree, "SIZE", "80x80"); IupSetAttributes(tree, "FONT=COURIER_NORMAL_10, \ TITLE=Figures, \ ADDBRANCH=3D, \ ADDBRANCH=2D, \ ADDLEAF1=trapeze, \ ADDBRANCH1=parallelogram, \ ADDLEAF2=diamond, \ ADDLEAF2=square, \ ADDBRANCH4=triangle, \ ADDLEAF5=scalenus, \ ADDLEAF5=isoceles, \ ADDLEAF5=equilateral, \ VALUE=6, \ ADDEXPANDED=NO"); return tree; }
/* 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, "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, "HELP_CB", (Icallback)help_cb); // IupSetAttribute(tree, "FONT", "COURIER_NORMAL_14"); // IupSetAttribute(tree, "FGCOLOR", "255 0 0"); // IupSetAttribute(tree, "SPACING", "10"); // IupSetAttribute(tree, "BGCOLOR", "255 255 255"); //IupSetAttribute(tree, "MARKMODE", "MULTIPLE"); //IupSetAttribute(tree, "SHOWDRAGDROP", "YES"); //IupSetAttribute(tree, "SHOWRENAME", "YES"); //IupSetAttribute(tree, "AUTODRAGDROP", "YES"); /* Gtk Only */ //IupSetAttribute(tree, "ADDEXPANDED", "NO"); // IupSetAttribute(tree, "HIDELINES", "YES"); // IupSetAttribute(tree, "HIDEBUTTONS", "YES"); // IupSetAttribute(tree, "INDENTATION", "40"); IupSetHandle("tree", tree); }
static Ihandle *createtree(void) { Ihandle *tree = IupTree(); IupSetAttributes(tree, "FONT=COURIER_NORMAL_10, \ NAME=Figures, \ ADDBRANCH=3D, \ ADDBRANCH=2D, \ ADDLEAF1=trapeze, \ ADDBRANCH1=parallelogram, \ ADDLEAF2=diamond, \ ADDLEAF2=square, \ ADDBRANCH4=triangle, \ ADDLEAF5=scalenus, \ ADDLEAF5=isosceles, \ ADDLEAF5=equilateral, \ RASTERSIZE=180x180, \ VALUE=6, \ CTRL=ON, \ SHIFT=ON, \ CX=600, \ CY=10, \ ADDEXPANDED=NO"); return tree; }
void ScrollBoxTest(void) { Ihandle *mnu, *_hbox_1, *_cnv_1, *_vbox_1, *dlg, *img, *_vbox_2, *_frm_1, *_frm_2, *_frm_3, *_frm_4, *_frm_5, *pbar, *val, *tabs, *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1, *tree; //img = IupImage(32,32, img_bits1); //IupSetHandle ("img1", img); //IupSetAttribute (img, "0", "0 0 0"); //IupSetAttribute (img, "1", "BGCOLOR"); //IupSetAttribute (img, "2", "255 0 0"); img = load_image_Tecgraf(); IupSetHandle ("img1", img); img = IupImage(32,32, img_bits2); IupSetHandle ("img2", img); IupSetAttribute (img, "0", "0 0 0"); IupSetAttribute (img, "1", "0 255 0"); IupSetAttribute (img, "2", "BGCOLOR"); IupSetAttribute (img, "3", "255 0 0"); mnu = IupMenu( IupSubmenu("IupSubmenu 1", IupMenu( IupSetAttributes(IupItem("IupItem 1 Checked", NULL), "VALUE=ON"), IupSeparator(), IupSetAttributes(IupItem("IupItem 2 Disabled", NULL), "ACTIVE=NO"), NULL)), IupItem("IupItem 3", NULL), IupItem("IupItem 4", NULL), NULL); IupSetHandle("mnu",mnu); _frm_1 = IupFrame( IupVbox( set_callbacks(IupSetAttributes(IupButton("Button Text", NULL), "PADDING=5x5, TIP=\"Button TIP\"")), IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton("Text", NULL), "IMAGE=img1, PADDING=5x5")),"ACTION", action1_cb, NULL), IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton(NULL, NULL), "IMAGE=img1")),"ACTION", action2_cb, NULL), IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton("", NULL), "IMAGE=img1,IMPRESS=img2")),"ACTION", action3_cb, NULL), IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton(NULL, NULL), "BGCOLOR=\"255 0 128\", SIZE=20x10")),"ACTION", action3_cb, NULL), NULL)); IupSetAttribute(_frm_1,"TITLE","IupButton"); _frm_2 = IupFrame( IupVbox( IupSetAttributes(IupLabel("Label Text"), "TIP=\"Label TIP\""), IupSetAttributes(IupLabel(NULL), "SEPARATOR=HORIZONTAL, NAME=SAMP_SEP"), IupSetAttributes(IupLabel(NULL), "IMAGE=img1"), NULL)); IupSetAttribute(_frm_2,"TITLE","IupLabel"); _frm_3 = IupFrame( IupVbox( set_callbacks(IupSetAttributes(IupToggle("Toggle Text", NULL), "VALUE=ON, TIP=\"Toggle TIP\"")), set_callbacks(IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1,IMPRESS=img2")), set_callbacks(IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1")), IupSetAttributes(IupFrame(IupRadio(IupVbox( set_callbacks(IupToggle("Toggle Text", NULL)), set_callbacks(IupToggle("Toggle Text", NULL)), NULL))), "TITLE=IupRadio"), NULL)); IupSetAttribute(_frm_3,"TITLE","IupToggle"); _text_1 = IupText( NULL); IupSetAttribute(_text_1,"VALUE","Single Line Text"); IupSetAttribute(_text_1,"SIZE","80x"); IupSetAttribute(_text_1,"TIP","Text TIP"); _ml_1 = IupMultiLine( NULL); IupSetAttribute(_ml_1,"VALUE","Multiline Text\nSecond Line\nThird Line"); IupSetAttribute(_ml_1,"EXPAND","YES"); IupSetAttribute(_ml_1,"SIZE","80x40"); IupSetAttribute(_ml_1,"TIP","Multiline TIP"); _frm_4 = IupFrame(IupVbox( set_callbacks(_text_1), set_callbacks(_ml_1), NULL)); IupSetAttribute(_frm_4,"TITLE","IupText"); _list_1 = IupList( NULL); // IupSetAttribute(_list_1,"EXPAND","YES"); IupSetAttribute(_list_1,"VALUE","1"); IupSetAttribute(_list_1,"1","Item 1 Text"); IupSetAttribute(_list_1,"2","Item 2 Text"); IupSetAttribute(_list_1,"3","Item 3 Text"); IupSetAttribute(_list_1,"TIP","List 1"); _list_2 = IupList( NULL); IupSetAttribute(_list_2,"DROPDOWN","YES"); // IupSetAttribute(_list_2,"EXPAND","YES"); IupSetAttribute(_list_2,"VALUE","2"); IupSetAttribute(_list_2,"1","Item 1 Text"); IupSetAttribute(_list_2,"2","Item 2 Text"); IupSetAttribute(_list_2,"3","Item 3 Text"); IupSetAttribute(_list_2,"TIP","List 2"); _list_3 = IupList( NULL); IupSetAttribute(_list_3,"EDITBOX","YES"); // IupSetAttribute(_list_3,"EXPAND","YES"); IupSetAttribute(_list_3,"VALUE","3"); IupSetAttribute(_list_3,"1","Item 1 Text"); IupSetAttribute(_list_3,"2","Item 2 Text"); IupSetAttribute(_list_3,"3","Item 3 Text"); IupSetAttribute(_list_3,"TIP","List 3"); _frm_5 = IupFrame(IupVbox( set_callbacks(_list_1), set_callbacks(_list_2), set_callbacks(_list_3), NULL)); IupSetAttribute(_frm_5,"TITLE","IupList"); _hbox_1 = IupHbox( _frm_1, _frm_2, _frm_3, _frm_4, _frm_5, NULL); val = IupVal(NULL); IupSetAttribute(val,"TIP","Valuator TIP"); set_callbacks(val); pbar = IupProgressBar(); IupSetAttribute(pbar, "VALUE", "0.5"); IupSetAttribute(pbar,"TIP","ProgressBar TIP"); set_callbacks(pbar); tabs = IupTabs(IupVbox(IupLabel("Tab0"), NULL), IupVbox(IupLabel("Tab1"), NULL), IupVbox(IupLabel("Tab2"), NULL), NULL); IupSetAttribute(tabs,"TABTITLE0","Tab Title 0"); IupSetAttribute(tabs,"TABTITLE1","Tab Title 1"); IupSetAttributeHandle(tabs,"TABIMAGE1", load_image_LogoTecgraf()); IupSetAttribute(tabs,"TABTITLE2","Tab Title 2"); IupSetAttribute(tabs,"RASTERSIZE","300x50"); IupSetAttribute(tabs,"TIP","Tabs TIP"); // IupSetAttribute(tabs,"PADDING","5x5"); set_callbacks(tabs); tree = IupTree(); IupSetAttribute(tree, "SHOWRENAME", "YES"); IupSetAttribute(tree,"RASTERSIZE","300x150"); IupSetAttribute(tree,"TIP","Tree TIP"); IupSetAttribute(tree,"EXPAND","NO"); set_callbacks(tree); _cnv_1 = IupCanvas(NULL); IupSetAttribute(_cnv_1,"BGCOLOR","128 255 0"); IupSetAttribute(_cnv_1,"SCROLLBAR","YES"); // IupSetAttribute(_cnv_1,"EXPAND","HORIZONTAL"); IupSetAttribute(_cnv_1,"EXPAND","NO"); IupSetAttribute(_cnv_1,"RASTERSIZE","200x100"); IupSetAttribute(_cnv_1,"TIP","Canvas TIP"); // IupSetAttribute(_cnv_1,"CANFOCUS","NO"); set_callbacks(_cnv_1); _vbox_1 = IupVbox( _hbox_1, IupHbox(IupSetAttributes(IupFrame(IupHbox(val, NULL)), "TITLE=IupVal"), IupSetAttributes(IupFrame(IupHbox(pbar, NULL)), "TITLE=IupProgressBar"), IupSetAttributes(IupFrame(IupHbox(tabs, NULL)), "TITLE=IupTabs"), NULL), IupHbox(IupSetAttributes(IupFrame(IupHbox(_cnv_1, NULL)), "TITLE=IupCanvas"), IupSetAttributes(IupFrame(IupHbox(tree, NULL)), "TITLE=IupTree"), NULL), IupHbox(IupSetAttributes(IupFrame(IupHbox(create_matrix(), NULL)), "TITLE=IupMatrix"), NULL), NULL); IupSetAttribute(_vbox_1,"MARGIN","5x5"); IupSetAttribute(_vbox_1,"GAP","5"); // _vbox_2 = IupVbox(IupSetAttributes(IupScrollBox(_vbox_1), "RASTERSIZE=400x300"), NULL); _vbox_2 = IupVbox(IupScrollBox(_vbox_1), NULL); IupSetAttribute(_vbox_2,"MARGIN","20x20"); dlg = IupDialog(_vbox_2); IupSetHandle("dlg",dlg); IupSetAttribute(dlg,"MENU","mnu"); IupSetAttribute(dlg,"TITLE","IupDialog Title"); // IupSetAttribute(dlg,"COMPOSITED","YES"); /* Windows Only */ // IupSetAttribute(dlg, "OPACITY", "192"); // IupSetAttribute(dlg, "RESIZE", "NO"); // IupSetAttribute(dlg, "BGCOLOR", "173 177 194"); // Motif BGCOLOR for documentation // IupSetAttribute(_vbox_1, "BGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "BGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "BACKGROUND", "200 10 80"); //IupSetGlobal("DLGBGCOLOR", "92 92 255"); //IupSetGlobal("TXTFGCOLOR", "255 92 92"); //IupSetGlobal("TXTBGCOLOR", "92 92 255"); // IupSetAttribute(dlg, "FONT", "Helvetica, 24"); // IupSetAttribute(dlg, "FONT", "-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-*"); // IupSetAttribute(box, "FGCOLOR", "255 0 0"); //IupSetAttribute(dlg,"RASTERSIZE","1000x800"); IupSetAttribute(dlg,"RASTERSIZE","400x300"); IupSetCallback(dlg, "RESIZE_CB", (Icallback)resize_cb); IupMap(dlg); IupSetAttribute(tree, "TITLE0", "Figures"); IupSetAttribute(tree, "ADDLEAF0", "Other"); /* new id=1 */ IupSetAttribute(tree, "ADDBRANCH1", "triangle"); /* new id=2 */ IupSetAttribute(tree, "ADDLEAF2", "equilateral"); /* ... */ IupSetAttribute(tree, "ADDLEAF3", "isoceles"); IupSetAttribute(tree, "ADDLEAF4", "scalenus"); IupShow(dlg); IupSetAttribute(dlg,"RASTERSIZE", NULL); }
static void CreateTree(void) { int tag = (int)lua_getnumber(lua_getglobal("iuplua_tag")); lua_pushusertag(IupTree(), tag); }