Пример #1
0
int IupShow (Ihandle* n)
{
  assert(n != NULL);
  if(n == NULL)
    return IUP_ERROR;

  if (handle(n))
    return IupShowXY( n, IupGetInt(n, IUP_X), IupGetInt(n, IUP_Y));
  else
    return IupShowXY( n, IUP_CURRENT, IUP_CURRENT );
}
Пример #2
0
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;
}
Пример #3
0
int main(int argc, char **argv)
{
    Ihandle *dlg;
    Ihandle *lbl;

    IupOpen(&argc, &argv);
    IupMglPlotOpen();

    lbl = IupMglLabel("\\int \\alpha \\sqrt{sin(\\pi x)^2 + \\gamma_{i_k}} dx");
    IupSetAttribute(lbl, "RASTERSIZE", "400x80");
    IupSetAttribute(lbl, "LABELFONTSIZE", "10");

//  IupSetAttribute(lbl, "BGCOLOR", "255 255 0");
//  IupSetAttribute(lbl, "FGCOLOR", "0 0 255");

    dlg = IupDialog(IupVbox(lbl, NULL));
    IupSetAttribute(dlg, "MARGIN", "10x10");
    IupSetAttribute(dlg, "TITLE", "IupMglLabel Example");

    IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

    IupMainLoop();

    IupClose();

    return EXIT_SUCCESS;
}
Пример #4
0
void CanvasScrollbarTest(void)
{
  Ihandle *dlg, *cnv;

  cnv = IupCanvas(NULL);
  IupSetAttribute(cnv, "RASTERSIZE", "300x200"); /* initial size */
  IupSetAttribute(cnv, "SCROLLBAR", "YES");
//  IupSetAttribute(cnv, "EXPAND", "NO");

  IupSetCallback(cnv, "RESIZE_CB",  (Icallback)resize_cb);
  IupSetCallback(cnv, "ACTION",  (Icallback)action);
  IupSetCallback(cnv, "MAP_CB",  (Icallback)map_cb);
  IupSetCallback(cnv, "UNMAP_CB",  (Icallback)unmap_cb);
  IupSetCallback(cnv, "WHEEL_CB",  (Icallback)wheel_cb);
  IupSetCallback(cnv, "SCROLL_CB",  (Icallback)scroll_cb);
                   
  dlg = IupDialog(IupVbox(cnv, NULL));
  IupSetAttribute(dlg, "TITLE", "Scrollbar Test");
  IupSetAttribute(dlg, "MARGIN", "10x10");

  IupMap(dlg);
  IupSetAttribute(cnv, "RASTERSIZE", NULL);  /* release the minimum limitation */
 
  IupShowXY(dlg,IUP_CENTER,IUP_CENTER);
}
Пример #5
0
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
0
int main(int argc, char **argv)
{
    Ihandle *dlg, *multitext, *vbox;

    IupOpen(&argc, &argv);

    multitext = IupText(NULL);
    vbox = IupVbox(
               multitext,
               NULL);
    IupSetAttribute(multitext, "MULTILINE", "YES");
    IupSetAttribute(multitext, "EXPAND", "YES");

    dlg = IupDialog(vbox);
    IupSetAttribute(dlg, "TITLE", "Simple Notepad");
    IupSetAttribute(dlg, "SIZE", "QUARTERxQUARTER");

    IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
    IupSetAttribute(dlg, "USERSIZE", NULL);

    IupMainLoop();

    IupClose();
    return EXIT_SUCCESS;
}
Пример #7
0
int main(int argc, char **argv)
{
  IupOpen(&argc, &argv);

  memset(password, 0, 100);

  text = IupText(NULL);
  IupSetAttribute(text, "SIZE",  "200x");
  IupSetCallback(text, "ACTION", (Icallback) action);
  IupSetCallback(text, "K_ANY", (Icallback) k_any);

  pwd = IupText(NULL);
  IupSetAttribute(pwd, "READONLY", "YES");
  IupSetAttribute(pwd, "SIZE", "200x");

  dlg = IupDialog(IupVbox(text, pwd, NULL));
  IupSetAttribute(dlg, "TITLE", "IupText");

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

  IupMainLoop();
  IupDestroy(dlg);
  IupClose();
  return 0;
}
Пример #8
0
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;
}
Пример #9
0
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;

}
Пример #10
0
void TrayTest(void)
{
  Ihandle *dlg, *img;

  img = IupImage(16, 16, pixmap);
  IupSetAttribute(img, "0", "BGCOLOR");
  IupSetAttribute(img, "1", "255 255 0");
  IupSetAttribute(img, "2", "255 0 0"); 
  IupSetAttribute(img, "3", "255 255 0");
  IupSetHandle ("img", img);

  dlg = IupDialog(NULL);

  IupSetAttribute(dlg, "TITLE", "Tray Test");
  IupSetAttribute(dlg, "TRAY", "YES");
  IupSetAttribute(dlg, "TRAYTIP", "Tip at Tray");
  IupSetAttribute(dlg, "TRAYIMAGE", "img");
  IupSetAttribute(dlg, "SIZE", "100x100");
  IupSetCallback(dlg, "TRAYCLICK_CB", (Icallback)trayclick);
  IupSetCallback(dlg, "CLOSE_CB", (Icallback)close_cb);
  IupSetCallback(dlg, "K_ESC", (Icallback)k_esc);

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

  /* start only the task bar icon */
  IupSetAttribute(dlg, "HIDETASKBAR", "YES");  
}
Пример #11
0
void main(int argc, char* argv[])
{
  Ihandle* dlg = NULL;
  Ihandle* cells  = NULL;

  IupOpen(&argc, &argv);
  IupControlsOpen();

  cells  = create();
  dlg = IupDialog(cells);

  IupSetAttribute(dlg, "RASTERSIZE", "400x400");
  IupSetAttribute(dlg, "TITLE", "IupCells");

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER) ;
  IupSetAttribute(dlg, "RASTERSIZE", NULL);

  IupMainLoop() ;

  IupDestroy(dlg);

  IupClose();

  return 0;
}
int main(void) {

	Ihandle *dlg;
	int res;
	extern void (*routine_drawPixel) (float x, float y);

	srand((unsigned int) time(0));                  /* Seed to current time value */
	
	routine_drawPixel = clipal_drawPixel;

	list_init(&pointList, free);
	res = util_readFromFile("clip_rectangle.txt");
	printf("Clip Rectangle loaded, return value: %d\n", res);
	
	if (res == -1) {
		printf("File read error\n");\
		getche();
		goto TERMINATE;
	}

	IupOpen(0, 0);
		IupGLCanvasOpen();

		dlg = createMainWindow();
		IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

		IupMainLoop();
	IupClose();
	
	TERMINATE:
	list_destroy(&pointList);
	return 0;
}
Пример #13
0
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;
}
Пример #14
0
static void ext_iup_show_xy(script_t* script, vector_t* args)
{
	Ihandle* handle = script_get_arg(args, 0)->nat.value;
	int x = (int)script_get_arg(args, 1)->number;
	int y = (int)script_get_arg(args, 2)->number;
	
	IupShowXY(handle, x, y);
}
Пример #15
0
static int ShowXY(lua_State *L)
{
  Ihandle *ih = iuplua_checkihandle(L,1);
  int x = luaL_optint(L,2, IUP_CURRENT);
  int y = luaL_optint(L,3, IUP_CURRENT);
  lua_pushinteger(L, IupShowXY(ih,x,y));
  return 1;
}
Пример #16
0
void startup() {
    // initialize seed
    srand((unsigned int)time(NULL));

    // kickoff event loops
    IupShowXY(dialog, IUP_CENTER, IUP_CENTER);
    IupMainLoop();
    // ! main loop won't return until program exit
}
Пример #17
0
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);
}
Пример #18
0
/* 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;

}
Пример #19
0
void TreeTest(void)
{
  Ihandle* dlg;
  
  init_tree();                            /* Initializes IupTree */
  init_dlg();                             /* Initializes the dlg */
  dlg = IupGetHandle("dlg");              /* Retrieves the dlg handle */
  IupShowXY(dlg, IUP_CENTER, IUP_CENTER); /* Displays the dlg */
  init_tree_nodes();                  /* Initializes attributes, can be done here or anywhere */
}
Пример #20
0
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;

}
Пример #21
0
int main(int argc, char **argv)
{
  IupOpen(&argc, &argv);      
  IupControlsOpen();      
  func_1();
  IupShowXY(IupGetHandle("dlg"),IUP_CENTER,IUP_CENTER);
  IupMainLoop();
  IupClose();  
  return EXIT_SUCCESS;

}
Пример #22
0
/*-----------------------*/
int main(int argc, char* argv[]) 
{
     IupSOpen(&argc, &argv);                      /* opens the IUP lib */

     gc.dialog = InitDialog();                      /* local function to create a dialog with buttons and canvas */
     IupShowXY(gc.dialog, IUP_CENTER, IUP_CENTER);  /* shows dialog in the center of screen */

     IupMainLoop();                        /* handle the program control to the IUP lib until a return IUP_CLOSE */

     IupClose();                           /* closes the IUP lib */ 
}
Пример #23
0
void MatrixCbModeTest(void)
{
  Ihandle* dlg, *box;

  box = IupVbox(create_matrix(), NULL);
  IupSetAttribute(box, "MARGIN", "10x10");

  dlg = IupDialog(box);
  IupSetAttribute(dlg, "TITLE", "IupMatrix Simple Test");
  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
}
Пример #24
0
static int iDetachBoxSetDetachAttrib(Ihandle* ih, const char* value)
{
  int cur_x, cur_y;
  IFnnii detachedCB = (IFnnii)IupGetCallback(ih, "DETACHED_CB");

  /* Create new dialog */
  Ihandle *new_parent = IupDialog(NULL);
  Ihandle *old_dialog = IupGetDialog(ih);

  /* Set new dialog as child of the current application */
  IupSetAttributeHandle(new_parent, "PARENTDIALOG", old_dialog);

  iupStrToIntInt(IupGetGlobal("CURSORPOS"), &cur_x, &cur_y, 'x');

  if (detachedCB)
  {
    int ret = detachedCB(ih, new_parent, cur_x, cur_y);
    if (ret == IUP_IGNORE)
    {
      IupDestroy(new_parent);
      return IUP_DEFAULT;
    }
  }

  /* set user size of the detachbox as the current size of the child */
  IupSetStrAttribute(ih, "RASTERSIZE", IupGetAttribute(ih->firstchild->brother, "RASTERSIZE"));

  /* Save current parent and reference child */
  ih->data->old_parent = ih->parent;
  ih->data->old_brother = ih->brother;

  IupMap(new_parent);

  /* Sets the new parent */
  IupReparent(ih, new_parent, NULL);

  /* Hide handler */
  IupSetAttribute(ih->firstchild, "VISIBLE", "No");

  /* force a dialog resize since IupMap already computed the dialog size */
  IupSetAttribute(new_parent, "RASTERSIZE", NULL);

  /* Maps and shows the new dialog */
  IupShowXY(new_parent, cur_x, cur_y);

  /* reset user size of the detachbox */
  IupSetAttribute(ih, "USERSIZE", NULL);

  /* Updates/redraws the layout of the old dialog */
  IupRefresh(old_dialog);

  (void)value;
  return 0;
}
Пример #25
0
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;
}
Пример #26
0
int main(int argc, char **argv){
	IupOpen(&argc, &argv);
	led_load(); //Loads the GUI compiled from LED files.
	mainDlg = IupGetHandle("mainDlg"); //Get the window named "mainDlg"
	IupShowXY(mainDlg, IUP_CENTER, IUP_CENTER); //Shows the main window

	aboutDlg = about_init(); //Get the window named "aboutDlg"
	IupSetCallback(IupGetHandle("about"), "ACTION", (Icallback)main_about); //Callback: Associates the click action of the button "about" with the "about" function.

 	IupMainLoop();
 	IupClose();
	return EXIT_SUCCESS;
}
Пример #27
0
void CellsCheckboardTest(void)
{
  Ihandle* dlg = NULL;
  Ihandle* cells  = NULL;

  cells  = create();

  dlg = IupDialog(cells);
  IupSetAttribute(dlg, "TITLE", "IupCells");

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER) ;
  IupSetAttribute(cells, "RASTERSIZE", NULL);
}
Пример #28
0
Файл: item.c Проект: defdef/iup
int main(int argc, char **argv)
{
  Ihandle *dlg;
  Ihandle *text;
  Ihandle *menu, *menu_file;
  Ihandle *submenu_file;
  Ihandle *item_save, *item_autosave, *item_exit;

  IupOpen(&argc, &argv);
 
  text = IupText(NULL);

  IupSetAttribute(text, "VALUE", "This is an empty text");

  item_save = IupItem("Save\tCtrl+S", NULL);  /* this is NOT related with the Ctrl+S key callback, it will just align the text at right */
  item_autosave = IupItem("&Auto Save", NULL);
  item_exit = IupItem("Exit", "item_exit_act");

  IupSetAttribute(item_exit, "KEY", "x");   /* this is NOT related with the K_X key callback, it will just underline the letter */

  IupSetCallback(item_exit, "ACTION", (Icallback) item_exit_cb);
  IupSetCallback(item_autosave, "ACTION", (Icallback) item_autosave_cb);

  IupSetAttribute(item_autosave, "VALUE", "ON");
  IupSetHandle("item_autosave", item_autosave); /* giving a name to a iup handle */

  menu_file = IupMenu(item_save, item_autosave, item_exit, NULL);
  
  submenu_file = IupSubmenu("File", menu_file);
  
  menu = IupMenu(submenu_file, NULL);
 
  IupSetHandle("menu", menu);
                                
  dlg = IupDialog(IupVbox(text, IupButton("Test", NULL), NULL));

  IupSetAttribute(dlg, "MARGIN", "10x10");
  IupSetAttribute(dlg, "GAP", "10");
  IupSetAttribute(dlg, "TITLE", "IupItem");
  IupSetAttribute(dlg, "MENU", "menu");
  IupSetCallback(dlg, "K_cX", (Icallback) item_exit_cb);   /* this will also affect the IupText if at focus, since it is used for clipboard cut */
  IupSetCallback(dlg, "K_cA", (Icallback) item_autosave_cb);  /* this will also affect the IupText if at focus, since it is used for select all */
  IupSetCallback(dlg, "K_cS", (Icallback) item_save_cb);

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
  IupMainLoop();
  IupClose();

  return EXIT_SUCCESS;

}
Пример #29
0
/* Main program */
int main(int argc, char **argv)
{
  Ihandle *dlg;
  IupOpen(&argc, &argv);       
  IupControlsOpen ();

  dlg = IupDialog(create_mat());
  IupSetAttribute(dlg, "TITLE", "IupMatrix");
  IupShowXY (dlg,IUP_CENTER,IUP_CENTER);
  IupMainLoop ();
  IupClose ();  
  return EXIT_SUCCESS;

}
Пример #30
0
int main(int argc, char **argv)
{
  IupOpen(&argc, &argv);      
  IupControlsOpen();      
  func_1();
  IupShowXY(IupGetHandle("dlg"),IUP_CENTER,IUP_CENTER);
  IupMainLoop();
  IupDestroy(IupGetHandle("img1"));
  IupDestroy(IupGetHandle("img2"));
  IupDestroy(IupGetHandle("dlg"));
  IupControlsClose();      
  IupClose();  
  return 0;
}