Exemplo n.º 1
0
/******************************************************************

  DrawSubMenu() -- This function draws the specified submenu gadget.

******************************************************************/
GS_errorType
DrawSubMenu(GSgadgetStruct *sm)
{
   int 	i;
   char *item_label;

   GS_errorType ExtractItemLabel();


   if (sm->gadget_type == GSSUBMENU) {

      /*  draw background of sub menu
       */
      SRGP_setColor(sm->gadget_bgd_color);
      SRGP_fillRectangle(sm->gadget_extent);

      /*  draw outline of sub menu
       */
      SRGP_setColor(sm->gadget_bor_color);
      SRGP_rectangle(sm->gadget_extent);

      /*  draw menu labels of sub menu
       */
      SRGP_setColor(sm->gadget_fgd_color);

      for (i = 0; i < sm->submenu->item_count; i++) {
         ExtractItemLabel(i, sm->submenu->item_list, item_label);
         SRGP_text(sm->submenu->item_pos[i], item_label);
      }
   }
   else
      return(GSNOTSUBMENUERR);

   return(GSNOERROR);
} /* end of DrawSubMenu()*/
Exemplo n.º 2
0
/******************************************************************

  DrawMenuBar() -- This function draws the specified menu bar gadget.

******************************************************************/
GS_errorType
DrawMenuBar(GSgadgetStruct *mb)
{
   int 	i;
   char *item_label;

   GS_errorType ExtractItemLabel();


   if (mb->gadget_type == GSMENUBAR) {

      /*  draw background of menu bar 
       */
      SRGP_setColor(mb->gadget_bgd_color);
      SRGP_fillRectangle(mb->gadget_extent);

      /*  draw outline of menu bar
       */
      SRGP_setColor(mb->gadget_bor_color);
      SRGP_rectangle(mb->gadget_extent);

      /*  draw menu labels of menu bar
       */
      SRGP_setColor(mb->gadget_fgd_color);

      for (i = 0; i < mb->menubar->item_count; i++) {
         ExtractItemLabel(i, mb->menubar->item_list, item_label);
         SRGP_text(mb->menubar->item_pos[i], item_label);
      }
   }
   else
      return(GSNOTMENUBARERR);

   return(GSNOERROR);
} /* end of DrawMenuBar()*/
Exemplo n.º 3
0
/******************************************************************

  DrawPushButton() -- This function draws the specified push 
		button gadget.

******************************************************************/
GS_errorType
DrawPushButton(GSgadgetStruct *bg)
{
   if (bg->gadget_type == GSPUSHBUTTON) {

      /*  draw background of button 
       */
      SRGP_setColor(bg->gadget_bgd_color);
      SRGP_fillRectangle(bg->gadget_extent);

      /*  draw outline of button
       */
      SRGP_setColor(bg->gadget_bor_color);
      SRGP_rectangle(bg->gadget_extent);

      /*  draw label of button
       */
      SRGP_setColor(bg->gadget_fgd_color);
      SRGP_text(bg->button->label_pos, bg->button->label);
   }
   else
      return(GSNOTBUTTONERR);

   return(GSNOERROR);
} /* end of DrawPushButton() */
Exemplo n.º 4
0
static void
EVUprint (char *text)
{
   SRGP_inquireAttributes (&bund);
   SRGP_setColor (COLOR_BLACK);
   SRGP_setWriteMode (WRITE_REPLACE);
   SRGP_setClipRectangle (SRGP_defRectangle(0,0,1023,799));
   SRGP_text (SRGP_defPoint(15,ycoord), text);
   ycoord -= ydelta;
   SRGP_setAttributes (&bund);
}
Exemplo n.º 5
0
/******************************************************************

  DrawToggleButton() -- This function draws the specified toggle 
		button gadget.

******************************************************************/
GS_errorType
DrawToggleButton(GSgadgetStruct *bg)
{
   if (bg->gadget_type == GSTOGBUTTON) {

      switch(bg->togbutton->shape)
      {
         case GSTOGSQUARE:
            if (bg->togbutton->state == FALSE)
            {
               /*  draw background of button 
                */
               SRGP_setColor(bg->gadget_bgd_color);
               SRGP_fillRectangle(bg->togbutton->square);

               /*  draw outline of button
                */
               SRGP_setColor(bg->gadget_bor_color);
               SRGP_rectangle(bg->togbutton->square);
            }
            else
            {
               /*  draw background of button 
                */
               SRGP_setColor(bg->gadget_bor_color);
               SRGP_fillRectangle(bg->togbutton->square);

               /*  draw outline of button
                */
               SRGP_setColor(bg->gadget_bgd_color);
               SRGP_rectangle(bg->togbutton->square);
            }
            break;
         case GSTOGDIAMOND:
            break;
         case GSTOGCIRCLE:
            break;
         default:
            break;
      }

      /*  draw label of button
       */
      SRGP_setColor(bg->gadget_fgd_color);
      SRGP_text(bg->togbutton->label_pos, bg->togbutton->label);
   }
   else
      return(GSNOTBUTTONERR);

   return(GSNOERROR);
} /* end of DrawToggleButton() */
Exemplo n.º 6
0
void print_coords(infoptr pic, point mouse_pos, rectangle box)
{
  char coord_string[20];
  dpoint coords;

  /* Peitetään vanha teksti */
  SRGP_setColor(SRGP_BLACK);
  SRGP_fillRectangle(box);
  
  /* Muotoillaan uusi teksti */
  coords = to_dpoint(mouse_pos, pic);
  sprintf(coord_string, "(%.17f, %.17f)", coords.x, coords.y);
  SRGP_setColor(SRGP_WHITE);
  SRGP_setClipRectangle(box); /* Varmistetaan ettei teksti ylitä rajoja */
  SRGP_text(box.bottom_left, coord_string);
  SRGP_setClipRectangle(pic->area);
}