home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 328_01 / wbuttond.c < prev    next >
C/C++ Source or Header  |  1991-03-17  |  1KB  |  71 lines

  1. /* WBUTTOND.C
  2.  *
  3.  *    contains wbutton_delete () -- remove a button from the list.
  4.  *
  5.  */
  6. #include "wsys.h"
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. void wbutton_delete (int uval, int redraw)
  14.     {
  15.     WBUTTON *Bptr, **chain;
  16.  
  17.  
  18.  
  19.     chain =  & (w0->winbutton );    /* address of chain */
  20.  
  21.     for (     Bptr = w0->winbutton;
  22.         Bptr;
  23.         chain = &(Bptr->Bchain),  Bptr = Bptr->Bchain )
  24.         {
  25.         if ( Bptr->Bval == uval )
  26.             {
  27.  
  28.             if ( 0== redraw )
  29.                 {
  30.                 /* need to erase button
  31.                  * so setup a 'blank' button.
  32.                  *         in the large model, *(NULL) is not necessarily 0
  33.                  */
  34.                 Bptr-> Btext = " ";
  35.                 }
  36.  
  37.             if ( Bptr-> Bstyle & WBTN_BOX )
  38.                 {
  39.                 /* erase the box first,
  40.                  * then shrink the size counters
  41.                  * so that wbutton_draw will work
  42.                  * in text area only.
  43.                  */
  44.                 wbutton_frame ( Bptr, NO_BORDER, wgetattr() );
  45.  
  46.                 ++(Bptr->Bx);
  47.                 ++(Bptr->By);
  48.                 --(Bptr->Bxend);
  49.                 --(Bptr->Byend);
  50.                 }
  51.  
  52.             wbutton_draw ( Bptr, wgetattr() );
  53.  
  54.             /* unlink button from chain */
  55.             *chain  = Bptr->Bchain;
  56.  
  57.             free ( Bptr );
  58.  
  59.  
  60.             break;        /* found button -- quit */
  61.  
  62.             }
  63.  
  64.  
  65.         }
  66.  
  67.  
  68.     return;    /* wbutton_delete () */
  69.     }
  70.  
  71.