home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / utils / precognition / include / graphicobject.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-24  |  3.2 KB  |  150 lines

  1. /* ==========================================================================
  2. **
  3. **                               GraphicObject.h
  4. **
  5. ** PObject<GraphicObject
  6. **
  7. ** A GraphicObject is a virtual class, derrived from class PObject.
  8. ** Potentially anything that can be drawn on a RastPort is a
  9. ** graphic object.
  10. **
  11. **
  12. ** ©1991 WILLISoft
  13. **
  14. ** ==========================================================================
  15. */
  16.  
  17. #ifndef GRAPHICOBJECT_H
  18. #define GRAPHICOBJECT_H
  19.  
  20. #include "PObject.h"
  21. #include "Intuition_typedefs.h"
  22. #include "Precognition_utils.h"
  23.  
  24. typedef struct GraphicObject
  25.    {
  26.       Class   *isa;
  27.       char    *PObjectName;
  28.       void    *Next;        /* Points to next GraphicObject in chain. */
  29.    } GraphicObject;
  30.  
  31.  
  32.  
  33.  
  34. Point Location( 
  35.    #ifdef ANSI_HEADERS
  36.                   GraphicObject *self 
  37.    #endif
  38.               );
  39.    /*
  40.    ** Returns the LeftEdge, TopEdge of 'self'.
  41.    */
  42.  
  43.  
  44.  
  45. Point SetLocation( 
  46.    #ifdef ANSI_HEADERS
  47.                    GraphicObject *self,
  48.                    PIXELS         LeftEdge,
  49.                    PIXELS         TopEdge 
  50.    #endif
  51.                   );
  52.    /*
  53.    ** Sets the LeftEdge, TopEdge of 'self'.
  54.    ** Returns the LeftEdge, TopEdge.
  55.    */
  56.  
  57.  
  58. Point Size( 
  59.    #ifdef ANSI_HEADERS
  60.                   GraphicObject *self 
  61.    #endif
  62.           );
  63.    /*
  64.    ** Returns the Width, Height of 'self'.
  65.    */
  66.  
  67.  
  68. Point AskSize( 
  69.    #ifdef ANSI_HEADERS
  70.                GraphicObject *self,
  71.                PIXELS         Width,
  72.                PIXELS         Height 
  73.    #endif
  74.              );
  75.    /*
  76.    ** Given a (Width, Height), returns the nearest (Width, Height)
  77.    ** that 'self' modify itself to be.  Does NOT actually change
  78.    ** the dimensions of 'self'.  (Some graphic objects have
  79.    ** constraints on their size.)
  80.    */
  81.  
  82. #define MinSize(s) AskSize(s,0,0)
  83. #define MaxSize(s) AskSize(s,32767,32767)
  84.  
  85.  
  86. Point SetSize( 
  87.    #ifdef ANSI_HEADERS
  88.                GraphicObject *self,
  89.                PIXELS         Width,
  90.                PIXELS         Height 
  91.    #endif
  92.               );
  93.    /*
  94.    ** Sets 'self's size to be as near (Width, Height) as possible,
  95.    ** returns the actual (Width, Height).
  96.    */
  97.  
  98.  
  99. UWORD SizeFlags( 
  100.    #ifdef ANSI_HEADERS
  101.                   GraphicObject *self 
  102.    #endif
  103.                );
  104.    /*
  105.    ** Returns the flags which define the axis's on which this object may
  106.    ** be sized.
  107.    ** (This is useful for the editor environment)
  108.    */
  109.  
  110. #define OBJSIZE_X 0x0001   /* object can be resized along the X axis. */
  111. #define OBJSIZE_Y 0x0002   /* object can be resized along the Y axis. */
  112.  
  113.  
  114.  
  115. void Render( 
  116.    #ifdef ANSI_HEADERS
  117.              GraphicObject *self,
  118.              RastPort      *RPort 
  119.    #endif
  120.            );
  121.  
  122.    /*
  123.    ** Draw object to RastPort 'RPort'.  The object's Location is
  124.    ** used as the top-left corner of drawing.
  125.    */
  126.  
  127.  
  128. /* NOTE: Not all GraphicObjects support titles.   Those that don't
  129. ** ignore SetTitle(), and return NULL for Title().
  130. */
  131.  
  132. BOOL SetTitle( 
  133.    #ifdef ANSI_HEADERS
  134.                GraphicObject *self, char *title 
  135.    #endif
  136.              );
  137.    /*
  138.    ** returns FALSE if object does not support titles.
  139.    */
  140.  
  141. char *Title( 
  142.    #ifdef ANSI_HEADERS
  143.                GraphicObject *self 
  144.    #endif
  145.             );
  146.    /*
  147.    ** Returns a pointer to the title of an object, or NULL if none.
  148.    */
  149.  
  150. #endif