home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / linkedit / linkedit.lha / link-edit / LinkEdit / Box / box_rd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-13  |  1.9 KB  |  102 lines

  1. /* rd.c: File containing all the redrawing routines */
  2.  
  3.  
  4. #include <stdio.h>
  5. #include<X11/Xlib.h>
  6. #include "box_types.h"
  7. #include "box_global.h"
  8.  
  9. ReDrawBoxTitleWindow(gnrc)
  10.  
  11. BoxStatus *gnrc;
  12.  
  13. {
  14.   XWindowAttributes xwa;
  15.   XWindowChanges xwc;
  16.   int x,y;
  17.  
  18.   if(gnrc->TitleWindow == (Window) 0) return(0);
  19.  
  20.   /* Redraw title */
  21.   /* Get information on TopWindow */
  22.  
  23.   XGetWindowAttributes(dpy,gnrc->TopWindow,&xwa);
  24.  
  25.   /* Change size of Title Bar to conform to new Top Window size */
  26.  
  27.   xwc.width = xwa.width;
  28.  
  29.   XConfigureWindow(dpy,gnrc->TitleWindow,(CWWidth),&xwc);
  30.  
  31.   x = (xwa.width - XTextWidth(gnrc->fontstruct,
  32.                                 gnrc->title,strlen(gnrc->title)))/2;
  33.   y = BOX_PAD + gnrc->fth;
  34.  
  35.   XDrawString(dpy,gnrc->TitleWindow,
  36.               gnrc->gc,x,y,gnrc->title,strlen(gnrc->title));
  37.  
  38.  
  39. }
  40.  
  41. ReDrawBoxMessageWindow(gnrc)
  42.  
  43. BoxStatus *gnrc;
  44.  
  45. {
  46.  
  47.   XWindowAttributes xwa;
  48.   XWindowChanges xwc;
  49.   int x,y;
  50.  
  51.   if(gnrc->MessageWindow == (Window) 0) return(0);
  52.  
  53.   /* Get information on TopWindow */
  54.  
  55.   XGetWindowAttributes(dpy,gnrc->TopWindow,&xwa);
  56.  
  57.   /* Change size of Message Bar to conform to new Top Window size */
  58.  
  59.   xwc.width = xwa.width;
  60.  
  61.   XConfigureWindow(dpy,gnrc->MessageWindow,(CWWidth),&xwc);
  62.  
  63.   x = BOX_PAD;
  64.   y = BOX_PAD + gnrc->fth;
  65.  
  66.   XDrawString(dpy,gnrc->MessageWindow,gnrc->reverse_gc,
  67.               x,y,gnrc->message,strlen(gnrc->message));
  68.  
  69. }
  70.  
  71. BoxPrintMessage(gnrc,s)
  72.  
  73. BoxStatus *gnrc;
  74. char *s;
  75.  
  76. {
  77.   fprintf(stderr,"%s\n",s);
  78.   if(gnrc->MessageWindow == (Window) 0) return(0);
  79.   strcpy(gnrc->message,s);
  80.   XClearWindow(dpy,gnrc->MessageWindow);
  81.  
  82.   XDrawString(dpy,gnrc->MessageWindow,gnrc->reverse_gc,
  83.               BOX_PAD,BOX_PAD+gnrc->fth,s,strlen(s));
  84. }
  85.  
  86. ReDrawBoxTopWindow(gnrc)
  87.  
  88. BoxStatus *gnrc;
  89.  
  90. {
  91.   BoxList *bx;
  92.  
  93.   bx = gnrc->box.next;
  94.   while(bx != NULL) {
  95.      if(bx->visible == BOX_YES || 
  96.               (bx->always_visible == BOX_YES)) {
  97.         DrawBox(gnrc,bx);
  98.        }
  99.      bx = bx->next;
  100.     }
  101. }
  102.