示例#1
0
int iupMatrixDrawSetRedrawAttrib(Ihandle* ih, const char* value)
{
    int type;

    if (value == NULL)
        type = 0;
    else if(value[0] == 'L' || value[0] == 'l')
        type = IMAT_PROCESS_LIN;
    else if(value[0] == 'C' || value[0] == 'c')
        type = IMAT_PROCESS_COL;
    else
        type = 0;

    if (type)  /* lines or columns, inluding their titles */
    {
        int min = 0, max = 0;
        value++;

        if(iupStrToIntInt(value, &min, &max, ':') != 2)
            max = min;

        if (min > max)
            return 0;

        iupMatrixPrepareDrawData(ih);

        if (ih->data->need_calcsize)
            iupMatrixAuxCalcSizes(ih);

        /* ignore empty area, draw only cells */

        iMatrixDrawTitleCorner(ih);

        if (type == IMAT_PROCESS_LIN)
        {
            iupMatrixDrawLineTitle(ih, min, max);
            if (ih->data->columns.num_noscroll>1)
                iupMatrixDrawCells(ih, min, 1, max, ih->data->columns.num_noscroll-1);
            iupMatrixDrawCells(ih, min, ih->data->columns.first, max, ih->data->columns.last);
        }
        else
        {
            iupMatrixDrawColumnTitle(ih, min, max);
            if (ih->data->lines.num_noscroll>1)
                iupMatrixDrawCells(ih, 1, min, ih->data->lines.num_noscroll-1, max);
            iupMatrixDrawCells(ih, ih->data->lines.first, min, ih->data->lines.last, max);
        }
    }
    else
    {
        /* Force CalcSize */
        iupMatrixAuxCalcSizes(ih);

        iMatrixDrawMatrix(ih);
    }

    ih->data->need_redraw = 0;
    iupMatrixDrawUpdate(ih);
    return 0;
}
示例#2
0
static void iMatrixDrawMatrix(Ihandle* ih)
{
    iupMatrixPrepareDrawData(ih);

    /* fill the background because there will be empty cells */
    if ((ih->data->lines.num == 1) || (ih->data->columns.num == 1))
    {
        cdCanvasBackground(ih->data->cddbuffer, cdIupConvertColor(ih->data->bgcolor_parent));
        cdCanvasClear(ih->data->cddbuffer);
    }

    /* Draw the corner between line and column titles, if necessary */
    iMatrixDrawTitleCorner(ih);

    /* If there are columns, then draw their titles */
    if (ih->data->columns.num_noscroll>1)
        iupMatrixDrawColumnTitle(ih, 1, ih->data->columns.num_noscroll-1);
    iupMatrixDrawColumnTitle(ih, ih->data->columns.first, ih->data->columns.last);

    /* If there are lines, then draw their titles */
    if (ih->data->lines.num_noscroll>1)
        iupMatrixDrawLineTitle(ih, 1, ih->data->lines.num_noscroll-1);
    iupMatrixDrawLineTitle(ih, ih->data->lines.first, ih->data->lines.last);

    /* If there are ordinary cells, then draw them */
    if (ih->data->columns.num_noscroll>1)
        iupMatrixDrawCells(ih, ih->data->lines.first, 1,
                           ih->data->lines.last, ih->data->columns.num_noscroll-1);
    if (ih->data->lines.num_noscroll>1)
        iupMatrixDrawCells(ih, 1, ih->data->columns.first,
                           ih->data->lines.num_noscroll-1, ih->data->columns.last);
    iupMatrixDrawCells(ih, ih->data->lines.first, ih->data->columns.first,
                       ih->data->lines.last, ih->data->columns.last);
}
示例#3
0
int iupMatrixDrawSetRedrawAttrib(Ihandle* ih, const char* value)
{
  int type;

  if (value == NULL)
    type = 0;
  else if(value[0] == 'L' || value[0] == 'l')
    type = IMAT_PROCESS_LIN;
  else if(value[0] == 'C' || value[0] == 'c')
    type = IMAT_PROCESS_COL;
  else
    type = 0;

  if (type)
  {
    int min = 0, max = 0;
    value++;

    if(iupStrToIntInt(value, &min, &max, ':') != 2)
      max = min;

    if (min > max)
      return 0;

    iupMatrixPrepareDrawData(ih);

    if (ih->data->need_calcsize)
      iupMatrixAuxCalcSizes(ih);

    if (ih->data->lines.sizes[0] && ih->data->columns.sizes[0])
      iMatrixDrawTitleCorner(ih);

    if (type == IMAT_PROCESS_LIN)
    {
      iupMatrixDrawLineTitle(ih, min, max);
      iupMatrixDrawCells(ih, min, ih->data->columns.first, max, ih->data->columns.last);
    }
    else
    {
      iupMatrixDrawColumnTitle(ih, min, max);
      iupMatrixDrawCells(ih, ih->data->lines.first, min, ih->data->lines.last, max);
    }
  }
  else
  {
    iupMatrixAuxCalcSizes(ih);
    iMatrixDrawMatrix(ih);
  }

  iupMatrixDrawUpdate(ih);
  return 0;
}
示例#4
0
/* Redraw the entire matrix, may or not redraw the line and column titles
   -> modo : this constant specifics the titles will be redraw, with the
             following values:
             IMAT_DRAW_ALL -> Redraw the title columns and lines
             IMAT_DRAW_COL -> Redraw just the title columns
             IMAT_DRAW_LIN -> Redraw just the title lines
     ... always redraw the cells - the "modo" just draw the titles ...
*/
void iupMatrixDrawMatrix(Ihandle* ih, int modo)
{
  ih->data->redraw = 1;

  if((ih->data->lin.num == 0) || (ih->data->col.num == 0))
  {
    cdCanvasBackground(ih->data->cddbuffer, cdIupConvertColor(iupControlBaseGetParentBgColor(ih)));
    cdCanvasClear(ih->data->cddbuffer);
  }

  /* Draw the corner between line and column titles, if necessary */
  iupMatrixDrawTitleCorner(ih);

  /* If there are columns and must draw them, then draw the titles */
  if((ih->data->col.num != 0) &&
     (modo == IMAT_DRAW_ALL || modo == IMAT_DRAW_COL) && ih->data->lin.titlewh)
  {
    iupMatrixDrawColumnTitle(ih, ih->data->col.first, ih->data->col.last);
  }

  /* If there are lines and must draw them, then draw the titles */
  if((ih->data->lin.num != 0) &&
     (modo == IMAT_DRAW_ALL || modo == IMAT_DRAW_LIN) &&
     ih->data->col.titlewh)
  {
    iupMatrixDrawLineTitle(ih, ih->data->lin.first, ih->data->lin.last);
  }

  /* If there are cells in the matrix, then draw the cells */
  if((ih->data->lin.num != 0) && (ih->data->col.num != 0))
    iupMatrixDrawCells(ih, ih->data->lin.first, ih->data->col.first, ih->data->lin.last, ih->data->col.last);
}
示例#5
0
static void iMatrixMarkItem(Ihandle* ih, int lin1, int col1, int mark, IFniii markedit_cb, IFnii mark_cb)
{
  int lin, col;

  if (ih->data->mark_full1 == IMAT_PROCESS_LIN)
  {
    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      for (col = 1; col < ih->data->columns.num; col++)
        iMatrixMarkCellSet(ih, lin1, col, mark, markedit_cb, mark_cb);
    }
    else
    {
      iMatrixMarkLinSet(ih, lin1, mark);
      iupMatrixDrawTitleLines(ih, lin1, lin1);
      if (ih->data->columns.num_noscroll>1)
        iupMatrixDrawCells(ih, lin1, 1, lin1, ih->data->columns.num_noscroll-1);
    }

    iupMatrixDrawCells(ih, lin1, 1, lin1, ih->data->columns.num-1);
  }
  else if (ih->data->mark_full1 == IMAT_PROCESS_COL)
  {
    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      for(lin = 1; lin < ih->data->lines.num; lin++)
        iMatrixMarkCellSet(ih, lin, col1, mark, markedit_cb, mark_cb);
    }
    else
    {
      iMatrixMarkColSet(ih, col1, mark);
      iupMatrixDrawTitleColumns(ih, col1, col1);
      if (ih->data->lines.num_noscroll>1)
        iupMatrixDrawCells(ih, 1, col1, ih->data->lines.num_noscroll-1, col1);
    }

    iupMatrixDrawCells(ih, 1, col1, ih->data->lines.num-1, col1);
  }
  else if (ih->data->mark_mode == IMAT_MARK_CELL)
  {
    iMatrixMarkCellSet(ih, lin1, col1, mark, markedit_cb, mark_cb);
    iupMatrixDrawCells(ih, lin1, col1, lin1, col1);
  }
}
示例#6
0
void iupMatrixCellUpdateValue(Ihandle* ih)
{
  IFniis value_edit_cb;
  char *value = iupMatrixEditGetValue(ih);

  iupMatrixCellSetValue(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell, value);

  value_edit_cb = (IFniis)IupGetCallback(ih, "VALUE_EDIT_CB");
  if (value_edit_cb)
    value_edit_cb(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell, value);

  iupMatrixPrepareDrawData(ih);
  iupMatrixDrawCells(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell, ih->data->lines.focus_cell, ih->data->columns.focus_cell);
}
示例#7
0
static void iMatrixEditUpdateValue(Ihandle* ih)
{
    char *value = iupMatrixEditGetValue(ih);

    iupAttribSet(ih, "CELL_EDITED", "Yes");

    if (ih->data->undo_redo) iupAttribSetClassObject(ih, "UNDOPUSHBEGIN", "EDITCELL");

    iupMatrixSetValue(ih, ih->data->edit_lin, ih->data->edit_col, value, 1);

    if (ih->data->undo_redo) iupAttribSetClassObject(ih, "UNDOPUSHEND", NULL);

    iupBaseCallValueChangedCb(ih);

    iupAttribSet(ih, "CELL_EDITED", NULL);

    iupMatrixPrepareDrawData(ih);
    iupMatrixDrawCells(ih, ih->data->edit_lin, ih->data->edit_col, ih->data->edit_lin, ih->data->edit_col);
}
示例#8
0
int iupMatrixSetMarkAttrib(Ihandle* ih, int lin, int col, const char* value)
{
  if (ih->data->mark_mode == IMAT_MARK_NO)
    return 0;

  if (lin >= 0 && col >= 0)  /* both are specified */
  {
    if (!iupMatrixCheckCellPos(ih, lin, col))
      return 0;

    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      int mark, ret = 0;

      if (lin == 0 || col == 0) /* title can NOT have a mark */
        return 0;

      mark = iupStrBoolean(value);

      if (ih->data->callback_mode)
      {
        IFniii markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");
        if (markedit_cb && !ih->data->inside_markedit_cb)
        {
          ih->data->inside_markedit_cb = 1;
          markedit_cb(ih, lin, col, mark);
          ih->data->inside_markedit_cb = 0;
        }
        else
        {
          if (mark)
          {
            iupAttribSetId2(ih, "MARK", lin, col, "1");
            ret = 1;
          }
          else
            iupAttribSetId2(ih, "MARK", lin, col, NULL);
        }
      }
      else
      {
        if (mark)
          ih->data->cells[lin][col].flags |= IMAT_IS_MARKED;
        else
          ih->data->cells[lin][col].flags &= ~IMAT_IS_MARKED;
      }

      if (ih->handle)
      {
        /* This assumes that the matrix has been draw completely previously */
        iupMatrixPrepareDrawData(ih);
        iupMatrixDrawCells(ih, lin, col, lin, col);
      }

      return ret;
    }
    else
    {
      int mark = iupStrBoolean(value);

      if (ih->data->mark_mode & IMAT_MARK_LIN && lin>0)
      {
        if (mark)
          ih->data->lines.dt[lin].flags |= IMAT_IS_MARKED;
        else
          ih->data->lines.dt[lin].flags &= ~IMAT_IS_MARKED;
      }

      if (ih->data->mark_mode & IMAT_MARK_COL && col>0)
      {
        if (mark)
          ih->data->columns.dt[col].flags |= IMAT_IS_MARKED;
        else
          ih->data->columns.dt[col].flags &= ~IMAT_IS_MARKED;
      }

      if (ih->handle)
      {
        /* This assumes that the matrix has been drawn completely previously */
        iupMatrixPrepareDrawData(ih);
        iupMatrixDrawCells(ih, lin, col, lin, col);
      }
    }
  }

  return 0;
}
示例#9
0
void iupMatrixMarkBlockSet(Ihandle* ih, int ctrl, int lin1, int col1)
{
  int mark = 1, mark_full_all, lin, col;
  IFniii markedit_cb = NULL;
  IFnii mark_cb = NULL;

  iupMatrixMarkBlockReset(ih);
  iupMatrixPrepareDrawData(ih);

  if (!ih->data->mark_multiple || ih->data->mark_continuous || !ctrl)
  {
    iupMatrixMarkClearAll(ih, 1);
    iupMatrixDraw(ih, 0);
  }
  else
    mark = -1; /* toggle mark state */

  ih->data->mark_full1 = 0;
  mark_full_all = 0;

  if (lin1 == 0 && col1 == 0)
  {
    if ((ih->data->mark_mode == IMAT_MARK_CELL && ih->data->mark_multiple) ||
        ih->data->mark_mode == IMAT_MARK_COL ||
        ih->data->mark_mode == IMAT_MARK_LIN)
      mark_full_all = 1;
  }
  /* If it was pointing for a column title... */
  else if (lin1 == 0)
  {
    if ((ih->data->mark_mode == IMAT_MARK_CELL && ih->data->mark_multiple) || 
         ih->data->mark_mode & IMAT_MARK_COL)
      ih->data->mark_full1 = IMAT_PROCESS_COL;
  }
  /* If it was pointing for a line title... */
  else if (col1 == 0)
  {
    if ((ih->data->mark_mode == IMAT_MARK_CELL && ih->data->mark_multiple) || 
         ih->data->mark_mode & IMAT_MARK_LIN)
      ih->data->mark_full1 = IMAT_PROCESS_LIN;
  }

  if (ih->data->mark_mode == IMAT_MARK_CELL && ih->data->callback_mode)
  {
    markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");
    mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");
  }

  if (mark_full_all)
  {
    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      for (col = 1; col < ih->data->columns.num; col++)
      {
        for(lin = 1; lin < ih->data->lines.num; lin++)
          iMatrixMarkCellSet(ih, lin, col, mark, markedit_cb, mark_cb);
      }
    }
    else if (ih->data->mark_mode == IMAT_MARK_LIN)
    {
      for(lin = 1; lin < ih->data->lines.num; lin++)
        iMatrixMarkLinSet(ih, lin, mark);

      iupMatrixDrawTitleLines(ih, 1, ih->data->lines.num-1);
    }
    else if (ih->data->mark_mode == IMAT_MARK_COL)
    {
      for (col = 1; col < ih->data->columns.num; col++)
        iMatrixMarkColSet(ih, col, mark);

      iupMatrixDrawTitleColumns(ih, 1, ih->data->columns.num-1);
    }

    iupMatrixDrawCells(ih, 1, 1, ih->data->lines.num-1, ih->data->columns.num-1);
  }
  else
    iMatrixMarkItem(ih, lin1, col1, mark, markedit_cb, mark_cb);

  ih->data->mark_lin1 = lin1;
  ih->data->mark_col1 = col1;
  ih->data->mark_block = 1;
}
示例#10
0
int iupMatrixSetMarkAttrib(Ihandle* ih, const char* name_id, const char* value)
{
  int lin = 0, col = 0;

  if (ih->data->mark_mode == IMAT_MARK_NO)
    return 0;

  if (iupStrToIntInt(name_id, &lin, &col, ':') == 2)
  {
    if (!iupMatrixCheckCellPos(ih, lin, col))
      return 0;

    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      int mark;

      if (lin == 0 || col == 0) /* title can NOT have a mark */
        return 0;

      mark = iupStrBoolean(value);

      if (ih->data->callback_mode)
      {
        IFniii markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");
        if (markedit_cb)
          markedit_cb(ih, lin, col, mark);
        else if (mark)
          return 1;  /* store the attribute */
      }
      else
      {
        if (mark)
          ih->data->cells[lin][col].flags |= IUPMAT_MARK;
        else
          ih->data->cells[lin][col].flags &= ~IUPMAT_MARK;
      }

      if (ih->handle)
      {
        /* This assumes that the matrix has been draw completely previously */
        iupMatrixPrepareDrawData(ih);
        iupMatrixDrawCells(ih, lin, col, lin, col);
      }
    }
    else
    {
      int mark = iupStrBoolean(value);

      if (ih->data->mark_mode & IMAT_MARK_LIN && lin!=0)
      {
        if (mark)
          ih->data->lines.flags[lin] |= IUPMAT_MARK;
        else
          ih->data->lines.flags[lin] &= ~IUPMAT_MARK;
      }

      if (ih->data->mark_mode & IMAT_MARK_COL && col!=0)
      {
        if (mark)
          ih->data->columns.flags[col] |= IUPMAT_MARK;
        else
          ih->data->columns.flags[col] &= ~IUPMAT_MARK;
      }

      if (ih->handle)
      {
        /* This assumes that the matrix has been draw completely previously */
        iupMatrixPrepareDrawData(ih);
        iupMatrixDrawCells(ih, lin, col, lin, col);
      }
    }
  }

  return 0;
}
示例#11
0
/* Make the scroll of a number of columns to the left or right side or
   lines on top or down, using the ScrollImage primitive. To the left, just
   move one column - to the right, can move more than one. On top, just
   move only one column - on down, can move more than one.
   -> dir : [IMAT_SCROLL_LEFT| IMAT_SCROLL_RIGHT | IMAT_SCROLL_UP | IMAT_SCROLL_DOWN]
   -> ref : First column/line to be redrawn when the move is to right or on down.
   -> num : Number of columns/lines to be moved,  when the move is to right or on down.
*/
void iupMatrixScroll(Ihandle* ih, int dir, int ref, int num)
{
  int x1, x2, y1, y2, xt2, yt2;
  int i;

  x1 = 0;
  x2 = ih->data->XmaxC;
  
  y1 = 0;
  y2 = ih->data->YmaxC;

  ih->data->redraw = 1;

  if(dir == IMAT_SCROLL_LEFT)
  {
    x1  = ih->data->col.titlewh;      /* skip the line title */
    x2 -= ih->data->col.wh[ih->data->col.first];
    if(x1 >= x2)
    {
     iupMatrixDrawMatrix(ih, IMAT_DRAW_COL);
     return;
    }

    cdCanvasScrollArea(ih->data->cddbuffer, x1, x2, y1, y2, ih->data->col.wh[ih->data->col.first], 0);

    iupMatrixDrawColumnTitle(ih, ih->data->col.first, ih->data->col.first);

    iupMatrixCDSetCdFrameColor(ih);
    cdCanvasLine(ih->data->cddbuffer, ih->data->XmaxC, y1, ih->data->XmaxC, y2);

    iupMatrixDrawCells(ih, ih->data->lin.first, ih->data->col.first, ih->data->lin.last, ih->data->col.first);
  }
  else if(dir == IMAT_SCROLL_UP)
  {
    y2 -= ih->data->lin.titlewh;      /* skip the column title */
    y1 += ih->data->lin.wh[ih->data->lin.first];
    if(y1 >= y2)
    {
     iupMatrixDrawMatrix(ih, IMAT_DRAW_LIN);
     return;
    }

    cdCanvasScrollArea(ih->data->cddbuffer, x1, x2, y1, y2, 0, -ih->data->lin.wh[ih->data->lin.first]);
    iupMatrixDrawLineTitle(ih, ih->data->lin.first, ih->data->lin.first);
    iupMatrixDrawCells(ih, ih->data->lin.first, ih->data->col.first, ih->data->lin.first, ih->data->col.last);
  }
  else if(dir == IMAT_SCROLL_RIGHT)
  {
    x1 = ih->data->col.titlewh;      /* skip the line title */
    for(i = 1; i <= num; i++)
      x1 += ih->data->col.wh[ih->data->col.first-i];
    if(x1 >= x2)
    {
     iupMatrixDrawMatrix(ih, IMAT_DRAW_COL);
     return;
    }

    cdCanvasScrollArea(ih->data->cddbuffer, x1, x2/*-1*/, y1, y2, ih->data->col.titlewh-x1, 0);

    xt2 = iupMatrixDrawColumnTitle(ih, ref, ih->data->col.last);

    if(xt2 < x2)          /* clear the right area that doesn't have column */
    {
      iupMatrixDrawEmptyArea(ih, xt2, x2, y1, y2);
    }
    else
    {
      iupMatrixCDSetCdFrameColor(ih);
      cdCanvasLine(ih->data->cddbuffer, x2, y1, x2, y2);
    }

    /* draw the cells */
    iupMatrixDrawCells(ih, ih->data->lin.first, ref, ih->data->lin.last, ih->data->col.last);
  }
  else if(dir == IMAT_SCROLL_DOWN)
  {
    y2 -= ih->data->lin.titlewh;      /* skip the column title */
    for(i = 1; i <= num; i++)
      y2 -= ih->data->lin.wh[ih->data->lin.first-i];
    if(y1 >= y2)
    {
     iupMatrixDrawMatrix(ih, IMAT_DRAW_LIN);
     return;
    }

    cdCanvasScrollArea(ih->data->cddbuffer, x1, x2/*-1*/, y1, y2, 0, ih->data->YmaxC-ih->data->lin.titlewh-y2);

    yt2 = iupMatrixDrawLineTitle(ih, ref, ih->data->lin.last);

    if(yt2 < y1)          /* clear the right area that doesn't have column */
    {
     iupMatrixDrawEmptyArea(ih, x1, x2, y1, yt2);
    }
    else
    {
     iupMatrixCDSetCdFrameColor(ih);
     cdCanvasLine(ih->data->cddbuffer, x1, y1, x2, y1);
    }

    /* desenha as celulas */
    iupMatrixDrawCells(ih, ref, ih->data->col.first, ih->data->lin.last, ih->data->col.last);
  }
}
示例#12
0
int iupMatrixProcessKeyPress(Ihandle* ih, int c)
{
  /* This function is also called from inside the keyboard callbacks 
     of the Text and Dropdown list when in edition mode */

  int ret = IUP_IGNORE; /* default for processed keys */

  /* Hide (off) the marked cells if the key is not tab/del */
  if (c != K_TAB && c != K_sTAB && c != K_DEL && c != K_sDEL)
    iupMatrixMarkClearAll(ih, 1);

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

  switch (c)
  {
    case K_CR+2000:   /* used by the iMatrixEditTextKeyAny_CB and iMatrixEditDropDownKeyAny_CB */
      if (iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyCr(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cHOME:
    case K_sHOME:
    case K_HOME:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyHome(ih);
      ih->data->homekeycount++;
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cEND:
    case K_sEND:
    case K_END:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyEnd(ih);
      ih->data->endkeycount++;
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_sTAB:
    case K_TAB:
      return IUP_CONTINUE;  /* do not redraw */

    case K_cLEFT:
    case K_sLEFT:
    case K_LEFT:
      if (iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyLeft(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cRIGHT:
    case K_sRIGHT:
    case K_RIGHT:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyRight(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cUP:
    case K_sUP:
    case K_UP:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyUp(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break ;

    case K_cDOWN:
    case K_sDOWN:
    case K_DOWN:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyDown(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_sPGUP:
    case K_PGUP:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyPgUp(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_sPGDN:
    case K_PGDN:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyPgDown(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_SP:
    case K_CR:
    case K_sCR:
      if (iupMatrixEditShow(ih))
        return IUP_IGNORE; /* do not redraw */
      break;

    case K_sDEL:
    case K_DEL:
      {
        int lin, col;
        char str[100];
        IFnii mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");

        iupMatrixPrepareDrawData(ih);

        for(lin = 1; lin < ih->data->lines.num; lin++)
        {
          for(col = 1; col < ih->data->columns.num; col++)
          {
            if (iupMatrixMarkCellGet(ih, lin, col, mark_cb, str))
            {
              if (iupMatrixAuxCallEditionCbLinCol(ih, lin, col, 1) != IUP_IGNORE)
              {
                IFniis value_edit_cb;

                iupMatrixCellSetValue(ih, lin, col, NULL);

                value_edit_cb = (IFniis)IupGetCallback(ih, "VALUE_EDIT_CB");
                if (value_edit_cb)
                  value_edit_cb(ih, lin, col, NULL);

                iupMatrixDrawCells(ih, lin, col, lin, col);
              }
            }
          }
        }
        break;
      }
    default:
      /* if a valid character is pressed enter edition mode */
      if (iup_isprint(c))
      {
        if (iupMatrixEditShow(ih))
        {
          if (ih->data->datah == ih->data->texth)
          {
            char value[2] = {0,0};
            value[0] = (char)c;
            IupStoreAttribute(ih->data->datah, "VALUE", value);
            IupSetAttribute(ih->data->datah, "CARET", "2");
          }
          return IUP_IGNORE; /* do not redraw */
        }
      }
      ret = IUP_DEFAULT; /* unprocessed keys */
      break;
  }

  iupMatrixDrawUpdate(ih);  
  return ret;
}