Exemple #1
0
int main(int argc, char* argv[])
{
  Ihandle* dlg;

  IupOpen(&argc, &argv);

  dlg = CreateDialog();

  IupShow(dlg);
  
  /* Try to get a file name from the command line. */
  if (argc > 1)
    ShowImage(argv[1], dlg);
  else   
  {
    char file_name[1024] = "*.*";
    if (IupGetFile(file_name) == 0)
      ShowImage(file_name, dlg);
  }
                                   
  IupMainLoop();
  IupDestroy(dlg);
  IupClose();

  return 0;
}
Exemple #2
0
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;
}
Exemple #3
0
static void counter_start(int totalcount)
{
  if (!counter_dlg)
  {
    counter_dlg = IupProgressDlg();

    //  IupSetAttribute(counter_dlg, "PARENTDIALOG", "MainWindow");
    IupSetAttribute(counter_dlg, "TITLE", "Long Processing Test");
    IupSetAttribute(counter_dlg, "DESCRIPTION", "Description first line\nSecond Line");
    IupSetCallback(counter_dlg, "CANCEL_CB", cancel_cb);
    IupSetInt(counter_dlg, "TOTALCOUNT", totalcount);
    IupSetAttribute(counter_dlg, "RESIZE", "YES");
//    IupSetAttribute(counter_dlg, "MINCLOCK", "500");
//    IupSetAttribute(counter_dlg, "MINPERCENT", "20");
  }

  IupSetAttribute(counter_dlg, "STATE", NULL);

  IupShow(counter_dlg);

  IupSetAttribute(counter_dlg, "SIMULATEMODAL", "Yes");

//  Ihandle* main_window = IupGetHandle("MainWindow");
//  IupSetAttribute(main_window, "TASKBARPROGRESSSTATE", "NORMAL");
//  IupSetAttribute(main_window, "TASKBARPROGRESSVALUE", "0");

  printf("Start\n");
}
Exemple #4
0
/* main program */
int main(int argc, char **argv)
{
  char *error=NULL;

  /* IUP initialization */
  IupOpen(&argc, &argv);
  IupControlsOpen () ;

  /* loads LED */
  if((error = IupLoad("vbox.led")))
  {
    IupMessage("LED error", error);
    return 1 ;
  }

  dlg = IupGetHandle("Alinhav");

  /* sets callbacks */
//  IupSetFunction( "acao_pausa", (Icallback) btn_pause_cb );

  /* shows dialog */
//  IupShowXY(dlg,IUP_CENTER,IUP_CENTER);
  IupShow(dlg);

  /* main loop */
  IupMainLoop();

  IupDestroy(dlg);

  /* ends IUP */
  IupControlsClose() ;
  IupClose();

  return 0 ;
}
Exemple #5
0
void TextSpinTest(void)
{
  Ihandle *dlg, *text;

  text = IupText(NULL);
  IupSetAttribute(text, "SIZE", "60x");
//  IupSetAttribute(text, "EXPAND", "HORIZONTAL");

  IupSetAttribute(text, "SPIN", "YES");
  IupSetAttribute(text, "SPINMIN", "5");
  IupSetAttribute(text, "SPINMAX", "50");
  IupSetAttribute(text, "SPININC", "10");
//  IupSetAttribute(text, "SPINWRAP", "YES");
//  IupSetAttribute(text, "SPINALIGN", "LEFT");
  IupSetAttribute(text, "SPINVALUE", "13");
//  IupSetAttribute(text, "SPINAUTO", "NO");
  IupSetAttribute(text, "NAME", "spin");

//  IupSetCallback(text, "SPIN_CB", (Icallback)spin_cb);
//  IupSetCallback(text, "ACTION", (Icallback)action_cb);
//  IupSetCallback(text, "VALUECHANGED_CB", (Icallback)valuechanged_cb);

  dlg = IupDialog(IupVbox(text, IupButton("SPINVALUE", "setspinvalue"), NULL));
  IupSetAttribute(dlg, "GAP", "20");
  IupSetAttribute(dlg, "MARGIN", "20x20");
//  IupSetAttribute(dlg, "BGCOLOR", "173 177 194");  // Motif BGCOLOR for documentation

  IupSetFunction("setspinvalue", (Icallback)setspinvalue);

  IupSetAttribute(dlg, "TITLE", "Text Spin Test");
  IupShow(dlg);
}
Exemple #6
0
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;
}
Exemple #7
0
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);
}
Exemple #8
0
void SplitTest(void)
{
  Ihandle *dlg, *bt, *split, *ml, *vbox;

  bt = IupButton("Button", NULL);
  IupSetAttribute(bt, "EXPAND", "YES");

  ml = IupMultiLine(NULL);
  IupSetAttribute(ml, "EXPAND", "YES");
  IupSetAttribute(ml, "VISIBLELINES", "5");
  IupSetAttribute(ml, "VISIBLECOLUMNS", "10");
  
  split = IupSplit(bt, ml);
//  IupSetAttribute(split, "ORIENTATION", "VERTICAL");
  IupSetAttribute(split, "ORIENTATION", "HORIZONTAL");
  IupSetAttribute(split, "COLOR", "127 127 255");

  vbox = IupVbox(split, NULL);
  IupSetAttribute(vbox, "MARGIN", "10x10");
  IupSetAttribute(vbox, "GAP", "10");

  dlg = IupDialog(vbox);
  IupSetAttribute(dlg, "TITLE", "IupSplit Example");

  IupShow(dlg);
}
int main(int argc, char **argv)
{
  Ihandle *canvas, *finale, *dg;

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

  canvas = IupGLCanvas(NULL);
  IupSetCallback(canvas, "ACTION", (Icallback) redraw);
  IupSetAttribute(canvas, IUP_BUFFER, IUP_DOUBLE);
  IupSetAttribute(canvas, "RASTERSIZE", "123x200");

  finale = IupHbox(IupFill(), 
                   canvas, 
                   IupFill(), 
                   NULL);

  dg = IupDialog(finale);
  IupSetAttribute(dg, "TITLE", "IupGLCanvas");

  IupShow(dg);
  IupMainLoop();
  IupClose();

  return EXIT_SUCCESS;
}
Exemple #10
0
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;
}
Exemple #11
0
static int iDialogSetVisibleAttrib(Ihandle* ih, const char* value)
{
  if (iupStrBoolean(value))
    IupShow(ih);
  else
    IupHide(ih);
  return 0;
}
Exemple #12
0
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();
}
Exemple #13
0
void WebBrowserTest(void)
{
  Ihandle *txt, *dlg, *web;
  Ihandle *btLoad, *btReload, *btBack, *btForward, *btStop;
#ifndef WIN32
  Ihandle *history;
#endif

  IupWebBrowserOpen();              

  // Creates an instance of the WebBrowser control
  web = IupWebBrowser();

  // Creates a dialog containing the control
  dlg = IupDialog(IupVbox(IupHbox(btBack = IupButton("Back", NULL),
                                  btForward = IupButton("Forward", NULL),
                                  txt = IupText(""),
                                  btLoad = IupButton("Load", NULL),
                                  btReload = IupButton("Reload", NULL),
                                  btStop = IupButton("Stop", NULL),
#ifndef WIN32
                                  history = IupButton("History", NULL),
#endif
                                  NULL), 
                                  web, NULL));
  IupSetAttribute(dlg, "TITLE", "IupWebBrowser");
  IupSetAttribute(dlg, "MY_TEXT", (char*)txt);
  IupSetAttribute(dlg, "MY_WEB", (char*)web);
  IupSetAttribute(dlg, "RASTERSIZE", "800x600");
  IupSetAttribute(dlg, "MARGIN", "10x10");
  IupSetAttribute(dlg, "GAP", "10");

   //IupSetAttribute(web, "HTML", "<html><body><b>Hello</b>World!</body></html>");
//   IupSetAttribute(txt, "VALUE", "My HTML");
  IupSetAttribute(txt, "VALUE", "http://www.tecgraf.puc-rio.br/iup");
//  IupSetAttribute(txt, "VALUE", "file:///D:/tecgraf/iup/html/index.html");
  IupSetAttribute(web, "VALUE", IupGetAttribute(txt, "VALUE"));
  IupSetAttributeHandle(dlg, "DEFAULTENTER", btLoad);

  IupSetAttribute(txt, "EXPAND", "HORIZONTAL");
  IupSetCallback(btLoad, "ACTION", (Icallback)load_cb);
  IupSetCallback(btReload, "ACTION", (Icallback)reload_cb);
  IupSetCallback(btBack, "ACTION", (Icallback)back_cb);
  IupSetCallback(btForward, "ACTION", (Icallback)forward_cb);
  IupSetCallback(btStop, "ACTION", (Icallback)stop_cb);
#ifndef WIN32
  IupSetCallback(history, "ACTION", (Icallback)history_cb);
#endif

  IupSetCallback(web, "NEWWINDOW_CB", (Icallback)newwindow_cb);
  IupSetCallback(web, "NAVIGATE_CB", (Icallback)navigate_cb);
  IupSetCallback(web, "ERROR_CB", (Icallback)error_cb);
  IupSetCallback(web, "COMPLETED_CB", (Icallback)completed_cb);

  // Shows dialog
  IupShow(dlg);
}
Exemple #14
0
void MdiTest(void)
{
  Ihandle* dlg;

  createMenu();

  dlg = createFrame();
//  IupSetAttribute(dlg, "PLACEMENT", "MAXIMIZED");
  IupShow(dlg);
}
Exemple #15
0
/* 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;

}
  SampleClass()
  {
    sample_count = 0;
    
    Ihandle* button = IupButton("Test", NULL);
    // 2) Associate the callback with the button
    IUP_CLASS_SETCALLBACK(button, "ACTION", ButtonAction);

    Ihandle* dialog = IupDialog(button);
    // 1) Register this object as a callback receiver (only once)
    IUP_CLASS_INITCALLBACK(dialog, SampleClass);

    IupShow(dialog);
  };
Exemple #17
0
int main(int argc, char **argv)
{
  Ihandle *male, *female, *exclusive, *frame, *dialog;

  IupOpen(&argc, &argv);

  male  = IupToggle ("Male", "");
  female = IupToggle ("Female", "");

  exclusive = IupRadio
  (
    IupVbox
    (
      male,
      female,
      NULL
    )
  );
  IupSetHandle("male", male);
  IupSetHandle("female", female);
  IupSetAttribute(exclusive, IUP_VALUE, "female");
  IupSetAttribute(exclusive, IUP_TIP, "Two state button - Exclusive - RADIO");

  frame = IupFrame
  (
    exclusive
  );
  IupSetAttribute (frame, IUP_TITLE, "Gender");

  dialog = IupDialog
  (
    IupHbox
    (
      IupFill(),
      frame,
      IupFill(),
      NULL
    )
  );

  IupSetAttributes(dialog, "SIZE=140, TITLE=IupRadio, RESIZE=NO, MINBOX=NO, MAXBOX=NO");

  IupShow(dialog);
  IupMainLoop();
  IupDestroy(dialog);
  IupClose();

  return 0; 
}
Exemple #18
0
void SpinTest(void)
{
    Ihandle *dlg, *spinbox, *text;

    spinbox = IupSpinbox(IupSetAttributes(text = IupText(NULL), "SIZE=50x, EXPAND=HORIZONTAL, FONT=\"Times, 24\""));
//  IupSetAttribute(text, "MASK", "/d+|AUTO");

    IupSetCallback(spinbox, "SPIN_CB", (Icallback)spin_cb);

    dlg = IupDialog(IupVbox(spinbox, NULL));
    IupSetAttribute(dlg, "MARGIN", "10x10");

    IupSetAttribute(dlg, "TITLE", "IupSpin Test");
    IupShow(dlg);
}
Exemple #19
0
int main(int argc, char **argv)
{
  Ihandle *dlg, *bt, *dbox, *lbl, *ml, *hbox, *bt2, *txt;
  IupOpen(&argc, &argv);

  bt = IupButton("Detache Me!", NULL);
  IupSetCallback(bt, "ACTION", (Icallback)btn_detach_cb);
  IupSetHandle("detach", bt);

  ml = IupMultiLine(NULL);
  IupSetAttribute(ml, "EXPAND", "YES");
  IupSetAttribute(ml, "VISIBLELINES", "5");

  hbox = IupHbox(bt, ml, NULL);
  IupSetAttribute(hbox, "MARGIN", "10x0");

  dbox = IupDetachBox(hbox);
  IupSetAttribute(dbox, "ORIENTATION", "VERTICAL");
  //IupSetAttribute(dbox, "SHOWGRIP", "NO");
  //IupSetAttribute(dbox, "BARSIZE", "0");
  //IupSetAttribute(dbox, "COLOR", "255 0 0");
  IupSetCallback(dbox, "DETACHED_CB", (Icallback)detached_cb);
  IupSetHandle("dbox", dbox);

  lbl = IupLabel("Label");
  IupSetAttribute(lbl, "EXPAND", "VERTICAL");

  bt2 = IupButton("Restore me!", NULL);
  IupSetAttribute(bt2, "EXPAND", "YES");
  IupSetAttribute(bt2, "ACTIVE", "NO");
  IupSetCallback(bt2, "ACTION", (Icallback)btn_restore_cb);
  IupSetHandle("restore", bt2);

  txt = IupText(NULL);
  IupSetAttribute(txt, "EXPAND", "HORIZONTAL");

  dlg = IupDialog(IupVbox(dbox, lbl, bt2, txt, NULL));
  IupSetAttribute(dlg, "TITLE", "IupDetachBox Example");
  IupSetAttribute(dlg, "MARGIN", "10x10");
  IupSetAttribute(dlg, "GAP", "10");
  IupSetAttribute(dlg, "RASTERSIZE", "300x300");

  IupShow(dlg);

  IupMainLoop();
  IupClose();
  return EXIT_SUCCESS;
}
Exemple #20
0
static Ihandle *  createdialog(void)
{
  Ihandle* txt, *bt;
  Ihandle * browser = IupOleCreateBrowser();

  // Creates a dialog containing the OLE control
  Ihandle* dlg = IupDialog(IupVbox(IupHbox(txt = IupText(""), bt = IupButton("Load", NULL), NULL), browser, NULL));
  IupSetAttribute(dlg, "TITLE", "IupOle");
  IupSetAttribute(dlg, "MY_TEXT", (char*)txt);
  IupSetAttribute(dlg, "MY_BROWSER", (char*)browser);
  IupSetAttribute(txt, "EXPAND", "HORIZONTAL");
  IupSetAttribute(txt, "VALUE", "d:/EditalUniversal.doc");
  IupSetCallback(bt, "ACTION", (Icallback)load_cb);

  // Shows dialog
  IupShow(dlg);

  return dlg;
}
Exemple #21
0
int main(int argc, char **argv)
{
  Ihandle* txt, *bt;
  IupOpen(&argc, &argv);
  IupOleControlOpen();

  // Creates an instance of the WebBrowser control
  Ihandle* control = IupOleControl("Shell.Explorer.2");

  // Sets production mode
  IupSetAttribute(control, "DESIGNMODE", "NO");

  // Creates a dialog containing the OLE control
  Ihandle* dlg = IupDialog(IupVbox(IupHbox(txt = IupText(""), bt = IupButton("Load", NULL), NULL), control, NULL));
  IupSetAttribute(dlg, "TITLE", "IupOle");
  IupSetAttribute(dlg, "MY_TEXT", (char*)txt);
  IupSetAttribute(txt, "EXPAND", "HORIZONTAL");
  IupSetCallback(bt, "ACTION", (Icallback)load_cb);

  // Maps the dialog to force the creation of the control
  IupMap(dlg);

  // Gathers the IUnknown pointer to access the control's interface

  IUnknown* punk = (IUnknown*) IupGetAttribute(control, "IUNKNOWN");
  IWebBrowser2 *pweb = NULL;
  punk->QueryInterface(IID_IWebBrowser2, (void **)&pweb);
  punk->Release();
  IupSetAttribute(dlg, "MY_WEB", (char*)pweb);

  // Shows dialog
  IupShow(dlg);

  IupMainLoop();

  // Releases the control interface
  pweb->Release();

  IupClose();

  return EXIT_SUCCESS;

}
static int iDetachBoxSetDetachAttrib(Ihandle* ih, const char* value)
{
  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);

  if (detachedCB)
    detachedCB(ih, new_parent, 0, 0);

  /* 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 canvas bar */
  ih->data->barsize = 0;
  IupHide(ih->firstchild);

  /* Restores the cursor */
  IupSetAttribute(ih->firstchild, "CURSOR", "MOVE");

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

  IupSetAttribute(new_parent, "RASTERSIZE", NULL);
  IupRefresh(new_parent);

  /* Maps and shows the new dialog */
  IupShow(new_parent);

  (void)value;
  return 0;
}
Exemple #23
0
int main(int argc, char **argv)
{
  Ihandle *text, *dg;

  IupOpen(&argc, &argv);

  text = IupText("");
  IupSetAttribute(text, "MASK", "/d*");

  IupSetAttribute(text, "SIZE",   "100x");
  IupSetAttribute(text, "EXPAND", "HORIZONTAL");

  dg = IupDialog(text);
  IupSetAttribute(dg, "TITLE", "IupText MASK");

  IupShow(dg);
  IupMainLoop();
  IupClose();
  return EXIT_SUCCESS;
}
Exemple #24
0
void PreDialogsTest(void)
{
    char* msg = "Press a key for a pre-defined dialog:\n"
                "e = IupMessageDlg(ERROR)\n"
                "i = IupMessageDlg(INFORMATION)\n"
                "w = IupMessageDlg(WARNING)\n"
                "q = IupMessageDlg(QUESTION)\n"
                "--------------------\n"
                "o = IupFileDlg(OPEN)\n"
                "O = IupFileDlg(OPEN+PREVIEW)\n"
                "G = IupFileDlg(OPEN+PREVIEW+OPENGL)\n"
                "s = IupFileDlg(SAVE)\n"
                "d = IupFileDlg(DIR)\n"
                "--------------------\n"
                "c = IupColorDlg\n"
                "f = IupFontDlg\n"
                "--------------------\n"
                "m = IupMessage\n"
                "a = IupAlarm\n"
                "t = IupGetText\n"
                "g = IupGetFile\n"
                "l = IupListDialog\n"
                "y = IupLayoutDialog\n"
                "--------------------\n"
                "Esc = quit";
    Ihandle *dlg = IupDialog(IupVbox(IupLabel(msg), NULL));

#ifdef USE_OPENGL
    IupGLCanvasOpen();
#endif

    IupSetHandle("_MAIN_DIALOG_TEST_", dlg);

    IupSetAttribute(dlg, "TITLE", "Pre-defined Dialogs Test");
    IupSetAttribute(dlg, "MARGIN", "10x10");

    IupSetCallback(dlg, "K_ANY",    (Icallback)k_any);
    IupSetCallback(dlg, "CLOSE_CB", (Icallback)close_cb);

    IupShow(dlg);
}
Exemple #25
0
void main(int argc, char **argv)
{
  Ihandle *dlg, *ml;

  IupOpen(&argc, &argv);

  ml = IupMultiLine(NULL);
  IupSetCallback(ml, "ACTION", (Icallback)mlaction);
  IupSetAttribute(ml, IUP_EXPAND, IUP_YES);
  IupSetAttribute(ml, IUP_VALUE,  "I ignore the DEL key!");
  IupSetAttribute(ml, IUP_BORDER, IUP_YES);

  dlg = IupDialog(ml);
  IupSetAttribute(dlg, IUP_TITLE, "IupMultiline");
  IupSetAttribute(dlg, IUP_SIZE,  "QUARTERxQUARTER");

  IupShow(dlg);
  IupMainLoop();
  IupDestroy(dlg);
  IupClose();
}
static int iDetachBoxSetRestoreAttrib(Ihandle* ih, const char* value)
{
  Ihandle *dlg = IupGetDialog(ih);

  IupReparent(ih, ih->data->old_parent, ih->data->old_brother);

  /* Restores and shows the bar handler when the element returns to its previous parent */
  ih->data->barsize = 10;  /* default size */
  IupShow(ih->firstchild);

  /* Restores the cursor */
  IupSetAttribute(ih->firstchild, "CURSOR", "MOVE");

  IupRefresh(ih->data->old_parent);

  /* Reset previous parent and brother */
  ih->data->old_parent = NULL;
  ih->data->old_brother = NULL;

  IupDestroy(dlg);
  (void)value;
  return 0;
}
Exemple #27
0
static int mdi_new(Ihandle* ih)
{
  static int id = 0;
  Ihandle *box, *cnv, *dlg;

  cnv = IupCanvas(NULL);
  IupSetAttribute(cnv,"BGCOLOR","128 255 0");

  box = IupVbox(cnv, NULL);
  IupSetAttribute(box,"MARGIN","5x5");

  dlg = IupDialog(box);
  IupSetfAttribute(dlg,"TITLE","MDI Child (%d)", id); id++;
  IupSetAttribute(dlg,"MDICHILD","YES");
  IupSetAttribute(dlg,"PARENTDIALOG","mdiFrame");
  IupSetCallback(dlg,"MDIACTIVATE_CB",(Icallback)mdi_activate);
  IupSetAttribute(dlg,"RASTERSIZE","300x300");
//  IupSetAttribute(dlg, "PLACEMENT", "MAXIMIZED");

  IupShow(dlg);

  return IUP_DEFAULT;
}
Exemple #28
0
void LabelTest(void)
{
  Ihandle *dlg, *label, *image1, *image2, *image3, 
          *box1, *box2, *fill;

  box1 = IupVbox(NULL);
  IupSetAttribute(box1, "MARGIN", "5x5");
  IupSetAttribute(box1, "GAP", "5");
  IupSetAttribute(box1, "BGCOLOR", "75 150 170");  /* label must be transparent for BGCOLOR */
  IupSetAttribute(box1, "PADDING", "5x5");

  label = IupLabel(NULL);
  if (IupGetInt(NULL, "UTF8MODE"))
    IupSetAttribute(label, "TITLE", "Text Labels (çãõáóé)");
  else
    IupSetAttribute(label, "TITLE", "Text Labels (ηγυασι)");
  //IupSetAttribute(label, "BGCOLOR", IupGetGlobal("DLGBGCOLOR"));
  IupSetAttribute(label, "PADDING", "0x0");
  IupSetAttribute(label, "TIP", "Text Label");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "HORIZONTAL");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "TITLE", "Text &Label\nSecond Line");
  IupSetAttribute(label, "FGCOLOR", "0 0 255");
  IupSetAttribute(label, "RASTERSIZE", "150x70");
