Пример #1
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;
}
Пример #2
0
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;
}
Пример #3
0
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;
}
Пример #4
0
void iupMatrixEditCreate(Ihandle* ih)
{
    /******** EDIT *************/
    ih->data->texth = IupText(NULL);
    ih->data->texth->currentwidth = 20;  /* just to avoid initial size 0x0 */
    ih->data->texth->currentheight = 10;
    iupChildTreeAppend(ih, ih->data->texth);

    IupSetCallback(ih->data->texth, "ACTION",       (Icallback)iMatrixEditTextAction_CB);
    IupSetCallback(ih->data->texth, "K_ANY",        (Icallback)iMatrixEditTextKeyAny_CB);
    IupSetCallback(ih->data->texth, "KILLFOCUS_CB", (Icallback)iMatrixEditKillFocus_CB);
    IupSetAttribute(ih->data->texth, "VALUE",  "");
    IupSetAttribute(ih->data->texth, "VISIBLE", "NO");
    IupSetAttribute(ih->data->texth, "ACTIVE",  "NO");
    IupSetAttribute(ih->data->texth, "FLOATING", "IGNORE");


    /******** DROPDOWN *************/
    ih->data->droph = IupList(NULL);
    ih->data->droph->currentwidth = 20;  /* just to avoid initial size 0x0 */
    ih->data->droph->currentheight = 10;
    iupChildTreeAppend(ih, ih->data->droph);

    if (IupGetGlobal("MOTIFVERSION"))
        IupSetCallback(ih->data->droph, "DROPDOWN_CB",  (Icallback)iMatrixEditDropDown_CB);

    IupSetCallback(ih->data->droph, "ACTION",       (Icallback)iMatrixEditDropDownAction_CB);
    IupSetCallback(ih->data->droph, "KILLFOCUS_CB", (Icallback)iMatrixEditKillFocus_CB);
    IupSetCallback(ih->data->droph, "K_ANY",        (Icallback)iMatrixEditDropDownKeyAny_CB);
    IupSetAttribute(ih->data->droph, "DROPDOWN", "YES");
    IupSetAttribute(ih->data->droph, "MULTIPLE", "NO");
    IupSetAttribute(ih->data->droph, "VISIBLE", "NO");
    IupSetAttribute(ih->data->droph, "ACTIVE",  "NO");
    IupSetAttribute(ih->data->droph, "FLOATING", "IGNORE");
}
Пример #5
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;
}
Пример #6
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);
}
Пример #7
0
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;
}
Пример #8
0
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;
}
Пример #9
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;
}
Пример #10
0
void guiVal_OnInit( void )
{
  guiVal->tbValue  = IupText( NULL );
  guiVal->hlType = IupHList( NULL );
  IupSetStrAttribute( guiVal->hlType,  "1",  "schar" );
  IupSetStrAttribute( guiVal->hlType,  "2",  "uchar" );
  IupSetStrAttribute( guiVal->hlType,  "3",  "short" );
  IupSetStrAttribute( guiVal->hlType,  "4", "ushort" );
  IupSetStrAttribute( guiVal->hlType,  "5",    "int" );
  IupSetStrAttribute( guiVal->hlType,  "6",   "uint" );
  IupSetStrAttribute( guiVal->hlType,  "7",   "long" );
  IupSetStrAttribute( guiVal->hlType,  "8",  "ulong" );
  IupSetStrAttribute( guiVal->hlType,  "9",   "lint" );
  IupSetStrAttribute( guiVal->hlType, "10",  "ulint" );
  IupSetStrAttribute( guiVal->hlType, "11",    "fpn" );
  IupSetStrAttribute( guiVal->hlType, "12",    "dpn" );
  IupSetStrAttribute( guiVal->hlType, "13",    "lpn" );
  guiVal->value.vb   = IupVbox(  guiVal->tbValue, guiVal->hlType, NULL );
  guiVal->value.fset = IupFrame( guiVal->value.vb );
  IupSetAttribute( guiVal->value.fset, IUP_SIZE, "100x30" );
  IupSetAttribute( guiVal->value.fset, IUP_EXPAND, IUP_HORIZONTAL );
  IupAppend( guiVal->main.vb, guiVal->value.fset );
  IupMap( guiVal->value.fset );
  guiVal_OnLang();
}
Пример #11
0
static int Text(lua_State *L)
{
  Ihandle *ih = IupText(NULL);
  iuplua_plugstate(L, ih);
  iuplua_pushihandle_raw(L, ih);
  return 1;
}
Пример #12
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);
}
Пример #13
0
/* 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;
}
Пример #14
0
int item_goto_action_cb(Ihandle* item_goto)
{
  Ihandle* multitext = IupGetDialogChild(item_goto, "MULTITEXT");
  Ihandle *dlg, *box, *bt_ok, *bt_cancel, *txt, *lbl;

  int line_count = IupGetInt(multitext, "LINECOUNT");

  lbl = IupLabel(NULL);
  IupSetfAttribute(lbl, "TITLE", "Line Number [1-%d]:", line_count);
  txt = IupText(NULL);
  IupSetAttribute(txt, "MASK", IUP_MASK_UINT);  /* unsigned integer numbers only */
  IupSetAttribute(txt, "NAME", "LINE_TEXT");
  IupSetAttribute(txt, "VISIBLECOLUMNS", "20");
  bt_ok = IupButton("OK", NULL);
  IupSetInt(bt_ok, "TEXT_LINECOUNT", line_count);
  IupSetAttribute(bt_ok, "PADDING", "10x2");
  IupSetCallback(bt_ok, "ACTION", (Icallback)goto_ok_action_cb);
  bt_cancel = IupButton("Cancel", NULL);
  IupSetCallback(bt_cancel, "ACTION", (Icallback)goto_cancel_action_cb);
  IupSetAttribute(bt_cancel, "PADDING", "10x2");

  box = IupVbox(
    lbl,
    txt,
    IupSetAttributes(IupHbox(
      IupFill(),
      bt_ok,
      bt_cancel,
      NULL), "NORMALIZESIZE=HORIZONTAL"),
    NULL);
  IupSetAttribute(box, "MARGIN", "10x10");
  IupSetAttribute(box, "GAP", "5");

  dlg = IupDialog(box);
  IupSetAttribute(dlg, "TITLE", "Go To Line");
  IupSetAttribute(dlg, "DIALOGFRAME", "Yes");
  IupSetAttributeHandle(dlg, "DEFAULTENTER", bt_ok);
  IupSetAttributeHandle(dlg, "DEFAULTESC", bt_cancel);
  IupSetAttributeHandle(dlg, "PARENTDIALOG", IupGetDialog(item_goto));

  IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);

  if (IupGetInt(dlg, "STATUS") == 1)
  {
    int line = IupGetInt(txt, "VALUE");
    int pos;
    IupTextConvertLinColToPos(multitext, line, 0, &pos);
    IupSetInt(multitext, "CARETPOS", pos);
    IupSetInt(multitext, "SCROLLTOPOS", pos);
  }

  IupDestroy(dlg);

  return IUP_DEFAULT;
}
Пример #15
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;
}
Пример #16
0
static Ihandle* dupSetupUI() {
    Ihandle *dupControlsBox = IupHbox(
        IupLabel("Count:"),
        countInput = IupText(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*)&dupInbound);
    IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
    IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&dupOutbound);
    // sync count
    IupSetAttribute(countInput, "VISIBLECOLUMNS", "3");
    IupSetAttribute(countInput, "VALUE", STR(COPIES_COUNT));
    IupSetCallback(countInput, "VALUECHANGED_CB", (Icallback)uiSyncInteger);
    IupSetAttribute(countInput, SYNCED_VALUE, (char*)&count);
    IupSetAttribute(countInput, INTEGER_MAX, COPIES_MAX);
    IupSetAttribute(countInput, INTEGER_MIN, COPIES_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(chanceInput, "VALUE", NAME"-chance");
        setFromParameter(countInput, "VALUE", NAME"-count");
    }

    return dupControlsBox;
}
Пример #17
0
void MatrixCbsTest(void)
{
  Ihandle *dlg, *bt;

  IupMatrixExOpen();
 
  IupSetFunction("removeline", (Icallback)removeline);
  IupSetFunction("addline", (Icallback)addline);
  IupSetFunction("removecol", (Icallback)removecol);
  IupSetFunction("addcol", (Icallback)addcol);
  IupSetFunction("redraw", (Icallback)redraw);

  createmenu();

  bt = IupButton("Button", NULL);
  IupSetCallback(bt, "ACTION", bt_cb);
  IupSetAttribute(bt, "CANFOCUS", "NO");

  dlg = IupDialog(
//          IupZbox(
          IupTabs(
            IupSetAttributes(
              IupVbox((create_mat(1)), bt, IupText(""), IupLabel("Label Text"), IupFrame(IupVal("HORIZONTAL")), 
                NULL), "MARGIN=10x10, GAP=10, TABTITLE=Test1"),
            IupSetAttributes(
              IupVbox(IupFrame(create_mat(2)), 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), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), 
            NULL)); 
  IupSetAttribute(dlg,"TITLE", "IupMatrix");
  IupSetAttribute(dlg,"MENU", "mymenu");
  IupSetAttributeHandle(dlg,"DEFAULTENTER", bt);
//  IupSetAttribute(dlg,"BGCOLOR", "255 0 255");

  //IupSetAttribute(dlg,"COMPOSITED", "YES");
  //IupSetAttribute(dlg,"OPACITY", "192");

  IupShowXY(dlg,IUP_CENTER,IUP_CENTER);
}
Пример #18
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;

}
Пример #19
0
int button_cb()
{
  Ihandle *dlg, *cv = IupCanvas("");
  IupSetAttribute(cv, IUP_SIZE, "100x100");
  IupSetAttribute(cv, IUP_MOTION_CB, "mm");
  IupSetAttribute(cv, IUP_TIP, "SEGUNDO ELEMENT");
  dlg = IupDialog(IupVbox(IupText(""), cv, NULL));
  IupSetAttribute(dlg, IUP_SHOW_CB, "showcb");
  IupSetAttribute(dlg, IUP_GETFOCUS_CB, "getfocus_cb");
  IupPopup(dlg, IUP_CENTER, IUP_CENTER);
  IupSetAttribute(dlg, IUP_SHOW_CB, NULL);
  printf("saiu do popup\n");
  return IUP_DEFAULT;
}
Пример #20
0
static Ihandle *BWLimiterSetupUI() {

    Ihandle *BWLimiterControlsBox = IupHbox(
        IupLabel("Max BW(Kb):"),
        BWmaxInput = IupText(NULL),
		  inboundCheckbox = IupToggle("Inbound", NULL),
		  outboundCheckbox = IupToggle("Outbound", NULL),
		  IupLabel("Q Size(Kb):"),
		  BWQueueSize = IupText(NULL),
        NULL
        );

	 // sync BWLimiter packet number
	 IupSetAttribute(BWmaxInput, "VISIBLECOLUMNS", "3");
	 IupSetAttribute(BWmaxInput, "VALUE", STR(BW_DEFAULT));
	 IupSetCallback(BWmaxInput, "VALUECHANGED_CB", (Icallback)uiSyncInteger);
	 IupSetAttribute(BWmaxInput, SYNCED_VALUE, (char*)&BWMaxValue);
	 IupSetAttribute(BWmaxInput, INTEGER_MAX, BW_MAX);
	 IupSetAttribute(BWmaxInput, INTEGER_MIN, BW_MIN);

	 IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
	 IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&BWLimiterInbound);
	 IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
	 IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&BWLimiterOutbound);
	 
	 // sync BWLimiter packet number
	 IupSetAttribute(BWQueueSize, "VISIBLECOLUMNS", "3");
	 IupSetAttribute(BWQueueSize, "VALUE", STR(BW_QUEUESIZE_DEFAULT));
	 IupSetCallback(BWQueueSize, "VALUECHANGED_CB", (Icallback)uiSyncInteger);
	 IupSetAttribute(BWQueueSize, SYNCED_VALUE, (char*)&BWQueueSizeValue);
	 IupSetAttribute(BWQueueSize, INTEGER_MAX, BW_QUEUESIZE_MAX);
	 IupSetAttribute(BWQueueSize, INTEGER_MIN, BW_QUEUESIZE_MIN);



    return BWLimiterControlsBox;
}
Пример #21
0
// List method changes
static int _list_method_cb(/*@unused@*/ Ihandle *ih,
                                        /*@unused@*/ char *text, int pos, int state) {
    if( state == 0 )
        return IUP_DEFAULT;
    if( !run_task )
        run_task = IupSetAtt(NULL,IupTimer(),"TIME","100",NULL);
    switch(pos) {
    case 1:
        LOG(LOGVERBOSE,_("Running geocode with hostip"));
        IupSetAttribute(lbl_status,"VALUE","");
        IupSetfAttribute(lbl_status,"APPEND",
                         _("Downloading info, this may be slow..."));
        (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geocode);
        IupSetAttribute(run_task,"RUN","YES");
        IupSetAttribute(list_method,"VISIBLE","NO");
        break;
    case 2:
        LOG(LOGVERBOSE,_("Running geocode with geobytes"));
        IupSetAttribute(lbl_status,"VALUE","");
        IupSetfAttribute(lbl_status,"APPEND",
                         _("Downloading info, this may be slow..."));
        (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geobytes);
        IupSetAttribute(run_task,"RUN","YES");
        IupSetAttribute(list_method,"VISIBLE","NO");
        break;
    case 3: {
        edt_address = IupSetAtt(NULL,IupText(NULL),
                                "VALUE","Enter Address...",
                                "EXPAND","HORIZONTAL",NULL);
        (void)IupSetCallback(edt_address,"GETFOCUS_CB",(Icallback)_address_clear);
        btn_address = IupSetAtt(NULL,IupButton(_("Lookup"),NULL),NULL);
        (void)IupSetCallback(btn_address,"ACTION",(Icallback)_address_lookup);
        hbox_address = IupHbox(edt_address,btn_address,NULL);
        if( (vbox_method!=NULL)
                && (hbox_address!=NULL)
                && (lbl_status!=NULL) )
            (void)IupInsert(vbox_method,lbl_status,hbox_address);
        else {
            LOG(LOGERR,_("Location search controls not created!"));
            return IUP_DEFAULT;
        }
        IupSetAttribute(list_method,"VISIBLE","NO");
        (void)IupMap(hbox_address);
        IupRefresh(hbox_address);
        break;
    }
    };
    return IUP_DEFAULT;
}
Пример #22
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);
}
Пример #23
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;
}
Пример #24
0
int main(int argc, char **argv)
{
  Ihandle *dlg, *multitext, *vbox;
  Ihandle *file_menu, *item_exit, *item_open, *item_saveas;
  Ihandle *sub1_menu, *menu;

  IupOpen(&argc, &argv);

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

  item_open = IupItem("Open", NULL);
  item_saveas = IupItem("Save As", NULL);
  item_exit = IupItem("Exit", NULL);
  IupSetCallback(item_exit, "ACTION", (Icallback)exit_cb);

  file_menu = IupMenu(
    item_open,
    item_saveas,
    IupSeparator(),
    item_exit,
    NULL);

  sub1_menu = IupSubmenu("File", file_menu);

  menu = IupMenu(sub1_menu, NULL);

  vbox = IupVbox(
    multitext,
    NULL);

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

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

  IupMainLoop();

  IupClose();
  return EXIT_SUCCESS;
}
Пример #25
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;
}
Пример #26
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;

}
Пример #27
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;
}
Пример #28
0
int main(int argc, char **argv)
{
  Ihandle* dlg, *iupcanvas;	

  IupOpen(&argc, &argv);

//  iupcanvas = IupCanvas(NULL);
  iupcanvas = IupText(NULL);
  IupSetAttribute(iupcanvas,IUP_KEYPRESS_CB,"keypress_cb"); 
  IupSetFunction("keypress_cb", (Icallback) keypress_cb);
  
  dlg = IupDialog(iupcanvas);
  IupSetAttribute(dlg, "TITLE", "IupCanvas");
//  IupSetAttribute(dlg, "K_ANY", "k_any");
//  IupSetFunction("k_any", (Icallback) k_any);

  IupShowXY(dlg,100,100);
  
  IupMainLoop();
  IupDestroy(dlg);
  IupClose();
  return 0;
}
Пример #29
0
int  iupDataEntry(int    maxlin,
                  int*   maxcol,
                  int*   maxscr,
                  char*  title,
                  char** text,
                  char** data)
{
  int i, bt;
  Ihandle *ok, *cancel, *dlg, *vb, *hb, **txt, **lbl, *button_box, *dlg_box;

  txt = (Ihandle **)calloc(maxlin, sizeof(Ihandle*));
  if (txt == NULL) return -2;
  lbl = (Ihandle **)calloc(maxlin+1, sizeof(Ihandle*));

  vb = IupVbox(NULL);

  for (i=0; i<maxlin; i++)
  {
    txt[i] = IupText(NULL);
    IupSetAttribute(txt[i],"VALUE",data[i]);
    IupSetfAttribute(txt[i],"VISIBLECOLUMNS","%dx", maxscr[i]);
    IupSetfAttribute(txt[i],"NC", "%d", maxcol[i]);
    IupSetAttribute(txt[i],"EXPAND","HORIZONTAL");

    hb = IupHbox(lbl[i] = IupLabel(text[i]), txt[i], NULL);
    IupSetAttribute(hb,"MARGIN","0x0");
    IupSetAttribute(hb,"ALIGNMENT","ACENTER");
    IupAppend(vb, hb);
  }
  lbl[i] = NULL;
  IupInsert(vb, NULL, IupNormalizerv(lbl));

  ok = IupButton("OK", NULL);
  IupSetAttribute(ok, "PADDING", "20x0");
  IupSetCallback(ok, "ACTION", (Icallback)CB_button_OK);

  cancel = IupButton(iupStrMessageGet("IUP_CANCEL"), NULL);
  IupSetAttribute(cancel, "PADDING", "20x0");
  IupSetCallback(cancel, "ACTION", (Icallback)CB_button_CANCEL);

  button_box = IupHbox(
    IupFill(), 
    ok,
    cancel,
    NULL);
  IupSetAttribute(button_box,"MARGIN","0x0");
  IupSetAttribute(button_box, "NORMALIZESIZE", "HORIZONTAL");

  dlg_box = IupVbox(
    IupFrame(vb),
    button_box,
    NULL);
  IupSetAttribute(dlg_box,"MARGIN","10x10");
  IupSetAttribute(dlg_box,"GAP","5");

  dlg = IupDialog(dlg_box);

  IupSetAttribute(dlg,"TITLE",title);
  IupSetAttribute(dlg,"MINBOX","NO");
  IupSetAttribute(dlg,"MAXBOX","NO");
  IupSetAttributeHandle(dlg,"DEFAULTENTER", ok);
  IupSetAttributeHandle(dlg,"DEFAULTESC", cancel);
  IupSetAttribute(dlg,"PARENTDIALOG",IupGetGlobal("PARENTDIALOG"));
  IupSetAttribute(dlg,"ICON", IupGetGlobal("ICON"));

  IupMap(dlg);

  IupSetfAttribute(dlg,"MAXSIZE", "65535x%d", IupGetInt2(dlg, "RASTERSIZE"));
  IupSetAttribute(dlg,"MINSIZE", IupGetAttribute(dlg, "RASTERSIZE"));

  IupPopup(dlg,IUP_CENTER,IUP_CENTER);

  for (i=0; i<maxlin; i++)
  {
    data[i] = (char *)iupStrDup(IupGetAttribute(txt[i], "VALUE"));
  }

  free(txt);

  bt = IupGetInt(dlg, "STATUS");
  IupDestroy(dlg);
  return bt;
}
Пример #30
0
int main(int argc, char **argv)
{
  Ihandle *dlg, *vbox, *multitext, *menu;
  Ihandle *sub_menu_file, *file_menu, *item_exit, *item_new, *item_open, *item_save, *item_saveas, *item_revert;
  Ihandle *sub_menu_edit, *edit_menu, *item_find, *item_goto, *item_copy, *item_paste, *item_cut, *item_delete, *item_select_all;
  Ihandle *btn_cut, *btn_copy, *btn_paste, *btn_find, *btn_new, *btn_open, *btn_save;
  Ihandle *sub_menu_format, *format_menu, *item_font;
  Ihandle *sub_menu_help, *help_menu, *item_help, *item_about;
  Ihandle *sub_menu_view, *view_menu, *item_toolbar, *item_statusbar;
  Ihandle *lbl_statusbar, *toolbar_hb, *recent_menu;
  Ihandle *config;
  const char* font;

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

  config = IupConfig();
  IupSetAttribute(config, "APP_NAME", "simple_notepad");
  IupConfigLoad(config);

  multitext = IupText(NULL);
    IupSetAttribute(multitext, "MULTILINE", "YES");
    IupSetAttribute(multitext, "EXPAND", "YES");
    IupSetAttribute(multitext, "NAME", "MULTITEXT");
    IupSetAttribute(multitext, "DIRTY", "NO");
    IupSetCallback(multitext, "CARET_CB", (Icallback)multitext_caret_cb);
    IupSetCallback(multitext, "VALUECHANGED_CB", (Icallback)multitext_valuechanged_cb);
    IupSetCallback(multitext, "DROPFILES_CB", (Icallback)dropfiles_cb);

  font = IupConfigGetVariableStr(config, "MainWindow", "Font");
  if (font)
    IupSetStrAttribute(multitext, "FONT", font);

  lbl_statusbar = IupLabel("Lin 1, Col 1");
    IupSetAttribute(lbl_statusbar, "NAME", "STATUSBAR");  
    IupSetAttribute(lbl_statusbar, "EXPAND", "HORIZONTAL");
    IupSetAttribute(lbl_statusbar, "PADDING", "10x5");

  item_new = IupItem("New\tCtrl+N", NULL);
    IupSetAttribute(item_new, "IMAGE", "IUP_FileNew");
    IupSetCallback(item_new, "ACTION", (Icallback)item_new_action_cb);
  btn_new = IupButton(NULL, NULL);
    IupSetAttribute(btn_new, "IMAGE", "IUP_FileNew");
    IupSetAttribute(btn_new, "FLAT", "Yes");
    IupSetCallback(btn_new, "ACTION", (Icallback)item_new_action_cb);

  item_open = IupItem("&Open...\tCtrl+O", NULL);
    IupSetAttribute(item_open, "IMAGE", "IUP_FileOpen");
    IupSetCallback(item_open, "ACTION", (Icallback)item_open_action_cb);
  btn_open = IupButton(NULL, NULL);
    IupSetAttribute(btn_open, "IMAGE", "IUP_FileOpen");
    IupSetAttribute(btn_open, "FLAT", "Yes");
    IupSetCallback(btn_open, "ACTION", (Icallback)item_open_action_cb);

  item_save = IupItem("Save\tCtrl+S", NULL);
    IupSetAttribute(item_save, "NAME", "ITEM_SAVE");
    IupSetAttribute(item_save, "IMAGE", "IUP_FileSave");
    IupSetCallback(item_save, "ACTION", (Icallback)item_save_action_cb);
  btn_save = IupButton(NULL, NULL);
    IupSetAttribute(btn_save, "IMAGE", "IUP_FileSave");
    IupSetAttribute(btn_save, "FLAT", "Yes");
    IupSetCallback(btn_save, "ACTION", (Icallback)item_save_action_cb);

  item_saveas = IupItem("Save &As...", NULL);
    IupSetAttribute(item_saveas, "NAME", "ITEM_SAVEAS");
    IupSetCallback(item_saveas, "ACTION", (Icallback)item_saveas_action_cb);

  item_revert = IupItem("Revert", NULL);
    IupSetAttribute(item_revert, "NAME", "ITEM_REVERT");
    IupSetCallback(item_revert, "ACTION", (Icallback)item_revert_action_cb);
    
  item_exit = IupItem("E&xit", NULL);
    IupSetCallback(item_exit, "ACTION", (Icallback)item_exit_action_cb);

  item_find = IupItem("&Find...\tCtrl+F", NULL);
    IupSetAttribute(item_find, "IMAGE", "IUP_EditFind");
    IupSetCallback(item_find, "ACTION", (Icallback)item_find_action_cb);
  btn_find = IupButton(NULL, NULL);
    IupSetAttribute(btn_find, "IMAGE", "IUP_EditFind");
    IupSetAttribute(btn_find, "FLAT", "Yes");
    IupSetCallback(btn_find, "ACTION", (Icallback)item_find_action_cb);

  item_cut = IupItem("Cut\tCtrl+X", NULL);
    IupSetAttribute(item_cut, "NAME", "ITEM_CUT");
    IupSetAttribute(item_cut, "IMAGE", "IUP_EditCut");
    IupSetCallback(item_cut, "ACTION", (Icallback)item_cut_action_cb);
  item_copy = IupItem("Copy\tCtrl+C", NULL);
    IupSetAttribute(item_copy, "NAME", "ITEM_COPY");  
    IupSetAttribute(item_copy, "IMAGE", "IUP_EditCopy");
    IupSetCallback(item_copy, "ACTION", (Icallback)item_copy_action_cb);
  item_paste = IupItem("Paste\tCtrl+V", NULL);
    IupSetAttribute(item_paste, "NAME", "ITEM_PASTE");
    IupSetAttribute(item_paste, "IMAGE", "IUP_EditPaste");
    IupSetCallback(item_paste, "ACTION", (Icallback)item_paste_action_cb);
  item_delete = IupItem("Delete\tDel", NULL);
    IupSetAttribute(item_delete, "IMAGE", "IUP_EditErase");  
    IupSetAttribute(item_delete, "NAME", "ITEM_DELETE");
    IupSetCallback(item_delete, "ACTION", (Icallback)item_delete_action_cb);
  item_select_all = IupItem("Select All\tCtrl+A", NULL);
    IupSetCallback(item_select_all, "ACTION", (Icallback)item_select_all_action_cb);

  btn_cut = IupButton(NULL, NULL);
    IupSetAttribute(btn_cut, "IMAGE", "IUP_EditCut");
    IupSetAttribute(btn_cut, "FLAT", "Yes");
    IupSetCallback(btn_cut, "ACTION", (Icallback)item_cut_action_cb);
  btn_copy = IupButton(NULL, NULL);
    IupSetAttribute(btn_copy, "IMAGE", "IUP_EditCopy");
    IupSetAttribute(btn_copy, "FLAT", "Yes");
    IupSetCallback(btn_copy, "ACTION", (Icallback)item_copy_action_cb);
  btn_paste = IupButton(NULL, NULL);
    IupSetAttribute(btn_paste, "IMAGE", "IUP_EditPaste");
    IupSetAttribute(btn_paste, "FLAT", "Yes");
    IupSetCallback(btn_paste, "ACTION", (Icallback)item_paste_action_cb);

  toolbar_hb = IupHbox(
    btn_new,
    btn_open,
    btn_save,
    IupSetAttributes(IupLabel(NULL), "SEPARATOR=VERTICAL"),
    btn_cut,
    btn_copy,
    btn_paste,
    IupSetAttributes(IupLabel(NULL), "SEPARATOR=VERTICAL"),
    btn_find,
    NULL);
  IupSetAttribute(toolbar_hb, "MARGIN", "5x5");
  IupSetAttribute(toolbar_hb, "GAP", "2");

  item_toolbar = IupItem("&Toobar...", NULL);
  IupSetCallback(item_toolbar, "ACTION", (Icallback)item_toolbar_action_cb);
  IupSetAttribute(item_toolbar, "VALUE", "ON");
  item_statusbar = IupItem("&Statusbar...", NULL);
  IupSetCallback(item_statusbar, "ACTION", (Icallback)item_statusbar_action_cb);
  IupSetAttribute(item_statusbar, "VALUE", "ON");

  if (!IupConfigGetVariableIntDef(config, "MainWindow", "Toolbar", 1))
  {
    IupSetAttribute(item_toolbar, "VALUE", "OFF");

    IupSetAttribute(toolbar_hb, "FLOATING", "YES");
    IupSetAttribute(toolbar_hb, "VISIBLE", "NO");
  }

  if (!IupConfigGetVariableIntDef(config, "MainWindow", "Statusbar", 1))
  {
    IupSetAttribute(item_statusbar, "VALUE", "OFF");

    IupSetAttribute(lbl_statusbar, "FLOATING", "YES");
    IupSetAttribute(lbl_statusbar, "VISIBLE", "NO");
  }

  item_goto = IupItem("&Go To...\tCtrl+G", NULL);
    IupSetCallback(item_goto, "ACTION", (Icallback)item_goto_action_cb);

  item_font = IupItem("&Font...", NULL);
    IupSetCallback(item_font, "ACTION", (Icallback)item_font_action_cb);
  item_help = IupItem("&Help...", NULL);
    IupSetCallback(item_help, "ACTION", (Icallback)item_help_action_cb);
  item_about = IupItem("&About...", NULL);
    IupSetCallback(item_about, "ACTION", (Icallback)item_about_action_cb);

  recent_menu = IupMenu(NULL);

  file_menu = IupMenu(
    item_new,
    item_open,
    item_save,
    item_saveas,
    item_revert,
    IupSeparator(),
    IupSubmenu("Recent &Files", recent_menu),
    item_exit,
    NULL);
  edit_menu = IupMenu(
    item_cut,
    item_copy,
    item_paste,
    item_delete,
    IupSeparator(),
    item_find,
    item_goto,
    IupSeparator(),
    item_select_all,
    NULL);
  format_menu = IupMenu(
    item_font,
    NULL);
  view_menu = IupMenu(
    item_toolbar,
    item_statusbar,
    NULL);
  help_menu = IupMenu(
    item_help,
    item_about,
    NULL);

  IupSetCallback(file_menu, "OPEN_CB", (Icallback)file_menu_open_cb);
  IupSetCallback(edit_menu, "OPEN_CB", (Icallback)edit_menu_open_cb);

  sub_menu_file = IupSubmenu("&File", file_menu);
  sub_menu_edit = IupSubmenu("&Edit", edit_menu);
  sub_menu_format = IupSubmenu("F&ormat", format_menu);
  sub_menu_view = IupSubmenu("&View", view_menu);
  sub_menu_help = IupSubmenu("&Help", help_menu);

  menu = IupMenu(
    sub_menu_file,
    sub_menu_edit,
    sub_menu_format,
    sub_menu_view,
    sub_menu_help,
    NULL);

  vbox = IupVbox(
    toolbar_hb,
    multitext,
    lbl_statusbar,
    NULL);

  dlg = IupDialog(vbox);
  IupSetAttributeHandle(dlg, "MENU", menu);
  IupSetAttribute(dlg, "SIZE", "HALFxHALF");
  IupSetCallback(dlg, "CLOSE_CB", (Icallback)item_exit_action_cb);
  IupSetCallback(dlg, "DROPFILES_CB", (Icallback)dropfiles_cb);

  IupSetAttribute(dlg, "CONFIG", (char*)config);

  /* parent for pre-defined dialogs in closed functions (IupMessage) */
  IupSetAttributeHandle(NULL, "PARENTDIALOG", dlg);

  IupSetCallback(dlg, "K_cN", (Icallback)item_new_action_cb);
  IupSetCallback(dlg, "K_cO", (Icallback)item_open_action_cb);
  IupSetCallback(dlg, "K_cS", (Icallback)item_save_action_cb);
  IupSetCallback(dlg, "K_cF", (Icallback)item_find_action_cb);
  IupSetCallback(dlg, "K_cG", (Icallback)item_goto_action_cb);
  
  IupConfigRecentInit(config, recent_menu, item_recent_cb, 10);

  IupShowXY(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
  IupSetAttribute(dlg, "USERSIZE", NULL);  /* remove minimum size restriction */

  new_file(dlg);

  /* open a file from the command line (allow file association in Windows) */
  if (argc > 1 && argv[1])
  {
    const char* filename = argv[1];
    open_file(dlg, filename);
  }

  IupMainLoop();

  IupClose();
  return EXIT_SUCCESS;
}