Exemplo n.º 1
0
static void iDialogComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  int decorwidth, decorheight;
  Ihandle* child = ih->firstchild;

  /* if does not have a menu, but the attribute is defined,
     try to update the menu before retrieving the decoration. */
  char* value = iupAttribGet(ih, "MENU");
  if (!ih->data->menu && value)
    iDialogSetMenuAttrib(ih, value);

  iupDialogGetDecorSize(ih, &decorwidth, &decorheight);
  *w = decorwidth;
  *h = decorheight;

  if (child)
  {
    /* update child natural size first */
    iupBaseComputeNaturalSize(child);

    *children_expand = child->expand;
    *w += child->naturalwidth;
    *h += child->naturalheight;
  }
}
Exemplo n.º 2
0
static void iTabsComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
  Ihandle* child;
  int children_expand, 
      children_naturalwidth, children_naturalheight;
  int decorwidth, decorheight;

  /* calculate total children natural size (even for hidden children) */
  children_expand = 0;
  children_naturalwidth = 0;
  children_naturalheight = 0;

  for (child = ih->firstchild; child; child = child->brother)
  {
    /* update child natural size first */
    iupBaseComputeNaturalSize(child);

    children_expand |= child->expand;
    children_naturalwidth = iupMAX(children_naturalwidth, child->naturalwidth);
    children_naturalheight = iupMAX(children_naturalheight, child->naturalheight);
  }

  iTabsGetDecorSize(ih, &decorwidth, &decorheight);

  *expand = children_expand;
  *w = children_naturalwidth + decorwidth;
  *h = children_naturalheight + decorheight;
}
Exemplo n.º 3
0
static void iZboxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  Ihandle* child;
  int children_naturalwidth, children_naturalheight;

  /* calculate total children natural size (even for hidden children) */
  children_naturalwidth = 0;
  children_naturalheight = 0;

  for (child = ih->firstchild; child; child = child->brother)
  {
    /* update child natural size first */
    if (!(child->flags & IUP_FLOATING_IGNORE))
      iupBaseComputeNaturalSize(child);

    if (!(child->flags & IUP_FLOATING))
    {
      *children_expand |= child->expand;
      children_naturalwidth = iupMAX(children_naturalwidth, child->naturalwidth);
      children_naturalheight = iupMAX(children_naturalheight, child->naturalheight);
    }
  }

  *w = children_naturalwidth;
  *h = children_naturalheight;
}
Exemplo n.º 4
0
void iupLayoutCompute(Ihandle* ih)
{
  /* usually called only for the dialog */

  int shrink = iupAttribGetBoolean(ih, "SHRINK");

  /* Compute the natural size for all elements in the dialog,   
     using the minimum visible size and the defined user size.
     The minimum visible size is the size where all the controls can display
     all their contents.
     The defined user size is used to increase the value of the minimum visible size for containers,
     for standard controls will replace the minimum visible size.
     So the native size will be the maximum value between 
     minimum visible size and defined user size.
     Also calculates the expand configuration for each element, but expand is used only in SetChildrenCurrentSize.
     SEQUENCE: will first calculate the native size for the children, then for the element. */
  iupBaseComputeNaturalSize(ih);

  /* Set the current size (not reflected in the native element yet) based on
     the natural size and the expand configuration. 
     If shrink is 0 (default) the current size of containers can be only larger than the natural size,
     the result will depend on the EXPAND attribute.
     If shrink is 1 the containers can be resized to sizes smaller than the natural size.
     SEQUENCE: will first calculate the current size of the element, then for the children. */
  iupBaseSetCurrentSize(ih, 0, 0, shrink);

  /* Now that the current size is known, set the position of the elements 
     relative to the parent.
     SEQUENCE: will first set the position of the element, then for the children. */
  iupBaseSetPosition(ih, 0, 0);
}
Exemplo n.º 5
0
static void iCboxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
  Ihandle* child;
  int children_expand, 
      children_naturalwidth, children_naturalheight;
  int cx, cy;

  /* calculate total children natural size (even for hidden children) */
  children_expand = 0;
  children_naturalwidth = 0;
  children_naturalheight = 0;

  for (child = ih->firstchild; child; child = child->brother)
  {
    /* update child natural size first */
    iupBaseComputeNaturalSize(child);

    cx = iupAttribGetInt(child, "CX");
    cy = iupAttribGetInt(child, "CY");

    children_expand |= child->expand;
    children_naturalwidth = iupMAX(children_naturalwidth, cx+child->naturalwidth);
    children_naturalheight = iupMAX(children_naturalheight, cy+child->naturalheight);
  }

  *expand = children_expand;
  *w = children_naturalwidth;
  *h = children_naturalheight;
}
Exemplo n.º 6
0
static char* iGridBoxGetNumLinAttrib(Ihandle* ih)
{
  if (!ih->handle)
    iupBaseComputeNaturalSize(ih);

  return iupStrReturnInt(ih->data->num_lin);
}
Exemplo n.º 7
0
static void iDetachBoxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  int natural_w = 0, 
      natural_h = 0;

  /* bar */
  if (ih->data->orientation == IDBOX_VERT)
    natural_w += ih->data->barsize;
  else
    natural_h += ih->data->barsize;

  if (ih->firstchild->brother)
  {
    Ihandle* child = ih->firstchild->brother;

    /* update child natural size first */
    iupBaseComputeNaturalSize(child);

    if (ih->data->orientation == IDBOX_VERT)
    {
      natural_w += child->naturalwidth;
      natural_h = iupMAX(natural_h, child->naturalheight);
    }
    else  /* IDBOX_HORIZ */
    {
      natural_w = iupMAX(natural_w, child->naturalwidth);
      natural_h += child->naturalheight;
    }

    *children_expand |= child->expand;
  }

  *w = natural_w;
  *h = natural_h;
}
Exemplo n.º 8
0
static void iExpanderComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
  int child_expand = 0,
      natural_w, natural_h;
  Ihandle *child = ih->firstchild->brother;
  int bar_size = iExpanderGetBarSize(ih);

  /* bar */
  if (ih->data->position == IEXPANDER_LEFT || ih->data->position == IEXPANDER_RIGHT)
  {
    natural_w = bar_size;
    natural_h = IEXPAND_HANDLE_SIZE;
  }
  else
  {
    natural_w = IEXPAND_HANDLE_SIZE;
    natural_h = bar_size;

    if (ih->data->position == IEXPANDER_TOP)
    {
      char* title = iupAttribGetStr(ih, "TITLE");
      if (title)
      {
        int title_size = 0;
        iupdrvFontGetMultiLineStringSize(ih, title, &title_size, NULL);
        natural_w += title_size;
        natural_h += 2*IEXPAND_HANDLE_SPC;
      }
    }
  }

  if (child)
  {
    /* update child natural bar_size first */
    iupBaseComputeNaturalSize(child);

    if (ih->data->position == IEXPANDER_LEFT || ih->data->position == IEXPANDER_RIGHT)
    {
      if (ih->data->state == IEXPANDER_OPEN)  /* only open, not float */
        natural_w += child->naturalwidth;
      natural_h = iupMAX(natural_h, child->naturalheight);
    }
    else
    {
      natural_w = iupMAX(natural_w, child->naturalwidth);
      if (ih->data->state == IEXPANDER_OPEN)  /* only open, not float */
        natural_h += child->naturalheight;
    }

    child_expand = child->expand;
  }

  *expand = child_expand;
  *w = natural_w;
  *h = natural_h;
}
Exemplo n.º 9
0
static void iSboxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  int natural_w = ih->naturalwidth, 
      natural_h = ih->naturalheight;

  /* only allow expand in the oposite direction, complement iupBaseContainerUpdateExpand */
  if (ih->data->direction == ISBOX_EAST || ih->data->direction == ISBOX_WEST)
      ih->expand &= ~IUP_EXPAND_WIDTH;
  else 
      ih->expand &= ~IUP_EXPAND_HEIGHT;

  /* always has at least one child, the bar */

  /* This is an unusual element, the iupBaseComputeNaturalSize logic is done twice, one here and one back there. */

  if (ih->firstchild->brother)
  {
    Ihandle* child = ih->firstchild->brother;

    /* update child natural size first */
    iupBaseComputeNaturalSize(child);

    *children_expand = child->expand;

    /* calculate as in iupBaseComputeNaturalSize */
    natural_w = iupMAX(natural_w, child->naturalwidth  + iSboxGetXborder(ih));
    natural_h = iupMAX(natural_h, child->naturalheight + iSboxGetYborder(ih));
  }

  /* update control to fit its children according to direction */

  /* bar */
  if (ih->data->direction == ISBOX_EAST || ih->data->direction == ISBOX_WEST)
  {
    ih->data->w = iupMAX(natural_w, ih->data->w);
    ih->data->h = natural_h;
  }
  else  /* ISBOX_NORTH || ISBOX_SOUTH */
  {
    ih->data->w = natural_w;
    ih->data->h = iupMAX(natural_h, ih->data->h);
  }

  /* child */
  if (ih->firstchild->brother)
  {
    Ihandle* child = ih->firstchild->brother;
    child->naturalwidth  = ih->data->w - iSboxGetXborder(ih);
    child->naturalheight = ih->data->h - iSboxGetYborder(ih);
  }

  *w = ih->data->w;
  *h = ih->data->h;
}
Exemplo n.º 10
0
static void iSpinboxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  /* update spin natural size */
  iupBaseComputeNaturalSize(ih->firstchild);

  if (ih->firstchild->brother)
  {
    /* update child natural size */
    iupBaseComputeNaturalSize(ih->firstchild->brother);

    *children_expand = ih->firstchild->brother->expand;

    *w = ih->firstchild->brother->naturalwidth + ih->firstchild->naturalwidth;
    *h = iupMAX(ih->firstchild->brother->naturalheight, ih->firstchild->naturalheight);
  }
  else
  {
    *w = ih->firstchild->naturalwidth;
    *h = ih->firstchild->naturalheight;
  }
}
Exemplo n.º 11
0
static void iScrollBoxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
  if (ih->firstchild)
  {
    /* update child natural size */
    iupBaseComputeNaturalSize(ih->firstchild);
  }

  /* ScrollBox size does not depends on the child size */
  (void)w;
  (void)h;
  (void)expand;
}
Exemplo n.º 12
0
static void iVboxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  Ihandle* child;
  int total_natural_width, total_natural_height;

  /* calculate total children natural size */
  int children_count = 0;
  int children_natural_maxwidth = 0;
  int children_natural_maxheight = 0;
  int children_natural_height = 0;

  for (child = ih->firstchild; child; child = child->brother)
  {
    /* update child natural size first */
    if (!(child->flags & IUP_FLOATING_IGNORE))
      iupBaseComputeNaturalSize(child);

    if (!(child->flags & IUP_FLOATING))
    {
      *children_expand |= child->expand;
      children_natural_maxwidth = iupMAX(children_natural_maxwidth, child->naturalwidth);
      children_natural_maxheight = iupMAX(children_natural_maxheight, child->naturalheight);
      children_count++;
    }
  }

  /* reset to max natural width and/or height if NORMALIZESIZE is defined */
  if (ih->data->normalize_size)
    iupNormalizeSizeBoxChild(ih, ih->data->normalize_size, children_natural_maxwidth, children_natural_maxheight);

  /* must be done after normalize */
  for (child = ih->firstchild; child; child = child->brother)
  {
    if (!(child->flags & IUP_FLOATING))
      children_natural_height += child->naturalheight;
  }

  /* leave room at the element for the maximum natural size of the children when is_homogeneous */
  if (ih->data->is_homogeneous)
    children_natural_height = children_natural_maxheight*children_count;

  /* compute the Vbox contents natural size */
  total_natural_width  = children_natural_maxwidth + 2*ih->data->margin_x;
  total_natural_height = children_natural_height + (children_count-1)*ih->data->gap + 2*ih->data->margin_y;

  /* Store to be used in iVboxCalcEmptyHeight */
  ih->data->total_natural_size = total_natural_height;

  *w = total_natural_width;
  *h = total_natural_height;
}
Exemplo n.º 13
0
static void iGLCanvasBoxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  Ihandle* child;
  for (child = ih->firstchild; child; child = child->brother)
  {
    /* update child natural size only */
    iupBaseComputeNaturalSize(child);
  }

  /* Also set expand to its own expand so it will not depend on children */
  *children_expand = ih->expand;

  (void)w;
  (void)h;
}
Exemplo n.º 14
0
static void iGLCanvasBoxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  Ihandle* child;
  for (child = ih->firstchild; child; child = child->brother)
  {
    /* update child natural size only */
    iupBaseComputeNaturalSize(child);
  }

  /* use this to overwrite container behavior in iupBaseComputeNaturalSize */
  *children_expand = ih->expand;

  (void)w;
  (void)h;
}
Exemplo n.º 15
0
static void iScrollBoxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
  if (ih->firstchild)
  {
    /* update child natural size first */
    iupBaseComputeNaturalSize(ih->firstchild);

    *expand = ih->firstchild->expand;
  }

  /* ScrollBox size does not depends on the child size,
     its natural size must be 0 to be free of restrictions. */
  (void)w;
  (void)h;
}
Exemplo n.º 16
0
static void iScrollBoxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  if (ih->firstchild)
  {
    /* update child natural size first */
    iupBaseComputeNaturalSize(ih->firstchild);
  }

  /* ScrollBox size does not depends on the child size,
     its natural size must be 0 to be free of restrictions. */
  (void)w;
  (void)h;

  /* Also set expand to its own expand so it will not depend on children */
  *children_expand = ih->expand;
}
Exemplo n.º 17
0
static void iFrameComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
  int decorwidth, decorheight;
  Ihandle* child = ih->firstchild;

  iFrameGetDecorSize(ih, &decorwidth, &decorheight);
  *w = decorwidth;
  *h = decorheight;

  if (child)
  {
    /* update child natural size first */
    iupBaseComputeNaturalSize(child);

    *expand = child->expand;
    *w += child->naturalwidth;
    *h += child->naturalheight;
  }
}
Exemplo n.º 18
0
static void iGLFrameComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
    int decorwidth, decorheight, title_width;
    Ihandle* child = ih->firstchild;

    iGLFrameGetDecorSize(ih, &decorwidth, &decorheight, &title_width);
    *w = decorwidth;
    *h = decorheight;

    if (child)
    {
        /* update child natural size first */
        iupBaseComputeNaturalSize(child);

        *children_expand = child->expand;
        *w += iupMAX(child->naturalwidth, title_width);  /* make room for title always */
        *h += child->naturalheight;
    }
    else
        *w += title_width;
}
Exemplo n.º 19
0
static int iNormalizerSetNormalizeAttrib(Ihandle* ih, const char* value)
{
  int i, count;
  Ihandle** ih_list;
  Ihandle* ih_control;
  int natural_maxwidth = 0, natural_maxheight = 0;
  int normalize = iupNormalizeGetNormalizeSize(value);
  if (!normalize)
    return 1;

  count = iupArrayCount(ih->data->ih_array);
  ih_list = (Ihandle**)iupArrayGetData(ih->data->ih_array);

  for (i = 0; i < count; i++)
  {
    ih_control = ih_list[i];
    iupBaseComputeNaturalSize(ih_control);
    natural_maxwidth = iupMAX(natural_maxwidth, ih_control->naturalwidth);
    natural_maxheight = iupMAX(natural_maxheight, ih_control->naturalheight);
  }

  for (i = 0; i < count; i++)
  {
    ih_control = ih_list[i];
    if (!(ih_control->flags & IUP_FLOATING) && 
        (ih_control->iclass->nativetype != IUP_TYPEVOID || 
         !IupClassMatch(ih_control, "fill")))
    {
      if (normalize & NORMALIZE_WIDTH)
        ih_control->userwidth = natural_maxwidth;
      if (normalize & NORMALIZE_HEIGHT)
        ih_control->userheight = natural_maxheight;
    }
  }
  return 1;
}
Exemplo n.º 20
0
static void iSplitComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
  int natural_w = 0, 
      natural_h = 0;
  Ihandle *child1, *child2 = NULL;
  child1 = ih->firstchild->brother;
  if (child1)
    child2 = child1->brother;

  /* always has at least one child, the bar, not necessary to compute its natural size */
  if (ih->data->orientation == ISPLIT_VERT)
    natural_w += ih->data->barsize;
  else
    natural_h += ih->data->barsize;

  if (child1)
  {
    /* update child natural size first */
    iupBaseComputeNaturalSize(child1);

    if (ih->data->orientation == ISPLIT_VERT)
    {
      natural_w += child1->naturalwidth;
      natural_h = iupMAX(natural_h, child1->naturalheight);
    }
    else
    {
      natural_w = iupMAX(natural_w, child1->naturalwidth);
      natural_h += child1->naturalheight;
    }

    *expand = child1->expand;

    if (child2)
    {
      /* update child natural size first */
      iupBaseComputeNaturalSize(child2);

      if (ih->data->orientation == ISPLIT_VERT)
      {
        natural_w += child2->naturalwidth;
        natural_h = iupMAX(natural_h, child2->naturalheight);
      }
      else
      {
        natural_w = iupMAX(natural_w, child2->naturalwidth);
        natural_h += child2->naturalheight;
      }

      *expand |= child2->expand;
    }
  }

  if (ih->data->val == -1)
  {
    if (child1)
    {
      if (ih->data->orientation == ISPLIT_VERT)
        ih->data->val = (child1->naturalwidth*1000)/(natural_w-ih->data->barsize);
      else
        ih->data->val = (child1->naturalheight*1000)/(natural_h-ih->data->barsize);

      iSplitCropVal(ih);
    }
    else
      ih->data->val = ih->data->min;
  }

  *w = natural_w;
  *h = natural_h;
}
Exemplo n.º 21
0
static void iGridBoxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  Ihandle* child;
  int num_lin, num_col, num_div, i;
  int children_natural_width = 0, children_natural_height = 0;

  /* calculate total children natural size */
  int children_natural_maxwidth = 0;
  int children_natural_maxheight = 0;
  int child_count = 0;

  for (child = ih->firstchild; child; child = child->brother)
  {
    if (ih->data->expand_children)
      child->expand = ih->data->expand_children;

    /* update child natural size first */
    if (!(child->flags & IUP_FLOATING_IGNORE))
      iupBaseComputeNaturalSize(child);

    if (!(child->flags & IUP_FLOATING))
    {
      *children_expand |= child->expand;
      child_count++;
    }
  }

  if (ih->data->num_div == -1)
    num_div = iGridBoxCalcNumDiv(ih);
  else
    num_div = ih->data->num_div;

  /* Notice that num_lin*num_col can be > child_count */
  if (ih->data->orientation==IGBOX_HORIZONTAL)
  {
    num_lin = child_count / num_div;
    if (child_count % num_div)
      num_lin++;
    num_col = num_div;
  }
  else
  {
    num_lin = num_div;
    num_col = child_count / num_div;
    if (child_count % num_div)
      num_col++;
  }

  /* read only, computed only here */
  ih->data->num_lin = num_lin;
  ih->data->num_col = num_col;

  /* IMPORTANT: the reference line defines the width of each column,
     and the reference column defines the height of each line */

  i = 0;
  for (child = ih->firstchild; child; child = child->brother)
  {
    if (!(child->flags & IUP_FLOATING))
    {
      int lin, col;
      iGridBoxCalcLinCol(ih, i, &lin, &col);

      if (col == ih->data->size_col)
      {
        children_natural_height += child->naturalheight;
        children_natural_maxheight = iupMAX(children_natural_maxheight, child->naturalheight);
      }
      if (lin == ih->data->size_lin)
      {
        children_natural_width += child->naturalwidth;
        children_natural_maxwidth = iupMAX(children_natural_maxwidth, child->naturalwidth);
      }

      i++;
    }
  }

  /* reset to max natural width and/or height if NORMALIZESIZE is defined */
  if (ih->data->normalize_size)  /* this directly affects the child natural size */
  {
    iupNormalizeSizeBoxChild(ih, ih->data->normalize_size, children_natural_maxwidth, children_natural_maxheight);

    /* must update the children natural size because
       normalize was done after its calculation */
    if (ih->data->normalize_size & 1) 
      children_natural_width = children_natural_maxwidth*num_col;
    if (ih->data->normalize_size & 2)
      children_natural_height = children_natural_maxheight*num_lin;
  }

  /* leave room at the element for the maximum natural size of the children when is_homogeneous */
  /* this affects only the space left for the child to expand */
  if (ih->data->is_homogeneous_col)  /* all columns with the same width */
    children_natural_width = children_natural_maxwidth*num_col;
  if (ih->data->is_homogeneous_lin)  /* all lines with the same height */
    children_natural_height = children_natural_maxheight*num_lin;

  /* compute the GridBox contents natural size */
  *w = children_natural_width  + (num_col-1)*ih->data->gap_col + 2*ih->data->margin_x;
  *h = children_natural_height + (num_lin-1)*ih->data->gap_lin + 2*ih->data->margin_y;

  /* Store to be used in iGridCalcEmptyHeight */
  ih->data->total_natural_width  = *w;
  ih->data->total_natural_height = *h;
}
Exemplo n.º 22
0
static void iGLExpanderComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand)
{
  int child_expand = 0,
      natural_w, natural_h;
  Ihandle *child = ih->firstchild;
  int bar_size = iGLExpanderGetBarSize(ih);

  /* bar */
  if (ih->data->position == IEXPANDER_LEFT || ih->data->position == IEXPANDER_RIGHT)
  {
    natural_w = bar_size;
    natural_h = IEXPAND_HANDLE_SIZE;  /* just a minimum size */
  }
  else
  {
    natural_w = IEXPAND_HANDLE_SIZE;  /* just a minimum size */
    natural_h = bar_size;

    if (ih->data->position == IEXPANDER_TOP)
    {
      char* title, *image;

      /* if IMAGE is defined assume that will cover all the canvas area */
      image = iupAttribGetStr(ih, "IMAGE");
      if (image)
      {
        int image_w = 0;
        iupGLImageGetInfo(image, &image_w, NULL, NULL);
        natural_w = iupMAX(natural_w, image_w);
      }

      /* if TITLE and IMAGE are both defined then 
         IMAGE is only the handle */

      title = iupAttribGetStr(ih, "TITLE");
      if (title)
      {
        int title_size = 0;
        iupGLFontGetMultiLineStringSize(ih, title, &title_size, NULL);
        natural_w += title_size;
      }

      if (ih->data->extra_buttons != 0)
        natural_w += ih->data->extra_buttons * (IEXPAND_BUTTON_SIZE + IEXPAND_SPACING);

      if (image || title || ih->data->extra_buttons != 0)
        natural_w += 2 * IEXPAND_BACK_MARGIN;
    }
  }

  if (child)
  {
    /* update child natural bar_size first */
    iupBaseComputeNaturalSize(child);

    if (ih->data->position == IEXPANDER_LEFT || ih->data->position == IEXPANDER_RIGHT)
    {
      if (ih->data->state == IEXPANDER_OPEN)  /* only open, not float */
        natural_w += child->naturalwidth;
      natural_h = iupMAX(natural_h, child->naturalheight);
    }
    else
    {
      natural_w = iupMAX(natural_w, child->naturalwidth);
      if (ih->data->state == IEXPANDER_OPEN)  /* only open, not float */
        natural_h += child->naturalheight;
    }

    if (ih->data->state == IEXPANDER_OPEN)
      child_expand = child->expand;
    else
    {
      if (ih->data->position == IEXPANDER_LEFT || ih->data->position == IEXPANDER_RIGHT)
        child_expand = child->expand & IUP_EXPAND_HEIGHT;  /* only vertical allowed */
      else
        child_expand = child->expand & IUP_EXPAND_WIDTH;  /* only horizontal allowed */
    }
  }

  *children_expand = child_expand;
  *w = natural_w;
  *h = natural_h;
}