home *** CD-ROM | disk | FTP | other *** search
/ Dream 48 / Amiga_Dream_48.iso / Atari / c / libs / egemd220.lzh / DIALOG.DEM / DIAMOUSE / DIAMOUSE.C < prev    next >
C/C++ Source or Header  |  1995-01-31  |  1KB  |  56 lines

  1.  
  2. /* DialogMouse (PRG): Demonstriert von der Mausposition abhängige Mausform/Infozeile */
  3.  
  4. #include <e_gem.h>
  5. #include <string.h>
  6. #include "diamouse.h"
  7.  
  8. DIAINFO *di;
  9. OBJECT *tr;
  10.  
  11. char *dm="DiaMouse",
  12. path[][MAX_PATH]={"\\ST-GUIDE.AC?","\\DOCUMENTS\\","\\SETTINGS\\","\\MODULES\\"},
  13. *info[]={"","Hilfesystem","Pfad für Dokumente...","Pfad für Einstellungen...","Pfad für Module...","Abbruch","","Bestätigen",""};
  14.  
  15. int ObInfo(DIAINFO *di,OBJECT *t,int ob,int l,int x,int y,GRECT *r)
  16. {
  17.     window_info(di->di_win,info[ob]);
  18.     if (ob>=PATH1 && ob<=PATH4)
  19.     {
  20.         MouseCursor();
  21.         return(DIALOG_MOUSE);
  22.     }
  23.     return(DIALOG_OBJECT);
  24. }
  25.  
  26. void main()
  27. {
  28.     if (open_rsc("diamouse.rsc",NULL,dm,dm,"DIAMOUSE",0,0,0)==TRUE)
  29.     {
  30.         rsrc_gaddr(R_TREE,0,&tr);
  31.         fix_objects(tr,NO_SCALING,8,16);
  32.         if ((di=open_dialog(tr,dm,NULL,NULL,DIA_MOUSEPOS,FALSE,WIN_DIAL|WD_INFO,0,NULL,NULL))!=NULL)
  33.         {
  34.             char file[MAX_PATH],buf[MAX_PATH],*pa,ex;
  35.  
  36.             for (ex=0;ex<4;ex++)
  37.                 ob_set_text(tr,ex+PATH1,path[ex]);
  38.  
  39.             dialog_mouse(di,ObInfo);
  40.             while ((ex=XFormObject(NULL,NULL))>=PATH1 && ex<=PATH4)
  41.             {
  42.                 strcpy(file,GetFilename(strcpy(buf,pa=path[ex-PATH1])));
  43.                 GetPath(buf);
  44.                 if (FileSelect(info[ex],buf,file,NULL,FALSE,0,NULL)>0)
  45.                 {
  46.                     MakeFullpath(pa,buf,ex==PATH1 ? file : "");
  47.                     ob_draw(di,ex);
  48.                 }
  49.                 ob_select(di,tr,ex,FALSE,TRUE);
  50.             }
  51.         }
  52.         close_rsc(TRUE,0);
  53.     }
  54.     exit(-1);
  55. }
  56.