home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Enlightenment / enl_BETA-0.13.src.tar.gz / enl_BETA-0.13.src.tar / enl-0.13 / buttons.c < prev    next >
C/C++ Source or Header  |  1997-11-17  |  2KB  |  89 lines

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