//  IupSetAttribute(label, "RASTERSIZE", "30x70");
//  IupSetAttribute(label, "WORDWRAP", "YES");
//  IupSetAttribute(label, "ELLIPSIS", "YES");
  IupSetAttribute(label, "ALIGNMENT", "ALEFT:ATOP");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "TITLE", "Text\nSecond Line");
  IupSetAttribute(label, "RASTERSIZE", "150x70");
  IupSetAttribute(label, "ALIGNMENT", "ACENTER:ACENTER");
  IupSetAttribute(label, "FONT", "Helvetica, Underline 14");
//  IupSetAttribute(label, "FONTSIZE", "14");
//  IupSetAttribute(label, "FONTSTYLE", "Italic");
//  IupSetAttribute(label, "FONTSTYLE", "Bold");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "TITLE", "Text\n<b>Second Line</b>");
  IupSetAttribute(label, "RASTERSIZE", "150x70");
  IupSetAttribute(label, "ALIGNMENT", "ARIGHT:ABOTTOM");
  IupSetAttribute(label, "MARKUP", "YES");
  IupAppend(box1, label);

  box2 = IupVbox(NULL);
  IupSetAttribute(box2, "MARGIN", "5x5");
  IupSetAttribute(box2, "GAP", "5");
  IupSetAttribute(box2, "BGCOLOR", "75 150 170");
  IupSetAttribute(box2, "PADDING", "5x5");

  image1 = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8);
  IupSetAttribute(image1, "0", "BGCOLOR");
  IupSetAttribute(image1, "1", "255 0 0"); 
  IupSetAttribute(image1, "2", "0 255 0");
  IupSetAttribute(image1, "3", "0 0 255"); 
  IupSetAttribute(image1, "4", "255 255 255"); 
  IupSetAttribute(image1, "5", "0 0 0"); 

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image1);
  //IupSetAttribute(label, "IMAGE", "TECGRAF_BITMAP");
  //IupSetAttribute(label, "IMAGE", "../test/tecgraf.bmp");
  //IupSetAttribute(label, "IMAGE", "../test/file_large.xbm");
  //IupSetAttribute(label, "IMAGE", "gtk-open");
  //IupSetAttribute(label, "BGCOLOR", IupGetGlobal("DLGBGCOLOR"));
  IupSetAttribute(label, "PADDING", "0x0");
  IupSetAttribute(label, "TIP", "Image Label");
  IupAppend(box2, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "HORIZONTAL");
  IupAppend(box2, label);

  fill = IupFill();
  IupSetAttribute(fill, "SIZE", "20");
  IupAppend(box2, fill);

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image1);
  IupSetAttribute(label, "RASTERSIZE", "150x50");
  IupAppend(box2, label);

  image2 = IupImageRGB(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_24);

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image2);
  IupSetAttribute(label, "RASTERSIZE", "150x50");
  IupSetAttribute(label, "ALIGNMENT", "ACENTER");
  IupAppend(box2, label);

  image3 = IupImageRGBA(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_32);

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image3);
  IupSetAttribute(label, "RASTERSIZE", "150x50");
  IupSetAttribute(label, "ALIGNMENT", "ARIGHT");
  IupAppend(box2, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "VERTICAL");

  dlg = IupDialog(IupHbox(box1, label, box2, NULL));
  IupSetAttribute(dlg, "TITLE", "IupLabel Test");
