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 / graphics / AutoDrawArea.h next >
C/C++ Source or Header  |  1994-05-04  |  2KB  |  61 lines

  1. #ifndef APP_AutoDrawArea_H
  2. #define APP_AutoDrawArea_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/graphics/AutoDrawArea.h 1.04 (04.05.94) $
  11.  **    
  12.  ******************************************************************************/
  13.  
  14. #include <APlusPlus/intuition/StdGadget.h>
  15. #include <APlusPlus/graphics/DrawArea.h>
  16.  
  17.  
  18. /******************************************************************************************
  19.          » AutoDrawArea class «   virtual base class
  20.  
  21.    Base class for rectangular graphical output. Combines a clipped drawing area with a
  22.     rectangular boolean gadget so that mouse actions can be noticed.
  23.     The redrawing after window resizing is done automatically. The user only has to 
  24.     define a 'drawSelf' callback where he can make his drawings which are clipped to
  25.     the DrawArea rectangle.
  26.  
  27.  ******************************************************************************************/
  28. class AutoDrawArea : public StdGadget, public DrawArea
  29. {
  30.    private:
  31.       ULONG bgFillPen;  
  32.  
  33.    protected:
  34.       APTR redrawSelf(GWindow *home,ULONG& returnType);   // inherited from GraphicObject
  35.         void clear();
  36.         
  37.    public:
  38.       AutoDrawArea(GOB_OWNER, AttrList& attrs);
  39.       ~AutoDrawArea() {}
  40.  
  41.       virtual void drawSelf()=0;      // draw routine (called from redrawSelf or explicitly)
  42.       /** overload this method to define your special draw class.
  43.        **/
  44.         void callback(const IntuiMessageC* imsg); 
  45.         /** overload this callback to receive mouse actions within the DrawArea rectangle.
  46.          ** Call AutoDrawArea::callback(msg) first in your callback! MouseX,MouseY then will contain
  47.          ** view-relative values.
  48.          **/
  49.          
  50.       ULONG setAttributes(AttrList& attrs);
  51.       ULONG getAttribute(Tag,ULONG&);
  52.       void setBGFillPen(ULONG pen) { bgFillPen = pen; }
  53.             
  54.             
  55. };
  56.  
  57. // error codes
  58.  
  59. #define AUTODRAWAREA_HAS_NO_GWINDOW_ROOT  (IOTYPE_AUTODRAWAREA+1)
  60.  
  61. #endif