Exemplo n.º 1
0
static void Insert(void)
{
  if (lua_isnil(lua_getparam(2)))
    iuplua_pushihandle(IupInsert(iuplua_checkihandle(1), NULL, iuplua_checkihandle(3)));
  else
    iuplua_pushihandle(IupInsert(iuplua_checkihandle(1), iuplua_checkihandle(2), iuplua_checkihandle(3)));
}
Exemplo n.º 2
0
static int Insert(lua_State *L)
{
  iuplua_pushihandle(L, IupInsert(iuplua_checkihandle(L,1),
                                  iuplua_checkihandleornil(L,2),
                                  iuplua_checkihandle(L,3)));
  return 1;
}
Exemplo n.º 3
0
int item_insert_cb(Ihandle* ih)
{
  Ihandle* ref_item = IupGetChild(IupGetParent(ih), 4);   /* before the first appended item, just after the separator */
  printf("ACTION(%s)\n", IupGetAttribute(ih, "TITLE"));
  if (ref_item)
  {
    Ihandle* item = IupItem("New Inserted Item", "item_cb");
    IupInsert(IupGetParent(ih), ref_item, item);
    IupMap(item);
  }
  return IUP_DEFAULT;
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
0
void guiMenu_OnInit ( void )
{
  guiHacks_OnInit();
  guiMenu = IupHList ( NULL );
  guiData = IupHList ( NULL );
  guiActionVB = IupHbox ( guiMenu, guiData, NULL );
  IupInsert ( guiDlg.vb, guiOrg.main.fset, guiActionVB );
  IupMap ( guiActionVB );
  IupSetAttribute ( guiActionVB, IUP_EXPAND, IUP_HORIZONTAL );
  IupSetAttribute ( guiMenu, IUP_EXPAND, IUP_HORIZONTAL );
  IupSetAttribute ( guiData, IUP_EXPAND, IUP_HORIZONTAL );
  IupSetCallback ( guiMenu, "VALUECHANGED_CB", guiMenu_OnValueChanged );
  IupSetCallback ( guiData, "VALUECHANGED_CB", guiData_OnValueChanged );
  guiMenu_OnLang();
}
Exemplo n.º 6
0
static int cbInsertTab(Ihandle* ih)
{
  Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");
  Ihandle* ref_vbox = IupGetHandle(IupGetAttribute(tabs, "VALUE"));
  Ihandle *vbox;

  vbox = IupFrame(IupVbox(IupLabel("Label YYY"), IupButton("Button YYY", "cbChildButton"), NULL));
  IupSetAttribute(vbox, "TABTITLE", "YYY");
  IupSetAttribute(vbox, "TITLE", "TABS YYY");

  IupInsert(tabs, ref_vbox, vbox);
  IupMap(vbox);

  IupRefresh(tabs); /* update children layout */

  return IUP_DEFAULT;
}
Exemplo n.º 7
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;
}