コード例 #1
0
ファイル: iup_tabs.c プロジェクト: DavidPhillipOster/IupCocoa
static void iTabsGetDecorOffset(Ihandle* ih, int *dx, int *dy)
{
  if (ih->data->type == ITABS_LEFT || ih->data->type == ITABS_RIGHT)
  {
    if (ih->data->type == ITABS_LEFT)
    {
      if (ih->data->orientation == ITABS_HORIZONTAL)
      {
        int max_width = iTabsGetMaxWidth(ih);
        *dx = 4 + (3 + max_width + 3) + 2;
      }
      else
      {
        int max_height = iTabsGetMaxHeight(ih);
        *dx = 4 + (3 + max_height + 3) + 2;

        if (ih->handle && ih->data->is_multiline)
        {
          int num_lin = iupdrvTabsGetLineCountAttrib(ih);
          *dx += (num_lin-1)*(3 + max_height + 3 + 1);
        }
      }
    }
    else
      *dx = 4;

    *dy = 4;
  }
  else /* "BOTTOM" or "TOP" */
  {
    if (ih->data->type == ITABS_TOP)
    {
      if (ih->data->orientation == ITABS_HORIZONTAL)
      {
        int max_height = iTabsGetMaxHeight(ih);
        *dy = 4 + (3 + max_height + 3) + 2;

        if (ih->handle && ih->data->is_multiline)
        {
          int num_lin = iupdrvTabsGetLineCountAttrib(ih);
          *dy += (num_lin-1)*(3 + max_height + 3 + 1);
        }
      }
      else
      {
        int max_width = iTabsGetMaxWidth(ih);
        *dy = 4 + (3 + max_width + 3) + 2;
      }
    }
    else
      *dy = 4;

    *dx = 4;
  }

  *dx += ih->data->horiz_padding;
  *dy += ih->data->vert_padding;
}
コード例 #2
0
ファイル: iup_tabs.c プロジェクト: gcfavorites/tastools
static void iTabsGetDecorSize(Ihandle* ih, int *width, int *height)
{
  if (ih->data->type == ITABS_LEFT || ih->data->type == ITABS_RIGHT)
  {
    if (ih->data->orientation == ITABS_HORIZONTAL)
    {
      int max_width = iTabsGetMaxWidth(ih);
      *width  = 4 + (3 + max_width + 3) + 2 + 4;
      *height = 4 + 4;

      if (iupdrvTabsExtraDecor(ih))
      {
        int h;
        iupdrvFontGetCharSize(ih, NULL, &h);
        *height += h + 4;
      }
    }
    else
    {
      int max_height = iTabsGetMaxHeight(ih);
      *width  = 4 + (3 + max_height + 3) + 2 + 4;
      *height = 4 + 4;

      if (ih->handle && ih->data->is_multiline)
      {
        int num_lin = iupdrvTabsGetLineCountAttrib(ih);
        *width += (num_lin-1)*(3 + max_height + 3 + 1);
      }
    }
  }
  else /* "BOTTOM" or "TOP" */
  {
    if (ih->data->orientation == ITABS_HORIZONTAL)
    {
      int max_height = iTabsGetMaxHeight(ih);
      *width  = 4 + 4;
      *height = 4 + (3 + max_height + 3) + 2 + 4;

      if (ih->handle && ih->data->is_multiline)
      {
        int num_lin = iupdrvTabsGetLineCountAttrib(ih);
        *height += (num_lin-1)*(3 + max_height + 3 + 1);
      }

      if (iupdrvTabsExtraDecor(ih))
      {
        int h;
        iupdrvFontGetCharSize(ih, NULL, &h);
        *width += h + 4;
      }
    }
    else
    {
      int max_width = iTabsGetMaxWidth(ih);
      *width  = 4 + 4;
      *height = 4 + (3 + max_width + 3) + 2 + 4;
    }
  }

  *width  += ih->data->horiz_padding;
  *height += ih->data->vert_padding;
}