예제 #1
0
static void iSboxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int posx = 0, posy = 0;

  /* bar */
  if (ih->data->direction == ISBOX_EAST)
  {
    posx = ih->data->w - ISBOX_THICK;
    if (posx<0) posx = 0;
  }
  if (ih->data->direction == ISBOX_SOUTH)
  {
    posy = ih->data->h - ISBOX_THICK;
    if (posy<0) posy = 0;
  }

  iupBaseSetPosition(ih->firstchild, x+posx, y+posy);

  /* child */
  if (ih->firstchild->brother)
  {  
    iSboxAddDecorOffset(ih, &x, &y);
    iupBaseSetPosition(ih->firstchild->brother, x, y);
  } 
}
예제 #2
0
static void iSpinboxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  if (ih->firstchild->brother)
  { 
    if (ih->firstchild->brother->currentheight < ih->firstchild->currentheight)
    {
      /* bar */
      iupBaseSetPosition(ih->firstchild, x+ih->firstchild->brother->currentwidth, y);

      y += (ih->firstchild->currentheight-ih->firstchild->brother->currentheight)/2;

      /* child */
      iupBaseSetPosition(ih->firstchild->brother, x, y);
    }
    else
    {
      /* child */
      iupBaseSetPosition(ih->firstchild->brother, x, y);

      y += (ih->firstchild->brother->currentheight-ih->firstchild->currentheight)/2;

      /* bar */
      iupBaseSetPosition(ih->firstchild, x+ih->firstchild->brother->currentwidth, y);
    }
  } 
  else
  {
    /* bar */
    iupBaseSetPosition(ih->firstchild, x, y);
  }
}
예제 #3
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);
}
예제 #4
0
static void iVboxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int dx, client_width;
  Ihandle* child;

  x += ih->data->margin_x;
  y += ih->data->margin_y;

  client_width = ih->currentwidth - 2*ih->data->margin_x;
  if (client_width<0) client_width=0;

  for (child = ih->firstchild; child; child = child->brother)
  {
    if (!(child->flags & IUP_FLOATING))
    {
      if (ih->data->alignment == IUP_ALIGN_ACENTER)
        dx = (client_width - child->currentwidth)/2;
      else if (ih->data->alignment == IUP_ALIGN_ARIGHT)
        dx = client_width - child->currentwidth;
      else  /* IUP_ALIGN_ALEFT */
        dx = 0;
      if (dx<0) dx = 0;
                      
      /* update child */
      iupBaseSetPosition(child, x+dx, y);

      /* calculate next */
      if (ih->data->homogeneous_size)
        y += ih->data->homogeneous_size + ih->data->gap;
      else
        y += child->currentheight + ih->data->gap;
    }
  }
}
예제 #5
0
static void iGLScrollBoxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  if (ih->firstchild)
  {
    iupBaseSetPosition(ih->firstchild, x - iupAttribGetInt(ih, "POSX"),
                                       y - iupAttribGetInt(ih, "POSY"));
  }
}
예제 #6
0
static void iDetachBoxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  /* bar */
  iupBaseSetPosition(ih->firstchild, x, y);

  /* child */
  if (ih->data->orientation == IDBOX_VERT)
  {
    x += ih->data->barsize;
    iupBaseSetPosition(ih->firstchild->brother, x, y);
  }
  else  /* IDBOX_HORIZ */
  {
    y += ih->data->barsize;
    iupBaseSetPosition(ih->firstchild->brother, x, y);
  }
}
예제 #7
0
파일: iup_scrollbox.c 프로젝트: defdef/iup
static void iScrollBoxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  if (ih->firstchild)
    iupBaseSetPosition(ih->firstchild, -IupGetInt(ih, "POSX"), -IupGetInt(ih, "POSY"));

  (void)x;  /* Native container, position is reset */
  (void)y;
}
예제 #8
0
파일: iup_zbox.c 프로젝트: defdef/iup
static void iZboxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int dx = 0, dy = 0;
  Ihandle* child;

  for (child = ih->firstchild; child; child = child->brother)
  {
    if (!(child->flags & IUP_FLOATING))
    {
      switch (ih->data->alignment)
      {
      case IZBOX_ALIGN_ACENTER:
        dx=(ih->currentwidth-child->currentwidth)/2;
        dy=(ih->currentheight-child->currentheight)/2;
        break;
      case IZBOX_ALIGN_NORTH:
        dx=(ih->currentwidth-child->currentwidth)/2;
        dy=0;
        break;
      case IZBOX_ALIGN_SOUTH:
        dx=(ih->currentwidth-child->currentwidth)/2;
        dy=ih->currentheight-child->currentheight;
        break;
      case IZBOX_ALIGN_WEST:
        dx=0;
        dy=(ih->currentheight-child->currentheight)/2;
        break;
      case IZBOX_ALIGN_EAST:
        dx=ih->currentwidth-child->currentwidth;
        dy=(ih->currentheight-child->currentheight)/2;
        break;
      case IZBOX_ALIGN_NE:
        dx=ih->currentwidth-child->currentwidth;
        dy=0;
        break;
      case IZBOX_ALIGN_SE:
        dx=ih->currentwidth-child->currentwidth;
        dy=ih->currentheight-child->currentheight;
        break;
      case IZBOX_ALIGN_SW:
        dx=0;
        dy=ih->currentheight-child->currentheight;
        break;
      case IZBOX_ALIGN_NW:
      default:
        dx=0;
        dy=0;
        break;
      }
      if (dx<0) dx = 0;
      if (dy<0) dy = 0;
                     
      /* update child */
      iupBaseSetPosition(child, x+dx, y+dy);
    }
  }
}
예제 #9
0
파일: iupgtk_dialog.c 프로젝트: LuaDist/iup
/* replace the common dialog SetChildrenPosition method because of 
   the menu that it is inside the dialog. */
