コード例 #1
0
ファイル: iupmatrix.c プロジェクト: svn2github/iup-iup
static int iMatrixSetShowAttrib(Ihandle* ih, const char* value)
{
  int lin = -1, col = -1;

 /* Get the parameters. The '*' indicates that want to keep the table in
    the same line or column */
  if (iupStrToIntInt(value, &lin, &col, ':') != 2)
  {
    if (lin != -1)
      col = ih->data->columns.first;
    else if (col != -1)
      lin = ih->data->lines.first;
    else
      return 0;
  }

  /* Check if the cell exists */
  if (!iupMatrixCheckCellPos(ih, lin, col))
    return 0;

  /* Can not be a title */
  if((lin < 1) || (col < 1))
    return 0;

  if (!iupMatrixAuxIsCellStartVisible(ih, lin, col))
    iupMatrixScrollToVisible(ih, lin, col);

  return 0;
}
コード例 #2
0
ファイル: iup_matrixlist.c プロジェクト: Vulcanior/IUP
static char* iMatrixListGetIdValueAttrib(Ihandle* ih, int lin)
{
  ImatrixListData* mtxList = (ImatrixListData*)iupAttribGet(ih, "_IUPMTXLIST_DATA");

  if (iupMatrixCheckCellPos(ih, lin, mtxList->label_col))
    return iupMatrixGetValue(ih, lin, mtxList->label_col);
  return NULL;
}
コード例 #3
0
ファイル: iup_matrixlist.c プロジェクト: Vulcanior/IUP
static int iMatrixListSetIdValueAttrib(Ihandle* ih, int lin, const char* value)
{
  ImatrixListData* mtxList = (ImatrixListData*)iupAttribGet(ih, "_IUPMTXLIST_DATA");

  if (iupMatrixCheckCellPos(ih, lin, mtxList->label_col))
    iupMatrixSetValue(ih, lin, mtxList->label_col, value, 0);
  return 0;
}
コード例 #4
0
ファイル: iupmatrix.c プロジェクト: svn2github/iup-iup
static char* iMatrixGetIdValueAttrib(Ihandle* ih, const char* name_id)
{
  int lin, col;
  if (iupStrToIntInt(name_id, &lin, &col, ':') == 2)
  {
    if (iupMatrixCheckCellPos(ih, lin, col))
      return iupMatrixCellGetValue(ih, lin, col);
  }
  return NULL;
}
コード例 #5
0
ファイル: iupmatrix.c プロジェクト: svn2github/iup-iup
static int iMatrixSetIdValueAttrib(Ihandle* ih, const char* name_id, const char* value)
{
  int lin = 0, col = 0;
  if (iupStrToIntInt(name_id, &lin, &col, ':') == 2)
  {
    if (iupMatrixCheckCellPos(ih, lin, col))
      iupMatrixCellSetValue(ih, lin, col, value);
  }
  return 0;
}
コード例 #6
0
ファイル: iupmat_mark.c プロジェクト: Vulcanior/IUP
char* iupMatrixGetMarkAttrib(Ihandle* ih, int lin, int col)
{
  if (ih->data->mark_mode == IMAT_MARK_NO)
    return "0";

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

    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      if (lin == 0 || col == 0)  /* title can NOT have a mark */
        return NULL;

      if (ih->data->callback_mode)
      {
        IFnii mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");
        if (mark_cb)
        {
          if (mark_cb(ih, lin, col))
            return "1";
          else
            return "0";
        }
        else
          return NULL;  /* check the hash table */
      }
      else
      {
        if (ih->data->cells[lin][col].flags & IMAT_IS_MARKED)
          return "1";
        else
          return "0";
      }
    }
    else
    {
      if (ih->data->mark_mode & IMAT_MARK_LIN && 
          lin>0 && 
          ih->data->lines.dt[lin].flags & IMAT_IS_MARKED)
        return "1";

      if (ih->data->mark_mode & IMAT_MARK_COL && 
          col>0 && 
          ih->data->columns.dt[col].flags & IMAT_IS_MARKED)
        return "1";

      return "0";
    }
  }

  return NULL;
}
コード例 #7
0
ファイル: iupmat_mark.c プロジェクト: Airr/iup_mac
char* iupMatrixGetMarkAttrib(Ihandle* ih, const char* name_id)
{
  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 NULL;

    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      if (lin == 0 || col == 0) /* title can NOT have a mark */
        return NULL;

      if (ih->data->callback_mode)
      {
        IFnii mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");
        if (mark_cb)
        {
          if (mark_cb(ih, lin, col))
            return "1";
          else
            return "0";
        }
        else
          return NULL;  /* let check the hash table */
      }
      else
      {
        if (ih->data->cells[lin][col].flags & IUPMAT_MARK)
          return "1";
        else
          return "0";
      }
    }
    else
    {
      if (ih->data->mark_mode & IMAT_MARK_LIN && lin!=0 && ih->data->lines.flags[lin] & IUPMAT_MARK)
        return "1";

      if (ih->data->mark_mode & IMAT_MARK_COL && col!=0 && ih->data->columns.flags[col] & IUPMAT_MARK)
        return "1";

      return "0";
    }
  }

  return NULL;
}
コード例 #8
0
ファイル: iupmatrix.c プロジェクト: svn2github/iup-iup
static int iMatrixSetFocusCellAttrib(Ihandle* ih, const char* value)
{
  int lin = 0, col = 0;
  if (iupStrToIntInt(value, &lin, &col, ':') == 2)
  {
    if (!iupMatrixCheckCellPos(ih, lin, col))
      return 0;

    if (lin <= 0 || col <= 0) /* title can NOT have the focus */
      return 0;
    if (lin >= ih->data->lines.num || col >= ih->data->columns.num)
      return 0;

    iupMatrixFocusSet(ih, lin, col);

    if (ih->data->cddbuffer)
      iupMatrixDrawUpdate(ih);
  }

  return 0;
}
コード例 #9
0
ファイル: iupmatrix.c プロジェクト: svn2github/iup-iup
static int iMatrixSetOriginAttrib(Ihandle* ih, const char* value)
{
  int lin = -1, col = -1;

 /* Get the parameters. The '*' indicates that want to keep the table in
    the same line or column */
  if (iupStrToIntInt(value, &lin, &col, ':') != 2)
  {
    if (lin != -1)
      col = ih->data->columns.first;
    else if (col != -1)
      lin = ih->data->lines.first;
    else
      return 0;
  }

  /* Check if the cell exists */
  if (!iupMatrixCheckCellPos(ih, lin, col))
    return 0;

  /* Can not be a title */
  if((lin < 1) || (col < 1))
    return 0;

  ih->data->columns.first = col;
  ih->data->columns.first_offset = 0;
  ih->data->lines.first = lin;
  ih->data->lines.first_offset = 0;

  /* when "first" is changed must update scroll pos */
  iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_COL);
  iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_LIN);

  iupMatrixDraw(ih, 1);
  return 0;
}
コード例 #10
0
ファイル: iupmat_mark.c プロジェクト: Vulcanior/IUP
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;
}
コード例 #11
0
ファイル: iupmat_mark.c プロジェクト: Airr/iup_mac
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;
}
コード例 #12
0
ファイル: iupmatrix.c プロジェクト: svn2github/iup-iup
static char* iMatrixGetIdValueAttrib(Ihandle* ih, int lin, int col)
{
  if (iupMatrixCheckCellPos(ih, lin, col))
    return iupMatrixCellGetValue(ih, lin, col);
  return NULL;
}
コード例 #13
0
ファイル: iupmatrix.c プロジェクト: svn2github/iup-iup
static int iMatrixSetIdValueAttrib(Ihandle* ih, int lin, int col, const char* value)
{
  if (iupMatrixCheckCellPos(ih, lin, col))
    iupMatrixCellSetValue(ih, lin, col, value);
  return 0;
}