//  IupSetAttribute(dlg, "BACKGROUND", "0 0 128");
//  IupSetAttributeHandle(dlg, "BACKGROUND", image2);
  IupSetCallback(dlg, "ENTERWINDOW_CB", enter_cb);

  IupShow(dlg);
//  IupShowXY(dlg,IUP_LEFT,IUP_BOTTOM);
}
Exemple #29
0
void ScrollBoxTest(void)
{
  Ihandle *mnu, *_hbox_1, *_cnv_1, *_vbox_1, *dlg, *img, *_vbox_2,
    *_frm_1, *_frm_2, *_frm_3, *_frm_4, *_frm_5, *pbar, *val, *tabs,
    *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1, *tree;

  //img = IupImage(32,32, img_bits1);
  //IupSetHandle ("img1", img); 
  //IupSetAttribute (img, "0", "0 0 0"); 
  //IupSetAttribute (img, "1", "BGCOLOR");
  //IupSetAttribute (img, "2", "255 0 0");

  img = load_image_Tecgraf();
  IupSetHandle ("img1", img); 

  img = IupImage(32,32, img_bits2);
  IupSetHandle ("img2", img); 
  IupSetAttribute (img, "0", "0 0 0"); 
  IupSetAttribute (img, "1", "0 255 0");
  IupSetAttribute (img, "2", "BGCOLOR");
  IupSetAttribute (img, "3", "255 0 0");

  mnu = IupMenu(
    IupSubmenu("IupSubmenu 1", IupMenu(
      IupSetAttributes(IupItem("IupItem 1 Checked", NULL), "VALUE=ON"),
      IupSeparator(),

      IupSetAttributes(IupItem("IupItem 2 Disabled", NULL), "ACTIVE=NO"),
      NULL)),
    IupItem("IupItem 3", NULL),
    IupItem("IupItem 4", NULL), 
    NULL);
  IupSetHandle("mnu",mnu);

  _frm_1 = IupFrame(
    IupVbox(
      set_callbacks(IupSetAttributes(IupButton("Button Text", NULL), "PADDING=5x5, TIP=\"Button TIP\"")), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton("Text", NULL), "IMAGE=img1, PADDING=5x5")),"ACTION", action1_cb, NULL), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton(NULL, NULL), "IMAGE=img1")),"ACTION", action2_cb, NULL), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton("", NULL), "IMAGE=img1,IMPRESS=img2")),"ACTION", action3_cb, NULL), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton(NULL, NULL), "BGCOLOR=\"255 0 128\", SIZE=20x10")),"ACTION", action3_cb, NULL), 
      NULL));
  IupSetAttribute(_frm_1,"TITLE","IupButton");

  _frm_2 = IupFrame(
    IupVbox(
      IupSetAttributes(IupLabel("Label Text"), "TIP=\"Label TIP\""),
      IupSetAttributes(IupLabel(NULL), "SEPARATOR=HORIZONTAL, NAME=SAMP_SEP"),
      IupSetAttributes(IupLabel(NULL), "IMAGE=img1"),
      NULL));
  IupSetAttribute(_frm_2,"TITLE","IupLabel");

  _frm_3 = IupFrame(
    IupVbox(
      set_callbacks(IupSetAttributes(IupToggle("Toggle Text", NULL), "VALUE=ON, TIP=\"Toggle TIP\"")),
      set_callbacks(IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1,IMPRESS=img2")),
      set_callbacks(IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1")),
      IupSetAttributes(IupFrame(IupRadio(IupVbox(
        set_callbacks(IupToggle("Toggle Text", NULL)), 
        set_callbacks(IupToggle("Toggle Text", NULL)), 
        NULL))), "TITLE=IupRadio"),
      NULL));
  IupSetAttribute(_frm_3,"TITLE","IupToggle");

  _text_1 = IupText( NULL);
  IupSetAttribute(_text_1,"VALUE","Single Line Text");
  IupSetAttribute(_text_1,"SIZE","80x");
  IupSetAttribute(_text_1,"TIP","Text TIP");

  _ml_1 = IupMultiLine( NULL);
  IupSetAttribute(_ml_1,"VALUE","Multiline Text\nSecond Line\nThird Line");
  IupSetAttribute(_ml_1,"EXPAND","YES");
  IupSetAttribute(_ml_1,"SIZE","80x40");
  IupSetAttribute(_ml_1,"TIP","Multiline TIP");

  _frm_4 = IupFrame(IupVbox(
    set_callbacks(_text_1),
    set_callbacks(_ml_1),
    NULL));
  IupSetAttribute(_frm_4,"TITLE","IupText");

  _list_1 = IupList( NULL);
//  IupSetAttribute(_list_1,"EXPAND","YES");
  IupSetAttribute(_list_1,"VALUE","1");
  IupSetAttribute(_list_1,"1","Item 1 Text");
  IupSetAttribute(_list_1,"2","Item 2 Text");
  IupSetAttribute(_list_1,"3","Item 3 Text");
  IupSetAttribute(_list_1,"TIP","List 1");

  _list_2 = IupList( NULL);
  IupSetAttribute(_list_2,"DROPDOWN","YES");
//  IupSetAttribute(_list_2,"EXPAND","YES");
  IupSetAttribute(_list_2,"VALUE","2");
  IupSetAttribute(_list_2,"1","Item 1 Text");
  IupSetAttribute(_list_2,"2","Item 2 Text");
  IupSetAttribute(_list_2,"3","Item 3 Text");
  IupSetAttribute(_list_2,"TIP","List 2");

  _list_3 = IupList( NULL);
  IupSetAttribute(_list_3,"EDITBOX","YES");
//  IupSetAttribute(_list_3,"EXPAND","YES");
  IupSetAttribute(_list_3,"VALUE","3");
  IupSetAttribute(_list_3,"1","Item 1 Text");
  IupSetAttribute(_list_3,"2","Item 2 Text");
  IupSetAttribute(_list_3,"3","Item 3 Text");
  IupSetAttribute(_list_3,"TIP","List 3");

  _frm_5 =  IupFrame(IupVbox(
      set_callbacks(_list_1),
      set_callbacks(_list_2),
      set_callbacks(_list_3),
      NULL));
  IupSetAttribute(_frm_5,"TITLE","IupList");

  _hbox_1 = IupHbox(
    _frm_1,
    _frm_2,
    _frm_3,
    _frm_4,
    _frm_5,
    NULL);

  val = IupVal(NULL);
  IupSetAttribute(val,"TIP","Valuator TIP");
  set_callbacks(val);
  
  pbar = IupProgressBar();
  IupSetAttribute(pbar, "VALUE", "0.5");
  IupSetAttribute(pbar,"TIP","ProgressBar TIP");
  set_callbacks(pbar);

  tabs = IupTabs(IupVbox(IupLabel("Tab0"), NULL), IupVbox(IupLabel("Tab1"), NULL), IupVbox(IupLabel("Tab2"), NULL), NULL);
  IupSetAttribute(tabs,"TABTITLE0","Tab Title 0");
  IupSetAttribute(tabs,"TABTITLE1","Tab Title 1");
  IupSetAttributeHandle(tabs,"TABIMAGE1", load_image_LogoTecgraf());
  IupSetAttribute(tabs,"TABTITLE2","Tab Title 2");
  IupSetAttribute(tabs,"RASTERSIZE","300x50");
  IupSetAttribute(tabs,"TIP","Tabs TIP");
//  IupSetAttribute(tabs,"PADDING","5x5");
  set_callbacks(tabs);

  tree = IupTree();
  IupSetAttribute(tree, "SHOWRENAME",   "YES");
  IupSetAttribute(tree,"RASTERSIZE","300x150");
  IupSetAttribute(tree,"TIP","Tree TIP");
  IupSetAttribute(tree,"EXPAND","NO");
  set_callbacks(tree);

  _cnv_1 = IupCanvas(NULL);
  IupSetAttribute(_cnv_1,"BGCOLOR","128 255 0");
  IupSetAttribute(_cnv_1,"SCROLLBAR","YES");
//  IupSetAttribute(_cnv_1,"EXPAND","HORIZONTAL");
  IupSetAttribute(_cnv_1,"EXPAND","NO");
  IupSetAttribute(_cnv_1,"RASTERSIZE","200x100");
  IupSetAttribute(_cnv_1,"TIP","Canvas TIP");
//  IupSetAttribute(_cnv_1,"CANFOCUS","NO");
  set_callbacks(_cnv_1);

  _vbox_1 = IupVbox(
    _hbox_1,
    IupHbox(IupSetAttributes(IupFrame(IupHbox(val, NULL)), "TITLE=IupVal"),
            IupSetAttributes(IupFrame(IupHbox(pbar, NULL)), "TITLE=IupProgressBar"),
            IupSetAttributes(IupFrame(IupHbox(tabs, NULL)), "TITLE=IupTabs"),
            NULL),
    IupHbox(IupSetAttributes(IupFrame(IupHbox(_cnv_1, NULL)), "TITLE=IupCanvas"),
            IupSetAttributes(IupFrame(IupHbox(tree, NULL)), "TITLE=IupTree"),
            NULL),
    IupHbox(IupSetAttributes(IupFrame(IupHbox(create_matrix(), NULL)), "TITLE=IupMatrix"),
            NULL),
    NULL);
  IupSetAttribute(_vbox_1,"MARGIN","5x5");
  IupSetAttribute(_vbox_1,"GAP","5");

//  _vbox_2 = IupVbox(IupSetAttributes(IupScrollBox(_vbox_1), "RASTERSIZE=400x300"), NULL);
  _vbox_2 = IupVbox(IupScrollBox(_vbox_1), NULL);
  IupSetAttribute(_vbox_2,"MARGIN","20x20");

  dlg = IupDialog(_vbox_2);
  IupSetHandle("dlg",dlg);
  IupSetAttribute(dlg,"MENU","mnu");
  IupSetAttribute(dlg,"TITLE","IupDialog Title");
//  IupSetAttribute(dlg,"COMPOSITED","YES");   /* Windows Only */
//  IupSetAttribute(dlg, "OPACITY", "192");
//  IupSetAttribute(dlg, "RESIZE", "NO");

//  IupSetAttribute(dlg, "BGCOLOR", "173 177 194");  // Motif BGCOLOR for documentation
//  IupSetAttribute(_vbox_1, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BACKGROUND", "200 10 80");

  //IupSetGlobal("DLGBGCOLOR", "92 92 255");
  //IupSetGlobal("TXTFGCOLOR", "255 92 92");
  //IupSetGlobal("TXTBGCOLOR", "92 92 255");

//  IupSetAttribute(dlg, "FONT", "Helvetica, 24");
//  IupSetAttribute(dlg, "FONT", "-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-*");
  
//  IupSetAttribute(box, "FGCOLOR", "255 0 0");

  //IupSetAttribute(dlg,"RASTERSIZE","1000x800");
  IupSetAttribute(dlg,"RASTERSIZE","400x300");
  IupSetCallback(dlg, "RESIZE_CB", (Icallback)resize_cb);

  IupMap(dlg);

  IupSetAttribute(tree, "TITLE0",         "Figures");  
  IupSetAttribute(tree, "ADDLEAF0",      "Other");     /* new id=1 */
  IupSetAttribute(tree, "ADDBRANCH1",   "triangle");  /* new id=2 */     
  IupSetAttribute(tree, "ADDLEAF2",     "equilateral");  /* ... */
  IupSetAttribute(tree, "ADDLEAF3",     "isoceles");
  IupSetAttribute(tree, "ADDLEAF4",     "scalenus");

  IupShow(dlg);

  IupSetAttribute(dlg,"RASTERSIZE", NULL);
}
Exemple #30
0
static int Show (lua_State *L)
{
  lua_pushinteger(L, IupShow(iuplua_checkihandle(L,1)));
  return 1;
}