当前位置: 首页>>代码示例>>C++>>正文


C++ IupSetCallback函数代码示例

本文整理汇总了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;
}
开发者ID:LuaDist,项目名称:iup,代码行数:35,代码来源:bigtest.c

示例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;
}
开发者ID:Archs,项目名称:iup-aio,代码行数:29,代码来源:iup_gauge.c

示例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;
}
开发者ID:286897655,项目名称:clumsy,代码行数:33,代码来源:cap.c

示例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 ();
}
开发者ID:rustanitu,项目名称:TFG,代码行数:30,代码来源:TransferFunctionsViewer.cpp

示例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;
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:26,代码来源:iup_glcanvasbox.c

示例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;
}
开发者ID:AbooJan,项目名称:clumsy,代码行数:30,代码来源:drop.c

示例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;
}
开发者ID:Archs,项目名称:iup-aio,代码行数:34,代码来源:iup_expander.c

示例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);
}
开发者ID:Airr,项目名称:iup_mac,代码行数:26,代码来源:timer.c

示例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;
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:32,代码来源:iup_sbox.c

示例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;
}
开发者ID:286897655,项目名称:clumsy,代码行数:33,代码来源:reset.c

示例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;
}
开发者ID:AndrewKL,项目名称:clumsy,代码行数:29,代码来源:tamper.c

示例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 */
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:29,代码来源:iup_dial.c

示例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;
}
开发者ID:defdef,项目名称:iup,代码行数:31,代码来源:getxy_showxy.c

示例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;

}
开发者ID:svn2github,项目名称:iup-github,代码行数:35,代码来源:scrollbar.c

示例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);
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:32,代码来源:glcanvas_cube.c


注:本文中的IupSetCallback函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。