home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / easygui_os12 / source / plugins / windowify_os12.e < prev   
Encoding:
Text File  |  2000-06-11  |  2.3 KB  |  87 lines

  1. OPT MODULE
  2. OPT PREPROCESS
  3.  
  4. -> RST: Added conditional EASY_OS12 support
  5. #define EASY_OS12
  6.  
  7. #ifdef EASY_OS12
  8.   MODULE 'tools/easygui_os12'
  9. #endif
  10. #ifndef EASY_OS12
  11.   OPT OSVERSION=37
  12.   MODULE 'tools/easygui'
  13. #endif
  14.  
  15. MODULE 'intuition/intuition', 'intuition/gadgetclass',
  16.        'libraries/gadtools',
  17.        'tools/textlen',
  18.        'gadtools','utility/tagitem'
  19.  
  20. EXPORT OBJECT windowify OF plugin
  21.   disabled
  22. PRIVATE
  23.   gadget:PTR TO gadget
  24.   label, winlabel, winxsize
  25.   resize
  26. ENDOBJECT
  27.  
  28. OBJECT sizeplug OF plugin
  29.   xsize
  30. ENDOBJECT
  31. PROC sizeplug(xsize) OF sizeplug
  32.   self.xsize:=xsize
  33. ENDPROC
  34. PROC min_size(ta,fh) OF sizeplug IS self.xsize,0
  35.  
  36.  
  37. PROC windowify(label,winlabel=NIL,
  38.              resizex=FALSE,resizey=FALSE,disabled=FALSE) OF windowify
  39.   self.label:=IF label THEN label ELSE ''
  40.   self.winlabel:=IF winlabel THEN winlabel ELSE self.label
  41.   self.disabled:=disabled
  42.   self.resize:=(IF resizex THEN RESIZEX ELSE 0) OR
  43.                (IF resizey THEN RESIZEY ELSE 0)
  44. ENDPROC
  45.  
  46. PROC end() OF windowify IS EMPTY
  47.  
  48. PROC min_size(ta,fh) OF windowify
  49.   self.winxsize:=textlen(self.winlabel,ta)+48
  50. ENDPROC textlen(self.label,ta)+16,fh+6
  51.  
  52. PROC will_resize() OF windowify IS self.resize
  53.  
  54. -> Don't need to define this:
  55. ->PROC render(ta,x,y,xs,ys,w) OF windowify IS EMPTY
  56.  
  57. PROC gtrender(gl,vis,ta,x,y,xs,ys,w) OF windowify
  58.   -> Or, a gadget in the title bar would have also been nice...
  59.   self.gadget:=CreateGadgetA(BUTTON_KIND,gl,
  60.                  [x,y,xs,ys,self.label,ta,0,
  61.                   PLACETEXT_IN,vis,NIL]:newgadget,
  62.                  [GA_DISABLED,self.disabled,TAG_DONE])
  63.   IF self.gadget=NIL THEN Raise("tlfy")
  64. ENDPROC self.gadget
  65.  
  66. -> Don't need to define this:
  67. -> PROC clear_render(win:PTR TO window) OF windowify IS EMPTY
  68.  
  69. PROC message_test(imsg:PTR TO intuimessage,win:PTR TO window) OF windowify
  70.   IF imsg.class=IDCMP_GADGETUP THEN RETURN imsg.iaddress=self.gadget
  71. ENDPROC FALSE
  72.  
  73. PROC message_action(class,qual,code,win:PTR TO window) OF windowify HANDLE
  74.   DEF sp=NIL:PTR TO sizeplug
  75.   NEW sp.sizeplug(self.winxsize)
  76.   closewin(self.gh)
  77.   easyguiA(self.winlabel,[ROWS, [PLUGIN,0,sp,TRUE] ], [EG_WTYPE, WTYPE_NOSIZE, EG_TOP, 0, EG_LEFT,  0, TAG_DONE])
  78. EXCEPT DO
  79.   openwin(self.gh)
  80.   END sp
  81. ENDPROC FALSE
  82.  
  83. PROC setdisabled(disabled=TRUE) OF windowify
  84.   Gt_SetGadgetAttrsA(self.gadget,self.gh.wnd,NIL,[GA_DISABLED,disabled,NIL])
  85.   self.disabled:=disabled
  86. ENDPROC
  87.