Beispiel #1
0
/*
 * This draws the widget.
 */
static void drawCDKDScaleField (CDKDSCALE *widget)
{
   char temp[256];

   werase (widget->fieldWin);

   /* Draw the value in the field. */
   {
      char format[256];
      int digits = MINIMUM(widget->digits, 30);
      sprintf (format, "%%.%if", digits);
      sprintf (temp, format, widget->current);
   }
   writeCharAttrib (widget->fieldWin,
		    widget->fieldWidth - (int)strlen(temp) - 1,
		    0,
		    temp,
		    widget->fieldAttr,
		    HORIZONTAL,
		    0,
		    (int)strlen(temp));

   moveToEditPosition(widget, widget->fieldEdit);
   wrefresh (widget->fieldWin);
}
Beispiel #2
0
/*
 * This writes out a char * string with no attributes.
 */
void writeChar (WINDOW *window,
		int xpos,
		int ypos,
		char *string,
		int align,
		int start,
		int end)
{
   writeCharAttrib (window, xpos, ypos, string, A_NORMAL, align, start, end);
}
Beispiel #3
0
/*
 * This draws the widget.
 */
static void drawCDKUScaleField (CDKUSCALE *widget)
{
    char temp[256];

    werase (widget->fieldWin);

    /* Draw the value in the field. */
    sprintf (temp, "%u", widget->current);
    writeCharAttrib (widget->fieldWin,
                     widget->fieldWidth - (int)strlen(temp) - 1,
                     0,
                     temp,
                     widget->fieldAttr,
                     HORIZONTAL,
                     0,
                     (int)strlen(temp));

    moveToEditPosition(widget, widget->fieldEdit);
    wrefresh (widget->fieldWin);
}
Beispiel #4
0
/*
 * This draws the scale widget.
 */
static void drawCDKFScaleField (CDKFSCALE *scale)
{
   /* Declare the local variables. */
   char temp[256], format[256];

   /* Erase the field. */
   werase (scale->fieldWin);

   /* Draw the value in the field. */
   sprintf (format, "%%.%if", scale->digits);
   sprintf (temp, format, scale->current);
   writeCharAttrib (scale->fieldWin,
			scale->fieldWidth-(int)strlen(temp)-1, 0, temp,
			scale->fieldAttr,
			HORIZONTAL, 0,
			(int)strlen(temp));

   /* Refresh the field window. */
   touchwin (scale->fieldWin);
   wrefresh (scale->fieldWin);
}
Beispiel #5
0
/*
 * This draws the widget.
 */
static void drawCDKFSliderField (CDKFSLIDER *widget)
{
   int fillerCharacters, x;
   char temp[256];
   float step = ((float)widget->fieldWidth
   		/ (float)(widget->high - widget->low));

   /* Determine how many filler characters need to be drawn. */
   fillerCharacters = (int)((widget->current - widget->low) * step);

   werase (widget->fieldWin);

   /* Add the character to the window. */
   for (x=0; x < fillerCharacters; x++)
   {
      mvwaddch (widget->fieldWin, 0, x, widget->filler);
   }

   /* Draw the value in the field. */
   {
      char format[256];
      int digits = MINIMUM(widget->digits, 30);
      sprintf (format, "%%.%if", digits);
      sprintf (temp, format, widget->current);
   }
   writeCharAttrib (widget->fieldWin,
		    widget->fieldWidth,
		    0,
		    temp,
		    A_NORMAL,
		    HORIZONTAL,
		    0,
		    (int)strlen(temp));

   moveToEditPosition(widget, widget->fieldEdit);
   wrefresh (widget->fieldWin);
}