home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / c / intuitionpp / ipp / msgwindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-06  |  2.8 KB  |  86 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. ///////////////////////////////////////////////////////////////////////////////
  3. ///////////////////                                        ////////////////////
  4. ///////////////////           file : msgwindow.h           ////////////////////
  5. ///////////////////                                        ////////////////////
  6. ///////////////////////////////////////////////////////////////////////////////
  7. ///////////////////////////////////////////////////////////////////////////////
  8. //
  9. //    Class MsgWindow :
  10. //
  11. //        - Simple event-driven handling for Intuition windows.
  12. //        Link gadgets and menu you created to this object and
  13. //        link any message it could get with its corresponding gadget
  14. //        or menu item and the function you want to be called when
  15. //        receiving appropriate message.
  16. //          Then give control to the window with softcontrol() or
  17. //        hardcontrol().
  18. //
  19. //        - softcontrol() returns the current message only if the
  20. //        object get a message wich as not been handled by it,
  21. //         i.e. there is no link made by you for this message.
  22. //
  23. //        - hardcontrol() never returns !!!
  24. //
  25. //        - If you don't wish to give control to the object you can
  26. //        handle messages yourself with getImsg() or waitImsg() or
  27. //        filterImsg() wich executes the appropriate callback linked
  28. //        by you or return the message if it's inapropriate.
  29.  
  30.  
  31. #ifndef __MSGWINDOW__
  32. #define __MSGWINDOW__
  33.  
  34. #include <ipp/cwindow.h>
  35. #include <ipp/imessage.h>
  36.  
  37.  
  38. class MsgWindow : public virtual CWindow
  39. {
  40. protected:
  41.     struct Menu *menu;
  42.     IEvent *events;
  43.     virtual void update();
  44.     IMessage * readImsg(struct IntuiMessage *intuimessage, IMessage& imessage);
  45. public:
  46.     MsgWindow();
  47.     MsgWindow(struct NewWindow *newwindow);
  48.     MsgWindow(struct ExtNewWindow *extnewwindow);
  49.     MsgWindow(struct NewWindow *newwindow, struct TagItem *tags);
  50.     ~MsgWindow();
  51.  
  52.     virtual BOOL open();
  53.     virtual void close();
  54.     ULONG setIDCMPflags(ULONG idcmpflags);
  55.     ULONG getIDCMPflags();
  56.  
  57.     struct Gadget * linkgadgets(struct Gadget *gadgetlist);
  58.     struct Gadget * rmgadgets();
  59.     void refreshgadgets(struct Gadget *gadgetlist);
  60.     void refreshglist(struct Gadget *gadgetlist, WORD count);
  61.     BOOL activategadget(struct Gadget *gadget);
  62.     void ongadget(struct Gadget *gadget);
  63.     void offgadget(struct Gadget *gadget);
  64.  
  65.     struct Menu * linkmenu(struct Menu *menu);
  66.     struct Menu * rmmenu();
  67.     void onmenu(UWORD menunumber);
  68.     void offmenu(UWORD menunumber);
  69.  
  70.     void reportmouse(BOOL yesorno);
  71.  
  72.     BOOL linkIevent(ULONG iclass, ULONG icode, ULONG iqualifier, void *object, void (*callback)(IMessage&));
  73.     void rmIevents();
  74.  
  75.     IMessage * getImsg(IMessage& imessage);
  76.     IMessage * waitImsg(IMessage& imessage);
  77.     void clearImsg();
  78.     IMessage * filterImsg(IMessage& imessage);
  79.     IMessage * softcontrol(IMessage& imessage);
  80.     void hardcontrol();
  81. };
  82.  
  83.  
  84. #endif //__MSGWINDOW__
  85.  
  86.