Ejemplo n.º 1
0
static int click(Ihandle *self, int lin, int col)
{
  char* value = IupMatGetAttribute(self, "", lin, col);
  if (!value) value = "NULL";
  printf("click_cb(%d, %d)\n", lin, col);
  printf("  VALUE%d:%d = %s\n", lin, col, value);
  return IUP_DEFAULT;
}
Ejemplo n.º 2
0
int iupmaskMatSet(Ihandle* ih, const char* mask_str, int autofill, int casei, int lin, int col)
{
    (void)autofill;
    IupMatSetAttribute(ih,"MASKCASEI", lin, col, casei?"YES":"NO");
    IupMatSetAttribute(ih,"MASK", lin, col, (char*)mask_str);
    if (iupStrEqual(mask_str, IupMatGetAttribute(ih,"MASK", lin, col)))
        return 1;
    else
        return 0;
}
Ejemplo n.º 3
0
int iupmaskMatGet(Ihandle *ih, char **sval, int lin, int col)
{
    char *val = IupMatGetAttribute(ih,"",lin,col);
    Imask* mask = (Imask*)IupGetAttribute(ih,"OLD_MASK_DATA");

    if (iupMaskCheck(mask,val)==1)
    {
        *sval = val;
        return 1;
    }
    else
        return 0;
}
Ejemplo n.º 4
0
int iupmaskMatGetInt(Ihandle *ih, int *ival, int lin, int col)
{
    char *val = IupMatGetAttribute(ih,"",lin,col);
    Imask* mask = (Imask*)IupGetAttribute(ih,"OLD_MASK_DATA");

    if(iupMaskCheck(mask,val)==1)
    {
        *ival = 0;
        sscanf(val,"%d",ival);
        return 1;
    }
    else
        return 0;
}
Ejemplo n.º 5
0
int iupmaskMatGetFloat(Ihandle *ih, float *fval, int lin, int col)
{
    char *val = IupMatGetAttribute(ih,"",lin,col);
    Imask* mask = (Imask*)IupGetAttribute(ih,"OLD_MASK_DATA");

    if (iupMaskCheck(mask,val)==1)
    {
        *fval = 0.0F;
        sscanf(val,"%f",fval);
        return 1;
    }
    else
        return 0;
}
Ejemplo n.º 6
0
int iupmaskMatGetDouble(Ihandle *ih, double *dval, int lin, int col)
{
    char *val = IupMatGetAttribute(ih,"",lin,col);
    Imask* mask = (Imask*)IupGetAttribute(ih,"OLD_MASK_DATA");

    if(iupMaskCheck(mask,val)==1)
    {
        *dval = 0.0;
        sscanf(val,"%lf",dval);
        return 1;
    }
    else
        return 0;
}
Ejemplo n.º 7
0
int iupmaskMatCheck(Ihandle *ih, int lin, int col)
{
    char *val = IupMatGetAttribute(ih,"",lin,col);
    Imask* mask = (Imask*)IupGetAttribute(ih,"OLD_MASK_DATA");
    return iupMaskCheck(mask,val)==1;
}
Ejemplo n.º 8
0
int iupMatrixEditShow(Ihandle* ih)
{
  char* mask;
  int w, h, x, y;

  /* work around for Windows when using Multiline */
  if (iupAttribGet(ih, "_IUPMAT_IGNORE_SHOW"))
  {
    iupAttribSetStr(ih, "_IUPMAT_IGNORE_SHOW", NULL);
    return 0;
  }

  /* there are no cells that can be edited */
  if (ih->data->columns.num <= 1 || ih->data->lines.num <= 1)
    return 0;

  /* not active */
  if(!IupGetInt(ih, "ACTIVE"))
    return 0;

  /* already visible */
  if(IupGetInt(ih->data->datah, "VISIBLE"))
    return 0;

  /* notify application */
  if (iMatrixEditCallEditionCb(ih, 1, 0) == IUP_IGNORE)
    return 0;

  if (iMatrixEditCallMenuDropCb(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell))
    return 0;

  /* select edit control */
  iMatrixEditChooseElement(ih);

  /* position the cell to make it visible */
  /* If the focus is not visible, a scroll is done for that the focus to be visible */
  if (!iupMatrixAuxIsCellStartVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell))
    iupMatrixScrollToVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell);

  /* set attributes */
  iupMatrixPrepareDrawData(ih);
  IupStoreAttribute(ih->data->datah, "BGCOLOR", iupMatrixGetBgColor(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell));
  IupStoreAttribute(ih->data->datah, "FGCOLOR", iupMatrixGetFgColor(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell));
  IupSetAttribute(ih->data->datah, "FONT", iupMatrixGetFont(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell));

  mask = IupMatGetAttribute(ih,"MASK", ih->data->lines.focus_cell, ih->data->columns.focus_cell);
  if (mask)
  {
    IupSetAttribute(ih->data->datah, "MASKCASEI", IupMatGetAttribute(ih,"MASKCASEI", ih->data->lines.focus_cell, ih->data->columns.focus_cell));
    IupSetAttribute(ih->data->datah, "MASK", mask);
  }
  else
  {
    mask = IupMatGetAttribute(ih,"MASKINT", ih->data->lines.focus_cell, ih->data->columns.focus_cell);
    if (mask)
      IupSetAttribute(ih->data->datah, "MASKINT", mask);
    else
    {
      mask = IupMatGetAttribute(ih,"MASKFLOAT", ih->data->lines.focus_cell, ih->data->columns.focus_cell);
      if (mask)
        IupSetAttribute(ih->data->datah, "MASKFLOAT", mask);
      else
        IupSetAttribute(ih->data->datah, "MASK", NULL);
    }
  }

  /* calc size */
  iupMatrixGetVisibleCellDim(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell, &x, &y, &w, &h);

  ih->data->datah->x = x;
  ih->data->datah->y = y;

  ih->data->datah->currentwidth  = w;
  ih->data->datah->currentheight = h;
  iupClassObjectLayoutUpdate(ih->data->datah);

  /* activate and show */
  IupSetAttribute(ih->data->datah, "ACTIVE",  "YES");
  IupSetAttribute(ih->data->datah, "VISIBLE", "YES");
  IupSetFocus(ih->data->datah);

  return 1;
}