本文整理汇总了C++中IupSetAttributes函数的典型用法代码示例。如果您正苦于以下问题:C++ IupSetAttributes函数的具体用法?C++ IupSetAttributes怎么用?C++ IupSetAttributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IupSetAttributes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IupGetText
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;
}
示例2: main
int main(int argc, char **argv)
{
Ihandle *win,*tabs,*buttons;
IupOpen(&argc, &argv);
tabs = IupTabs(
IupQuakeBindingLayout(),
IupQuakeMouseLayout(),
IupFill(),
IupFill(),
IupFill(),
NULL
);
IupStoreAttribute(tabs, "TABTITLE0", "Keyboard");
IupStoreAttribute(tabs, "TABTITLE1", "Mouse");
IupStoreAttribute(tabs, "TABTITLE2", "Audio");
IupStoreAttribute(tabs, "TABTITLE3", "Video");
IupStoreAttribute(tabs, "TABTITLE4", "Multiplayer");
IupStoreAttribute(tabs, "MARGIN", "2x2");
buttons = IupHbox(
IupSetCallbacks(IupButton("&Quit", "ACTION"), "ACTION", (Icallback)IupExitLoop, NULL),
IupFill(),
IupButton("&Save", NULL),
IupFill(),
IupButton("&Launch game", NULL),
NULL
);
win = IupDialog(
IupSetAttributes(
IupVbox(
IupSetAttributes(
IupLabel("Action Quake 2 Configuration"),
"EXPAND=YES, ALIGNMENT=ACENTER:ACENTER, FONT=\"sans-serif, Bold 18\""
),
tabs,
//buttons,
NULL
),
"GAP=5, MARGIN=3x3"
)
);
IupStoreAttribute(win, "TITLE", "Action Quake 2 Configuration");
IupStoreAttribute(win, "RESIZE", "NO");
IupShow(win);
/* bug? */
IupStoreAttribute(win, "SIZE", NULL);
IupRefresh(win);
IupMainLoop();
}
示例3: main
int main(int argc, char **argv)
{
Ihandle *dlg;
Ihandle *list, *list_multiple, *list_dropdown;
Ihandle *frm_medal, *frm_sport, *frm_prize;
IupOpen(&argc, &argv);
list = IupList ("list_act");
IupSetAttributes (list, "1=Gold, 2=Silver, 3=Bronze, 4=Tecgraf, 5=None,"
"SHOWIMAGE=YES, SHOWDRAGDROP=YES, XXX_SPACING=4, VALUE=4");
load_medal_images();
IupSetAttribute(list, "IMAGE1", "IMGGOLD");
IupSetAttribute(list, "IMAGE2", "IMGSILVER");
IupSetAttribute(list, "IMAGE3", "IMGBRONZE");
IupSetAttributeHandle(list, "IMAGE4", load_image_Tecgraf());
IupSetCallback(list, "DRAGDROP_CB", (Icallback)dragdrop_cb);
// IupSetAttribute(list, "FONT", "Helvetica, Bold 40");
// IupSetAttribute(list, "AUTOHIDE", "NO");
frm_medal = IupFrame (list);
IupSetAttribute (frm_medal, "TITLE", "Best medal");
list_multiple = IupList(NULL);
IupSetAttributes (list_multiple, "1=\"100m dash\", 2=\"Long jump\", 3=\"Javelin throw\", 4=\"110m hurdlers\", 5=\"Hammer throw\",6=\"High jump\","
"MULTIPLE=YES, VALUE=\"+--+--\", SIZE=EIGHTHxEIGHTH");
IupSetCallback(list_multiple, "ACTION", (Icallback)list_multiple_cb);
frm_sport = IupFrame (list_multiple);
IupSetAttribute (frm_sport, "TITLE", "Competed in");
list_dropdown = IupList (NULL);
IupSetAttributes (list_dropdown, "1=\"Less than US$ 1000\", 2=\"US$ 2000\", 3=\"US$ 5000\", 4=\"US$ 10000\", 5=\"US$ 20000\", 6=\"US$ 50000\", 7=\"More than US$ 100000\","
"SHOWIMAGE=YES, DROPDOWN=YES, VISIBLE_ITEMS=3");
IupSetAttributeHandle(list_dropdown, "IMAGE1", IupImageRGB(20, 20, image_data_24));
IupSetAttributeHandle(list_dropdown, "IMAGE2", IupImageRGB(20, 20, image_data_24));
IupSetAttributeHandle(list_dropdown, "IMAGE3", load_image_Tecgraf());
frm_prize = IupFrame (list_dropdown);
IupSetAttribute (frm_prize, "TITLE", "Prizes won");
dlg = IupDialog (IupHbox (frm_medal, frm_sport, frm_prize, NULL));
IupSetAttribute (dlg, "TITLE", "IupList Example");
IupShowXY (dlg, IUP_CENTER, IUP_CENTER);
// IupSetAttribute(IupGetChild(dlg, 0), "BGCOLOR", "92 92 255");
// IupSetAttribute(dlg, "BACKGROUND", "200 10 80");
// IupSetAttribute(dlg, "BGCOLOR", "92 92 255");
IupMainLoop ();
IupClose ();
return EXIT_SUCCESS;
}
示例4: IupVal
Ihandle *IupQuakeScale(char *title, float min, float max, float step, char *key, float def)
{
Ihandle *scale,*label_value,*label_min,*label_max;
char buf[128];
scale = IupVal("HORIZONTAL");
snprintf(buf, 128, "EXPAND=HORIZONTAL, MIN=%.1f, MAX=%.1f, VALUE=%.1f, STEP=0.01", min, max, def);
IupSetAttributes(scale, buf);
IupSetCallback(scale, "VALUECHANGED_CB", (Icallback)IupQuakeScaleUpdate);
snprintf(buf, 16, "%.1f", def);
label_value = IupLabel(buf);
IupStoreAttribute(label_value, "EXPAND", "HORIZONTAL");
IupStoreAttribute(label_value, "ALIGNMENT", "ACENTER:ACENTER");
snprintf(buf, 16, "%.1f", min);
label_min = IupLabel(buf);
IupStoreAttribute(label_min, "ALIGNMENT", "ACENTER:ACENTER");
snprintf(buf, 16, "%.1f", max);
label_max = IupLabel(buf);
IupStoreAttribute(label_max, "ALIGNMENT", "ACENTER:ACENTER");
return IupVbox(
IupLabel(title),
IupHbox(
label_min,
label_value,
label_max,
NULL
),
scale,
NULL
);
}
示例5: GLCanvasCubeTest
void GLCanvasCubeTest(void)
{
Ihandle *dlg, *canvas, *box;
IupGLCanvasOpen();
box = IupVbox(NULL);
IupSetAttribute(box, "MARGIN", "5x5");
canvas = IupGLCanvas(NULL);
IupSetCallback(canvas, "ACTION", action);
IupSetCallback(canvas, "BUTTON_CB", (Icallback)button_cb);
IupSetCallback(canvas, "MOTION_CB", (Icallback)motion_cb);
// IupSetAttribute(canvas, "BUFFER", "DOUBLE");
IupSetAttribute(canvas, "RASTERSIZE", "300x300");
IupAppend(box, canvas);
dlg = IupDialog(IupSetAttributes(IupFrame(box), "TITLE=Test"));
IupSetAttribute(dlg, "TITLE", "IupGLCanvas Test");
// IupSetAttribute(dlg, "COMPOSITED", "YES");
IupMap(dlg);
IupGLMakeCurrent(canvas);
// init();
printf("Vendor: %s\n", glGetString(GL_VENDOR));
printf("Renderer: %s\n", glGetString(GL_RENDERER));
printf("Version: %s\n", glGetString(GL_VERSION));
IupSetAttribute(canvas, "RASTERSIZE", NULL);
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
}
示例6: main
int main(int argc, char **argv)
{
Ihandle *dlg;
Ihandle *btn;
IupOpen(&argc, &argv);
/* Creates a backgroundbox */
btn = IupBackgroundBox(IupVbox(IupButton("This button does nothing", ""), IupText(""), NULL));
/* Creates dialog */
dlg = IupDialog
(
IupVbox
(
btn,
NULL
)
);
IupSetAttributes (dlg, "MARGIN=10x10, GAP=10, TITLE = \"IupBackgroundBox Example\"");
IupShowXY (dlg, IUP_CENTER, IUP_CENTER );
IupMainLoop ();
IupClose ();
return EXIT_SUCCESS;
}
示例7: SetAttributes
static int SetAttributes(lua_State *L)
{
Ihandle * ih = iuplua_checkihandle(L,1);
const char *attributes = luaL_checkstring(L,2);
IupSetAttributes(ih, attributes);
iuplua_pushihandle(L,ih);
return 1;
}
示例8: TabsTest
void TabsTest(void)
{
Ihandle *box, *frm1, *frm2, *dlg, *tabs;
tabs = CreateTabs(1);
box = IupHbox(tabs,
frm1 = IupFrame(IupRadio(IupVbox(IupToggle("TOP", "cbType"),
IupToggle("LEFT", "cbType"),
IupToggle("BOTTOM", "cbType"),
IupToggle("RIGHT", "cbType"),
NULL))),
frm2 = IupFrame(IupRadio(IupVbox(IupToggle("HORIZONTAL", "cbOrientation"),
IupToggle("VERTICAL", "cbOrientation"),
NULL))),
IupVbox(IupSetAttributes(IupButton("Add Tab", "cbAddTab"), "TIP=\"Button Tip\""),
IupButton("Insert Tab", "cbInsertTab"),
IupButton("Remove Tab", "cbRemoveTab"),
IupToggle("Inactive", "cbInactive"),
IupButton("VALUEPOS=0", "cbValuePos"),
NULL),
NULL);
IupSetAttribute(frm1, "MARGIN", "5x5");
IupSetAttribute(frm2, "MARGIN", "5x5");
IupSetAttribute(frm1, "GAP", "0");
IupSetAttribute(frm2, "GAP", "0");
IupSetAttribute(frm1, "TITLE", "Type");
IupSetAttribute(frm2, "TITLE", "Orientation");
IupSetAttribute(box, "MARGIN", "10x10");
IupSetAttribute(box, "GAP", "10");
dlg = IupDialog(box);
IupSetAttribute(dlg, "TITLE", "IupTabs Test");
IupSetAttribute(dlg, "APP_TABS", (char*)tabs);
// IupSetAttribute(box, "BGCOLOR", "92 92 255");
// IupSetAttribute(dlg, "BGCOLOR", "92 92 255");
// IupSetAttribute(dlg, "BACKGROUND", "200 10 80");
// IupSetAttributeHandle(dlg, "BACKGROUND", load_image_LogoTecgraf());
// IupSetAttribute(dlg, "FGCOLOR", "10 200 80");
// IupSetAttribute(dlg, "BGCOLOR", "173 177 194"); // Motif BGCOLOR for documentation
// IupSetAttribute(dlg,"COMPOSITED","NO");
IupMap(dlg);
IupSetAttribute(dlg, "SIZE", NULL);
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
IupSetFunction("cbOrientation", (Icallback)cbOrientation);
IupSetFunction("cbType", (Icallback)cbType);
IupSetFunction("cbAddTab", (Icallback)cbAddTab);
IupSetFunction("cbInsertTab", (Icallback)cbInsertTab);
IupSetFunction("cbRemoveTab", (Icallback)cbRemoveTab);
IupSetFunction("cbInactive", (Icallback)cbInactive);
IupSetFunction("cbChildButton", (Icallback)cbChildButton);
IupSetFunction("cbValuePos", (Icallback)cbValuePos);
}
示例9: main
/* 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;
}
示例10: new_file
static void new_file(char* dialogtype, int preview)
{
Ihandle *dlg = IupFileDlg();
IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_");
IupSetAttribute(dlg, "DIALOGTYPE", dialogtype);
IupSetAttribute(dlg, "TITLE", "IupFileDlg Test");
IupSetAttribute(dlg, "DIRECTORY", "/tecgraf/iup");
if (strcmp(dialogtype, "DIR")!=0)
{
IupSetAttributes(dlg, "FILTER = \"*.bmp\", FILTERINFO = \"Bitmap Files\"");
IupSetAttribute(dlg, "EXTFILTER", "Text files|*.txt;*.doc|Image files|*.jpg;*.bmp;*.gif|");
// IupSetAttribute(dlg, "FILE", "/tecgraf/im/test.bmp");
IupSetAttribute(dlg, "FILE", "test.bmp");
}
IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);
// IupSetAttributes(dlg, "FILE = \"\\tecgraf\\iup\\test.bmp\""); // OK
// IupSetAttributes(dlg, "FILE = \"/tecgraf/iup/test.bmp\""); // OK
// IupSetAttributes(dlg, "FILE = \"test.bmp\", DIRECTORY = \"/tecgraf/iup\""); // OK
// IupSetAttributes(dlg, "FILE = \"test.bmp\", DIRECTORY = \"\\tecgraf\\iup\""); // OK
// IupSetAttribute(dlg, "NOCHANGEDIR", "NO");
// IupSetAttribute(dlg, "MULTIPLEFILES", "YES");
if (preview)
{
IupSetAttribute(dlg, "SHOWPREVIEW", "YES");
IupSetCallback(dlg, "FILE_CB", (Icallback)file_cb);
#ifdef USE_OPENGL
if (preview==2)
{
Ihandle* glcanvas = IupGLCanvas(NULL);
IupSetAttribute(glcanvas, "BUFFER", "DOUBLE");
IupSetAttributeHandle(dlg, "PREVIEWGLCANVAS", glcanvas);
}
#endif
}
IupPopup(dlg, IUP_CURRENT, IUP_CURRENT);
switch(IupGetInt(dlg, "STATUS"))
{
case 1:
printf("OK\n");
printf(" New file - VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
break;
case 0 :
printf("OK\n");
printf(" File exists - VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
break;
case -1 :
printf("CANCEL\n");
break;
}
IupDestroy(dlg);
}
示例11: main
/* Main program */
int main(int argc, char **argv)
{
Ihandle *dlg;
IupOpen(&argc, &argv);
IupControlsOpen();
IupSetFunction("removeline", (Icallback)removeline);
IupSetFunction("addline", (Icallback)addline);
IupSetFunction("removecol", (Icallback)removecol);
IupSetFunction("addcol", (Icallback)addcol);
IupSetFunction("redraw", (Icallback)redraw);
createmenu();
dlg = IupDialog(
IupTabs(
IupSetAttributes(
IupVbox((create_mat()), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"),
NULL), "MARGIN=10x10, GAP=10, TABTITLE=Test1"),
IupSetAttributes(
IupVbox(IupFrame(create_mat()), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"),
// NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2,FONT=HELVETICA_ITALIC_14"),
NULL), "FONT=HELVETICA_NORMAL_12, BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"),
NULL));
IupSetAttribute(dlg,IUP_TITLE, "IupMatrix");
IupSetAttribute(dlg,IUP_MENU, "mymenu");
// IupSetAttribute(dlg,"BGCOLOR", "255 0 255");
//IupSetAttribute(dlg,"COMPOSITED", "YES");
//IupSetAttribute(dlg,"LAYERED", "YES");
//IupSetAttribute(dlg,"LAYERALPHA", "192");
IupShowXY(dlg,IUP_CENTER,IUP_CENTER) ;
IupMainLoop();
iupmaskMatRemove(IupGetHandle("mat1"), 2, 1) ;
iupmaskMatRemove(IupGetHandle("mat2"), 2, 1) ;
IupDestroy(dlg);
IupControlsClose();
IupClose();
return 0;
}
示例12: item_goto_action_cb
int item_goto_action_cb(Ihandle* item_goto)
{
Ihandle* multitext = IupGetDialogChild(item_goto, "MULTITEXT");
Ihandle *dlg, *box, *bt_ok, *bt_cancel, *txt, *lbl;
int line_count = IupGetInt(multitext, "LINECOUNT");
lbl = IupLabel(NULL);
IupSetfAttribute(lbl, "TITLE", "Line Number [1-%d]:", line_count);
txt = IupText(NULL);
IupSetAttribute(txt, "MASK", IUP_MASK_UINT); /* unsigned integer numbers only */
IupSetAttribute(txt, "NAME", "LINE_TEXT");
IupSetAttribute(txt, "VISIBLECOLUMNS", "20");
bt_ok = IupButton("OK", NULL);
IupSetInt(bt_ok, "TEXT_LINECOUNT", line_count);
IupSetAttribute(bt_ok, "PADDING", "10x2");
IupSetCallback(bt_ok, "ACTION", (Icallback)goto_ok_action_cb);
bt_cancel = IupButton("Cancel", NULL);
IupSetCallback(bt_cancel, "ACTION", (Icallback)goto_cancel_action_cb);
IupSetAttribute(bt_cancel, "PADDING", "10x2");
box = IupVbox(
lbl,
txt,
IupSetAttributes(IupHbox(
IupFill(),
bt_ok,
bt_cancel,
NULL), "NORMALIZESIZE=HORIZONTAL"),
NULL);
IupSetAttribute(box, "MARGIN", "10x10");
IupSetAttribute(box, "GAP", "5");
dlg = IupDialog(box);
IupSetAttribute(dlg, "TITLE", "Go To Line");
IupSetAttribute(dlg, "DIALOGFRAME", "Yes");
IupSetAttributeHandle(dlg, "DEFAULTENTER", bt_ok);
IupSetAttributeHandle(dlg, "DEFAULTESC", bt_cancel);
IupSetAttributeHandle(dlg, "PARENTDIALOG", IupGetDialog(item_goto));
IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
if (IupGetInt(dlg, "STATUS") == 1)
{
int line = IupGetInt(txt, "VALUE");
int pos;
IupTextConvertLinColToPos(multitext, line, 0, &pos);
IupSetInt(multitext, "CARETPOS", pos);
IupSetInt(multitext, "SCROLLTOPOS", pos);
}
IupDestroy(dlg);
return IUP_DEFAULT;
}
示例13: IupSetAttributes
Ihandle *IupQuakeMouseLayout()
{
Ihandle *tab;
tab = IupSetAttributes(
IupHbox(
IupVbox(
IupQuakeSetToggle("Reverse mouse", "m_pitch", "-0.022", "0.022", 0),
IupQuakeSetToggle("Use automatic sensitivity scaling", "m_autosens", "1", "0", 1),
IupQuakeScale("Mouse sensitivity", 1.00, 20.00, 0.1, "sensitivity", 3.00),
NULL
),
IupFill(),
NULL
),
"HOMOGENEOUS=YES"
);
IupSetAttributes(tab, "GAP=5");
return tab;
}
示例14: main
/* Main program */
int main(int argc, char **argv)
{
Ihandle *dlg, *cb;
/* Initializes IUP */
IupOpen(&argc, &argv);
IupControlsOpen();
/* Creates a canvas associated with the redraw action */
cnvs = IupCanvas(NULL);
IupSetCallback(cnvs, "ACTION", (Icallback)redraw_cb);
/* Sets size, minimum and maximum values, position and size of the thumb */
/* of the horizontal scrollbar of the canvas */
IupSetAttributes(cnvs, "RASTERSIZE=200x300");
cb = IupColorbar();
IupSetAttribute(cb, "RASTERSIZE", "70x");
IupSetAttribute(cb, "EXPAND", "VERTICAL");
IupSetAttribute(cb, "NUM_PARTS", "2");
IupSetAttribute(cb, "SHOW_SECONDARY", "YES");
IupSetCallback(cb, "SELECT_CB", (Icallback)select_cb);
IupSetCallback(cb, "CELL_CB", (Icallback)cell_cb);
IupSetCallback(cb, "SWITCH_CB", (Icallback)switch_cb);
// IupSetAttribute(cb, "SQUARED", "NO");
IupSetAttribute(cb, "PREVIEW_SIZE", "60");
/* Creates a dialog with a vbox containing the canvas and the colorbar. */
dlg = IupDialog(IupHbox(cnvs, cb, NULL));
/* Sets the dialog's title, so that it is mapped properly */
IupSetAttribute(dlg, "TITLE", "IupColorbar");
/* Maps the dialog. This must be done before the creation of the CD canvas */
IupMap(dlg);
/* Creates a CD canvas of type CD_IUP */
cdcanvas = cdCreateCanvas(CD_IUP, cnvs);
/* Shows dialog on the center of the screen */
IupShow(dlg);
/* Initializes IUP main loop */
IupMainLoop();
/* Finishes IUP */
IupClose();
/* Program finished successfully */
return EXIT_SUCCESS;
}
示例15: item_find_action_cb
int item_find_action_cb(Ihandle* item_find)
{
Ihandle* dlg = (Ihandle*)IupGetAttribute(item_find, "FIND_DIALOG");
if (!dlg)
{
Ihandle* multitext = IupGetDialogChild(item_find, "MULTITEXT");
Ihandle *box, *bt_next, *bt_close, *txt, *find_case;
txt = IupText(NULL);
IupSetAttribute(txt, "NAME", "FIND_TEXT");
IupSetAttribute(txt, "VISIBLECOLUMNS", "20");
find_case = IupToggle("Case Sensitive", NULL);
IupSetAttribute(find_case, "NAME", "FIND_CASE");
bt_next = IupButton("Find Next", NULL);
IupSetAttribute(bt_next, "PADDING", "10x2");
IupSetCallback(bt_next, "ACTION", (Icallback)find_next_action_cb);
bt_close = IupButton("Close", NULL);
IupSetCallback(bt_close, "ACTION", (Icallback)find_close_action_cb);
IupSetAttribute(bt_close, "PADDING", "10x2");
box = IupVbox(
IupLabel("Find What:"),
txt,
find_case,
IupSetAttributes(IupHbox(
IupFill(),
bt_next,
bt_close,
NULL), "NORMALIZESIZE=HORIZONTAL"),
NULL);
IupSetAttribute(box, "MARGIN", "10x10");
IupSetAttribute(box, "GAP", "5");
dlg = IupDialog(box);
IupSetAttribute(dlg, "TITLE", "Find");
IupSetAttribute(dlg, "DIALOGFRAME", "Yes");
IupSetAttributeHandle(dlg, "DEFAULTENTER", bt_next);
IupSetAttributeHandle(dlg, "DEFAULTESC", bt_close);
IupSetAttributeHandle(dlg, "PARENTDIALOG", IupGetDialog(item_find));
/* Save the multiline to acess it from the callbacks */
IupSetAttribute(dlg, "MULTITEXT", (char*)multitext);
/* Save the dialog to reuse it */
IupSetAttribute(item_find, "FIND_DIALOG", (char*)dlg);
}
/* centerparent first time, next time reuse the last position */
IupShowXY(dlg, IUP_CURRENT, IUP_CURRENT);
return IUP_DEFAULT;
}