home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Enlightenment / enl_DR-0.10.tar.gz / enl_DR-0.10.tar / enl / buttons.c < prev    next >
C/C++ Source or Header  |  1997-05-13  |  2KB  |  101 lines

  1. #include "enlightenment.h"
  2.  
  3. BWin *GetButtonWinID(Window w)
  4. {
  5.    struct blist *ptr;
  6.    
  7.    ptr=bl.first;
  8.    while (ptr)
  9.      {
  10.     if (ptr->bwin->win==w) 
  11.       {
  12.          return ptr->bwin;
  13.       }
  14.     ptr=ptr->next;
  15.      }
  16.    return 0;
  17. }
  18.  
  19. void AddButton(BWin *bwin)
  20. {
  21.    struct blist *pptr;
  22.    struct blist *ptr;
  23.    
  24.    pptr=NULL;
  25.    ptr=bl.first;
  26.    while (ptr)
  27.      {
  28.     pptr=ptr;
  29.     ptr=ptr->next;
  30.      }
  31.    if (pptr==NULL)
  32.      {
  33.     bl.first=malloc(sizeof(struct blist));
  34.     bl.first->next=NULL;
  35.     bl.first->bwin=bwin;
  36.      }
  37.    else
  38.      {
  39.     pptr->next=malloc(sizeof(struct blist));
  40.     pptr->next->next=NULL;
  41.     pptr->next->bwin=bwin;
  42.      }
  43. }
  44.  
  45. void DelButton(Window w)
  46. {
  47. }
  48.  
  49. void ButtonDraw(BWin *bwin)
  50. {
  51.    if (!bwin) return;
  52.    
  53.    if (bwin->state==BTN_NORM)
  54.      {
  55.     if (bwin->unsel_pmap) XSetWindowBackgroundPixmap(disp,bwin->win,bwin->unsel_pmap);
  56.     if (bwin->unsel_mask) XShapeCombineMask(disp,bwin->win,ShapeBounding,0,0,bwin->unsel_mask,ShapeSet);
  57.     XClearWindow(disp,bwin->win);
  58.     XSync(disp,False);
  59.      }
  60.    else if (bwin->state==BTN_SEL)
  61.      {
  62.     if (bwin->sel_pmap) XSetWindowBackgroundPixmap(disp,bwin->win,bwin->sel_pmap);
  63.     if (bwin->sel_mask) XShapeCombineMask(disp,bwin->win,ShapeBounding,0,0,bwin->sel_mask,ShapeSet);
  64.     XClearWindow(disp,bwin->win);
  65.     XSync(disp,False);
  66.      }
  67.    else if (bwin->state==BTN_CLICK)
  68.      {
  69.     if (bwin->click_pmap) XSetWindowBackgroundPixmap(disp,bwin->win,bwin->click_pmap);
  70.     if (bwin->click_mask) XShapeCombineMask(disp,bwin->win,ShapeBounding,0,0,bwin->click_mask,ShapeSet);
  71.     XClearWindow(disp,bwin->win);
  72.     XSync(disp,False);
  73.      }
  74. }
  75.  
  76. void MapButtons()
  77. {
  78.    struct blist *ptr;
  79.    
  80.    ptr=bl.first;
  81.    while (ptr)
  82.      {
  83.     XMapWindow(disp,ptr->bwin->win);
  84.     ptr=ptr->next;
  85.      }
  86. }
  87.  
  88. void RaiseLowerButtons()
  89. {
  90.    struct blist *ptr;
  91.    
  92.    ptr=bl.first;
  93.    while (ptr)
  94.      {
  95.     if (ptr->bwin->above) XRaiseWindow(disp,ptr->bwin->win);
  96.     else XLowerWindow(disp,ptr->bwin->win);
  97.     ptr=ptr->next;
  98.      }
  99. }
  100.  
  101.