Ejemplo n.º 1
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);
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 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;
}