本文整理汇总了C++中IupLabel函数的典型用法代码示例。如果您正苦于以下问题:C++ IupLabel函数的具体用法?C++ IupLabel怎么用?C++ IupLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IupLabel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iupwinVersion
void iupwinVersion(void)
{
Ihandle* dial, *ok;
dial = IupDialog(IupVbox(IupFrame(IupVbox(
IupLabel(IupVersion()),
IupLabel(IUP_VERSION_DATE),
IupLabel(IUP_COPYRIGHT),
NULL)),
ok = IupButton("Ok", NULL),
NULL));
IupSetCallback(ok, "ACTION", (Icallback)ok_cb);
IupSetAttribute(dial,IUP_TITLE,"IUP");
IupSetAttribute(dial,IUP_MENUBOX,IUP_NO);
IupSetAttribute(dial,IUP_MINBOX,IUP_NO);
IupSetAttribute(dial,IUP_MAXBOX,IUP_NO);
IupSetAttribute(dial,IUP_RESIZE,IUP_NO);
IupSetAttribute(dial,"GAP","5");
IupSetAttribute(dial,"MARGIN","5");
IupPopup(dial, IUP_CENTER, IUP_CENTER);
IupDestroy(dial);
}
示例2: 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
);
}
示例3: 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;
}
示例4: dropSetupUI
static Ihandle* dropSetupUI() {
Ihandle *dropControlsBox = IupHbox(
inboundCheckbox = IupToggle("Inbound", NULL),
outboundCheckbox = IupToggle("Outbound", NULL),
IupLabel("Chance(%):"),
chanceInput = IupText(NULL),
NULL
);
IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4");
IupSetAttribute(chanceInput, "VALUE", "10.0");
IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance);
IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance);
IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&dropInbound);
IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&dropOutbound);
// enable by default to avoid confusing
IupSetAttribute(inboundCheckbox, "VALUE", "ON");
IupSetAttribute(outboundCheckbox, "VALUE", "ON");
if (parameterized) {
setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound");
setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound");
setFromParameter(chanceInput, "VALUE", NAME"-chance");
}
return dropControlsBox;
}
示例5: tamperSetupUI
static Ihandle* tamperSetupUI() {
Ihandle *dupControlsBox = IupHbox(
checksumCheckbox = IupToggle("Redo Checksum", NULL),
inboundCheckbox = IupToggle("Inbound", NULL),
outboundCheckbox = IupToggle("Outbound", NULL),
IupLabel("Chance(%):"),
chanceInput = IupText(NULL),
NULL
);
IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4");
IupSetAttribute(chanceInput, "VALUE", "10.0");
IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance);
IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance);
IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&tamperInbound);
IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&tamperOutbound);
// sync doChecksum
IupSetCallback(checksumCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(checksumCheckbox, SYNCED_VALUE, (char*)&doChecksum);
// enable by default to avoid confusing
IupSetAttribute(inboundCheckbox, "VALUE", "ON");
IupSetAttribute(outboundCheckbox, "VALUE", "ON");
IupSetAttribute(checksumCheckbox, "VALUE", "ON");
return dupControlsBox;
}
示例6: ext_iup_label
static void ext_iup_label(script_t* script, vector_t* args)
{
script_string_t name = script_get_arg(args, 0)->string;
Ihandle* label = IupLabel(name.data);
script_push_native(script, label, NULL, iup_handle_free);
script_return_top(script);
}
示例7: uiSetupModule
static void uiSetupModule(Module *module, Ihandle *parent) {
Ihandle *groupBox, *toggle, *controls, *icon;
groupBox = IupHbox(
icon = IupLabel(NULL),
toggle = IupToggle(module->displayName, NULL),
IupFill(),
controls = module->setupUIFunc(),
NULL
);
IupSetAttribute(groupBox, "EXPAND", "HORIZONTAL");
IupSetAttribute(groupBox, "ALIGNMENT", "ACENTER");
IupSetAttribute(controls, "ALIGNMENT", "ACENTER");
IupAppend(parent, groupBox);
// set controls as attribute to toggle and enable toggle callback
IupSetCallback(toggle, "ACTION", (Icallback)uiToggleControls);
IupSetAttribute(toggle, CONTROLS_HANDLE, (char*)controls);
IupSetAttribute(toggle, SYNCED_VALUE, (char*)module->enabledFlag);
IupSetAttribute(controls, "ACTIVE", "NO"); // startup as inactive
IupSetAttribute(controls, "NCGAP", "4"); // startup as inactive
// set default icon
IupSetAttribute(icon, "IMAGE", "none_icon");
IupSetAttribute(icon, "PADDING", "4x");
module->iconHandle = icon;
// parameterize toggle
if (parameterized) {
setFromParameter(toggle, "VALUE", module->shortName);
}
}
示例8: capSetupUI
static Ihandle* capSetupUI() {
Ihandle *capControlsBox = IupHbox(
inboundCheckbox = IupToggle("Inbound", NULL),
outboundCheckbox = IupToggle("Outbound", NULL),
IupLabel("Bandwidth Cap(kb/s):"),
kpsInput = IupText(NULL),
NULL
);
IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&capInbound);
IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&capOutbound);
IupSetAttribute(kpsInput, "VISIBLECOLUMNS", "4");
IupSetAttribute(kpsInput, "VALUE", "32.0");
IupSetCallback(kpsInput, "VALUECHANGED_CB", (Icallback)uiSyncFixed);
IupSetAttribute(kpsInput, SYNCED_VALUE, (char*)&kps);
IupSetAttribute(kpsInput, FIXED_MAX, CAP_MAX);
IupSetAttribute(kpsInput, FIXED_MIN, CAP_MIN);
// enable by default to avoid confusing
IupSetAttribute(inboundCheckbox, "VALUE", "ON");
IupSetAttribute(outboundCheckbox, "VALUE", "ON");
if (parameterized) {
setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound");
setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound");
setFromParameter(kpsInput, "VALUE", NAME"-kps");
}
return capControlsBox;
}
示例9: main
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;
}
示例10: main
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;
}
示例11: resetSetupUI
static Ihandle* resetSetupUI() {
Ihandle *dupControlsBox = IupHbox(
rstButton = IupButton("RST next packet", NULL),
inboundCheckbox = IupToggle("Inbound", NULL),
outboundCheckbox = IupToggle("Outbound", NULL),
IupLabel("Chance(%):"),
chanceInput = IupText(NULL),
NULL
);
IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4");
IupSetAttribute(chanceInput, "VALUE", "0");
IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance);
IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance);
IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&resetInbound);
IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&resetOutbound);
IupSetCallback(rstButton, "ACTION", resetSetRSTNextButtonCb);
IupSetAttribute(rstButton, "PADDING", "4x");
// enable by default to avoid confusing
IupSetAttribute(inboundCheckbox, "VALUE", "ON");
IupSetAttribute(outboundCheckbox, "VALUE", "ON");
if (parameterized) {
setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound");
setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound");
setFromParameter(chanceInput, "VALUE", NAME"-chance");
}
return dupControlsBox;
}
示例12: main
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;
}
示例13: 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();
}
示例14: iuplua_show_error_message
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 = "[email protected]_ERROR";
lbl = IupLabel("[email protected]_LUAERROR");
IupSetAttribute(lbl, "EXPAND", "HORIZONTAL");
if (value) IupSetStrAttribute(lbl, "TITLE", value);
copy = IupButton("[email protected]_COPY", NULL);
IupSetStrAttribute(copy, "TIP", "[email protected]_COPYTOCLIPBOARD");
IupSetStrAttribute(copy, "PADDING", IupGetGlobal("DEFAULTBUTTONPADDING"));
IupSetCallback(copy, "ACTION", show_error_copy_action);
button = IupButton("[email protected]_CONTINUE", NULL);
IupSetStrAttribute(button, "PADDING", IupGetGlobal("DEFAULTBUTTONPADDING"));
IupSetCallback(button, "ACTION", show_error_continue_action);
abort = IupButton("[email protected]_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);
}
示例15: 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;
}