本文整理汇总了C++中IupSetCallback函数的典型用法代码示例。如果您正苦于以下问题:C++ IupSetCallback函数的具体用法?C++ IupSetCallback怎么用?C++ IupSetCallback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IupSetCallback函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
int i, count = sizeof(test_list)/sizeof(TestItems);
char str[50];
Ihandle *dlg, *list;
IupOpen(&argc, &argv);
IupControlsOpen();
// IupSetGlobal("LANGUAGE", "PORTUGUESE");
dlg = IupDialog(IupVbox(list = IupList(NULL), NULL));
IupSetAttribute(dlg, "MARGIN", "10x10");
IupSetAttribute(dlg, "TITLE", "IupTests");
IupSetCallback(dlg, "CLOSE_CB", close_cb);
IupSetAttribute(list, "VISIBLELINES", "15");
IupSetAttribute(list, "EXPAND", "YES");
IupSetCallback(list, "DBLCLICK_CB", (Icallback)dblclick_cb);
IupSetCallback(list, "K_CR", k_enter_cb);
for (i=0; i<count; i++)
{
sprintf(str, "%d", i+1);
IupSetAttribute(list, str, test_list[i].title);
}
IupShowXY(dlg, 100, IUP_CENTER);
IupMainLoop();
IupClose();
return EXIT_SUCCESS;
}
示例2: iGaugeCreateMethod
static int iGaugeCreateMethod(Ihandle* ih, void **params)
{
(void)params;
/* free the data allocated by IupCanvas */
free(ih->data);
ih->data = iupALLOCCTRLDATA();
/* change the IupCanvas default values */
iupAttribSetStr(ih, "BORDER", "NO");
IupSetAttribute(ih, "SIZE", IGAUGE_DEFAULTSIZE);
ih->expand = IUP_EXPAND_NONE;
/* default values */
iupAttribSetStr(ih, "FGCOLOR", IGAUGE_DEFAULTCOLOR);
ih->data->fgcolor = cdIupConvertColor(IGAUGE_DEFAULTCOLOR);
ih->data->vmax = 1;
ih->data->bgcolor = CD_GRAY;
ih->data->light_shadow = CD_WHITE;
ih->data->mid_shadow = CD_GRAY;
ih->data->dark_shadow = CD_DARK_GRAY;
ih->data->show_text = 1;
/* IupCanvas callbacks */
IupSetCallback(ih, "RESIZE_CB", (Icallback)iGaugeResize_CB);
IupSetCallback(ih, "ACTION", (Icallback)iGaugeRedraw_CB);
return IUP_NOERROR;
}
示例3: 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;
}
示例4: IupGLCanvas
void TransferFunctionsViewer::BuildInterface ()
{
m_iup_canvas = IupGLCanvas ("tfviewer_canvas");
IupSetCallback (m_iup_canvas, "ACTION", (Icallback)TransferFunctionsViewer::Action);
IupSetCallback (m_iup_canvas, "BUTTON_CB", (Icallback)TransferFunctionsViewer::Button_CB);
IupSetCallback (m_iup_canvas, "MOTION_CB", (Icallback)TransferFunctionsViewer::Motion_CB);
IupSetAttribute (m_iup_canvas, IUP_BUFFER, IUP_DOUBLE);
IupSetAttribute (m_iup_canvas, IUP_RASTERSIZE, "258x50");
IupSetAttribute (m_iup_canvas, IUP_RESIZE, IUP_NO);
IupSetHandle ("tfviewer_canvas", m_iup_canvas);
m_iup_sub_menu_file = IupSubmenu ("Arquivo", IupMenu(NULL));
m_iup_menu = IupMenu (m_iup_sub_menu_file, NULL);
IupSetHandle ("TransferFunctionMenu", m_iup_menu);
m_iup_main_dialog = IupDialog (m_iup_canvas);
//IupSetAttribute (m_iup_main_dialog, "MENU", "TransferFunctionMenu");
IupSetAttribute (m_iup_main_dialog, "TITLE", "Transfer Function Visualization");
IupSetAttribute (m_iup_main_dialog, "BORDER", "NO");
IupSetAttribute (m_iup_main_dialog, "RESIZE", "NO");
IupMap (m_iup_main_dialog);
IupRefresh (m_iup_main_dialog);
if (!m_pixels)
m_pixels = new float[258 * 50 * 4];
Redraw ();
}
示例5: iGLCanvasBoxCreateMethod
static int iGLCanvasBoxCreateMethod(Ihandle* ih, void** params)
{
int i;
char new_name[50];
for (i = 0; i < CB_NAMES_COUNT; i++)
{
/* save the internal callbacks */
sprintf(new_name, "GLBOX_%s", iglcanvasbox_cb_names[i]);
IupSetCallback(ih, new_name, iglcanvasbox_cbs[i]);
}
IupSetCallback(ih, "SWAPBUFFERS_CB", iGLCanvasBoxSwapBuffers_CB);
if (params)
{
Ihandle** iparams = (Ihandle**)params;
while (*iparams)
{
IupAppend(ih, *iparams);
iparams++;
}
}
return IUP_NOERROR;
}
示例6: 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;
}
示例7: iExpanderCreateMethod
static int iExpanderCreateMethod(Ihandle* ih, void** params)
{
Ihandle* bar;
ih->data = iupALLOCCTRLDATA();
ih->data->position = IEXPANDER_TOP;
ih->data->state = IEXPANDER_OPEN;
ih->data->barSize = -1;
bar = IupCanvas(NULL);
iupChildTreeAppend(ih, bar); /* bar will always be the firstchild */
bar->flags |= IUP_INTERNAL;
IupSetAttribute(bar, "CANFOCUS", "NO");
IupSetAttribute(bar, "BORDER", "NO");
IupSetAttribute(bar, "EXPAND", "NO");
/* Setting callbacks */
IupSetCallback(bar, "BUTTON_CB", (Icallback) iExpanderButton_CB);
IupSetCallback(bar, "ACTION", (Icallback) iExpanderAction_CB);
IupSetCallback(bar, "ACTION", (Icallback) iExpanderAction_CB);
IupSetCallback(bar, "ENTERWINDOW_CB", (Icallback)iExpanderEnterWindow_cb);
IupSetCallback(bar, "LEAVEWINDOW_CB", (Icallback)iExpanderLeaveWindow_cb);
if (params)
{
Ihandle** iparams = (Ihandle**)params;
if (*iparams)
IupAppend(ih, *iparams);
}
return IUP_NOERROR;
}
示例8: TimerTest
void TimerTest(void)
{
Ihandle *dlg;
dlg = IupDialog(NULL);
IupSetAttribute(dlg, "TITLE", "IupTimer Test");
IupSetAttribute(dlg, "SIZE", "200x100");
IupShow(dlg);
timer1 = IupTimer();
timer2 = IupTimer();
timer3 = IupTimer();
IupSetAttribute(timer1, "TIME", "100");
IupSetAttribute(timer1, "RUN", "YES");
IupSetCallback(timer1, "ACTION_CB", (Icallback)timer_cb);
IupSetAttribute(timer2, "TIME", "400");
IupSetAttribute(timer2, "RUN", "YES");
IupSetCallback(timer2, "ACTION_CB", (Icallback)timer_cb);
IupSetAttribute(timer3, "TIME", "5000");
IupSetAttribute(timer3, "RUN", "YES");
IupSetCallback(timer3, "ACTION_CB", (Icallback)timer_cb);
}
示例9: iSboxCreateMethod
static int iSboxCreateMethod(Ihandle* ih, void** params)
{
Ihandle* bar;
ih->data = iupALLOCCTRLDATA();
ih->data->direction = ISBOX_EAST;
ih->data->h = -1;
ih->data->w = -1;
bar = IupCanvas(NULL);
bar->flags |= IUP_INTERNAL;
iupChildTreeAppend(ih, bar); /* bar will always be the firstchild */
IupSetAttribute(bar, "BORDER", "YES");
IupSetAttribute(bar, "EXPAND", "NO");
IupSetAttribute(bar, "BGCOLOR", "192 192 192");
/* Setting callbacks */
IupSetCallback(bar, "BUTTON_CB", (Icallback) iSboxButton_CB);
IupSetCallback(bar, "FOCUS_CB", (Icallback) iSboxFocus_CB);
IupSetCallback(bar, "MOTION_CB", (Icallback) iSboxMotion_CB);
if (params)
{
Ihandle** iparams = (Ihandle**)params;
if (*iparams)
IupAppend(ih, *iparams);
}
return IUP_NOERROR;
}
示例10: 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;
}
示例11: 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;
}
示例12: iDialSetOrientationAttrib
static int iDialSetOrientationAttrib(Ihandle* ih, const char* value)
{
/* valid only before map */
if (ih->handle)
return 0;
if (iupStrEqualNoCase(value, "VERTICAL"))
{
ih->data->Draw = iDialDrawVertical;
ih->data->orientation = IDIAL_VERTICAL;
IupSetCallback(ih, "MOTION_CB", (Icallback)iDialMotionVertical_CB);
IupSetAttribute(ih, "SIZE", "16x80");
}
else if (iupStrEqualNoCase(value, "CIRCULAR"))
{
ih->data->Draw = iDialDrawCircular;
ih->data->orientation = IDIAL_CIRCULAR;
IupSetCallback(ih, "MOTION_CB", (Icallback)iDialMotionCircular_CB);
IupSetAttribute(ih, "SIZE", "40x36");
}
else /* "HORIZONTAL" */
{
ih->data->Draw = iDialDrawHorizontal;
ih->data->orientation = IDIAL_HORIZONTAL;
IupSetCallback(ih, "MOTION_CB", (Icallback)iDialMotionHorizontal_CB);
IupSetAttribute(ih, "SIZE", "80x16");
}
return 0; /* do not store value in hash table */
}
示例13: main
int main(int argc, char **argv)
{
int X=100, Y=200;
FILE *fp;
Ihandle *dlg, *mat;
fp = fopen("test.dat", "r");
if (fp != NULL)
{
fread(&X,sizeof(int),1,fp);
fread(&Y,sizeof(int),1,fp);
fclose(fp);
}
printf("X,Y=%d,%d\n", X, Y);
IupOpen(&argc, &argv);
IupControlsOpen ();
mat = create_mat();
dlg = IupDialog(mat);
IupSetAttribute(dlg,"SHRINK","YES");
IupSetAttribute(dlg, "TITLE", "IupMatrix");
IupSetCallback(dlg, "RESIZE_CB", (Icallback) resize_cb);
IupSetCallback(dlg, "CLOSE_CB", (Icallback) close_cb);
IupShowXY (dlg,X,Y);
IupMainLoop ();
IupClose ();
return EXIT_SUCCESS;
}
示例14: main
int main(int argc, char **argv)
{
Ihandle *dialog, *canvas;
IupOpen(&argc, &argv);
canvas = IupCanvas(NULL);
IupSetAttribute(canvas, "RASTERSIZE", "300x200"); /* initial size */
IupSetAttribute(canvas, "SCROLLBAR", "YES");
IupSetAttribute(canvas, "XMAX", "599");
IupSetAttribute(canvas, "YMAX", "399");
IupSetCallback(canvas, "SCROLL_CB", (Icallback)scroll_cb);
IupSetCallback(canvas, "RESIZE_CB", (Icallback)resize_cb);
IupSetCallback(canvas, "ACTION", (Icallback)action);
dialog = IupDialog(canvas);
IupSetAttribute(dialog, "TITLE", "Scrollbar Test");
IupMap(dialog);
cdcanvas = cdCreateCanvas(CD_IUP, canvas);
IupSetAttribute(canvas, "RASTERSIZE", NULL); /* release the minimum limitation */
IupShowXY(dialog,IUP_CENTER,IUP_CENTER);
IupMainLoop();
cdKillCanvas(cdcanvas);
IupDestroy(dialog);
IupClose();
return EXIT_SUCCESS;
}
示例15: 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);
}