/* ==========================================================================
**
**                               GraphicObject.h
**
** PObject<GraphicObject
**
** A GraphicObject is a virtual class, derrived from class PObject.
** Potentially anything that can be drawn on a RastPort is a
** graphic object.
**
**
** ©1991 WILLISoft
**
** ==========================================================================
*/

#ifndef GRAPHICOBJECT_H
#define GRAPHICOBJECT_H

#include "PObject.h"
#include "Intuition_typedefs.h"
#include "Precognition_utils.h"

typedef struct GraphicObject
   {
      Class   *isa;
      char    *PObjectName;
      void    *Next;        /* Points to next GraphicObject in chain. */
   } GraphicObject;




Point Location( 
   #ifdef ANSI_HEADERS
                  GraphicObject *self 
   #endif
              );
   /*
   ** Returns the LeftEdge, TopEdge of 'self'.
   */



Point SetLocation( 
   #ifdef ANSI_HEADERS
                   GraphicObject *self,
                   PIXELS         LeftEdge,
                   PIXELS         TopEdge 
   #endif
                  );
   /*
   ** Sets the LeftEdge, TopEdge of 'self'.
   ** Returns the LeftEdge, TopEdge.
   */


Point Size( 
   #ifdef ANSI_HEADERS
                  GraphicObject *self 
   #endif
          );
   /*
   ** Returns the Width, Height of 'self'.
   */


Point AskSize( 
   #ifdef ANSI_HEADERS
               GraphicObject *self,
               PIXELS         Width,
               PIXELS         Height 
   #endif
             );
   /*
   ** Given a (Width, Height), returns the nearest (Width, Height)
   ** that 'self' modify itself to be.  Does NOT actually change
   ** the dimensions of 'self'.  (Some graphic objects have
   ** constraints on their size.)
   */

#define MinSize(s) AskSize(s,0,0)
#define MaxSize(s) AskSize(s,32767,32767)


Point SetSize( 
   #ifdef ANSI_HEADERS
               GraphicObject *self,
               PIXELS         Width,
               PIXELS         Height 
   #endif
              );
   /*
   ** Sets 'self's size to be as near (Width, Height) as possible,
   ** returns the actual (Width, Height).
   */


UWORD SizeFlags( 
   #ifdef ANSI_HEADERS
                  GraphicObject *self 
   #endif
               );
   /*
   ** Returns the flags which define the axis's on which this object may
   ** be sized.
   ** (This is useful for the editor environment)
   */

#define OBJSIZE_X 0x0001   /* object can be resized along the X axis. */
#define OBJSIZE_Y 0x0002   /* object can be resized along the Y axis. */



void Render( 
   #ifdef ANSI_HEADERS
             GraphicObject *self,
             RastPort      *RPort 
   #endif
           );

   /*
   ** Draw object to RastPort 'RPort'.  The object's Location is
   ** used as the top-left corner of drawing.
   */


/* NOTE: Not all GraphicObjects support titles.   Those that don't
** ignore SetTitle(), and return NULL for Title().
*/

BOOL SetTitle( 
   #ifdef ANSI_HEADERS
               GraphicObject *self, char *title 
   #endif
             );
   /*
   ** returns FALSE if object does not support titles.
   */

char *Title( 
   #ifdef ANSI_HEADERS
               GraphicObject *self 
   #endif
            );
   /*
   ** Returns a pointer to the title of an object, or NULL if none.
   */

#endif 