home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / OTL-MC7.DMS / in.adf / classes.lha / Classes / Intuition / Window.h < prev   
Encoding:
C/C++ Source or Header  |  1995-01-31  |  7.0 KB  |  237 lines

  1. #ifndef CPP_INTUITION_WINDOW_H
  2. #define CPP_INTUITION_WINDOW_H
  3.  
  4. // Eine Window Klasse
  5. //
  6. // Autor: Jochen Becher
  7. //
  8. // Historie:
  9. // Version 1.0, am 8. Januar 94
  10. //
  11.  
  12. #ifndef CPP_UTILITY_TAGITEM_H
  13. #include <classes/utility/tagitem.h>
  14. #endif
  15.  
  16. #ifndef INTUITION_INTUITION_H
  17. #include <intuition/intuition.h>
  18. #endif
  19.  
  20. #ifndef CPP_INTUITION_IDCMP_H
  21. #include <classes/intuition/idcmp.h>
  22. #endif
  23.  
  24. #ifndef CPP_EXCEPTIONS_EXCEPTIONS_H
  25. #include <classes/exceptions/exceptions.h>
  26. #endif
  27.  
  28. class WindowSnapshotC {
  29. public:
  30.     WindowSnapshotC();
  31.     VOID setTop(WORD t) { wTop = t; };
  32.     WORD top() const { return wTop; };
  33.     VOID setLeft(WORD l) { wLeft = l; };
  34.     WORD left() const { return wLeft; };
  35.     VOID setWidth(WORD w) { wWidth = w; };
  36.     WORD width() const { return wWidth; };
  37.     VOID setHeight(WORD h) { wHeight = h; };
  38.     WORD height() const { return wHeight; };
  39.     VOID setBusy(BOOL b) { wBusy = b; };
  40.     BOOL busy() const { return wBusy; };
  41. private:
  42.     WORD wTop,wLeft,wWidth,wHeight;
  43.     BOOL wBusy;
  44. };
  45.  
  46. // **************************************************************
  47.  
  48. class WindowC : protected NodeC {
  49. friend class WindowListC;
  50. public:
  51.     WindowC(IDCMPortC &, Tag tag1Type, ...) throw (MemoryX);
  52.     WindowC(IDCMPortC &, struct TagItem *tags = NULL) throw (MemoryX);
  53.     WindowC(const WindowC &) throw (MemoryX);
  54.     virtual ~WindowC();
  55.     WindowC &operator= (const WindowC &) throw (MemoryX);
  56.     BOOL isOpen() const { return window_ob != NULL; };
  57.     struct Window *window() const { return window_ob; };
  58.     struct RastPort *rastPort() const
  59.         { return window_ob ? window_ob->RPort : NULL; };
  60.     IDCMPortC &idcmPort() const { return idcmport; };
  61.     TagItemC &creationTags() const { return (TagItemC &) inittags; };
  62.     virtual VOID open(Tag tag1Type, ...) throw (WindowX, MemoryX)
  63.         { WindowC::open((struct TagItem *) &tag1Type); };
  64.     virtual VOID open(struct TagItem *tagList = NULL) throw (WindowX, MemoryX);
  65.     virtual VOID close(BOOL snapshot = FALSE);
  66.     virtual VOID setIDCMP(ULONG idcmpFlags);
  67.     VOID addIDCMP(ULONG idcmpFlags);
  68.     VOID subIDCMP(ULONG idcmpFlags);
  69.     virtual BOOL setMenuStrip(class MenuC &);
  70.     virtual BOOL resetMenuStrip();
  71.     virtual VOID clearMenuStrip(BOOL forget = FALSE);
  72.     virtual BOOL setGadgetList(class GadgetListC &);
  73.     virtual VOID resetGadgetList(BOOL refresh = TRUE);
  74.     virtual VOID clearGadgetList(BOOL forget = FALSE, BOOL refresh = TRUE);
  75.     virtual VOID refreshGadgets();
  76.     virtual BOOL setBusy(BOOL state);
  77.     BOOL isBusy() const { return busy; };
  78.     virtual BOOL snapshot(WindowSnapshotC &);
  79.     virtual BOOL stamp(WindowSnapshotC &);
  80. // die Methoden zur "alten" Gadgetverwaltung sind nicht kompatibel zur
  81. // GadgetList
  82.     BOOL addGadget(struct Gadget *gadget);
  83.     BOOL addGadgets(struct Gadget *gadgets);
  84.     BOOL remGadget(struct Gadget *gadget);
  85.     BOOL remGadgets(struct Gadget *gadgets, WORD number = ~0);
  86.     BOOL refreshGadgets(struct Gadget *gadgets, WORD number = ~0);
  87.     virtual VOID activate();
  88.     virtual BOOL changeSize(WORD Width, WORD Height);
  89.     virtual VOID move(WORD LeftEdge, WORD TopEdge);
  90.     virtual VOID change(WORD LeftEdge, WORD TopEdge, WORD Width, WORD Height);
  91.     virtual BOOL limits(WORD MinWidth, WORD MinHeight, WORD MaxWidth, WORD MaxHeight);
  92.     virtual BOOL limitMin(WORD MinWidth, WORD MinHeight);
  93.     virtual BOOL limitMax(WORD MaxWidth, WORD MaxHeight);
  94.     virtual VOID toBack();
  95.     virtual VOID toFront();
  96.     virtual VOID moveInFrontOf(struct Window *BehindWindow);
  97.     virtual VOID moveInFrontOf(const WindowC &BehindWindow);
  98.     virtual VOID zip();
  99.     virtual VOID setTitles(STRPTR WindowTitle, STRPTR ScreenTitle);
  100.     virtual VOID setWindowTitle(STRPTR WindowTitle);
  101.     virtual VOID setScreenTitle(STRPTR ScreenTitle);
  102.     virtual VOID setPointer(UWORD *Pointer,
  103.         WORD Height, WORD Width, WORD XOffset, WORD YOffset);
  104.     virtual VOID clearPointer();
  105.     virtual VOID disableMenu(ULONG number, BOOL v);
  106.     virtual VOID beginRefresh();
  107.     virtual VOID endRefresh(BOOL Complete = TRUE);
  108.     virtual VOID refreshFrame();
  109. protected:
  110.     virtual VOID freeIDCMP();
  111. private:
  112.     VOID clearBusy();
  113.     IDCMPortC &idcmport;
  114.     struct Window *window_ob;
  115.     TagItemC inittags;
  116.     BOOL menuattached;
  117.     class MenuC *menu;
  118.     ULONG idcmps;
  119.     BOOL gadgetlistattached;
  120.     class GadgetListC *gadgets;
  121.     BOOL busy;
  122.     struct Requester *busyReq;
  123.     UWORD *busyPointer;
  124.     BYTE busyHeight, busyWidth, busyXOffset, busyYOffset;
  125. };
  126.  
  127. // **************************************************************
  128.  
  129. class WindowListC : protected ListC {
  130. public:
  131.     WindowListC();
  132.     VOID add(WindowC &w) { ListC::addTail(w); };
  133.     VOID close(BOOL snapshot = FALSE);
  134.     BOOL setBusy(BOOL state, WindowC *except = NULL);
  135. };
  136.  
  137. // **************************************************************
  138.  
  139. class WindowEventHandlerC : public IDCMPEventHandlerC {
  140. public:
  141.     WindowEventHandlerC(WindowC &, ULONG IDCMPclass);
  142.     WindowEventHandlerC(class WindowEventHandlerChainC &);
  143.     WindowC *window() const { return cWindow; };
  144. protected:
  145.     BOOL _forMe(IntuiMessageC &);
  146.     WindowC *cWindow;
  147. };
  148.  
  149. class WindowEventHandlerChainC : public WindowEventHandlerC,
  150.     public HandlerChainC {
  151. public:
  152.     WindowEventHandlerChainC(WindowC &, ULONG IDCMPclass);
  153.     VOID add(WindowEventHandlerC &h) { HandlerChainC::add(h); };
  154.     BOOL handle(MessageC &msg) { return HandlerChainC::handle(msg); };
  155.     BOOL exit() { return HandlerChainC::exit(); };
  156. };
  157.  
  158. // **************************************************************
  159.  
  160. class WindowCloseHandlerC : public WindowEventHandlerC {
  161. public:
  162.     WindowCloseHandlerC(WindowC &);
  163.     virtual VOID close() { _exit = TRUE; };
  164.     BOOL exit() { return _exit };
  165. protected:
  166.     BOOL _handle(IntuiMessageC &);
  167.     BOOL _exit;
  168. };
  169.  
  170. // **************************************************************
  171.  
  172. class WindowActiveHandlerC : public WindowEventHandlerC {
  173. public:
  174.     WindowActiveHandlerC(WindowC &);
  175.     virtual VOID activated() { };
  176. protected:
  177.     BOOL _handle(IntuiMessageC &);
  178. };
  179.  
  180. // **************************************************************
  181.  
  182. class WindowInactiveHandlerC : public WindowEventHandlerC {
  183. public:
  184.     WindowInactiveHandlerC(WindowC &);
  185.     virtual VOID inactivated() { };
  186. protected:
  187.     BOOL _handle(IntuiMessageC &);
  188. };
  189.  
  190. // **************************************************************
  191.  
  192. class WindowRefreshHandlerChainC : public WindowEventHandlerChainC {
  193. public:
  194.     WindowRefreshHandlerChainC(WindowC &);
  195.     BOOL handle(MessageC &);
  196. };
  197.  
  198. class WindowRefreshHandlerC : public WindowEventHandlerC {
  199. public:
  200.     WindowRefreshHandlerC(WindowRefreshHandlerChainC &);
  201.     virtual VOID refresh() { };
  202. protected:
  203.     BOOL _handle(IntuiMessageC &);
  204. };
  205.  
  206. // **************************************************************
  207.  
  208. class WindowNewsizeHandlerC : public WindowEventHandlerC {
  209. public:
  210.     WindowNewsizeHandlerC(WindowC &);
  211.     virtual VOID newsize() { };
  212. protected:
  213.     BOOL _handle(IntuiMessageC &);
  214. };
  215.  
  216. // **************************************************************
  217.  
  218. class WindowSizeverifyHandlerC : public WindowEventHandlerC {
  219. public:
  220.     WindowSizeverifyHandlerC(WindowC &);
  221.     virtual VOID verify() { };
  222. protected:
  223.     BOOL _handle(IntuiMessageC &);
  224. };
  225.  
  226. // **************************************************************
  227.  
  228. class WindowChangeHandlerC : public WindowEventHandlerC {
  229. public:
  230.     WindowChangeHandlerC(WindowC &);
  231.     virtual VOID change() { };
  232. protected:
  233.     BOOL _handle(IntuiMessageC &);
  234. };
  235.  
  236. #endif
  237.