static void gtkDialogSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int menu_h = gtkDialogGetMenuSize(ih);
  (void)x;
  (void)y;

  /* Child coordinates are relative to client left-top corner. */
  iupBaseSetPosition(ih->firstchild, 0, menu_h);
}
예제 #10
0
파일: iup_frame.c 프로젝트: Airr/iup_mac
static void iFrameSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  /* IupFrame is the native parent of its children,
     so the position is restarted at (0,0) */

  iupdrvFrameGetDecorOffset(ih, &x, &y);

  /* Child coordinates are relative to client left-top corner. */
  iupBaseSetPosition(ih->firstchild, x, y);
}
예제 #11
0
static void iGLFrameSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
    if (ih->firstchild)
    {
        int dx, dy;
        iGLFrameGetDecorOffset(ih, &dx, &dy);

        iupBaseSetPosition(ih->firstchild, x + dx, y + dy);
    }
}
예제 #12
0
static void iSplitSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  Ihandle *child1, *child2 = NULL;
  child1 = ih->firstchild->brother;
  if (child1)
    child2 = child1->brother;

  if (ih->data->orientation == ISPLIT_VERT)
  {
    if (child1)
      iupBaseSetPosition(child1, x, y);
    x += iSplitGetWidth1(ih);

    /* bar */
    iupBaseSetPosition(ih->firstchild, x, y);
    x += ih->data->barsize;

    if (child2)
      iupBaseSetPosition(child2, x, y);
  }
  else /* ISPLIT_HORIZ */
  {
    if (child1)
      iupBaseSetPosition(child1, x, y);
    y += iSplitGetHeight1(ih);

    /* bar */
    iupBaseSetPosition(ih->firstchild, x, y);
    y += ih->data->barsize;

    if (child2)
      iupBaseSetPosition(child2, x, y);
  }
}
예제 #13
0
static void iCboxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int cx, cy;
  Ihandle* child;

  for (child = ih->firstchild; child; child = child->brother)
  {
    cx = iupAttribGetInt(child, "CX");
    cy = iupAttribGetInt(child, "CY");

    /* update child */
    iupBaseSetPosition(child, x+cx, y+cy);
  }
}
예제 #14
0
static void iTabsSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  /* IupTabs is the native parent of its children,
     so the position is restarted at (0,0).
     In all systems, each tab is a native window covering the client area.
     Child coordinates are relative to client left-top corner of the tab page. */
  Ihandle* child;
  (void)x;
  (void)y;
  for (child = ih->firstchild; child; child = child->brother)
  {
    iupBaseSetPosition(child, 0, 0);
  }
}
예제 #15
0
파일: iup_scrollbox.c 프로젝트: defdef/iup
static int iScrollBoxScroll_CB(Ihandle *ih, int op, float posx, float posy)
{
  if (ih->firstchild)
  {
    if (IupGetInt(ih, "DX") > IupGetInt(ih, "XMAX")-iupdrvGetScrollbarSize())
      posx = 0;
    if (IupGetInt(ih, "DY") > IupGetInt(ih, "YMAX")-iupdrvGetScrollbarSize())
      posy = 0;

    iupBaseSetPosition(ih->firstchild, -(int)posx, -(int)posy);
    iupLayoutUpdate(ih->firstchild);
  }
  (void)op;
  return IUP_DEFAULT;
}
예제 #16
0
static void iDialogSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  if (ih->firstchild)
  {
    char* offset = iupAttribGet(ih, "CHILDOFFSET");

    /* Native container, position is reset */
    x = 0;
    y = 0;

    if (offset) iupStrToIntInt(offset, &x, &y, 'x');

    /* Child coordinates are relative to client left-top corner. */
    iupBaseSetPosition(ih->firstchild, x, y);
  }
}
예제 #17
0
static void iTabsSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  /* In all systems, each tab is a native window covering the client area.
     Child coordinates are relative to client left-top corner of the tab page. */
  Ihandle* child;
  char* offset = iupAttribGet(ih, "CHILDOFFSET");

  /* Native container, position is reset */
  x = 0;
  y = 0;

  if (offset) iupStrToIntInt(offset, &x, &y, 'x');

  for (child = ih->firstchild; child; child = child->brother)
    iupBaseSetPosition(child, x, y);
}
예제 #18
0
파일: iup_glexpander.c 프로젝트: defdef/iup
static void iGLExpanderSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  Ihandle *child = ih->firstchild;
  if (child)
  {
    int bar_size = iGLExpanderGetBarSize(ih);

    if (ih->data->position == IEXPANDER_LEFT)
      x += bar_size;
    else if (ih->data->position == IEXPANDER_TOP)
      y += bar_size;

    if (ih->data->state == IEXPANDER_OPEN)
      iupBaseSetPosition(child, x, y);
  }
}
예제 #19
0
static void iGLCanvasBoxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  Ihandle* child;
  int horiz_margin = 0, vert_margin = 0;

  IupGetIntInt(ih, "MARGIN", &horiz_margin, &vert_margin);

  /* since GLCanvas is a native container ignore parameters x and y */

  for (child = ih->firstchild; child; child = child->brother)
  {
    int border = iupAttribGetBoolean(ih, "BORDER");

    int vert_pos = iGLCanvasBoxGetVerticalAlign(child);
    int horiz_pos = iGLCanvasBoxGetHorizontalAlign(child);

    if (vert_pos == IUP_ALIGN_ACENTER)
      y = (ih->currentheight - 2* border - child->currentheight) / 2;
    else if (vert_pos == IUP_ALIGN_ABOTTOM)
      y = ih->currentheight - 2 * border - child->currentheight - vert_margin;
    else if (vert_pos == IUP_ALIGN_ATOP)
      y = vert_margin;
    else  /* FLOAT */
      y = child->y;

    if (horiz_pos == IUP_ALIGN_ACENTER)
      x = (ih->currentwidth - 2 * border - child->currentwidth) / 2;
    else if (horiz_pos == IUP_ALIGN_ARIGHT)
      x = ih->currentwidth - 2 * border - child->currentwidth - horiz_margin;
    else if (horiz_pos == IUP_ALIGN_ALEFT)
      x = horiz_margin;
    else  /* FLOAT */ 
      x = child->x;

    /* do not include border in the positioning. It is already considered in CLIENTOFFSET. */

    iupBaseSetPosition(child, x, y);
  }
}
예제 #20
0
static void iExpanderSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  Ihandle *child = ih->firstchild->brother;
  int bar_size = iExpanderGetBarSize(ih);

  /* always position bar */
  if (ih->data->position == IEXPANDER_LEFT)
  {
    iupBaseSetPosition(ih->firstchild, x, y);
    x += bar_size;
  }
  else if (ih->data->position == IEXPANDER_RIGHT)
    iupBaseSetPosition(ih->firstchild, x + ih->currentwidth - bar_size, y);
  else if (ih->data->position == IEXPANDER_BOTTOM)
    iupBaseSetPosition(ih->firstchild, x, y + ih->currentheight - bar_size);
  else /* IEXPANDER_TOP */
  {
    iupBaseSetPosition(ih->firstchild, x, y);
    y += bar_size;
  }

  if (child)
  {
    if (ih->data->state == IEXPANDER_OPEN)
      iupBaseSetPosition(child, x, y);
    else if (ih->data->state == IEXPANDER_OPEN_FLOAT)
    {
      if (ih->data->position == IEXPANDER_RIGHT)
        x -= child->currentwidth;
      else if (ih->data->position == IEXPANDER_BOTTOM)
        y -= child->currentheight;

      iupBaseSetPosition(child, x, y);
    }
  }
}
예제 #21
0
static void iGridBoxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int dx, dy, i, *line_pos, 
      lin, col, *col_pos,
      *alignment_col, *alignment_lin, *col_width, *lin_height;
  Ihandle* child;
  Ihandle** child_array = NULL;

  col_pos = (int*)malloc(ih->data->num_col *sizeof(int));
  line_pos = (int*)malloc(ih->data->num_lin *sizeof(int));
  alignment_col = (int*)malloc(ih->data->num_col *sizeof(int));
  alignment_lin = (int*)malloc(ih->data->num_lin *sizeof(int));
  col_width = (int*)calloc(ih->data->num_col, sizeof(int));
  lin_height = (int*)calloc(ih->data->num_lin, sizeof(int));

  if (!ih->data->homogeneous_width || !ih->data->homogeneous_height)
    child_array = iGridBoxGetChildArray(ih);

  for (col=0; col<ih->data->num_col; col++)
  {
    if (ih->data->homogeneous_width)
      col_width[col] = ih->data->homogeneous_width;
    else
      col_width[col] = iGridBoxGetColWidth(ih, child_array, col);

    if (col==0)
      col_pos[col] = ih->data->margin_horiz;
    else
      col_pos[col] = col_pos[col - 1] + col_width[col - 1] + ih->data->gap_col;

    alignment_col[col] = iGridBoxGetAlignmentCol(ih, col);
  }

  for (lin=0; lin<ih->data->num_lin; lin++)
  {
    if (ih->data->homogeneous_height)
      lin_height[lin] = ih->data->homogeneous_height;
    else
      lin_height[lin] = iGridBoxGetLinHeight(ih, child_array, lin);

    if (lin == 0)
      line_pos[lin] = ih->data->margin_vert;
    else
      line_pos[lin] = line_pos[lin - 1] + lin_height[lin - 1] + ih->data->gap_lin;

    alignment_lin[lin] = iGridBoxGetAlignmentLin(ih, lin);
  }

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

      if (alignment_lin[lin] == IUP_ALIGN_ACENTER)
        dy = (lin_height[lin] - child->currentheight)/2;
      else if (alignment_lin[lin] == IUP_ALIGN_ABOTTOM)
        dy = lin_height[lin] - child->currentheight;
      else  /* IUP_ALIGN_ATOP */
        dy = 0;
      if (dy<0) dy = 0;

      if (alignment_col[col] == IUP_ALIGN_ACENTER)
        dx = (col_width[col] - child->currentwidth)/2;
      else if (alignment_col[col] == IUP_ALIGN_ARIGHT)
        dx = col_width[col] - child->currentwidth;
      else  /* IUP_ALIGN_ALEFT */     
        dx = 0;
      if (dx<0) dx = 0;

      /* update child */
      iupBaseSetPosition(child, x+col_pos[col]+dx, y+line_pos[lin]+dy);

      i++;
    }
  }

  if (child_array) free(child_array);
  free(alignment_col);
  free(alignment_lin);
  free(col_width);
  free(lin_height);
  free(col_pos);
  free(line_pos);
}
예제 #22
0
파일: iup_gridbox.c 프로젝트: defdef/iup
static void iGridBoxSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int dx, dy, i, *line_pos, 
      lin, col, *col_pos,
      *alignment_col, *alignment_lin, *col_width, *line_height;
  Ihandle* child;

  col_pos = (int*)malloc(ih->data->num_col *sizeof(int));
  line_pos = (int*)malloc(ih->data->num_lin *sizeof(int));
  alignment_col = (int*)malloc(ih->data->num_col *sizeof(int));
  alignment_lin = (int*)malloc(ih->data->num_lin *sizeof(int));
  col_width = (int*)malloc(ih->data->num_col *sizeof(int));
  line_height = (int*)malloc(ih->data->num_lin *sizeof(int));

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

      /* only for the reference line,
         the reference line defines the width of each column */
      if (lin==ih->data->size_lin)
      {
        if (ih->data->homogeneous_width)
          col_width[col] = ih->data->homogeneous_width + ih->data->gap_col;
        else
          col_width[col] = child->currentwidth + ih->data->gap_col;

        alignment_col[col] = iGridBoxGetAlignmentCol(ih, col);
      }

      /* only for the reference column,
         the reference column defines the height of each line */
      if (col==ih->data->size_col)
      {
        if (ih->data->homogeneous_height)
          line_height[lin] = ih->data->homogeneous_height + ih->data->gap_lin;
        else
          line_height[lin] = child->currentheight + ih->data->gap_lin;

        alignment_lin[lin] = iGridBoxGetAlignmentLin(ih, lin);
      }

      i++;
    }
  }

  for (col=0; col<ih->data->num_col; col++)
  {
    if (col==0)
      col_pos[col] = ih->data->margin_x;
    else
      col_pos[col] = col_pos[col-1] + col_width[col-1];
  }

  for (lin=0; lin<ih->data->num_lin; lin++)
  {
    if (lin==0)
      line_pos[lin] = ih->data->margin_y;
    else
      line_pos[lin] = line_pos[lin-1] + line_height[lin-1];
  }

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

      if (alignment_lin[lin] == IUP_ALIGN_ACENTER)
        dy = (line_height[lin] - child->currentheight)/2;
      else if (alignment_lin[lin] == IUP_ALIGN_ABOTTOM)
        dy = line_height[lin] - child->currentheight;
      else  /* IUP_ALIGN_ATOP */
        dy = 0;
      if (dy<0) dy = 0;

      if (alignment_col[col] == IUP_ALIGN_ACENTER)
        dx = (col_width[col] - child->currentwidth)/2;
      else if (alignment_col[col] == IUP_ALIGN_ARIGHT)
        dx = col_width[col] - child->currentwidth;
      else  /* IUP_ALIGN_ALEFT */
        dx = 0;
      if (dx<0) dx = 0;

      /* update child */
      iupBaseSetPosition(child, x+col_pos[col]+dx, y+line_pos[lin]+dy);

      i++;
    }
  }

  free(alignment_col);
  free(alignment_lin);
  free(col_width);
  free(line_height);
  free(col_pos);
  free(line_pos);
}
예제 #23
0
파일: iup_glexpander.c 프로젝트: defdef/iup
static int iGLExpanderMOTION_CB(Ihandle* ih, int x, int y, char* status)
{
  int redraw = 0;
  int bar_size = iGLExpanderGetBarSize(ih);
  Ihandle* gl_parent = (Ihandle*)iupAttribGet(ih, "GL_CANVAS");

  /* shift to bar position */
  if (ih->data->position == IEXPANDER_RIGHT)
    x += ih->currentwidth - 1 - bar_size;
  else if (ih->data->position == IEXPANDER_BOTTOM)
    y += ih->currentheight - 1 - bar_size;

  /* special highlight processing for handler area */
  if (iGLExpanderIsInsideHandler(ih, x, y, bar_size))
  {
    if (!iupAttribGet(ih, "HIGHLIGHT"))
    {
      redraw = 1;
      iupAttribSet(ih, "HIGHLIGHT", "1");
    }
  }
  else
  {
    if (iupAttribGet(ih, "HIGHLIGHT"))
    {
      redraw = 1;
      iupAttribSet(ih, "HIGHLIGHT", NULL);
    }
  }

  if (ih->data->position == IEXPANDER_TOP && !ih->data->moving)
  {
    if (y >= IEXPAND_SPACING + IEXPAND_BACK_MARGIN && y <= bar_size - IEXPAND_SPACING - IEXPAND_BACK_MARGIN)
    {
      int old_state[4];
      old_state[1] = ih->data->extra_buttons_state[1];
      old_state[2] = ih->data->extra_buttons_state[2];
      old_state[3] = ih->data->extra_buttons_state[3];

      if ((x >= ih->currentwidth - (IEXPAND_BUTTON_SIZE + IEXPAND_SPACING) - IEXPAND_BACK_MARGIN) &&
        (x < ih->currentwidth - IEXPAND_SPACING - IEXPAND_BACK_MARGIN))
      {
        if (ih->data->extra_buttons_state[1] == 0)
          ih->data->extra_buttons_state[1] = -1;  /* highlight if not pressed */
      }
      else
      {
        if (ih->data->extra_buttons_state[1] != 0)
          ih->data->extra_buttons_state[1] = 0;
      }

      if (ih->data->extra_buttons > 1)
      {
        if ((x >= ih->currentwidth - 2 * (IEXPAND_BUTTON_SIZE + IEXPAND_SPACING) - IEXPAND_BACK_MARGIN) &&
          (x < ih->currentwidth - (IEXPAND_BUTTON_SIZE + 2 * IEXPAND_SPACING) - IEXPAND_BACK_MARGIN))
        {
          if (ih->data->extra_buttons_state[2] == 0)
            ih->data->extra_buttons_state[2] = -1;  /* highlight if not pressed */
        }
        else
        {
          if (ih->data->extra_buttons_state[2] != 0)
            ih->data->extra_buttons_state[2] = 0;
        }
      }

      if (ih->data->extra_buttons == 3)
      {
        if ((x >= ih->currentwidth - 3 * (IEXPAND_BUTTON_SIZE + IEXPAND_SPACING) - IEXPAND_BACK_MARGIN) &&
          (x < ih->currentwidth - (2 * IEXPAND_BUTTON_SIZE + 3 * IEXPAND_SPACING) - IEXPAND_BACK_MARGIN))
        {
          if (ih->data->extra_buttons_state[3] == 0)
            ih->data->extra_buttons_state[3] = -1;  /* highlight if not pressed */
        }
        else
        {
          if (ih->data->extra_buttons_state[3] != 0)
            ih->data->extra_buttons_state[3] = 0;
        }
      }

      if (old_state[1] != ih->data->extra_buttons_state[1] ||
        old_state[2] != ih->data->extra_buttons_state[2] ||
        old_state[3] != ih->data->extra_buttons_state[3])
      {
        iupGLSubCanvasRedraw(ih);
        redraw = 0;
      }
    }
  }

  if (ih->data->moving)
  {
    x += ih->x;
    y += ih->y;

    if ((x != ih->data->start_x) || (y != ih->data->start_y))
    {
      IFnii cb = (IFnii)IupGetCallback(ih, "MOVE_CB");

      /* clear canvas box alignment */
      iupAttribSet(ih, "VERTICALALIGN", NULL);
      iupAttribSet(ih, "HORIZONTALALIGN", NULL);

      iupBaseSetPosition(ih, ih->x + (x - ih->data->start_x), ih->y + (y - ih->data->start_y));

      IupSetAttribute(gl_parent, "REDRAW", NULL);  /* redraw the whole box */
      redraw = 0;

      if (cb)
        cb(ih, ih->x, ih->y);
    }

    ih->data->start_x = x;
    ih->data->start_y = y;
  }

  if (redraw)
    iupGLSubCanvasRedraw(ih);

  (void)status;
  return IUP_DEFAULT;
}
예제 #24
0
static void iScrollBoxUpdatePosition(Ihandle* ih, float posx, float posy)
{
  iupBaseSetPosition(ih->firstchild, -(int)posx, -(int)posy);
}