home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / FSGFX.ZIP / G_DRWBTN.C < prev    next >
C/C++ Source or Header  |  1990-03-07  |  674b  |  34 lines

  1. /* g_drwbutn.c */
  2. /* draw a button with a text message in the middle */
  3.  
  4. #include <string.h>
  5. #include "mygraph.h"
  6.  
  7. struct rect g_drwbtn(int x,int y, char message1[], char message2[])
  8. {
  9.     struct rect inner;
  10.     struct rect outer;
  11.     int width;
  12.     char temp[80];
  13.  
  14.     strcpy(temp, message1);
  15.     strcat(temp,message2);
  16.  
  17.     width = (strlen(temp)*8)+16;
  18.     g_puts(x + 8, y + (14 / 3),    temp);
  19.  
  20.     outer.pt1.x = x;
  21.     outer.pt1.y = y;
  22.     outer.pt2.x = x + width;
  23.     outer.pt2.y = y + 14; /* 14 = height */
  24.     g_rect(outer);
  25.  
  26.     inner.pt1.x = x + 2;
  27.     inner.pt1.y = y + 1;
  28.     inner.pt2.x = inner.pt1.x + width-4;
  29.     inner.pt2.y = inner.pt1.y + 14;
  30.     g_rect(inner);
  31.     return(inner);
  32. }
  33.  
  34.