Exemplo n.º 1
0
Arquivo: dialog.c Projeto: dyne/MuSE
/*
 * This lets the user select the button.
 */
int activateCDKDialog (CDKDIALOG *dialog, chtype *actions)
{
   /* Declare local variables. */
   chtype input = 0;
   int ret;

   /* Draw the dialog box. */
   drawCDKDialog (dialog, ObjOf(dialog)->box);

   /* Lets move to the first button. */
   writeChtypeAttrib (dialog->win,
			dialog->buttonPos[dialog->currentButton],
			dialog->boxHeight-2,
			dialog->buttonLabel[dialog->currentButton],
			dialog->highlight,
			HORIZONTAL,
			0, dialog->buttonLen[dialog->currentButton]);
   wrefresh (dialog->win);

   /* Check if actions is null. */
   if (actions == 0)
   {
      for (;;)
      {
	 /* Get the input. */
	 input = wgetch (dialog->win);

	 /* Inject the character into the widget. */
	 ret = injectCDKDialog (dialog, input);
	 if (dialog->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }
   else
   {
      int length = chlen (actions);
      int x = 0;

      /* Inject each character one at a time. */
      for (x=0; x < length; x++)
      {
	 ret = injectCDKDialog (dialog, actions[x]);
	 if (dialog->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }

   /* Set the exit type and exit. */
   dialog->exitType = vEARLY_EXIT;
   return -1;
}
Exemplo n.º 2
0
Arquivo: fselect.c Projeto: dyne/MuSE
/*
 * This means you want to use the given file selector. It takes input
 * from the keyboard, and when it's done, it fills the entry info
 * element of the structure with what was typed.
 */
char *activateCDKFselect (CDKFSELECT *fselect, chtype *actions)
{
   /* Declare local variables. */
   chtype input = 0;
   char *ret	= 0;

   /* Draw the widget. */
   drawCDKFselect (fselect, ObjOf(fselect)->box);

   /* Check if 'actions' is null. */
   if (actions == 0)
   {
      for (;;)
      {
	 /* Get the input. */
	 input = wgetch (fselect->entryField->fieldWin);

	 /* Inject the character into the widget. */
	 ret = injectCDKFselect (fselect, input);
	 if (fselect->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }
   else
   {
      int length = chlen (actions);
      int x =0;

      /* Inject each character one at a time. */
      for (x=0; x < length; x++)
      {
	 ret = injectCDKFselect (fselect, actions[x]);
	 if (fselect->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }

   /* Set the exit type and exit. */
   fselect->exitType = vEARLY_EXIT;
   return 0;
}
Exemplo n.º 3
0
Arquivo: fscale.c Projeto: dyne/MuSE
/*
 * This allows the person to use the scale field.
 */
float activateCDKFScale (CDKFSCALE *scale, chtype *actions)
{
   /* Declare local variables. */
   float ret;

   /* Draw the scale widget. */
   drawCDKFScale (scale, ObjOf(scale)->box);

   /* Check if actions is null. */
   if (actions == 0)
   {
      chtype input = 0;
      for (;;)
      {
	 /* Get the input. */
	 input = wgetch (scale->fieldWin);

	 /* Inject the character into the widget. */
	 ret = injectCDKFScale (scale, input);
	 if (scale->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }
   else
   {
      int length = chlen (actions);
      int x = 0;

      /* Inject each character one at a time. */
      for (x=0; x < length; x++)
      {
	 ret = injectCDKFScale (scale, actions[x]);
	 if (scale->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }

   /* Set the exit type and return. */
   scale->exitType = vEARLY_EXIT;
   return -1;
}
Exemplo n.º 4
0
/*
 * This allows the person to use the widget's data field.
 */
unsigned activateCDKUScale (CDKUSCALE *widget, chtype *actions)
{
    unsigned ret;

    /* Draw the widget. */
    drawCDKUScale (widget, ObjOf(widget)->box);

    if (actions == 0)
    {
        chtype input = 0;
        boolean functionKey;

        for (;;)
        {
            input = getchCDKObject (ObjOf(widget), &functionKey);

            /* Inject the character into the widget. */
            ret = injectCDKUScale (widget, input);
            if (widget->exitType != vEARLY_EXIT)
            {
                return ret;
            }
        }
    }
    else
    {
        int length = chlen (actions);
        int x = 0;

        /* Inject each character one at a time. */
        for (x=0; x < length; x++)
        {
            ret = injectCDKUScale (widget, actions[x]);
            if (widget->exitType != vEARLY_EXIT)
            {
                return ret;
            }
        }
    }

    /* Set the exit type and return. */
    setExitType(widget, 0);
    return unknownUnsigned;
}
Exemplo n.º 5
0
/*
 * This actually does all the 'real' work of managing the scrolling list.
 */
int activateCDKScroll (CDKSCROLL *scrollp, chtype *actions)
{
   /* Draw the scrolling list */
   drawCDKScroll (scrollp, ObjOf (scrollp)->box);

   if (actions == 0)
   {
      chtype input;
      boolean functionKey;
      int ret;

      for (;;)
      {
	 fixCursorPosition (scrollp);
	 input = (chtype)getchCDKObject (ObjOf (scrollp), &functionKey);

	 /* Inject the character into the widget. */
	 ret = injectCDKScroll (scrollp, input);
	 if (scrollp->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }
   else
   {
      int length = chlen (actions);
      int i = 0;
      int ret;

      /* Inject each character one at a time. */
      for (i = 0; i < length; i++)
      {
	 ret = injectCDKScroll (scrollp, actions[i]);
	 if (scrollp->exitType != vEARLY_EXIT)
	    return ret;
      }
   }

   /* Set the exit type for the widget and return. */
   setExitType (scrollp, 0);
   return -1;
}
Exemplo n.º 6
0
/*
 * This was added for the builder.
 */
int activateCDKButton (CDKBUTTON *button, chtype *actions)
{
   chtype input = 0;
   boolean functionKey;
   int ret;

   drawCDKButton (button, ObjOf (button)->box);

   if (actions == 0)
   {
      for (;;)
      {
	 input = (chtype)getchCDKObject (ObjOf (button), &functionKey);

	 /* Inject the character into the widget. */
	 ret = injectCDKButton (button, input);
	 if (button->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }
   else
   {
      int length = chlen (actions);
      int x = 0;

      /* Inject each character one at a time. */
      for (x = 0; x < length; x++)
      {
	 ret = injectCDKButton (button, actions[x]);
	 if (button->exitType != vEARLY_EXIT)
	 {
	    return ret;
	 }
      }
   }

   /* Set the exit type and exit. */
   setExitType (button, 0);
   return -1;
}