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; }
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; }
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; }
void SplitTest(void) { Ihandle *dlg, *bt, *split, *ml, *vbox; bt = IupButton("Button", NULL); IupSetAttribute(bt, "EXPAND", "YES"); ml = IupMultiLine(NULL); IupSetAttribute(ml, "EXPAND", "YES"); IupSetAttribute(ml, "VISIBLELINES", "5"); IupSetAttribute(ml, "VISIBLECOLUMNS", "10"); split = IupSplit(bt, ml); // IupSetAttribute(split, "ORIENTATION", "VERTICAL"); IupSetAttribute(split, "ORIENTATION", "HORIZONTAL"); IupSetAttribute(split, "COLOR", "127 127 255"); vbox = IupVbox(split, NULL); IupSetAttribute(vbox, "MARGIN", "10x10"); IupSetAttribute(vbox, "GAP", "10"); dlg = IupDialog(vbox); IupSetAttribute(dlg, "TITLE", "IupSplit Example"); IupShow(dlg); }
static int MultiLine(lua_State *L) { Ihandle *ih = IupMultiLine(NULL); iuplua_plugstate(L, ih); iuplua_pushihandle_raw(L, ih); return 1; }
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); }
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; }
void main(int argc, char **argv) { Ihandle *dlg, *ml; IupOpen(&argc, &argv); ml = IupMultiLine(NULL); IupSetCallback(ml, "ACTION", (Icallback)mlaction); IupSetAttribute(ml, IUP_EXPAND, IUP_YES); IupSetAttribute(ml, IUP_VALUE, "I ignore the DEL key!"); IupSetAttribute(ml, IUP_BORDER, IUP_YES); dlg = IupDialog(ml); IupSetAttribute(dlg, IUP_TITLE, "IupMultiline"); IupSetAttribute(dlg, IUP_SIZE, "QUARTERxQUARTER"); IupShow(dlg); IupMainLoop(); IupDestroy(dlg); IupClose(); }
void TextTest(void) { int formatting = 0; Ihandle *dlg, *mltline, *text, *opt, *btn_def_enter, *btn_def_esc, *btn_active, *btn_overwrite, *btn_append, *btn_insert, *btn_caret, *btn_clip, *btn_key, *btn_readonly, *btn_tabsize, *btn_selection, *btn_selectedtext, *btn_nc, *btn_value, *lbl, *formattag, *btn_remformat; // IupSetGlobal("UTF8AUTOCONVERT", "NO"); text = IupText (NULL); IupSetAttribute(text, "EXPAND", "HORIZONTAL"); // IupSetAttribute(text, "VALUE", "Single Line Text"); IupSetAttribute(text, "CUEBANNER", "Enter Attribute Value Here"); IupSetAttribute(text, "NAME", "text"); IupSetAttribute(text, "TIP", "Attribute Value"); // IupSetAttribute(text, "FORMATTING", "YES"); opt = IupToggle("Set/Get", NULL); IupSetAttribute (opt, "VALUE", "ON"); IupSetHandle ("text2multi", opt); mltline = IupMultiLine(NULL); // mltline = IupText(NULL); // IupSetAttribute(mltline, "MULTILINE", "YES"); IupSetAttribute(mltline, "NAME", "mltline"); IupSetCallback(mltline, "DROPFILES_CB", (Icallback)dropfiles_cb); IupSetCallback(mltline, "BUTTON_CB", (Icallback)button_cb); // IupSetCallback(mltline, "MOTION_CB", (Icallback)motion_cb); IupSetCallback(mltline, "HELP_CB", (Icallback)help_cb); IupSetCallback(mltline, "GETFOCUS_CB", (Icallback)getfocus_cb); IupSetCallback(mltline, "KILLFOCUS_CB", (Icallback)killfocus_cb); IupSetCallback(mltline, "ENTERWINDOW_CB", (Icallback)enterwindow_cb); IupSetCallback(mltline, "LEAVEWINDOW_CB", (Icallback)leavewindow_cb); IupSetCallback(mltline, "ACTION", (Icallback)action); // IupSetCallback(mltline, "VALUECHANGED_CB", (Icallback)valuechanged_cb); // IupSetCallback(mltline, "K_ANY", (Icallback)k_any); IupSetCallback(mltline, "K_F2", (Icallback)k_f2); // IupSetCallback(mltline, "CARET_CB", (Icallback)caret_cb); // IupSetAttribute(mltline, "WORDWRAP", "YES"); // IupSetAttribute(mltline, "BORDER", "NO"); // IupSetAttribute(mltline, "AUTOHIDE", "YES"); // IupSetAttribute(mltline, "BGCOLOR", "255 0 128"); // IupSetAttribute(mltline, "FGCOLOR", "0 128 192"); // IupSetAttribute(mltline, "PADDING", "15x15"); if (IupGetInt(NULL, "UTF8MODE")) IupSetAttribute(mltline, "VALUE", "First Line\nSecond Line Big Big Big\nThird Line\nmore\nmore\n(çãõáóé)"); // UTF-8 else { char* txt = "First Line\nSecond Line Big Big Big\nThird Line\nmore\nmore\n(ηγυασι)"; //int len = strlen(txt); IupSetAttribute(mltline, "VALUE", txt); // Windows-1252 } IupSetAttribute(mltline, "TIP", "First Line\nSecond Line\nThird Line"); // IupSetAttribute(mltline, "FONT", "Helvetica, 14"); // IupSetAttribute(mltline, "MASK", IUP_MASK_FLOAT); // IupSetAttribute(mltline, "FILTER", "UPPERCASE"); // IupSetAttribute(mltline, "ALIGNMENT", "ACENTER"); // IupSetAttribute(mltline, "CANFOCUS", "NO"); // IupSetAttribute(mltline, "SCROLLBAR", "NO"); // IupSetAttribute(mltline, "NOHIDESEL", "Yes"); /* Turns on multiline expand and text horizontal expand */ IupSetAttribute(mltline, "SIZE", "80x40"); IupSetAttribute(mltline, "EXPAND", "YES"); // IupSetAttribute(mltline, "FONT", "Courier, 16"); // IupSetAttribute(mltline, "FONT", "Arial, 12"); // IupSetAttribute(mltline, "FORMATTING", "YES"); formatting = 1; if (formatting) /* just to make easier to comment this section */ { /* formatting before Map */ IupSetAttribute(mltline, "FORMATTING", "YES"); formattag = IupUser(); IupSetAttribute(formattag, "ALIGNMENT", "CENTER"); IupSetAttribute(formattag, "SPACEAFTER", "10"); IupSetAttribute(formattag, "FONTSIZE", "24"); IupSetAttribute(formattag, "SELECTION", "3,1:3,50"); IupSetAttribute(mltline, "ADDFORMATTAG_HANDLE", (char*)formattag); formattag = IupUser(); IupSetAttribute(formattag, "BGCOLOR", "255 128 64"); IupSetAttribute(formattag, "UNDERLINE", "SINGLE"); IupSetAttribute(formattag, "WEIGHT", "BOLD"); IupSetAttribute(formattag, "SELECTION", "3,7:3,11"); IupSetAttribute(mltline, "ADDFORMATTAG_HANDLE", (char*)formattag); } /* Creates buttons */ btn_append = IupButton ("&APPEND", NULL); btn_insert = IupButton ("INSERT", NULL); btn_caret = IupButton ("CARET", NULL); btn_readonly = IupButton ("READONLY", NULL); btn_selection = IupButton ("SELECTION", NULL); btn_selectedtext = IupButton ("SELECTEDTEXT", NULL); btn_nc = IupButton ("NC", NULL); btn_value = IupButton ("VALUE", NULL); btn_tabsize = IupButton ("TABSIZE", NULL); btn_clip = IupButton ("CLIPBOARD", NULL); btn_key = IupButton ("KEY", NULL); btn_def_enter = IupButton ("Default Enter", NULL); btn_def_esc = IupButton ("Default Esc", NULL); btn_active = IupButton("ACTIVE", NULL); btn_remformat = IupButton("REMOVEFORMATTING", NULL); btn_overwrite = IupButton("OVERWRITE", NULL); IupSetAttribute(btn_append, "TIP", "First Line\nSecond Line\nThird Line"); /* Registers callbacks */ IupSetCallback(btn_append, "ACTION", (Icallback) btn_append_cb); IupSetCallback(btn_insert, "ACTION", (Icallback) btn_insert_cb); IupSetCallback(btn_caret, "ACTION", (Icallback) btn_caret_cb); IupSetCallback(btn_readonly, "ACTION", (Icallback) btn_readonly_cb); IupSetCallback(btn_selection, "ACTION", (Icallback) btn_selection_cb); IupSetCallback(btn_selectedtext, "ACTION", (Icallback) btn_selectedtext_cb); IupSetCallback(btn_nc, "ACTION", (Icallback) btn_nc_cb); IupSetCallback(btn_value, "ACTION", (Icallback) btn_value_cb); IupSetCallback(btn_tabsize, "ACTION", (Icallback) btn_tabsize_cb); IupSetCallback(btn_clip, "ACTION", (Icallback) btn_clip_cb); IupSetCallback(btn_key, "ACTION", (Icallback) btn_key_cb); IupSetCallback(btn_def_enter, "ACTION", (Icallback) btn_def_enter_cb); IupSetCallback(btn_def_esc, "ACTION", (Icallback) btn_def_esc_cb); IupSetCallback(btn_active, "ACTION", (Icallback) btn_active_cb); IupSetCallback(btn_remformat, "ACTION", (Icallback) btn_remformat_cb); IupSetCallback(btn_overwrite, "ACTION", (Icallback) btn_overwrite_cb); lbl = IupLabel("&Multiline:"); IupSetAttribute(lbl, "PADDING", "2x2"); /* Creates dlg */ dlg = IupDialog(IupVbox(lbl, mltline, IupHbox (text, opt, NULL), IupHbox (btn_append, btn_insert, btn_caret, btn_readonly, btn_selection, NULL), IupHbox (btn_selectedtext, btn_nc, btn_value, btn_tabsize, btn_clip, btn_key, NULL), IupHbox (btn_def_enter, btn_def_esc, btn_active, btn_remformat, btn_overwrite, NULL), NULL)); IupSetCallback(dlg, "K_cO", (Icallback)file_open); IupSetAttribute(dlg, "TITLE", "IupText Test"); IupSetAttribute(dlg, "MARGIN", "10x10"); IupSetAttribute(dlg, "GAP", "5"); IupSetAttributeHandle(dlg, "DEFAULTENTER", btn_def_enter); IupSetAttributeHandle(dlg, "DEFAULTESC", btn_def_esc); IupSetAttribute(dlg, "SHRINK", "YES"); if (formatting) /* just to make easier to comment this section */ { IupMap(dlg); /* formatting after Map */ formattag = IupUser(); IupSetAttribute(formattag, "ITALIC", "YES"); IupSetAttribute(formattag, "STRIKEOUT", "YES"); IupSetAttribute(formattag, "SELECTION", "2,1:2,12"); IupSetAttribute(mltline, "ADDFORMATTAG_HANDLE", (char*)formattag); if (1) { int count = IupGetInt(mltline, "COUNT"); IupSetAttribute(mltline, "APPEND", "Append Test"); formattag = IupUser(); IupSetAttribute(formattag, "FGCOLOR", "0 128 64"); IupSetfAttribute(formattag, "SELECTIONPOS", "%d:%d", count+1, IupGetInt(mltline, "COUNT")); IupSetAttribute(mltline, "ADDFORMATTAG_HANDLE", (char*)formattag); } } /* Shows dlg in the center of the screen */ IupShowXY(dlg, IUP_CENTER, IUP_CENTER); IupSetFocus(mltline); }
int IupGetText(const char* title, char* text) { Ihandle *ok, *cancel, *multi_text, *button_box, *dlg_box, *dlg; int bt; multi_text = IupMultiLine(NULL); IupSetAttribute(multi_text,"EXPAND", "YES"); IupSetAttribute(multi_text,"VALUE", text); IupSetAttribute(multi_text,"FONT", "Courier, 12"); IupSetAttribute(multi_text, "VISIBLELINES", "10"); IupSetAttribute(multi_text, "VISIBLECOLUMNS", "50"); ok = IupButton("OK", NULL); IupSetAttribute(ok, "PADDING", "20x5"); IupSetCallback(ok, "ACTION", (Icallback)CB_button_OK); cancel = IupButton(iupStrMessageGet("IUP_CANCEL"), NULL); IupSetAttribute(cancel, "PADDING", "20x5"); IupSetCallback(cancel, "ACTION", (Icallback)CB_button_CANCEL); button_box = IupHbox( IupFill(), ok, cancel, NULL); IupSetAttribute(button_box,"MARGIN","0x0"); IupSetAttribute(button_box, "NORMALIZESIZE", "HORIZONTAL"); dlg_box = IupVbox( multi_text, button_box, NULL); IupSetAttribute(dlg_box,"MARGIN","10x10"); IupSetAttribute(dlg_box,"GAP","10"); dlg = IupDialog (dlg_box); IupSetAttribute(dlg,"TITLE", title); IupSetAttribute(dlg,"MINBOX","NO"); IupSetAttribute(dlg,"MAXBOX","NO"); IupSetAttributeHandle(dlg,"DEFAULTENTER", ok); IupSetAttributeHandle(dlg,"DEFAULTESC", cancel); IupSetAttribute(dlg,"PARENTDIALOG", IupGetGlobal("PARENTDIALOG")); IupSetAttribute(dlg,"ICON", IupGetGlobal("ICON")); IupMap(dlg); IupSetAttribute(multi_text, "VISIBLELINES", NULL); IupSetAttribute(multi_text, "VISIBLECOLUMNS", NULL); IupPopup(dlg, IUP_CENTER, IUP_CENTER); bt = IupGetInt(dlg, "STATUS"); if (bt==1) strcpy(text, IupGetAttribute(multi_text, "VALUE")); else bt = 0; /* return 0 instead of -1 */ IupDestroy(dlg); return bt; }
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); }
void func_1 (void) { Ihandle *_cbox, *_cnv_1, *dlg, *img, *_frm_1, *_frm_2, *_frm_3, *hbox, *_ctrl_1, *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1; 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 = 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"); _frm_1 = IupFrame( IupVbox( IupSetAttributes(IupButton("Button Text", NULL), "CINDEX=1"), IupSetAttributes(IupButton("", NULL), "IMAGE=img1,CINDEX=2"), IupSetAttributes(IupButton("", NULL), "IMAGE=img1,IMPRESS=img2,CINDEX=3"), NULL)); IupSetAttribute(_frm_1,"TITLE","IupButton"); IupSetAttribute(_frm_1,"CX","10"); IupSetAttribute(_frm_1,"CY","180"); _frm_2 = IupFrame( IupVbox( IupSetAttributes(IupLabel("Label Text"), "CINDEX=1"), IupSetAttributes(IupLabel(""), "SEPARATOR=HORIZONTAL,CINDEX=2"), IupSetAttributes(IupLabel(""), "IMAGE=img1,CINDEX=3"), NULL)); IupSetAttribute(_frm_2,"TITLE","IupLabel"); IupSetAttribute(_frm_2,"CX","200"); IupSetAttribute(_frm_2,"CY","250"); _frm_3 = IupFrame( IupVbox( IupSetAttributes(IupToggle("Toggle Text", NULL), "VALUE=ON,CINDEX=1"), IupSetAttributes(IupToggle("", NULL), "IMAGE=img1,IMPRESS=img2,CINDEX=2"), IupSetAttributes(IupFrame(IupRadio(IupVbox( IupSetAttributes(IupToggle("Toggle Text", NULL), "CINDEX=3"), IupSetAttributes(IupToggle("Toggle Text", NULL), "CINDEX=4"), NULL))), "TITLE=IupRadio"), NULL)); IupSetAttribute(_frm_3,"TITLE","IupToggle"); IupSetAttribute(_frm_3,"CX","400"); IupSetAttribute(_frm_3,"CY","250"); _text_1 = IupText( NULL); IupSetAttribute(_text_1,"VALUE","IupText Text"); IupSetAttribute(_text_1,"SIZE","80x"); IupSetAttribute(_text_1,"CINDEX","1"); IupSetAttribute(_text_1,"CX","10"); IupSetAttribute(_text_1,"CY","100"); _ml_1 = IupMultiLine( NULL); IupSetAttribute(_ml_1,"VALUE","IupMultiline Text\nSecond Line\nThird Line"); IupSetAttribute(_ml_1,"SIZE","80x60"); IupSetAttribute(_ml_1,"CINDEX","1"); IupSetAttribute(_ml_1,"CX","200"); IupSetAttribute(_ml_1,"CY","100"); _list_1 = IupList( NULL); 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,"CINDEX","1"); IupSetAttribute(_list_1,"CX","10"); IupSetAttribute(_list_1,"CY","10"); _list_2 = IupList( NULL); IupSetAttribute(_list_2,"DROPDOWN","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,"CINDEX","2"); IupSetAttribute(_list_2,"CX","200"); IupSetAttribute(_list_2,"CY","10"); _list_3 = IupList( NULL); IupSetAttribute(_list_3,"EDITBOX","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,"CINDEX","3"); IupSetAttribute(_list_3,"CX","400"); IupSetAttribute(_list_3,"CY","10"); _cnv_1 = IupCanvas( NULL); IupSetAttribute(_cnv_1,"RASTERSIZE","100x100"); IupSetAttribute(_cnv_1,"POSX","0"); IupSetAttribute(_cnv_1,"POSY","0"); IupSetAttribute(_cnv_1,"BGCOLOR","128 255 0"); IupSetAttribute(_cnv_1,"CX","400"); IupSetAttribute(_cnv_1,"CY","150"); _ctrl_1 = IupVal(NULL); IupSetAttribute(_ctrl_1,"CX","600"); IupSetAttribute(_ctrl_1,"CY","200"); _cbox = IupCbox( _text_1, _ml_1, _list_1, _list_2, _list_3, _cnv_1, _ctrl_1, createtree(), create_mat(), _frm_1, _frm_2, _frm_3, NULL); IupSetAttribute(_cbox,"SIZE","480x200"); hbox = IupSetAttributes(IupHbox(_cbox, NULL), "MARGIN=10x10"); dlg = IupDialog(hbox); IupSetHandle("dlg",dlg); IupSetAttribute(dlg,"TITLE","Cbox Test"); }
Ihandle* IupCreatev(const char *name, void **params) { Iclass *ic = NULL; char lower[30]; int size = 0; assert(name); if(name == NULL) return NULL; size = (int)strlen(name); size++; assert(size < 30 && size > 0); /* invalid name */ if(size > 30 || size <= 0) return NULL; while(size--) lower[size] = (char)tolower(name[size]); if(iupStrEqual(lower, "dialog")) return IupDialog(params? params[0] : NULL); else if(iupStrEqual(lower, "canvas")) return IupCanvas(NULL); else if(iupStrEqual(lower, "button")) return IupButton(NULL, NULL); else if(iupStrEqual(lower, "toggle")) return IupToggle(NULL, NULL); else if(iupStrEqual(lower, "label")) return IupLabel(NULL); else if(iupStrEqual(lower, "frame")) return IupFrame(NULL); else if(iupStrEqual(lower, "list")) return IupList(NULL); else if(iupStrEqual(lower, "multiline")) return IupMultiLine(NULL); else if(iupStrEqual(lower, "text")) return IupText(NULL); else if(iupStrEqual(lower, "user")) return IupUser(); else if(iupStrEqual(lower, "fill")) return IupFill(); else if(iupStrEqual(lower, "separator")) return IupSeparator(); else if(iupStrEqual(lower, "item")) return IupItem(NULL, NULL); else if(iupStrEqual(lower, "hbox")) return IupHboxv((Ihandle**)params); else if(iupStrEqual(lower, "zbox")) return IupZboxv((Ihandle**)params); else if(iupStrEqual(lower, "vbox")) return IupVboxv((Ihandle**)params); else if(iupStrEqual(lower, "menu")) return IupMenuv((Ihandle**)params); else if(iupStrEqual(lower, "radio")) return IupRadio(params[0]); else if(iupStrEqual(lower, "submenu")) return IupSubmenu(NULL, params? params[0] : NULL); /* Not accepted: image color IupGetFile IupListDialog IupMessage IupScanf IupAlarm */ ic = iupCpiGetClass(lower); return iupCpiCreate(ic, params); }
void func_1 (void) { Ihandle *_cbox, *_cnv_1, *dlg, *img, *_frm_1, *_frm_2, *_frm_3, *hbox, *_ctrl_1, *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1; 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 = 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"); _frm_1 = IupFrame( IupVbox( IupSetAttributes(IupButton("Button Text", "action"), "BGCOLOR=\"255 128 0\", CINDEX=1"), IupSetAttributes(IupButton("", "action"), "BGCOLOR=\"255 128 0\", CINDEX=1"), IupSetAttributes(IupButton("", "action"), "IMAGE=img1,BGCOLOR=\"255 128 0\", CINDEX=2"), IupSetAttributes(IupButton("", "action"), "IMAGE=img1,BGCOLOR=\"255 128 0\", IMPRESS=img2,CINDEX=3"), NULL)); IupSetAttribute(_frm_1,IUP_TITLE,"IupButton"); IupSetAttribute(_frm_1,"CX","10"); IupSetAttribute(_frm_1,"CY","180"); _frm_2 = IupFrame( IupVbox( IupSetAttributes(IupLabel("Label Text"), "CINDEX=1,FONT=HELVETICA_ITALIC_14"), IupSetAttributes(IupLabel(""), "SEPARATOR=HORIZONTAL,CINDEX=2"), IupSetAttributes(IupLabel(""), "IMAGE=img1,CINDEX=3"), NULL)); IupSetAttribute(_frm_2,IUP_TITLE,"IupLabel"); IupSetAttribute(_frm_2,"CX","200"); IupSetAttribute(_frm_2,"CY","250"); _frm_3 = IupFrame( IupVbox( IupSetAttributes(IupToggle("Toggle Text", "action"), "VALUE=ON,CINDEX=1,FONT=HELVETICA_ITALIC_14"), IupSetAttributes(IupToggle("", "action"), "IMAGE=img1,IMPRESS=img2,CINDEX=2"), IupSetAttributes(IupFrame(IupRadio(IupVbox( IupSetAttributes(IupToggle("Toggle Text", "action"), "CINDEX=3"), IupSetAttributes(IupToggle("Toggle Text", "action"), "CINDEX=4"), NULL))), "TITLE=IupRadio"), NULL)); IupSetAttribute(_frm_3,IUP_TITLE,"IupToggle"); IupSetAttribute(_frm_3,"CX","400"); IupSetAttribute(_frm_3,"CY","250"); IupSetAttribute(_frm_3,"RASTERSIZE","150x150"); _text_1 = IupText( "action"); IupSetAttribute(_text_1,IUP_VALUE,"IupText Text"); IupSetAttribute(_text_1,IUP_SIZE,"80x"); IupSetAttribute(_text_1,"CINDEX","1"); IupSetAttribute(_text_1,"CX","10"); IupSetAttribute(_text_1,"CY","100"); _ml_1 = IupMultiLine( "action"); IupSetAttribute(_ml_1,IUP_VALUE,"IupMultiline Text\nSecond Line\nThird Line"); IupSetAttribute(_ml_1,IUP_SIZE,"80x60"); IupSetAttribute(_ml_1,"CINDEX","1"); IupSetAttribute(_ml_1,"CX","200"); IupSetAttribute(_ml_1,"CY","100"); _list_1 = IupList( "action"); IupSetAttribute(_list_1,IUP_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,"CINDEX","1"); IupSetAttribute(_list_1,"CX","10"); IupSetAttribute(_list_1,"CY","10"); _list_2 = IupList( "action"); IupSetAttribute(_list_2,IUP_DROPDOWN,"YES"); IupSetAttribute(_list_2,IUP_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,"CINDEX","2"); IupSetAttribute(_list_2,"CX","200"); IupSetAttribute(_list_2,"CY","10"); _list_3 = IupList( "action"); IupSetAttribute(_list_3,"EDITBOX","YES"); IupSetAttribute(_list_3,IUP_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,"CINDEX","3"); IupSetAttribute(_list_3,"CX","400"); IupSetAttribute(_list_3,"CY","10"); _cnv_1 = IupCanvas( "do_nothing"); IupSetAttribute(_cnv_1,IUP_RASTERSIZE,"100x100"); IupSetAttribute(_cnv_1,IUP_POSX,"0.0"); IupSetAttribute(_cnv_1,IUP_POSY,"0.0"); IupSetAttribute(_cnv_1,IUP_BGCOLOR,"128 255 0"); IupSetAttribute(_cnv_1,"CX","400"); IupSetAttribute(_cnv_1,"CY","150"); _ctrl_1 = IupVal(NULL); IupSetAttribute(_ctrl_1,"CX","600"); IupSetAttribute(_ctrl_1,"CY","200"); // _cbox = IupCbox( _cbox = IupCboxBuilder( _text_1, _ml_1, _list_1, _list_2, _list_3, _cnv_1, _ctrl_1, createtree(), create_mat(), _frm_1, _frm_2, _frm_3, NULL); IupSetAttribute(_cbox,IUP_SIZE,"560x200"); hbox = IupHbox( IupSetAttributes(IupFill(), "SIZE=10"), IupVbox( IupSetAttributes(IupFill(), "SIZE=10"), IupFrame(_cbox), IupSetAttributes(IupLabel("Label Text"), "FONT=HELVETICA_ITALIC_14"), NULL), NULL); dlg = IupDialog(hbox); IupSetHandle("dlg",dlg); IupSetAttribute(dlg,IUP_TITLE,"Cbox Test"); IupSetAttribute(dlg,"COMPOSITED","YES"); /* improves a lot the redrawing */ // IupSetAttribute(dlg,"FONT","HELVETICA_ITALIC_14"); }
static void CreateMultiLine(void) { lua_pushusertag(IupMultiLine(NULL), iuplua_tag); }
void SampleTest(void) { Ihandle *mnu, *_hbox_1, *_cnv_1, *_vbox_1, *dlg, *img, *_frm_1, *_frm_2, *_frm_3, *_frm_4, *_frm_5, *pbar, *val, *tabs, *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1; //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( IupSetAttributes(IupButton("Button Text", NULL), "PADDING=5x5"), IupSetAttributes(IupButton("Text", NULL), "IMAGE=img1, PADDING=5x5"), IupSetAttributes(IupButton(NULL, NULL), "IMAGE=img1"), IupSetAttributes(IupButton("", NULL), "IMAGE=img1,IMPRESS=img2"), NULL)); IupSetAttribute(_frm_1,"TITLE","IupButton"); _frm_2 = IupFrame( IupVbox( IupLabel("Label Text"), IupSetAttributes(IupLabel(NULL), "SEPARATOR=HORIZONTAL"), IupSetAttributes(IupLabel(NULL), "IMAGE=img1"), NULL)); IupSetAttribute(_frm_2,"TITLE","IupLabel"); _frm_3 = IupFrame( IupVbox( IupSetAttributes(IupToggle("Toggle Text", NULL), "VALUE=ON"), // IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1,IMPRESS=img2"), IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1"), IupSetAttributes(IupFrame(IupRadio(IupVbox( IupToggle("Toggle Text", NULL), 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"); _ml_1 = IupMultiLine( NULL); IupSetAttribute(_ml_1,"VALUE","Multiline Text\nSecond Line\nThird Line"); IupSetAttribute(_ml_1,"EXPAND","YES"); IupSetAttribute(_ml_1,"SIZE","80x40"); _frm_4 = IupFrame(IupVbox( _text_1, _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"); _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"); _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"); _frm_5 = IupFrame(IupVbox( _list_1, _list_2, _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); pbar = IupGauge(); IupSetAttribute(pbar, "VALUE", "0.5"); tabs = IupTabs(IupVbox(NULL), IupVbox(NULL), IupVbox(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,"PADDING","5x5"); _cnv_1 = IupCanvas(NULL); IupSetAttribute(_cnv_1,"BGCOLOR","128 255 0"); IupSetAttribute(_cnv_1,"SCROLLBAR","HORIZONTAL"); IupSetAttribute(_cnv_1,"EXPAND","HORIZONTAL"); IupSetAttribute(_cnv_1,"RASTERSIZE","x100"); _vbox_1 = IupVbox( _hbox_1, IupHbox(IupSetAttributes(IupFrame(IupHbox(val, NULL)), "TITLE=IupVal"), IupSetAttributes(IupFrame(IupHbox(pbar, NULL)), "TITLE=IupGauge"), IupSetAttributes(IupFrame(IupHbox(tabs, NULL)), "TITLE=IupTabs"), NULL), IupSetAttributes(IupFrame(IupHbox(_cnv_1, NULL)), "TITLE=IupCanvas"), NULL); IupSetAttribute(_vbox_1,"MARGIN","5x5"); IupSetAttribute(_vbox_1,"GAP","5"); dlg = IupDialog(_vbox_1); IupSetHandle("dlg",dlg); IupSetAttribute(dlg,"MENU","mnu"); IupSetAttribute(dlg,"TITLE","IupDialog Title"); // IupSetAttribute(dlg,"COMPOSITED","NO"); /* Windows Only */ // 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"); // IupSetAttribute(dlg, "FONT", "Helvetica, 24"); // IupSetAttribute(dlg, "FONT", "-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-*"); // IupSetAttribute(box, "FGCOLOR", "255 0 0"); IupShow(dlg); }