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 >
Wrap
C/C++ Source or Header
|
1997-05-13
|
2KB
|
101 lines
#include "enlightenment.h"
BWin *GetButtonWinID(Window w)
{
struct blist *ptr;
ptr=bl.first;
while (ptr)
{
if (ptr->bwin->win==w)
{
return ptr->bwin;
}
ptr=ptr->next;
}
return 0;
}
void AddButton(BWin *bwin)
{
struct blist *pptr;
struct blist *ptr;
pptr=NULL;
ptr=bl.first;
while (ptr)
{
pptr=ptr;
ptr=ptr->next;
}
if (pptr==NULL)
{
bl.first=malloc(sizeof(struct blist));
bl.first->next=NULL;
bl.first->bwin=bwin;
}
else
{
pptr->next=malloc(sizeof(struct blist));
pptr->next->next=NULL;
pptr->next->bwin=bwin;
}
}
void DelButton(Window w)
{
}
void ButtonDraw(BWin *bwin)
{
if (!bwin) return;
if (bwin->state==BTN_NORM)
{
if (bwin->unsel_pmap) XSetWindowBackgroundPixmap(disp,bwin->win,bwin->unsel_pmap);
if (bwin->unsel_mask) XShapeCombineMask(disp,bwin->win,ShapeBounding,0,0,bwin->unsel_mask,ShapeSet);
XClearWindow(disp,bwin->win);
XSync(disp,False);
}
else if (bwin->state==BTN_SEL)
{
if (bwin->sel_pmap) XSetWindowBackgroundPixmap(disp,bwin->win,bwin->sel_pmap);
if (bwin->sel_mask) XShapeCombineMask(disp,bwin->win,ShapeBounding,0,0,bwin->sel_mask,ShapeSet);
XClearWindow(disp,bwin->win);
XSync(disp,False);
}
else if (bwin->state==BTN_CLICK)
{
if (bwin->click_pmap) XSetWindowBackgroundPixmap(disp,bwin->win,bwin->click_pmap);
if (bwin->click_mask) XShapeCombineMask(disp,bwin->win,ShapeBounding,0,0,bwin->click_mask,ShapeSet);
XClearWindow(disp,bwin->win);
XSync(disp,False);
}
}
void MapButtons()
{
struct blist *ptr;
ptr=bl.first;
while (ptr)
{
XMapWindow(disp,ptr->bwin->win);
ptr=ptr->next;
}
}
void RaiseLowerButtons()
{
struct blist *ptr;
ptr=bl.first;
while (ptr)
{
if (ptr->bwin->above) XRaiseWindow(disp,ptr->bwin->win);
else XLowerWindow(disp,ptr->bwin->win);
ptr=ptr->next;
}
}