home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / gnu / aplusplus-1.01-src.lha / src / amiga / aplusplus-1.01 / include / aplusplus / intuition / GadgetCV.h < prev    next >
C/C++ Source or Header  |  1994-05-09  |  3KB  |  89 lines

  1. #ifndef APP_GadgetCV_H
  2. #define APP_GadgetCV_H
  3. /******************************************************************************
  4.  **
  5.  **    C++ Class Library for the Amiga© system software.
  6.  **
  7.  **    Copyright (C) 1994 by Armin Vogt  **  EMail: armin@uni-paderborn.de
  8.  **    All Rights Reserved.
  9.  **
  10.  **    $VER: apphome:APlusPlus/intuition/GadgetCV.h 1.04 (04.05.94) $
  11.  **    
  12.  ******************************************************************************/
  13.  
  14.  
  15. class GWindow;
  16.  
  17. extern "C" {
  18. #include <intuition/intuition.h>
  19. #include <libraries/gadtools.h>
  20. }
  21. #include <APlusPlus/intuition/GWindow.h>
  22. #include <APlusPlus/graphics/GraphicObject.h>
  23. #include <APlusPlus/intuition/IntuiMessageC.h>
  24.  
  25.  
  26. /******************************************************************************************
  27.          » GadgetCV class «   virtual base class
  28.  
  29.    defines all methods that must be implemented for every derived gadget class to work
  30.    together with the GWindow class.
  31.    A virtual callback method is assigned to receive IntuiMessage events sent to the gadget.
  32.  
  33.  ******************************************************************************************/
  34.  
  35. class GadgetCV : public GraphicObject
  36. {
  37.     friend GWindow;
  38.    friend IntuiMessageC;
  39.     private:
  40.         static GWindow *redrawSelfHomeWindow;
  41.         
  42.    protected:
  43.         GadgetCV(GraphicObject *owner,AttrList& attrs)
  44.       : GraphicObject(owner,attrs) { }
  45.                 
  46.         struct Gadget *storeGadget(struct Gadget *);
  47.       // store the created gadget address in GadgetCV.
  48.       
  49.         struct Gadget *gadgetPtr() { return (struct Gadget*)IObject(); }
  50.       // the shadowed gadget or the first gadget in a list of gadgets is stored in gadgetPtr().
  51.         
  52.         struct Gadget *getGT_Context();    // give GadTools gadgets their context
  53.         
  54.         BOOL forceActiveGadget(const IntuiMessageC *imsg);        
  55.         // gadget stays active after GADGETUP msg ONLY if msg was not caused by the user activating 
  56.         // another gadget (in that case returns FALSE)!
  57.         
  58.         GWindow *getHomeWindow();
  59.         // get GWindow that is direct or indirect owner of this gadget
  60.         
  61.    public:
  62.       virtual ~GadgetCV() { };
  63.  
  64.       virtual APTR redrawSelf(GWindow *homeWindow,ULONG& returnType)    // inherited from GraphicObject
  65.         {
  66.             return GraphicObject::redrawSelf(homeWindow,returnType);  
  67.         }         
  68.         /** called when window size has been changed after GraphicObject has been adjusted.
  69.        ** The gadget/gadgetlist is removed from the window's gadgetlist when this method is called.
  70.        ** The gadget structure shadowed by the GadgetCV object has to be returned, also the type
  71.        ** of the gadget (Standart,Boopsi,GadTools).
  72.        ** In case of a list of gadgets the gadgets must be linked together (do not forget
  73.        ** the ending null in the last gadgets NextGadget entry!) and then returned
  74.        ** to be linked to the window again.
  75.        **/
  76.              
  77.       virtual void callback(const IntuiMessageC*)=0;
  78.         /** Here is your way of receiving events from 'this' gadget: overload callback method.
  79.          ** In further derived classes your callback will have to call the callback of the direct
  80.          ** base class of your Gadget class. Look at the description of this base class to know
  81.          ** when to call and why.
  82.          **/
  83.          
  84.       ULONG setAttributes(AttrList& attrs) { return GraphicObject::setAttributes(attrs); }
  85.         ULONG getAttribute(Tag,ULONG&);
  86. };
  87.  
  88. #endif
  89.