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 / status.c < prev    next >
C/C++ Source or Header  |  1997-11-16  |  5KB  |  112 lines

  1. #include "enlightenment.h"
  2.  
  3. void Init_StatusWin()
  4. {
  5.    /* Image *im; */
  6.    XSetWindowAttributes xatt;
  7.  
  8. /* 07/19/97 Mandrake (mandrake@mandrake.net - http://mandrake.net)
  9.  * I changed Init_StatusWin to use the imlib functions I wrote for iconify.c
  10.  */
  11.    
  12.    LoadImageSizeWithImlib(scfg.icons_bg, scfg.icons_icl, &scfg.icons_pmap, &scfg.icons_mask, scfg.icons_w, scfg.icons_h);
  13.    LoadImageSizeWithImlib(scfg.iconsbox_bg, scfg.iconsbox_icl, &scfg.iconsbox_pmap, &scfg.iconsbox_mask, scfg.iconsbox_w, scfg.iconsbox_h);
  14.    LoadImageSizeWithImlib(scfg.text_bg, scfg.text_icl, &scfg.text_pmap, &scfg.text_mask, scfg.text_w, scfg.text_h);
  15.    LoadImageSizeWithImlib(scfg.textbox_bg, scfg.textbox_icl, &scfg.textbox_pmap, &scfg.textbox_mask, scfg.textbox_w, scfg.textbox_h);
  16.    xatt.override_redirect=True;
  17.    scfg.icons_win=XCreateWindow(disp,root,scfg.icons_x,scfg.icons_y,scfg.icons_w,scfg.icons_h,
  18.                 0,depth,InputOutput,visual,CWOverrideRedirect,&xatt);
  19.    scfg.iconsbox_win=XCreateWindow(disp,scfg.icons_win,scfg.iconsbox_x,scfg.iconsbox_y,scfg.iconsbox_w,scfg.iconsbox_h,
  20.                 0,depth,InputOutput,visual,CWOverrideRedirect,&xatt);
  21.    scfg.text_win=XCreateWindow(disp,root,scfg.text_x,scfg.text_y,scfg.text_w,scfg.text_h,
  22.                 0,depth,InputOutput,visual,CWOverrideRedirect,&xatt);
  23.    scfg.textbox_win=XCreateWindow(disp,scfg.text_win,scfg.textbox_x,scfg.textbox_y,scfg.textbox_w,scfg.textbox_h,
  24.                 0,depth,InputOutput,visual,CWOverrideRedirect,&xatt);
  25.    if (scfg.icons_pmap) XSetWindowBackgroundPixmap(disp,scfg.icons_win,scfg.icons_pmap);
  26.    if (scfg.icons_mask) XShapeCombineMask(disp,scfg.icons_win,ShapeBounding,0,0,scfg.icons_mask,ShapeSet);
  27.    if (scfg.iconsbox_pmap) XSetWindowBackgroundPixmap(disp,scfg.iconsbox_win,scfg.iconsbox_pmap);
  28.    if (scfg.iconsbox_mask) XShapeCombineMask(disp,scfg.iconsbox_win,ShapeBounding,0,0,scfg.iconsbox_mask,ShapeSet);
  29.    if (scfg.text_pmap) XSetWindowBackgroundPixmap(disp,scfg.text_win,scfg.text_pmap);
  30.    if (scfg.text_mask) XShapeCombineMask(disp,scfg.text_win,ShapeBounding,0,0,scfg.text_mask,ShapeSet);
  31.    if (scfg.textbox_pmap) XSetWindowBackgroundPixmap(disp,scfg.textbox_win,scfg.textbox_pmap);
  32.    if (scfg.textbox_mask) XShapeCombineMask(disp,scfg.textbox_win,ShapeBounding,0,0,scfg.textbox_mask,ShapeSet);
  33.                         
  34.    XMapWindow(disp,scfg.iconsbox_win);
  35.    XMapWindow(disp,scfg.icons_win);
  36.    XMapWindow(disp,scfg.textbox_win);
  37.    XMapWindow(disp,scfg.text_win);
  38.    scfg.nexticon_x=0;
  39.    scfg.nexticon_y=0;
  40.    scfg.iconwin_list=NULL;
  41.    XSync(disp,False);
  42. }
  43.  
  44. void Kill_StatusWin()
  45. {
  46.    struct swlist *ptr;
  47.    
  48.    if (scfg.icons_pmap) ImlibFreePixmap(imd,scfg.icons_pmap);    
  49.    if (scfg.iconsbox_pmap) ImlibFreePixmap(imd,scfg.iconsbox_pmap);    
  50.    if (scfg.text_pmap) ImlibFreePixmap(imd,scfg.text_pmap);    
  51.    if (scfg.textbox_pmap) ImlibFreePixmap(imd,scfg.textbox_pmap);    
  52.    if (scfg.icons_bg) free(scfg.icons_bg);
  53.    if (scfg.iconsbox_bg) free(scfg.iconsbox_bg);
  54.    if (scfg.text_bg) free(scfg.text_bg);
  55.    if (scfg.textbox_bg) free(scfg.textbox_bg);
  56.    ptr=scfg.iconwin_list;
  57.    while(ptr)
  58.      {
  59.     if (ptr->win) XDestroyWindow(disp,ptr->win);
  60.     if (ptr->pmap) ImlibFreePixmap(imd,ptr->pmap);
  61.     if (ptr->mask) ImlibFreePixmap(imd,ptr->mask);
  62.     ptr=ptr->next;
  63.      }
  64.    XDestroyWindow(disp,scfg.icons_win);
  65.    XDestroyWindow(disp,scfg.iconsbox_win);
  66.    XDestroyWindow(disp,scfg.text_win);
  67.    XDestroyWindow(disp,scfg.textbox_win);
  68.    if (scfg.icons_pmap) ImlibFreePixmap(imd,scfg.icons_pmap);
  69.    if (scfg.icons_mask) ImlibFreePixmap(imd,scfg.icons_mask);
  70.    if (scfg.iconsbox_pmap) ImlibFreePixmap(imd,scfg.iconsbox_pmap);
  71.    if (scfg.iconsbox_mask) ImlibFreePixmap(imd,scfg.iconsbox_mask);
  72.    if (scfg.text_pmap) ImlibFreePixmap(imd,scfg.text_pmap);
  73.    if (scfg.text_mask) ImlibFreePixmap(imd,scfg.text_mask);
  74.    if (scfg.textbox_pmap) ImlibFreePixmap(imd,scfg.textbox_pmap);
  75.    if (scfg.textbox_mask) ImlibFreePixmap(imd,scfg.textbox_mask);
  76. }
  77.  
  78. void ShowStatus(char *text, char *icon, ImColor *icl)
  79. {
  80.    struct swlist *ptr;
  81.    struct swlist *pptr;
  82.    Image *im;
  83.    int w,h;
  84.    
  85.    im=LoadImage(imd,icon,icl);
  86.    ptr=scfg.iconwin_list;
  87.    while(ptr)
  88.      {
  89.     pptr=ptr;
  90.     ptr=ptr->next;
  91.      }
  92.    ptr=malloc(sizeof(struct swlist));
  93.    ptr->next=NULL;
  94.    if (scfg.iconwin_list) pptr->next=ptr;
  95.    else scfg.iconwin_list=ptr;
  96.    h=scfg.iconsbox_h;
  97.    w=(im->rgb_width*scfg.iconsbox_h)/im->rgb_height;
  98.    ImlibRender(imd,im,w,h);
  99.    ptr->pmap=ImlibMoveImageToPixmap(imd,im);
  100.    ptr->mask=ImlibMoveMaskToPixmap(imd,im);
  101.    ImlibDestroyImage(imd,im);
  102.    ptr->win=CreateWin(scfg.iconsbox_win,scfg.nexticon_x,scfg.nexticon_y,w,h);
  103.    scfg.nexticon_x+=w;
  104.    if (ptr->pmap) XSetWindowBackgroundPixmap(disp,ptr->win,ptr->pmap);
  105.    if (ptr->mask) XShapeCombineMask(disp,ptr->win,ShapeBounding,0,0,ptr->mask,ShapeSet);
  106.    XClearWindow(disp,ptr->win);
  107.    XMapWindow(disp,ptr->win);
  108.    XClearWindow(disp,scfg.textbox_win);
  109.    DrawText(scfg.textbox_win,text,0,0,scfg.textbox_w,scfg.textbox_h);
  110.    XSync(disp,False);
  111. }
  112.