示例#1
0
/*
 * This moves the alphalist field to the given location.
 */
static void _moveCDKAlphalist (CDKOBJS *object,
			       int xplace,
			       int yplace,
			       boolean relative,
			       boolean refresh_flag)
{
   CDKALPHALIST *alphalist = (CDKALPHALIST *)object;

   int currentX = getbegx (alphalist->win);
   int currentY = getbegy (alphalist->win);
   int xpos	= xplace;
   int ypos	= yplace;
   int xdiff	= 0;
   int ydiff	= 0;

   /*
    * If this is a relative move, then we will adjust where we want
    * to move to.
    */
   if (relative)
   {
      xpos = getbegx (alphalist->win) + xplace;
      ypos = getbegy (alphalist->win) + yplace;
   }

   /* Adjust the window if we need to. */
   alignxy (WindowOf (alphalist), &xpos, &ypos, alphalist->boxWidth, alphalist->boxHeight);

   /* Get the difference. */
   xdiff = currentX - xpos;
   ydiff = currentY - ypos;

   /* Move the window to the new location. */
   moveCursesWindow (alphalist->win, -xdiff, -ydiff);
   moveCursesWindow (alphalist->shadowWin, -xdiff, -ydiff);

   /* Move the sub-widgets. */
   moveCDKEntry (alphalist->entryField, xplace, yplace, relative, FALSE);
   moveCDKScroll (alphalist->scrollField, xplace, yplace, relative, FALSE);

   /* Touch the windows so they 'move'. */
   refreshCDKWindow (WindowOf (alphalist));

   /* Redraw the window, if they asked for it. */
   if (refresh_flag)
   {
      drawCDKAlphalist (alphalist, ObjOf (alphalist)->box);
   }
}
示例#2
0
文件: scroll.c 项目: Chaduke/bah.mod
/*
 * This moves the scroll field to the given location.
 */
static void _moveCDKScroll (CDKOBJS *object,
			    int xplace,
			    int yplace,
			    boolean relative,
			    boolean refresh_flag)
{
   /* *INDENT-EQLS* */
   CDKSCROLL *scrollp = (CDKSCROLL *)object;
   int currentX       = getbegx (scrollp->win);
   int currentY       = getbegy (scrollp->win);
   int xpos           = xplace;
   int ypos           = yplace;
   int xdiff          = 0;
   int ydiff          = 0;

   /*
    * If this is a relative move, then we will adjust where we want
    * to move to.
    */
   if (relative)
   {
      xpos = getbegx (scrollp->win) + xplace;
      ypos = getbegy (scrollp->win) + yplace;
   }

   /* Adjust the window if we need to. */
   alignxy (WindowOf (scrollp), &xpos, &ypos, scrollp->boxWidth, scrollp->boxHeight);

   /* Get the difference. */
   xdiff = currentX - xpos;
   ydiff = currentY - ypos;

   /* Move the window to the new location. */
   moveCursesWindow (scrollp->win, -xdiff, -ydiff);
   moveCursesWindow (scrollp->listWin, -xdiff, -ydiff);
   moveCursesWindow (scrollp->shadowWin, -xdiff, -ydiff);
   moveCursesWindow (scrollp->scrollbarWin, -xdiff, -ydiff);

   /* Touch the windows so they 'move'. */
   refreshCDKWindow (WindowOf (scrollp));

   /* Redraw the window, if they asked for it. */
   if (refresh_flag)
   {
      drawCDKScroll (scrollp, ObjOf (scrollp)->box);
   }
}
示例#3
0
文件: scale.c 项目: lavenliu/linuxc
/*
 * This moves the widget's data field to the given location.
 */
static void _moveCDKScale (CDKOBJS *object,
                           int xplace,
                           int yplace,
                           boolean relative,
                           boolean refresh_flag)
{
    CDKSCALE *widget = (CDKSCALE *) object;
    int currentX = getbegx (widget->win);
    int currentY = getbegy (widget->win);
    int xpos = xplace;
    int ypos = yplace;
    int xdiff = 0;
    int ydiff = 0;

    /*
     * If this is a relative move, then we will adjust where we want
     * to move to.
     */
    if (relative)
    {
        xpos = getbegx (widget->win) + xplace;
        ypos = getbegy (widget->win) + yplace;
    }

    /* Adjust the window if we need to. */
    alignxy (WindowOf (widget), &xpos, &ypos, widget->boxWidth, widget->boxHeight);

    /* Get the difference. */
    xdiff = currentX - xpos;
    ydiff = currentY - ypos;

    /* Move the window to the new location. */
    moveCursesWindow (widget->win, -xdiff, -ydiff);
    moveCursesWindow (widget->labelWin, -xdiff, -ydiff);
    moveCursesWindow (widget->fieldWin, -xdiff, -ydiff);
    moveCursesWindow (widget->shadowWin, -xdiff, -ydiff);

    /* Touch the windows so they 'move'. */
    refreshCDKWindow (WindowOf (widget));

    /* Redraw the window, if they asked for it. */
    if (refresh_flag)
    {
        drawCDKScale (widget, ObjOf (widget)->box);
    }
}