Пример #1
0
char* iupBaseGetSizeAttrib(Ihandle* ih)
{
  char* str;
  int charwidth, charheight, width, height;

  if (ih->handle)
  {
    width = ih->currentwidth;
    height = ih->currentheight;
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  if (charwidth == 0 || charheight == 0)
    return NULL;  /* if font failed get from the hash table */

  str = iupStrGetMemory(50);
  sprintf(str, "%dx%d", iupRASTER2WIDTH(width, charwidth), 
                        iupRASTER2HEIGHT(height, charheight));
  return str;
}
Пример #2
0
static char* iBoxGetCMarginAttrib(Ihandle* ih)
{
  char *str = iupStrGetMemory(50);
  int charwidth, charheight;
  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  sprintf(str, "%dx%d", iupRASTER2WIDTH(ih->data->margin_x, charwidth), iupRASTER2HEIGHT(ih->data->margin_y, charheight));
  return str;
}
Пример #3
0
static char* iBoxGetCGapAttrib(Ihandle* ih)
{
  if (IupClassMatch(ih, "vbox"))
  {
    int charheight;
    iupdrvFontGetCharSize(ih, NULL, &charheight);
    return iupStrReturnInt(iupRASTER2HEIGHT(ih->data->gap, charheight));
  }
  else
  {
    int charwidth;
    iupdrvFontGetCharSize(ih, &charwidth, NULL);
    return iupStrReturnInt(iupRASTER2WIDTH(ih->data->gap, charwidth));
  }
}
Пример #4
0
static char* iBoxGetCGapAttrib(Ihandle* ih)
{
  char *str = iupStrGetMemory(50);
  if (iupStrEqual(ih->iclass->name, "vbox"))
  {
    int charheight;
    iupdrvFontGetCharSize(ih, NULL, &charheight);
    sprintf(str, "%d", iupRASTER2HEIGHT(ih->data->gap, charheight));
  }
  else
  {
    int charwidth;
    iupdrvFontGetCharSize(ih, &charwidth, NULL);
    sprintf(str, "%d", iupRASTER2WIDTH(ih->data->gap, charwidth));
  }
  return str;
}
Пример #5
0
char *iupMatrixGetSize(Ihandle* ih, int index, int m, int pixels)
{
  char* str;
  int size;
  ImatLinColData *lincol_data;

  if(m == IMAT_PROCESS_LIN)
    lincol_data = &(ih->data->lines);
  else
    lincol_data = &(ih->data->columns);

  if (index < 0 || index > lincol_data->num-1)
    return NULL;

  if (m == IMAT_PROCESS_LIN)
    size = iupMatrixAuxGetLineHeight(ih, index);
  else
    size = iupMatrixAuxGetColumnWidth(ih, index);

  str = iupStrGetMemory(100);

  if (size)
  {
    /* remove the decoration added in iupMatrixAuxGet */
    if (m == IMAT_PROCESS_COL)
      size -= IMAT_PADDING_W + IMAT_FRAME_W;
    else
      size -= IMAT_PADDING_H + IMAT_FRAME_H;

    if (!pixels)
    {
      int charwidth, charheight;
      iupdrvFontGetCharSize(ih, &charwidth, &charheight);
      if (m == IMAT_PROCESS_COL)
        size = iupRASTER2WIDTH(size, charwidth);
      else
        size = iupRASTER2HEIGHT(size, charheight);
    }
  }

  sprintf(str, "%d", size);
  return str;
}
Пример #6
0
char* iupBaseGetSizeAttrib(Ihandle* ih)
{
  int charwidth, charheight, width, height;

  if (ih->handle)
  {
    width = ih->currentwidth;
    height = ih->currentheight;
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  if (charwidth == 0 || charheight == 0)
    return NULL;  /* if font failed get from the hash table */

  return iupStrReturnIntInt(iupRASTER2WIDTH(width, charwidth), iupRASTER2HEIGHT(height, charheight), 'x');
}
Пример #7
0
static char* iDialogGetSizeAttrib(Ihandle* ih)
{
  int charwidth, charheight, width, height;

  if (ih->handle)
  {
    /* ih->currentwidth and/or ih->currentheight could have been reset in SetSize */
    iupdrvDialogGetSize(ih, NULL, &width, &height);
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  if (charwidth == 0 || charheight == 0)
    return NULL;  /* if font failed get from the hash table */

  return iupStrReturnIntInt(iupRASTER2WIDTH(width, charwidth), iupRASTER2HEIGHT(height, charheight), 'x');
}
Пример #8
0
static char* iBoxGetCMarginAttrib(Ihandle* ih)
{
  int charwidth, charheight;
  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  return iupStrReturnIntInt(iupRASTER2WIDTH(ih->data->margin_horiz, charwidth), iupRASTER2HEIGHT(ih->data->margin_vert, charheight), 'x');
}
Пример #9
0
static char* iGridBoxGetCGapLinAttrib(Ihandle* ih)
{
  int charwidth;
  iupdrvFontGetCharSize(ih, &charwidth, NULL);
  return iupStrReturnInt(iupRASTER2WIDTH(ih->data->gap_lin, charwidth));
}