示例#1
0
文件: dialog.c 项目: dyne/MuSE
/*
 * This draws the dialog buttons and the separation line.
 */
void drawCDKDialogButtons (CDKDIALOG *dialog)
{
   /* Declare local variables. */
   int x;

   for (x=0; x < dialog->buttonCount; x++)
   {
      writeChtype (dialog->win,
			dialog->buttonPos[x],
			dialog->boxHeight-2,
			dialog->buttonLabel[x],
			HORIZONTAL, 0,
			dialog->buttonLen[x]);
   }
   writeChtypeAttrib (dialog->win,
			dialog->buttonPos[dialog->currentButton],
			dialog->boxHeight-2,
			dialog->buttonLabel[dialog->currentButton],
			dialog->highlight,
			HORIZONTAL, 0,
			dialog->buttonLen[dialog->currentButton]);

   /* Draw the separation line. */
   if (dialog->separator)
   {
      for (x=1; x < dialog->boxWidth-1; x++)
      {
	 mvwaddch (dialog->win, dialog->boxHeight-3, x, ACS_HLINE | dialog->BoxAttrib);
      }
      mvwaddch (dialog->win, dialog->boxHeight-3, 0, ACS_LTEE | dialog->BoxAttrib);
      mvwaddch (dialog->win, dialog->boxHeight-3, getmaxx(dialog->win)-1, ACS_RTEE | dialog->BoxAttrib);
   }
}
示例#2
0
文件: draw.c 项目: Chaduke/bah.mod
/*
 * This writes out a chtype * string.
 */
void writeChtype (WINDOW *window,
		  int xpos,
		  int ypos,
		  chtype *string,
		  int align,
		  int start,
		  int end)
{
   writeChtypeAttrib (window, xpos, ypos, string, A_NORMAL, align, start, end);
}
示例#3
0
文件: dialog.c 项目: 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;
}
示例#4
0
文件: scroll.c 项目: Chaduke/bah.mod
static void drawCDKScrollCurrent (CDKSCROLL *s)
{
   /* Rehighlight the current menu item. */
   int screenPos = s->itemPos[s->currentItem] - s->leftChar;
   chtype highlight = HasFocusObj (s) ? s->highlight : A_NORMAL;

   writeChtypeAttrib (s->listWin,
		      (screenPos >= 0) ? screenPos : 0,
		      s->currentHigh,
		      s->item[s->currentItem],
		      highlight,
		      HORIZONTAL,
		      (screenPos >= 0) ? 0 : (1 - screenPos),
		      s->itemLen[s->currentItem]);
}